codemirror-widgets
Utility to easily write interactive widgets for CodeMirror.
Installation
$ npm install codemirror-widgets
Usage
Example, replace LaTeX math ($$ ... $$
) by a preview using KaTeX
var widgets = ;var katex = ; // Create a type of widgetvar WidgetMath = widgets; // Create a widgets manager connected to an editorvar manager = widgets; // Connect a type of widget to the managermanager;
Mixins
Some prebuilt mixins make it event easier to create awesome widgets:
re
Find occurrence using a Regex:
var widgetMath = widgets;
menu
Bind a menu with multiple actions to your widgets. The menu will show up on click (like on Gmail).
var widgetLink = widgets;
editParagraph
Helper to update a paragraph when user is typing
var widgetLink = widgets;