JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q42998F
  • License MIT

A pure implementation of WYSIWYG HTML editor all we needed

Package Exports

  • editify

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (editify) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

NPM version NPM downloads Package License (MIT)

Editify

A pure implementation of WYSIWYG HTML editor all we needed.

Install

yarn add editify

Usage (commonjs)

<div id="editor">
  <p>This line is editable!</p>
</div>
import { Editify } from 'editify';

const editor = new Editify('editor');

editify.on('change', function(html, text) {
  console.log('change event: new html: ', html);
  console.log('change event: new text: ', text);
});

editify.on('selectionchange', function(selection) {
  console.log('selectionchange event: selected text: ', selection.toString());
});

Usage (umd)

<head>
  <script src="./editify.js"></script>
  <script>
    window.onload = function() {
      const editify = new Editify.Editify('editor');

      editify.on('change', function(html, text) {
        console.log('change event: new html: ', html);
        console.log('change event: new text: ', text);
      });

      editify.on('selectionchange', function(selection) {
        console.log('selectionchange event: selected text: ', selection.toString());
      });
    }
  </script>
</head>
<body>
  <div id="editor">
    <p>This line is editable!</p>
  </div>
</body>

Usage (next.js)

export default function EditifyPage() {
  const onChange = (html: string, text: string) => {
    console.log('change event: new html: ', html);
    console.log('change event: new text: ', text);
  };

  const onSelectionChange = (selection: Selection) => {
    console.log('selectionchange event: selected text: ', selection.toString());
  };

  React.useEffect(() => {
    // editify can be used only in client side
    const { Editify } = require("editify");

    const editor = new Editify("editor");

    editor.on("change", onChange);
    editor.on("selectionchange", onSelectionChange);

    return () => {
      editor.off("change", onChange);
      editor.off("selectionchange", onSelectionChange);
    };
  }, []);

  return (
    <div id="editor">
      <p>This line is editable!</p>
    </div>
  );
}

Roadmaps

  • contenteditable
  • on change event
  • on selectionchange event
  • toolbar (fixed)
    • inline: bold
      • toggle
    • inline: italic
      • toggle
    • inline: color
      • toggle
    • inline: link
      • insert
      • edit
      • remove
    • list
      • toggle
      • indent: tab
      • indent: shift+tab
    • image
      • insert
      • edit
      • remove
    • PDF
      • insert
      • edit
      • remove
    • table
      • insert
        • 2 * 2 cells
      • edit
        • cell
        • add row
        • add column
        • remove row
        • remove column
      • remove
      • cmd: tab
      • cmd: shift+tab
  • toolbar (hovered)
  • undo / redo