Skip to content

easywyg/mekong

Repository files navigation

Mekong

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

Quick example

  import Mekong from 'mekong';

  const mekong = new Mekong(document.getElementById('body'));
  mekong.useEntity('Paragraph');

  // Create paragraph with markup
  const p1 = mekong.create('Paragraph', { tag: 'p', attrs: {} });
  p1.setText('Hello world!')
  p1.setMarkup('strong', 0, 5)
  p1.setMarkup('em', 6, 11)
  p1.setMarkup('u', 4, 7)

  // 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

gulp build

Running tests

npm run test