强大的在线编辑器 Tower 开源Simditor

来源:互联网 发布:好的南方二本院校知乎 编辑:程序博客网 时间:2024/05/20 13:14

Tower开源Simditor —— 所见即所得的在线编辑器

这里给出网址,点击Download下载即可点击打开链接 使用方法见Docs,给出了下列代码,按照你安装的路径修改安装路径即可

使用方法

在你的html页面中引用如下文件:

<link media="all" rel="stylesheet" type="text/css" href="styles/font-awesome.css" /><link media="all" rel="stylesheet" type="text/css" href="styles/simditor.css" /><script type="text/javascript" src="scripts/jquery-2.0.3.js"></script><script type="text/javascript" src="scripts/module.js"></script><script type="text/javascript" src="scripts/uploader.js"></script><script type="text/javascript" src="scripts/simditor.js"></script>

在script中初始化编辑器:

var editor = new Simditor({  textarea: $('#textarea-id')});此外还可以在textarea下面,再加一些别的选项

Some optional options:

  • placeholder (default: '') Placeholder of simditor. Use the placeholder attribute value of the textarea by default.
  • toolbar (default: true) - Show the toolbar buttons
  • toolbarFloat (default: true) - Fixed the toolbar on the top of the browser when scrolling.
  • toolbarHidden (default: false) - Hide the toolbar.
  • defaultImage (default: 'images/image.png') - Default image placeholder. Used when inserting pictures in Simditor.
  • tabIndent (default: true) - Use 'tab' key to make indent.
  • params (default: {}) - Insert a hidden input in textarea to store params (key-value pairs).
  • upload (default: false) - Accept false or key - value pairs. Extra options for uploading images. e.g. 'url', 'params'
  • pasteImage (default: false) - Support uploading by pasting images from clipboard. Only supported by Firefox and Chrome.
 

依赖

  • jQuery 2.0+
  • Mycolorway Simple Module用于组件开发。
  • FontAwesome 用于工具栏按钮。
  • Mycolorway Simple Uploader 提供本地图片上传功能(可选)。

由来

从 2012 年第一版 Tower上线以来,Tower 团队就在寻找一款最为合适的编辑器以供 Tower 的用户使用。最早使用 wysihtml5作为 Tower 的编辑器,在前期 wysihtml5 很好的满足了 Tower 的核心需求——非常方便的添加附件,无论是直接粘贴剪切板里的内容还是拖动上传,wysihtml5 都很容易实现。不过随着 Tower 功能的增加,当 Tower 引入@ 成员、Markdown 功能、代码识别、自动短链等一系列功能以后,第三方开源编辑器的局限性也逐渐暴露出来,这些局限性让 Tower 在很多用户体验和工程复杂性的岔路口上选择向工程复杂性妥协。Tower 认为,作为一款在线生产力工具,让用户能极其舒畅地生产内容是它的核心品质之一,因此决定自己开发一款编辑器,这就是 Simditor 产生的原因。

经过不断地改进,Tower 在最近使用 simditor 替换了 默认编辑器,包括创建讨论、发表回复以及创建在线文档的编辑器,现在都使用 Simditor 了。Tower 认为,相比其他的开源编辑器,Simditor 不是一个业余爱好的产物,而是每天被几万人使用的真实产品。Tower 会非常谨慎地评估究竟什么功能是实际用户最为需要的,而不会因为交互很酷炫,就把功能增加进编辑器里,导致代码膨胀,造成麻烦的后果。

原创粉丝点击