项目作者: jl-

项目描述 :
Next semantic rich text editor
高级语言: JavaScript
项目地址: git://github.com/jl-/simo.git
创建时间: 2018-10-10T04:49:44Z
项目社区:https://github.com/jl-/simo

开源协议:MIT License

下载


Simo

licence
npm version
npm downloads

Features | Documentation | Examples

Next semantic rich text editor.

Features

  • small code base with a module system
  • framework agnostic

Examples

General

  1. <!-- Simo itself is framework agnostic. -->
  2. <!-- mount it with any view renderer you want, or write your own. Demo here using Vue with built-in renderer -->
  3. <template>
  4. <div data-gramm="false" ></div>
  5. </template>
  6. <script>
  7. import Editor from 'simo';
  8. export default {
  9. mounted () {
  10. const initState = {};
  11. this.editor = new Editor({ readonly: false });
  12. this.editor.mount(this.$el, initState);
  13. }
  14. };
  15. </script>

Customization

  1. // editor core
  2. import Editor from 'simo/core';
  3. // your custom renderer
  4. import Renderer from 'my-custom-renderer';
  5. // modules that enhance your editor
  6. // for example: use the builtin history module
  7. import History from 'simo/modules/history';
  8. const editor = new Editor({
  9. // schema: {},
  10. // modules: options for modules
  11. });
  12. // create a renderer instance the way(|options) you want,
  13. // for example: it needs a dom, and holds editor for future call.
  14. const renderer = new Renderer(
  15. document.querySelector('#editor'), editor
  16. );
  17. // add module instances to enhance your editor with more functionality
  18. editor.module('history', History/*, options*/);
  19. // finally, mount your editor with initial state
  20. editor.mount(renderer, {/* init state object */});

untitled