我正在尝试遵循 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/ 获取。
输出如下所示:
有两个问题:
- 工具栏不是固定的,而是滚动的。
- 垂直滚动条始终具有可滚动区域,即使编辑器为空时也是如此。
如何解决这两个问题?
最佳答案
我必须修改 quill 的两个类才能得到我想要的。就像这样
.ql-container.ql-snow {
height: auto;
}
.ql-editor {
height: 150px;
overflow-y: scroll;
}
关于javascript - Quill:如何防止工具栏滚动并设置高度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51706247/