【问题标题】:how to set width for CKEDITOR如何设置CKEDITOR的宽度
【发布时间】:2021-10-08 17:53:27
【问题描述】:

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, { 工具栏:[ “标题”, “大胆的”, “斜体”, “项目符号列表”, "编号列表", "块报价", ], });

返回新编辑器; }

【问题讨论】:

    标签: javascript html ckeditor


    【解决方案1】:

    由于您没有指定 CkEditor 版本,我将假设为 v4。

    编辑器高度默认设置为200px,宽度占其容器的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

    【讨论】:

    • @RobinChauhan 你用的是什么版本的 CkEditor?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-16
    • 2012-10-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多