作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当使用内容 contenteditable="true"
聚焦或模糊 DOM 元素时,CKEDITOR 内联显示/隐藏工具栏。
例如,如果用户单击页面背景,CKEDITOR 会隐藏工具栏。
我需要始终显示工具栏并禁用任何自动显示/隐藏功能。
有什么方法可以实现吗?
<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/
我是一名优秀的程序员,十分优秀!