【问题标题】:CKeditor insertHtml/ insertElement IE8 issueCKeditor insertHtml/ insertElement IE8 问题
【发布时间】:2013-01-04 14:21:35
【问题描述】:

我在 IE8 下使用 CKEditor insertHtml 和 insertElement 方法有一些问题,我开发了一些自定义插件,当我尝试将任何元素插入文本时,在我的情况下,这是带有一些额外自定义属性的“span”标签(其中此自定义标记值是 base64_encode'd 值))它不会将其插入光标位置(如在 FF 或 Chrome 中),而是在文本的开头...

以下是我如何使用这两个功能的两个示例:

//1

editor.insertHtml("<span class='internal' internal='" + params + "'>" + data.url + "</span>")

//2

var span = editor.document.createElement( 'span' );

span.setAttribute( 'class', 'internal' );
span.setAttribute( 'internal', params );
span.setText( data.url );
editor.insertElement( span );

有什么帮助吗? :-)

【问题讨论】:

  • 插入跨度时您没有提供任何信息(单击、击键、自动代码...)。 IE 有问题,并且很可能您遇到了与焦点相关的问题。在插入元素之前尝试调用editor·focus()。还要研究在插入之前和之后选择editor.getSelection().getRanges() 的位置(仍然,我不知道你想要完成什么)。还可以添加 editor.on( 'blur/focus', fn() ) 侦听器以查看您的实例发生了什么。
  • 另请注意 insertHtml 与 IE8 配合良好 nightly.ckeditor.com/13-01-21-08-51/full/samples/api.html
  • Cześć ;-) Span 在我的对话框的 onOK 操作中插入,我将尝试先对此重点进行一些研究,谢谢
  • 好的,我现在发现 IE8 没有获取范围,startOffset 和 endOffset 参数为 '0'(它在 Chrome 中运行良好)。 Blur & Focus 监听器确实触发了,但我不知道我必须在那里寻找什么参数。我的 CKEditor 版本是 3.6.4(更新它的问题是这是非常大的 cms 的一部分,它需要大量的测试和东西;/)
  • 如果您在非零位置看到插入符号,并且如果编辑器 聚焦,并且如果 IE 仍然在零位置返回空范围的选择,那么您的副本肯定有问题CKEditor 的。检查最新版本的相同代码。

标签: javascript ckeditor fckeditor


【解决方案1】:

仅供参考,我已将其从 3.6.4 版本更新到 4.0.1 版本。它刚刚开始工作:-)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-05-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-14
    • 2012-10-28
    相关资源
    最近更新 更多