Skip to content

RichEditor

Rich text editor component based on WangEditor.

Basic Usage

json
{
  "com": "RichEditor",
  "model": "content"
}

Props

PropertyTypeDefaultDescription
value / v-modelstring-HTML content
heightstring | number'400px'Editor height
placeholderstring'Enter content...'Placeholder text
readonlybooleanfalseWhether readonly
toolbarConfigobject-Toolbar configuration

Examples

Basic Usage

json
{
  "data": {
    "content": "<p>This is <strong>rich text</strong> content.</p>"
  },
  "com": "RichEditor",
  "model": "content"
}

Set Height

json
{
  "com": "RichEditor",
  "model": "content",
  "props": { "height": "500px" }
}

Readonly Mode

json
{
  "com": "RichEditor",
  "props": {
    "value": "{{ content }}",
    "readonly": true
  }
}

Custom Toolbar

json
{
  "com": "RichEditor",
  "model": "content",
  "props": {
    "toolbarConfig": {
      "excludeKeys": ["uploadVideo", "insertTable"]
    }
  }
}

In Form

json
{
  "com": "NForm",
  "props": { "model": "{{ form }}" },
  "children": [
    {
      "com": "NFormItem",
      "props": { "label": "Title" },
      "children": [{ "com": "NInput", "model": "form.title" }]
    },
    {
      "com": "NFormItem",
      "props": { "label": "Content" },
      "children": [
        {
          "com": "RichEditor",
          "model": "form.content",
          "props": { "height": "400px" }
        }
      ]
    }
  ]
}

Features

  • WYSIWYG editing
  • Image upload
  • Video insertion
  • Table editing
  • Code blocks
  • Font styles
  • Alignment
  • Lists
  • Links
  • Undo/Redo

Released under the MIT License