Medium.js

Taking control of content editable


This is Medium.js

Easy

Medium.js keeps HTML code within contenteditable semantic, simple, and clean. Medium.js also supports placeholders, automatic HR (or BR, or P) creation, events, hotkeys, simple & complex element injection, and more!

Compliant

Medium.js is html5 compliant and has been tested in Firefox, Chrome, Safari, Opera, & IE8+. Browser support is constantly improving!

HTML5 Powered with Connectivity / Realtime, CSS3 / Styling, Device Access, Graphics, 3D & Effects, Multimedia, Performance & Integration, and Semantics

Inspired

This script is inspired by Medium's beautiful content editor, something we have aspired to emulate since it's inception.

Authors

This code is brought to you by:


Features


Usage


            

Simply include the Medium.js library and CSS, and you are ready to rock. No dependencies


Demos

Inline

Partial

Rich

Rich with Insert Html

INSERT

Rich with Insert Html Object (domesticated only)

LI

Rich with Invoke Element (domesticated only)

B U I S
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce rutrum dapibus dictum. Etiam tempor a enim id sagittis. Donec sodales varius elementum. In iaculis consequat enim, et pellentesque erat accumsan ut. Nulla nec lacus nisi. Nullam id interdum risus, sit amet sollicitudin ipsum. Ut vitae rutrum nulla.

Vivamus eget dolor est. Donec lobortis felis metus, vel placerat nunc iaculis id. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Praesent eu neque dictum, pulvinar massa faucibus, accumsan diam. Vestibulum pharetra massa dolor, ut tincidunt nisl suscipit vitae.

Semantic


            

The code within Medium.js editors are very semantic and organized, giving you peace of mind with using contenteditable.


Options


            

All options (excluding modifiers, tags, and cssClasses) may be overridden with data-medium-* attributes on the element.


Behavior

There are two behaviors available, wild and domesticated.


Methods

Methods provide functionality that can be used with buttons, toolbars, WYSIWYG editors, and the environment it is being used with.


FAQ

What is the purpose of Medium.js?

Medium.js allows you to take total control over contenteditable elements. This means that you can use contenteditable without fearing your user is going to enter poor or invalid HTML. It keeps things tight, organized, and semantic.

Why are there different behaviours available?

Medium.js was written to be used in many environments, some need more stability than others. Domesticated offers this stability when needed.

Does this give me the cool toolbar like Medium's editor?

The focus of Medium.js has been to make introducing a toolbar, any toolbar, YOUR toolbar, ultra easy. Take a look at wikiLingo for example. More to come!

Medium.js works in all browsers!?!

Yup. This is because of you. But if you find a bug, please let us know or fork Medium.js and contribute so we can continue wide support!

Who uses Medium.js


Support

Need commercial support for Medium.js? Currently provided by Visual Interop Development llc., drop us a line, we can't wait to see what we can do together.

Licensing

MIT Licensing

Copyright (c) 2013 Jacob Kelley

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Fork me on GitHub