Git Product home page Git Product logo

editor's Introduction

Editor

A markdown editor you really want.

NOTICE: @NextStepWebs has created an improved markdown editor based on this project

Overview

Editor is not a WYSIWYG editor, it is a plain text markdown editor. Thanks for the great project codemirror, without which editor can never be created.

Basic Usage

The easiest way to use Editor is to simply load the script and stylesheet:

<link rel="stylesheet" href="http://lab.lepture.com/editor/editor.css" />
<script type="text/javascript" src="http://lab.lepture.com/editor/editor.js"></script>
<script type="text/javascript" src="http://lab.lepture.com/editor/marked.js"></script>

You can also use jsdelivr CDN:

<link rel="stylesheet" href="//cdn.jsdelivr.net/editor/0.1.0/editor.css">
<script src="//cdn.jsdelivr.net/editor/0.1.0/editor.js"></script>
<script src="//cdn.jsdelivr.net/editor/0.1.0/marked.js"></script>

Having done this, an editor instance can be created:

var editor = new Editor();
editor.render();

The editor will take the position of the first <textarea> element.

Get the content

To get back the edited content you use:

editor.codemirror.getValue();

Component

If you are using component, you can install it with:

$ component install lepture/editor

Seajs

If you are using seajs, you can install it with:

$ spm install lepture/editor

Development

You can build the dist files with grunt. After this repo is cloned, dig into the repo, and install everything you need:

$ npm install
$ npm install grunt-cli -g

Now you can create the dist files:

$ grunt transport

You can get everything you need in the build directory.

Configuration

The Editor Class accepts an option as the parameter. The supported options are:

  • element (DOM)

    The element of the textarea. The default value is the first <textarea>.

  • tools (array or false)

    If set false, the editor will have no toolbar.

  • status (array or false)

    If set false, the editor will have no statusbar.

  • actions (object)

  • shortcuts (object)

Example:

new Editor({
  element: document.getElementById('editor'),
  toolbar: []
})

Contributing

Contribution is welcome. As a way to keep all code clean, we use Grunt to build our distributed files. Make sure you have read our Contributing Guide.

License

MIT. Copyright (c) 2013 - 2014 by Hsiaoming Yang

editor's People

Contributors

adammesa avatar bigbluehat avatar bugidev avatar jpunt avatar klml avatar leo2807 avatar lepture avatar maicolben avatar manfromanotherland avatar mortie avatar nobrick avatar paazmaya avatar psalaets avatar rvboris avatar viveleroi avatar wescossick avatar whoisandy 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.