Creating an editor from scratch is a massive undertaking because of the sheer number of browser quirks and bugs with in-browser editing. I've done it several times for various niche projects. My advice would be to start with either TinyMCE or CKEditor as a base and extend them. Both have had unbelievable amounts of development time poured into them over several iterations to get them as good as they are now. Try taking a look at their bug trackers to get an idea of what they have to contend with. Both have decent options for extension, so you could write your own formatting commands to replace document.execCommand() and in both you can add buttons/tools to the toolbar and context menus.
Self-promotion alert: Another option for the future is to use the commands module I'm working on for my Rangy library. It's some way off completion but will initially have replacements for inline formatting commands offered by document.execCommand(), and will allow control of the tags/CSS it produces. Rough early demo here: http://rangy.googlecode.com/svn/branches/1point2/demos/commands.html
Don't do this. There are teams of developers behind high profile WYSIWYG editors, and they already have the workflow built into their development to handle cross browser testing.
Did you already try TinyMCE ? You have full control over the output via different parameters or existing plugins, also possible to write your own plugin..
发布评论
评论(5)
从头开始创建编辑器是一项艰巨的任务,因为浏览器内编辑存在大量的浏览器怪癖和错误。我已经为各种利基项目做过好几次了。我的建议是从 TinyMCE 或 CKEditor 作为基础开始并扩展它们。两者都经过多次迭代投入了令人难以置信的大量开发时间,才达到了现在的水平。尝试查看他们的错误跟踪器,了解他们必须应对的问题。两者都有不错的扩展选项,因此您可以编写自己的格式化命令来替换
document.execCommand()
,并且在两者中您都可以向工具栏和上下文菜单添加按钮/工具。自我推销提醒:未来的另一个选择是使用我正在为我的 Rangy 库。它距离完成还有一段路要走,但最初将替代
document.execCommand()
提供的内联格式化命令,并将允许控制它生成的标签/CSS。早期的粗略演示如下:http://rangy.googlecode.com/svn/分支/1point2/demos/commands.htmlCreating an editor from scratch is a massive undertaking because of the sheer number of browser quirks and bugs with in-browser editing. I've done it several times for various niche projects. My advice would be to start with either TinyMCE or CKEditor as a base and extend them. Both have had unbelievable amounts of development time poured into them over several iterations to get them as good as they are now. Try taking a look at their bug trackers to get an idea of what they have to contend with. Both have decent options for extension, so you could write your own formatting commands to replace
document.execCommand()
and in both you can add buttons/tools to the toolbar and context menus.Self-promotion alert: Another option for the future is to use the commands module I'm working on for my Rangy library. It's some way off completion but will initially have replacements for inline formatting commands offered by
document.execCommand()
, and will allow control of the tags/CSS it produces. Rough early demo here: http://rangy.googlecode.com/svn/branches/1point2/demos/commands.html不要这样做。高调的所见即所得编辑器背后有开发团队,他们已经在开发中内置了处理跨浏览器测试的工作流程。
看看
Dijit.Editor
Don't do this. There are teams of developers behind high profile WYSIWYG editors, and they already have the workflow built into their development to handle cross browser testing.
Look at
Dijit.Editor
我们查看的两个是:
http://tinymce.moxiecode.com/
和
http://ckeditor.com/
两者都完全符合我们的要求,但最终我们选择了商业 CKeditor。
The two we looked at were:
http://tinymce.moxiecode.com/
and
http://ckeditor.com/
Both did exactly what we wanted but in the end we went with the commercial CKeditor.
您是否已经尝试过 TinyMCE ?
您可以通过不同的参数或现有插件完全控制输出,也可以编写自己的插件。
Did you already try TinyMCE ?
You have full control over the output via different parameters or existing plugins, also possible to write your own plugin..