All Projects → BetaSu → My Vue Editor

BetaSu / My Vue Editor

Licence: mit
a rich text editor for Vue 2.x

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to My Vue Editor

Re Editor
一个开箱即用的React富文本编辑器 🚀re-editor
Stars: ✭ 367 (+184.5%)
Mutual labels:  editor, wysiwyg-editor
Core2d
A multi-platform data driven 2D diagram editor.
Stars: ✭ 475 (+268.22%)
Mutual labels:  editor, wysiwyg-editor
Drawerjs
A customizable WYSIWYG HTML canvas editor.
Stars: ✭ 383 (+196.9%)
Mutual labels:  editor, wysiwyg-editor
Smalleditor
Small WYSIWYG editor with delta save, inspired by Medium
Stars: ✭ 257 (+99.22%)
Mutual labels:  editor, wysiwyg-editor
Megadraft
Megadraft is a Rich Text editor built on top of Facebook's Draft.JS featuring a nice default base of components and extensibility
Stars: ✭ 982 (+661.24%)
Mutual labels:  editor, wysiwyg-editor
Text
📑 Collaborative document editing using Markdown
Stars: ✭ 282 (+118.6%)
Mutual labels:  editor, wysiwyg-editor
React Quill
A Quill component for React.
Stars: ✭ 4,739 (+3573.64%)
Mutual labels:  editor, wysiwyg-editor
Nib
Wysiwyg / Text editor components built using React and Prosemirror
Stars: ✭ 181 (+40.31%)
Mutual labels:  editor, wysiwyg-editor
Jodit
Jodit - Best WYSIWYG Editor for You
Stars: ✭ 947 (+634.11%)
Mutual labels:  editor, wysiwyg-editor
Proton
Purely native and extensible rich text editor for iOS and macOS Catalyst apps
Stars: ✭ 685 (+431.01%)
Mutual labels:  editor, wysiwyg-editor
Awesome Wysiwyg
A curated list of awesome WYSIWYG editors.
Stars: ✭ 1,801 (+1296.12%)
Mutual labels:  editor, wysiwyg-editor
React Page
Next-gen, highly customizable content editor for the browser - based on React and written in TypeScript. WYSIWYG on steroids.
Stars: ✭ 8,704 (+6647.29%)
Mutual labels:  editor, wysiwyg-editor
Vue Editor Js
editor.js for Vue users
Stars: ✭ 205 (+58.91%)
Mutual labels:  editor, wysiwyg-editor
Awesome Web Editor
🔨 Open source WEB editor summary
Stars: ✭ 306 (+137.21%)
Mutual labels:  editor, wysiwyg-editor
Flutter Quill
Rich text editor for Flutter
Stars: ✭ 177 (+37.21%)
Mutual labels:  editor, wysiwyg-editor
Angular Editor
A simple native WYSIWYG editor component for Angular 6 -10+
Stars: ✭ 428 (+231.78%)
Mutual labels:  editor, wysiwyg-editor
Rich Markdown Editor
The open source React and Prosemirror based markdown editor that powers Outline. Want to try it out? Create an account:
Stars: ✭ 2,468 (+1813.18%)
Mutual labels:  editor, wysiwyg-editor
Pell
📝 the simplest and smallest WYSIWYG text editor for web, with no dependencies
Stars: ✭ 11,653 (+8933.33%)
Mutual labels:  editor, wysiwyg-editor
Sceditor
A lightweight HTML and BBCode WYSIWYG editor
Stars: ✭ 503 (+289.92%)
Mutual labels:  editor, wysiwyg-editor
Canner Slate Editor
📝Rich Text / WYSIWYG Editor built for Modularity and Extensibility.
Stars: ✭ 1,071 (+730.23%)
Mutual labels:  editor, wysiwyg-editor

my-vue-editor

Travis Packagist Plugin on redmine.org

A rich text editor based on Vue2.x
中文文档

Demo

click here to see demo
More demo please refer to the example directory

Introduction

Our editor is based on vue-html5-editor secondary development. Thanks to its author PeakTai for providing a concise rich text editor plug-in, on the basis of which we have rewritten the native method and extended the functionality.

Install

npm install my-vue-editor

Introduced as a plug-in

import Vue from 'vue'
import myVueEditor from 'my-vue-editor'
Vue.use(myVueEditor, options)

Global introduction

<script src="serverpath/vue.js"></script>
<script src="serverpath/dist/my-vue-editor.js"></script>

Installed by the global variable myVueEditor

Vue.use(myVueEditor, options)

Use

<my-vue-editor :content="content" @change='ctnChange' @imageUpload='imageUpload'></my-vue-editor>

Configuration

Items       Type           Description
name     String Custom component name, the default is my-vue-editor
modules     Array Modules need to use
icons   Object     Covering the specified module's icon
commands Object     Custom command
shortcut Object     Custom shortcut
extendModules Array     Custom module
Any built-in module name Object     Overwrite the properties of the corresponding built-in module

example

