CKEditor 3 与 getData 的奇怪行为

发布于 2024-08-29 07:49:47 字数 2432 浏览 4 评论 0原文

每当我在 CKEditor 上调用 getData() 时,它也会返回一些服务器生成的脚本标签,并且有时也会返回 firebug div,这看起来有点奇怪。所以我不认为它与asp具体相关,但不确定

<script type="text/javascript">  

$(function() {
  if (queryString["fxml"]) {
    $("#ckeditorPH").css("display","block").ckeditor();  
  }  
});  
CKEDITOR.plugins.registered['save'] = {
  init: function(editor) {
            var command = editor.addCommand('save', {
                modes: {
                    wysiwyg: 1, source: 1
                },
                exec: function(editor) {
                    var $ck = $("#ckeditorPH").ckeditorGet();
                    $ck.updateElement();
                    $("#ckeContent").text($ck.getData()).html();
                }
            }
            );
            editor.ui.addButton('Save', { label: 'Save', command: 'save' });
   }
}
</script>


<asp:Content ID="Content3" ContentPlaceHolderID="CPmainContent" Runat="Server">
    <textarea id="ckeditorPH" style="display: none;" name="ckEditorPh" cols="1" rows="3"></textarea>
    <div id="ckeContent"></div>
</asp:Content>

一些示例返回的代码

<div id="footer">  
asdsdasdasd</div> 
<script type="text/javascript"> 
//<![CDATA[ var ctl00_ctl02_ImageArray =  new Array('', '', '', '/Wiki WebResource.axd?d=orvFyKxqjn_MxWN6EePxi9qdFITpyPFIgsCG-7yiV981&t=634031320320031812', '/Wiki/WebResource.axd?d=orvFyKxqjn_MxWN6EePxiziK9rrZZZfuENrSUk7FQmY1&t=634031320320031812', 
'/Wiki/WebResource.axd?d=orvFyKxqjn_MxWN6EePxixV5Wtl1sjTWzAxt10NTBqE1&t=634031320320031812');  
//]]>  
</script>  
<script type="text/javascript"> 
//<![CDATA[  
WebForm_InitCallback();  
var ctl00_ctl02_Data = new Object(); 
ctl00_ctl02_Data.images = ctl00_ctl02_ImageArray;  
ctl00_ctl02_Data.collapseToolTip = "Collapse {0}";  
ctl00_ctl02_Data.expandToolTip = "Expand {0}";  
ctl00_ctl02_Data.expandState = theForm.elements['ctl00_ctl02_ExpandState'];  
ctl00_ctl02_Data.selectedNodeID = theForm.elements['ctl00_ctl02_SelectedNode'];  
for (var i=0;i<6;i++) {  
var preLoad = new Image();  
if (ctl00_ctl02_ImageArray[i].length > 0)  
preLoad.src = ctl00_ctl02_ImageArray[i];  
}  
ctl00_ctl02_Data.lastIndex = 4;  
ctl00_ctl02_Data.populateLog = theForm.elements['ctl00_ctl02_PopulateLog'];  
ctl00_ctl02_Data.treeViewID = 'ctl00$ctl02';  
ctl00_ctl02_Data.name = 'ctl00_ctl02_Data';  
//]]>  
</script>

Whenever I call getData() on my CKEditor it returns what appears to be some server generated script tags, aswell, and it has on occaision returned the firebug div as well, which seems a bit odd. So I don't think that it is related to asp specifically, but not sure

<script type="text/javascript">  

$(function() {
  if (queryString["fxml"]) {
    $("#ckeditorPH").css("display","block").ckeditor();  
  }  
});  
CKEDITOR.plugins.registered['save'] = {
  init: function(editor) {
            var command = editor.addCommand('save', {
                modes: {
                    wysiwyg: 1, source: 1
                },
                exec: function(editor) {
                    var $ck = $("#ckeditorPH").ckeditorGet();
                    $ck.updateElement();
                    $("#ckeContent").text($ck.getData()).html();
                }
            }
            );
            editor.ui.addButton('Save', { label: 'Save', command: 'save' });
   }
}
</script>


<asp:Content ID="Content3" ContentPlaceHolderID="CPmainContent" Runat="Server">
    <textarea id="ckeditorPH" style="display: none;" name="ckEditorPh" cols="1" rows="3"></textarea>
    <div id="ckeContent"></div>
</asp:Content>

And some example returned code

<div id="footer">  
asdsdasdasd</div> 
<script type="text/javascript"> 
//<![CDATA[ var ctl00_ctl02_ImageArray =  new Array('', '', '', '/Wiki WebResource.axd?d=orvFyKxqjn_MxWN6EePxi9qdFITpyPFIgsCG-7yiV981&t=634031320320031812', '/Wiki/WebResource.axd?d=orvFyKxqjn_MxWN6EePxiziK9rrZZZfuENrSUk7FQmY1&t=634031320320031812', 
'/Wiki/WebResource.axd?d=orvFyKxqjn_MxWN6EePxixV5Wtl1sjTWzAxt10NTBqE1&t=634031320320031812');  
//]]>  
</script>  
<script type="text/javascript"> 
//<![CDATA[  
WebForm_InitCallback();  
var ctl00_ctl02_Data = new Object(); 
ctl00_ctl02_Data.images = ctl00_ctl02_ImageArray;  
ctl00_ctl02_Data.collapseToolTip = "Collapse {0}";  
ctl00_ctl02_Data.expandToolTip = "Expand {0}";  
ctl00_ctl02_Data.expandState = theForm.elements['ctl00_ctl02_ExpandState'];  
ctl00_ctl02_Data.selectedNodeID = theForm.elements['ctl00_ctl02_SelectedNode'];  
for (var i=0;i<6;i++) {  
var preLoad = new Image();  
if (ctl00_ctl02_ImageArray[i].length > 0)  
preLoad.src = ctl00_ctl02_ImageArray[i];  
}  
ctl00_ctl02_Data.lastIndex = 4;  
ctl00_ctl02_Data.populateLog = theForm.elements['ctl00_ctl02_PopulateLog'];  
ctl00_ctl02_Data.treeViewID = 'ctl00$ctl02';  
ctl00_ctl02_Data.name = 'ctl00_ctl02_Data';  
//]]>  
</script>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

衣神在巴黎 2024-09-05 07:49:47

firebug元素是由于Firebug之前版本的问题造成的,最新的1.6版本修复了它。

对于其余的脚本:我从未见过这样的东西。

The firebug element is due to problems in previous versions of Firebug and the latest 1.6 version fixes it.

For the rest of the scripts: I have never seen something like that.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文