1.1.2 • Published 5 years ago

bdfint-editor v1.1.2

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

#bdfint-editor

a lightweight web rich text editor

steps for dev

  1. install dependencies
yarn install
  1. run dev
npm run dev

run example

npm run example

example

import BdfintEditor from 'bdfint-editor';
// import the style file at appropriate place
import 'bdfint-editor/dist/css/BdfintEditor.min.css';

const editor = new BdfintEditor({
  el: '#app' // id ro class of the container element
});

// all config items below,
// you can config the editor according to your situation
editor.config({
  // watch mutations
  onChange: function(mutationList) {
    console.log(mutationList)
  },
  // handle focus event
  onFocus: function () {
    // ...
  },
  // handle blur event
  onBlur: function () {
    // ...
  },
  // handle when the editor instance is ready
  onReady: function () {
    editor.message('success', 'ready');
  },
  // path to upload files
  uploadPath: '',
  // custom query
  uploadQuery: {
    key: 'value'
    // ...
  }
});
// init and mount
editor.create();

methods list

namedescriptionreturn
editor.create();mount editor instance to container-
editor.config(configOption);config editor-
editor.getContent();get the content html stringHTML string
editor.setContent(html);set the content html string-
editor.message(type, text);display a message in the top of content area. type should be one of success,fail,warn,info-

configOption

namedescriptiontypeinjected parameters
serverserver hostString-
uploadPathpath to upload filesString-
menusmenus list. eg: 'bold', 'fontSize'Array-
uploadQuerycustom queryObject-
onFocuscallback of focus eventFunction-
onBlurcallback of blur eventFunction-
onReadycallback of ready eventFunction-
onChangecallback of change eventFunctionmutationsList

menus

namedescription
headh1-h6
fontSize-
fontFamily-
bold-
italic-
underline-
strikeThrough-
heightLight-
list-
align-
code-
link-
blockquote-
img-
table-
video-
undo-
redo-

support

IE10+

todo menu items

  • Video
  • Audio
  • Emoji
  • Graffiti
1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago