gpt4 book ai didi

javascript - 如何在 CKEDITOR 内联中禁用自动隐藏/显示工具栏

转载 作者:行者123 更新时间:2023-11-29 21:41:56 31 4
gpt4 key购买 nike

当使用内容 contenteditable="true" 聚焦或模糊 DOM 元素时,CKEDITOR 内联显示/隐藏工具栏。

例如,如果用户单击页面背景,CKEDITOR 会隐藏工具栏。

我需要始终显示工具栏并禁用任何自动显示/隐藏功能。

有什么方法可以实现吗?

http://jsfiddle.net/vdRYL/28/

<script src="//cdn.ckeditor.com/4.5.3/standard/ckeditor.js"></script>
Default behaviour:
<div id="first" contenteditable="true">Click me</div>
<br>

我试过了

CKEDITOR.inline(this._cloneDom.id, { startupFocus: false });

但没有成功

最佳答案

这是我所做的,它似乎在工作:

// in config I have set the recommended value:
config.startupFocus = true;

// load the editor
var instance = CKEDITOR.inline(element.id, {
// ... load config
});

// this works to prevent hiding of the editor, I don't know yet if this breaks anything,
// but seems to be working fine
instance.on('blur',function(){
return false;
});


// and because the startupFocus property triggers focus on each element that has the editor
// I scroll the document to the top on the event when editor is ready
instance.on("instanceReady", function(){
document.body.scrollTop = document.documentElement.scrollTop = 0;
});

关于javascript - 如何在 CKEDITOR 内联中禁用自动隐藏/显示工具栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32496365/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com