CKEditor“overflow:scroll”在父导致工具栏冻结在初始位置 [英] CKEditor "overflow: scroll" on parent causes toolbar to freeze at initial position
问题描述
当你在一个div中添加一个CKEditor到div:overflow:scroll时,工具栏在滚动父div时不会移动...
When you add a CKEditor to a div inside a div with: "overflow: scroll" the toolbar won't move when scrolling the parent div...
<div id="wrapper" style="overflow: scroll;">
<div contenteditable="true">This is the ckedito</div>
</div>
一个例子可以在这里找到: http://jsfiddle.net/W8Dt4/
An example can be found here: http://jsfiddle.net/W8Dt4/
有没有人知道解决这个问题的解决方法?
Does anyone know a workaround around this problem?
我认为所需的行为是:
- 当顶部没有足够的空间,底部有足够的空间时,将工具栏移动到编辑器底部。
推荐答案
使用版本4.4.3,我能够通过触发窗口滚动事件类似的方式,在CKEditor中的其他方面。将滚动事件附加到具有 overflow:scroll; 的父容器,并触发其中的窗口滚动。定位有点笨重,但仍然有效。
Using version 4.4.3, I was able to solve this problem by fire the window scroll event in a similar way that it is done in other areas in CKEditor. Attach a scroll event to the parent container that has overflow:scroll; set on it and trigger the window scroll within. The positioning is a little clunky but still works.
$("#parent-with-scroll").on('scroll', function (evt) {
CKEDITOR.document.getWindow().fire('scroll');
});
这篇关于CKEditor“overflow:scroll”在父导致工具栏冻结在初始位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!