Extensible WYSIWYG Markdown Editor For jQuery - tui.editor

Extensible WYSIWYG Markdown Editor For jQuery - tui.editor
File Size: 632 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

tui.editor is a powerful, extensible, full-featured, multi-language WYSIWYG Markdown Editor which can be implemented in either JavaScript or jQuery.

More features:

  • CommonMark and GitHub Flavored Markdown specifications.
  • Useful extensions: Color Picker, Chart, UML, table merge.
  • Easy to create your own extensions.
  • Simple & WYSIWYG modes.
  • Live HTML preview with synchronous scrolling support.
  • Syntax highlighting.
  • Allows to set content programmatically.

Basic Usage (jQuery Version):

1. Install the tui.editor via package managers.

# NPM
$ npm install tui-editor --save

2. Or include the tui.editor's files after jQuery library.

<link rel="stylesheet" href="dist/tui-editor.css">
<link rel="stylesheet" href="dist/tui-editor-contents.css">
<script src="https://code.jquery.com/jquery-1.12.4.min.js" 
        integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" 
        crossorigin="anonymous"></script>
<script src="dist/tui-editor-Editor.js"></script>

3. Create a container element in which you want to render the WYSIWYG Markdown Editor.

<div id="example"></div>

4. Call the function to render a basic WYSIWYG Markdown Editor.

$('#example').tuiEditor();

5. All possible options & functions to customize the WYSIWYG Markdown Editor.

  • height: Editor's height style value. Height is applied as border-box ex) '300px', '100%', 'auto'
  • minHeight: Editor's min-height style value in pixel ex '300px'
  • initialValue: Editor's initial value
  • previewStyle: Markdown editor's preview style (tab, vertical)
  • initialEditType: Initial editor type (markdown, wysiwyg)
  • events: eventlist Event list
  • events.load: It would be emitted when editor fully load
  • events.change: It would be emitted when content changed
  • events.stateChange: It would be emitted when format change by cursor position
  • events.focus: It would be emitted when editor get focus
  • events.blur: It would be emitted when editor loose focus
  • hooks: Hook list
  • hooks.previewBeforeHook: Submit preview to hook URL before preview be shown
  • hooks.addImageBlobHook: hook for image upload.
  • language: language
  • useCommandShortcut: whether use keyboard shortcuts to perform commands
  • useDefaultHTMLSanitizer: use default htmlSanitizer
  • codeBlockLanguages: supported code block languages to be listed. default is what highlight.js supports
  • usageStatistics: send hostname to google analytics
  • toolbarItems: toolbar items.
  • hideModeSwitch: hide mode switch tab bar
$('#example').tuiEditor({
  previewStyle: 'tab',
  initialEditType: 'markdown',
  height: '300px',
  minHeight: '200px',
  language: 'en_US',
  useDefaultHTMLSanitizer: true,
  useCommandShortcut: true,
  codeBlockLanguages: _codeBlockManager.CodeBlockManager.getHighlightJSLanguages(),
  usageStatistics: true,
  toolbarItems: ['heading', 'bold', 'italic', 'strike', 'divider', 'hr', 'quote', 'divider', 'ul', 'ol', 'task', 'indent', 'outdent', 'divider', 'table', 'image', 'link', 'divider', 'code', 'codeblock'],
  hideModeSwitch: false
});

Changelog:

2018-07-25

  • v1.2.6

2018-07-20

  • fix: switching to ww cause scrolling

This awesome jQuery plugin is developed by nhnent. For more Advanced Usages, please check the demo page or visit the official website.