项目作者: easywyg

项目描述 :
A document model for rich text editors
高级语言: JavaScript
项目地址: git://github.com/easywyg/mekong.git
创建时间: 2016-05-06T11:16:29Z
项目社区:https://github.com/easywyg/mekong

开源协议:

下载


Mekong

A Rich text editor Model layer. (not finished yet)

Quick example

  1. import Mekong from 'mekong';
  2. const mekong = new Mekong(document.getElementById('body'));
  3. mekong.useEntity('Paragraph');
  4. // Create paragraph with markup
  5. const p1 = mekong.create('Paragraph', { tag: 'p', attrs: {} });
  6. p1.setText('Hello world!')
  7. p1.setMarkup('strong', 0, 5)
  8. p1.setMarkup('em', 6, 11)
  9. p1.setMarkup('u', 4, 7)
  10. // It gives: <p><strong>Hell<u>o</u></strong> <em class="x1 x2"><u>w</u>orld</em>!</p>

Entities

Entity is a building block, such as paragraph, image, table and others.

Types of built-in entities
Virtual DOM

Mekong utilizes virtual DOM to partially update HTML markup.

Build from sources

  1. gulp build

Running tests

  1. npm run test