GithubHelp home page GithubHelp logo

anthrax3 / scribe Goto Github PK

View Code? Open in Web Editor NEW

This project forked from guardian/scribe

0.0 2.0 0.0 5.42 MB

A rich text editor framework for the web platform

Home Page: http://guardian.github.io/scribe/

License: Apache License 2.0

JavaScript 98.80% Shell 0.88% HTML 0.31%

scribe's Introduction

Scribe

A rich text editor framework for the web platform, with patches for browser inconsistencies and sensible defaults.

Status

Build Status Join the chat at https://gitter.im/guardian/scribe

Description

For an introduction, you may want to read the blog post Inside the Guardian’s CMS: meet Scribe, an extensible rich text editor.

Please note: There is a lot of missing documentation for Scribe and many of its plugins. We plan to improve this, however in the meantime we encourage you to look at the code. Scribe is very small in comparison to other libraries of its kind.

You can join us on IRC at [#scribejs] on freenode, or via the Google Group.

See an example.

Scribe only actively supports a sub-set of browsers.

Core

At the core of Scribe we have:

Patches

Scribe patches many browser inconsistencies in the native command API.

Installation

bower install scribe

Alternatively, you can access the distribution files through GitHub releases.

Usage Example

Scribe is an AMD module:

require(['scribe', 'scribe-plugin-blockquote-command', 'scribe-plugin-toolbar'],
  function (Scribe, scribePluginBlockquoteCommand, scribePluginToolbar) {
  var scribeElement = document.querySelector('.scribe');
  // Create an instance of Scribe
  var scribe = new Scribe(scribeElement);

  // Use some plugins
  scribe.use(scribePluginBlockquoteCommand());
  var toolbarElement = document.querySelector('.toolbar');
  scribe.use(scribePluginToolbar(toolbarElement));
});

You can see a live example here, or view the code here.

Also be sure to check the examples directory for an AMD syntax example as well as a CommonJS (browserify) example.

Options

allowBlockElements
Enable/disable block element mode (enabled by default)
undo: { enabled: false }
Enable/disable Scribe's custom undo manager
defaultCommandPatches
Defines which command patches should be loaded by default
defaultPlugins
Defines which of Scribe's built-in plugins should be active
defaultFormatters
Defines which of Scribe's default formatters should be active

For detailed documentation see the wiki page on options.

Architecture

A plugin is simply a function that receives Scribe as an argument:

function myPlugin(scribe) {}

A consumer can then use your plugin with Scribe.use:

scribe.use(myPlugin);

Plugins may package whatever functionality you desire, and you are free to use native APIs to do so. However, you are required to wrap any DOM manipulation in a transaction, so that we can capture state changes for the history. For example:

function myPlugin(scribe) {
  scribe.transactionManager.run(function () {
    // Do some fancy DOM manipulation
  });
}

Browser Support

Moved to the Github Wiki

Plugins

Scribe has a rich plugin ecosystem that expands and customises what it can do.

See the wiki for a list of plugins and how to create new ones

FAQ

See the wiki's FAQ

scribe's People

Contributors

aaalsaleh avatar aleludovici avatar alexeygolev avatar bahlo avatar bryant1410 avatar christopherliu avatar code-smith avatar cutandpastey avatar danburzo avatar davidtobin avatar edeustace avatar es avatar gitter-badger avatar hmgibson23 avatar jamespamplin avatar katebee avatar kekeblom avatar mattandrews avatar oliverjash avatar regiskuckaertz avatar rf- avatar robinedman avatar rrees avatar samvasko avatar shaundillon avatar shaunnetherby avatar sihil avatar tbonnin avatar theefer avatar tootallnate avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.