CKEditor 3 与 getData 的奇怪行为
每当我在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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.