使用 div 的在线所见即所得编辑器

发布于 2024-11-25 09:28:21 字数 1435 浏览 1 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

少女的英雄梦 2024-12-02 09:28:21

从头开始创建编辑器是一项艰巨的任务,因为浏览器内编辑存在大量的浏览器怪癖和错误。我已经为各种利基项目做过好几次了。我的建议是从 TinyMCE 或 CKEditor 作为基础开始并扩展它们。两者都经过多次迭代投入了令人难以置信的大量开发时间,才达到了现在的水平。尝试查看他们的错误跟踪器,了解他们必须应对的问题。两者都有不错的扩展选项,因此您可以编写自己的格式化命令来替换 document.execCommand(),并且在两者中您都可以向工具栏和上下文菜单添加按钮/工具。

自我推销提醒:未来的另一个选择是使用我正在为我的 Rangy 库。它距离完成还有一段路要走,但最初将替代 document.execCommand() 提供的内联格式化命令,并将允许控制它生成的标签/CSS。早期的粗略演示如下:http://rangy.googlecode.com/svn/分支/1point2/demos/commands.html

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

霓裳挽歌倾城醉 2024-12-02 09:28:21

不要这样做。高调的所见即所得编辑器背后有开发团队,他们已经在开发中内置了处理跨浏览器测试的工作流程。

看看

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

天邊彩虹 2024-12-02 09:28:21
  1. http://280slides.com/ 专为canvas标签打造
  2. 如果你足够顽固,一切皆有可能。
  1. http://280slides.com/ built for the canvas tag
  2. Everything is possible if you are stubborn enough.
她如夕阳 2024-12-02 09:28:21

我们查看的两个是:

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.

梓梦 2024-12-02 09:28:21

您是否已经尝试过 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..

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文