Vue.use(myVueEditor, {
  // Overlay built-in module's icon
  icons: {
    image: 'iui-icon iui-icon-pic',
    indent: 'iui-icon iui-icon-insert'
  },
  // Modules in use
  modules: [
    'font',
    'bold',
    'italic',
    'underline',
    'linethrough',
    'ul',
    'indent',
    'align',
    'image',
    'quote',
    'todo',
    // This is a custom module
    'customSave'
  ],
  // Overlay image module's configuration
  image: {
    maxSize: 5120 * 1024,
    imgOccupyNewRow: true,
    compress: {
      width: 1600,
      height: 1600,
      quality: 0.8
    }
  },
  // Overlay font module's configuration
  font: {
    config: {
      'xx-large': {
        fontSize: 6,
        name: 'H1'
      },
      'medium': {
        fontSize: 3,
        name: 'H2'
      },
      'small': {
        fontSize: 2,
        name: 'H3'
      },
      default: 'medium'
    },
    // Modify the font module's module inspect mechanism to inspect via style and tag name
    inspect (add) {
      add('style', {
        fontSize: ['xx-large', 'x-large', 'large', 'medium', 'small']
      }).add('tag', 'font')
    }
  },
  // Overlay ul module's configuration
  ul: {
    // When the ul module is inspected, disabled all but itself
    exclude: 'ALL_BUT_MYSELF',
    // When the ul module is clicked, execute the following method
    handler (rh) {
     console.log('i am ul!')
     rh.editor.execCommand('insertUnorderedList')  
    }
  },
  // When the ul module is inspected, disabled image, todo and ul module
  quote: {
    exclude: ['image', 'todo', 'ul']
  },
  // Customize an command named getAllTexts that prints out all the text nodes under the current range object
  commands: {
    getAllTexts (rh, arg) {
      console.log(rh.getAllTextNodeInRange())
    }
  },
  shortcut: {
    // Custom a shortcut key, when you press the command + s, execute the save function
    saveNote: {
      metaKey: true,
      keyCode: 83,
      handler (editor) {
        save()
      }
    }
  },
  // Customize a module, a alert pops up when you click on the module icon
  extendModules: [{
     name: 'smile',
     icon: 'iui iui-icon-smile'
     handler (rh) {
      alert('smile~~')
     }
  }]
})

Event

Event name       Description         
change     Trigger when editor content changes, parameter is up-to-date content data
imageUpload Trigger when uploading images, parameters include the corresponding data of the image,
replaceSrcAfterUploadFinish:Used to replace the src attribute of img from the base64 format to the url returned by the server when the upload is successful)
deleteImgWhenUploadFail:Used to delete the current picture when the upload fails

Modify the built-in module

Add a parameter with a built-in module's name as it's key, will cover the built-in module's original properties(See all built-in modules and their configuration items in src/modules directory)

Take the image module as an example

Vue.user(myVueEditor, {
  image: {
    // Modify the image module's icon
    icon: 'iui-pic',
    // Cover the original compression parameters, so that the image is not compressed when uploaded
    compress: null,
    // Can not upload the same image repeatedly
    canUploadSameImage: false
  }
})

Cutom module

Extend the module with the extendModules configuration item We provide some common module configuration items

Item       Type           Description  
name     String module's name
icon     String module icon's className,The fontAwesome icon is used by default
exclude     String Array disabled modules When current module is inspected
When value is 'ALL' means disable all modules include current module
When value is'ALL_BUT_MYSELF', means disabled all modules but current module
When value is type of Array, Input module name to be disabled
inspect     Function module inspect,When the cursor is in the list, the list module is highlighted, that is, the list module is inspected, which is based on its UL label as a test basis
The first argument to the function is a method named add, which called to add the module's inspection basis. When there are multiple inspection bases, please call chaining
The first parameter of the add method indicates what path to test. The optional is 'tag' 'style' and 'attribute'
When parameter 1 is 'tag', parameter 2 passes in a tag name string
When parameter 1 is 'style', parameter 2 is an object with styleName as key and styleValue as value. Note styleName use the hump form(ex:fontSize),When there are multiple styleValue please use the form of Array
When parameter 1 is 'attribute', parameter 2 is an object whose key is attribute name and attribute value is value, and note that if any value is desired, pass in ''(ex:add('attribute', {'data-todo': ''}))
handler     Function What to do when you click the module
Parameter 1 is range-handler instance, through which can you get the Vue instance of the current editor and the method to operate range
We do not recommend operating range directly in the handler, but should encapsulate the range action as a command, calling the command via the execCommand method under the editor instance in the handler
tab     Vue instance Conventional modules use handlers for handling clicks, and if you want to implement UI (drop-down list of font modules) or more complex logic (left-to-right switching of align modules), use tab
init     Function Corresponds to the editor component life cycle created, the parameter 1 is the editor instance. Note that the execCommand method can not be used at this time
mounted     Function Corresponds to the editor component life cycle mounted, the parameter 1 is the editor instance.
updated     Function Corresponds to the editor component life cycle updated, the parameter 1 is the editor instance.
destroyed     Function Corresponds to the editor component life cycle beforeDestroy, the parameter 1 is the editor instance.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].