gpt4 book ai didi

jquery - 使用 NicEditor 调整窗口大小

转载 作者:行者123 更新时间:2023-11-28 16:35:49 25 4
gpt4 key购买 nike

我正在使用 NicEditor ( http://nicedit.com )。

首先,我将文本区域的宽度设置为 100%,但是当我调整窗口大小时,编辑器保持不变,不会调整到新的 100% 窗口宽度。

<textarea style="width: 100%;"> something .. </textarea>

<script>
//<![CDATA[
bkLib.onDomLoaded(function() { nicEditors.allTextAreas() });
//]]>

</script>

我该如何解决这个问题?

编辑:我找到了一个有效的解决方案:

  $(function () {
editor = new nicEditor({fullPanel : false}).panelInstance('text');
})

$(window).resize(function() {
editor.removeInstance('text');
editor = new nicEditor({fullPanel : false}).panelInstance('text');
});

最佳答案

默认情况下,Nice Editor 或 CK Editor 没有响应功能。

试试下面这样的东西。通过父元素控制宽度和高度。

    <textarea id="comments" style="width:100%; height:100%;"></textarea>

每次调整窗口大小时,调用 NiceEdit

JS:

  var editor;
function reLoadEditor() {
editor.removeInstance('comments');
editor = new nicEditor({fullPanel : false}).panelInstance('comments');
}();

$(window).resize( function() {
reLoadEditor();
} );

引用 - 演示 3:添加/删除 NicEditors:
http://nicedit.com/demos.php?demo=3

关于jquery - 使用 NicEditor 调整窗口大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34578695/

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