• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

lepture/editor: A markdown editor. http://lab.lepture.com/editor/

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

lepture/editor

开源软件地址(OpenSource Url):

https://github.com/lepture/editor

开源编程语言(OpenSource Language):

JavaScript 68.0%

开源软件介绍(OpenSource Introduction):

Editor

A markdown editor you really want.

Sponsors

Editor is sponsored by Typlog.

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




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Editor发布时间:2022-08-18
下一篇:
vlang/markdown发布时间:2022-08-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap