Quill:如何防止工具栏滚动并设置高度?

2024-04-15

我正在尝试遵循以下示例https://quilljs.com/playground/#autogrow-height https://quilljs.com/playground/#autogrow-height但在设置编辑器框的高度并防止工具栏滚动到屏幕外时遇到问题。

我的代码是:

<div id="editorcontainer" style="height:10em; min-height:100%; overflow-y:auto;">
   <div id="editor" name="editor" style="min-height:100%; height:auto;"></div>
</div>

<script>
  var quill = new Quill("#editor",{
     modules: {
       toolbar: [ ... ]
         },
         scrollingContainer: "#editorcontainer",
         theme: "snow"
     });
</script>

JS Fiddle 位于https://jsfiddle.net/OldGeezer/xpvt214o/556844/ https://jsfiddle.net/OldGeezer/xpvt214o/556844/

输出如下所示:

有两个问题:

  1. 工具栏不是固定的,而是滚动的。
  2. 垂直滚动条始终具有可滚动区域,即使编辑器为空时也是如此。

我该如何解决这两个问题?


我必须修改 quill 的两个类才能得到我想要的。像这样

.ql-container.ql-snow {
    height: auto;
}
.ql-editor {
    height: 150px;
    overflow-y: scroll;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Quill:如何防止工具栏滚动并设置高度? 的相关文章