【问题标题】:Inline editing TD with CKEditor in IE10在 IE10 中使用 CKEditor 内联编辑 TD
【发布时间】:2014-08-18 21:00:45
【问题描述】:

我可以使用 CKEditor 使 TD 内联可编辑:

CKEDITOR.dtd.$editable.td = 1
CKEDITOR.inline('td_id');

它适用于 FireFox 和 Chrome。在 IE10 中,当我单击 TD 时会出现工具栏,但文本光标不会。所以无法编辑。

我知道 CKEditor 不支持 TD。有人破解吗?

【问题讨论】:

    标签: javascript ckeditor inline-editing


    【解决方案1】:

    至于 hack ......如何包装要编辑的内容,然后在保存期间展开?像这样未经测试的 jQuery 依赖代码:

    var td = $('#td_id');
    td.html('<div id="blargh">' + td.html() + '</div>');
    CKEDITOR.inline('blargh');
    
    // Do your magic and then when prior to saving do something like this
    var blarg = $('#blargh');
    blarg.parent().html(blarg.html());
    

    【讨论】:

    • 如果失败,我将删除答案。
    • 这或多或少是我自己最终做的事情,并且奏效了。一个技巧是向 TD 添加一个单击处理程序,该处理程序使用 $("div").focus(); 聚焦 DIV;所以在 DIV 之外的点击不会只是“消失”。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多