CKEditor 4内联:如何按需隐藏工具栏?

Mik*_*ike 5 javascript ckeditor

通常当您单击编辑区域以外的页面中的其他位置时,工具栏将隐藏,现在我还需要在用户命令上隐藏工具栏(例如用户按下快捷方式).

我试图hide在ckeditor工具栏div上调用jQuery 方法,但是一旦隐藏,即使用户专注于编辑区域,它也永远不会变得可见.

关于如何实现这一点的任何想法?非常感谢.

Was*_*utt 4

当焦点回到编辑区域时,您是否尝试执行 jQuery Show?

您还可以附加焦点和模糊事件来显示和隐藏工具栏:

// Call showToolBarDiv() when editor get the focus
    editor.on('focus', function (event)
    {
               showToolBarDiv( event );
     });
    // Call hideToolBarDiv() when editor loses the focus
    editor.on('blur', function (event)
    {
               hideToolBarDiv( event );
    });


    //Whenever CKEditor get focus. We will show the toolbar DIV.
     function showToolBarDiv( event )
     {
      // Select the correct toolbar DIV and show it.
      //'event.editor.name' returns the name of the DIV receiving focus.
        $('#'+event.editor.name+'TBdiv').show();
     }

     //Whenever CKEditor loses focus, We will hide the corresponding toolbar DIV.
     function hideToolBarDiv( event )
     {
        // Select the correct toolbar DIV and hide it.
        //'event.editor.name' returns the name of the DIV receiving focus.
        $('#'+event.editor.name+'TBdiv').hide();
     }
Run Code Online (Sandbox Code Playgroud)