javascript - 如何设置CKEDITOR的宽度
问题描述
async function TextEditor(element) {
const newEditor = await ClassicEditor.create(element, {
toolbar: [
"heading",
"bold",
"italic",
"bulletedList",
"numberedList",
"blockQuote",
],
});
return newEditor;
}
如何为CKEditor设置宽度和高度
async function TextEditor(element) {
const newEditor = await ClassicEditor.create(element, { toolbar: [ "heading", "bold", "italic", "bulletedList", "numberedList", "blockQuote", ], });
返回新编辑器;}
解决方案
由于您没有指定 CkEditor 版本,我将假设为 v4。
编辑器高度默认设置为200 像素,宽度占其容器的100%。
创建新编辑器时提供宽度或高度配置属性:
async function TextEditor(element) {
const newEditor = await ClassicEditor.create(element, {
toolbar: [
"heading",
"bold",
"italic",
"bulletedList",
"numberedList",
"blockQuote",
],
width: 300,
//resolves to 300px for fixed width
// for percentage use '80%'
height: 300,
});
return newEditor;
}
这应该让您按照CkEditor Doc For Sizing中的描述启动并运行
推荐阅读
- ethereum - 来自以太坊网站的 ERC20 代币代码
- apache - 网站是否需要为使用 SSL 的反向代理打开端口 443
- ecmascript-6 - setTimeout 使用 async-await 关键字,但不知道它是如何工作的
- excel - 动态搜索工作表并添加单元格的 VBA 代码
- node.js - 无论如何要使用 Multer 解压缩上传到内存中的文件?
- python - 如何在 python 的模块中加载文本文件?
- sql - 让两个 SQLite 数据库相互引用
- ms-access - MS Access SQL“喜欢”和通配符仅返回完全匹配
- html - “Hello Word” (html) 网站在专用服务器中?
- node.js - Nodemailer ECONNREFUSED 本地主机