yabwe /medium-editor

Medium.com WYSIWYG editor clone. Uses contenteditable API to implement a rich text solution.

★ 16,098⑂ 1,802👁 346⑃ 641● 943▤ 149
JavaScriptNOASSERTIONCreated 2013-05-29yabwe.github.io/medium-editor/
Download: 5.23.35.23.3 ↓5.23.32017-12-20
+0
Daily
16,098
stars
1,802
forks
346
watchers
641
prs
943
issues
149
releases

README

!medium-editor needs help!

If you would be interested in helping to maintain one of the most successful WYSIWYG text editors on github, let us know!  (See issue 1503)

 MediumEditor

This is a clone of medium.com inline editor toolbar.

MediumEditor has been written using vanilla JavaScript, no additional frameworks required.





 Browser Support



!Supported Browsers








 Basic usage

 Demo

__demo__: http://yabwe.github.io/medium-editor/

 Installation

Via npm:

Run in your console: npm install medium-editor

Via bower:

bower install medium-editor

Via an external CDN

 Using jsDelivr.

 For the latest version:

 html
 
 
 

 For a custom one:

 html
 
 
 

 Using CDNJS.

Manual installation:

Download the latest release and attach medium editor's stylesheets to your page:

Find the files to below mentioned linking in the dist folder. (./medium-editor/dist/...)

html
 
 


 Usage

The next step is to reference the editor's script

html



You can now instantiate a new MediumEditor object:
html
var editor = new MediumEditor('.editable');


The above code will transform all the elements with the .editable class into HTML5 editable contents and add the medium editor toolbar to them.

You can also pass a list of HTML elements:

javascript
var elements = document.querySelectorAll('.editable'),
    editor = new MediumEditor(elements);


MediumEditor also supports textarea. If you provide a textarea element, the script will create a new div with contentEditable=true, hide the textarea and link the textarea value to the div HTML content.

 Integrating with various frameworks

People have contributed wrappers around MediumEditor for integrating with different frameworks and tech stacks.  Take a look at the list of existing Wrappers and Integrations that have already been written for MediumEditor!

 MediumEditor Options

View the MediumEditor Options documentation on all the various options for MediumEditor.

Options to customize medium-editor are passed as the second argument to the MediumEditor constructor.  Example:

js
var editor = new MediumEditor('.editor', {
    // options go here
});


 Core options
 __activeButtonClass__: CSS class added to active buttons in the toolbar. Default: 'medium-editor-button-active'
 __buttonLabels__: type of labels on the buttons. Values: false | 'fontawesome'.  Default: false

 NOTE:
Using 'fontawesome' as the buttonLabels requires version 4.1.0 of the fontawesome css to be on the page to ensure all icons will be displayed correctly

 __delay__: time in milliseconds to show the toolbar or anchor tag preview. Default: 0
 __disableReturn__:  enables/disables the use of the return-key. You can also set specific element behavior by using setting a data-disable-return attribute. Default: false
 __disableDoubleReturn__:  allows/disallows two (or more) empty new lines. You can also set specific element behavior by using setting a data-disable-double-return attribute. Default: false
 __disableExtraSpaces__:  when s

Top issues

Discussions

Latest release

5.23.3 5.23.3 2017-12-20
:mrs_claus: Christmas release! :santa: 

This is a patch release with:
- a bug related to Firefox
- a bug if you use data-disable-preview

List of changes:

 Fix medium-editor-insert plugin css fixes on beagle theme 1361
 Update jsDelivr links 1366 & 1367
 Fix Firefox console warning causing issues 1370
 Do not check only for null targets or it will fail when it's undefined. 1373
 Fix crash when 'extensions' in 'isElementDescendantOfExtension' is undefined 1362
 Fix Jasmine Unit Test errors 1385
 Fix null error on pastedPlain.split 1397
 Fix broken browser tests 1396

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON