【问题标题】:CKEDITOR inline editor toolbar on text selection [closed]文本选择上的CKEDITOR内联编辑器工具栏[关闭]
【发布时间】:2013-03-09 06:17:04
【问题描述】:

CKEditor 4 可以在“内联编辑器”模式下使用,只要相关文本区域获得焦点,它就会显示一个工具栏。我需要隐藏工具栏,只在用户选择一些文本时才显示它,我该怎么做?

我也想知道如何重新定位工具栏。

【问题讨论】:

  • 问题已编辑,请查看并将状态更改为打开(@andrewsi)

标签: ckeditor inline onselect


【解决方案1】:

你可以试试这样的:

$('#showEditor').mouseup(function () {
    if(getSelectedText()){
    //show inline editor instance

CKEDITOR.disableAutoInline = true;
var editor = CKEDITOR.inline( document.getElementById( 'showEditor' ) );

    }
});

function getSelectedText() {
    var t = '';
    if (window.getSelection) {
        t = window.getSelection();
    } else if (document.getSelection) {
        t = document.getSelection();
    } else if (document.selection) {
        t = document.selection.createRange().text;
    }
    return t;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多