lucien-editor

1.0.0 • Public • Published

lucienEditor 富文本编辑器

安装

1.在包根目录下执行(测试包)

npm link

在工程项目下

测试包: npm link lucien-editor

npm install lucien-editor

引入

import {editor} from "lucien-editor"

// id是必填项
let lEditor =  editor("id", config);

config 配置项

let config = {
    width: 200, // 不是必填
    height: 100, // 不是必填
    menu:[
        "fontBgColor", // 文字背景色
        "fontColor", // 文字颜色
        "lineHeight", // 段落行高
        "table", // 表格
        "blod", // 加粗
        "italic" // 斜体
    ] // 顶部功能栏

}

设置word

let data = {
  "type": "doc",
  "content": [
    {
      "type": "paragraph",
      "content": [
        {
          "type": "text",
          "text": "Hello, Word!",
          "style":{
            "color": "red",
            "font-size":"18px"
          }
        }
      ]
    },
    {
      "type": "table",
      "style":{
        "border-width":"2px"
      },
      "content": [
        {
          "type": "row",
          "content": [
            {
              "type": "cell",
              "content": [
                {
                  "type": "paragraph",
                  "content": [
                    {
                      "type": "text",
                      "text": "cell1"
                    }
                  ]
                }
              ]
            },
            {
              "type": "cell",
              "content": [
                {
                  "type": "paragraph",
                  "content": [
                    {
                      "type": "text",
                      "text": "cell2"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

lEditor.setWordContent(wordData);    

设置编辑区富文本

let h = "<p>hello,world</p>"
lEditor.setContent(h);

清空编辑区富文本

lEditor.clear();

样式

1.读取的word 样式生成到内联
2.默认样式 css 外联
3.自定义加入 id名后加默认class名

Package Sidebar

Install

npm i lucien-editor

Weekly Downloads

1

Version

1.0.0

License

ISC

Unpacked Size

28.2 kB

Total Files

11

Last publish

Collaborators

  • huizixin