用于类似 Wiki 网站的 JavaScript HTML 编辑器?

发布于 2024-10-08 17:56:30 字数 942 浏览 0 评论 0原文

我有一个类似维基的网站,用户可以在其中发布和编辑。我需要一个好的 HTML 编辑器。我尝试过CKEditor,但它有问题,因为人们经常剪切和粘贴。它们使用的样式和 javascript 与周围的 HTML 以及我只想允许的内容(不改变颜色等)相冲突。也许有一种方法可以配置 CKEditor 来做我需要的事情,但从他们的文档中并不清楚如何做。不过,这是一年多前的事了。

我的要求如下:

  • 仅允许 HTML 的一小部分(带有斜体内联格式的简单段落等,由我们托管的图像以及我们网站内部的链接)
  • 作为干净的 xhtml尽可能更
  • 喜欢 (x)html,但我愿意
  • 使用 jQuery 替代标记,因此,如果编辑器依赖于 jQuery,那更好
  • 国际化
  • WYSIWYG 很好,但也许它有助于避免通过不使用 WYSIWYG 来避免复制/粘贴问题?

最重要的是不允许用户无意或故意搞砸事情,通常是通过复制和粘贴其他网页或 Word 文档。 markItUp! 看起来真的很不错,缺乏所见即所得让我持观望态度。我喜欢 WYMeditor 专注于干净的 xhtml,但在从演示和那里复制和粘贴时,它仍然允许疯狂过去 6 个月左右似乎没有太多活动。

StackOverflow 的编辑器可能对我们也有好处。就像markItUp!一样,它不是所见即所得,但非常简单。我知道他们拿走了 WMD 编辑器并更新了它。非 html 方面意味着服务器端可以更轻松地解析出潜在有害的代码......

你们觉得怎么样?对于类似 wiki 的网站编辑器来说,最好的解决方案是什么?

I have a wiki-like site where users can post and edit. I need a good HTML editor. I've tried CKEditor and it was problematic because people often cut and paste. They take with them styles and javascript that conflict with the surrounding HTML and with what I only want to allow (no changing colors, etc). Maybe there's a way to configure CKEditor to do what I need, but it wasn't obvious how from their documentation. This was over a year ago though..

My requirements are the following:

  • Only allow a small subset of HTML (simple paragraphs with inline formatting for italics, etc., images that are hosted by us and links internal to our site)
  • As clean xhtml as possible
  • Prefer (x)html, but I'm open to alternate markup
  • Using jQuery, so if the editor relies on jQuery that's preferable
  • Internationalizable
  • WYSIWYG is nice, but maybe it helps to avoid copy/paste issues by not having WYSIWYG?

The most important thing is to not allow users to inadvertently or purposely screw things up, usually through copying and pasting other webpages or word documents. markItUp! looks really nice, the lack of WYSIWYG has me on the fence. I love WYMeditor's focus on clean xhtml, but it still does allow craziness when copying and pasting from the demos and there doesn't seem to be much activity for the past 6 months or so.

StackOverflow's editor might be good for us too. Like markItUp!, it's not WYSIWYG, but it is very simple. I understand they took WMD-editor and updated it. The non-html aspect means an easier time on the server side parsing out potentially harmful code...

What do you guys think? What's the best solution out there for a wiki-like site editor?

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

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

发布评论

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

评论(1

眼泪也成诗 2024-10-15 17:56:30

您应该在启用 forcePasteAsPlainText 后重试 CKEditor

You should try again CKEditor after enabling forcePasteAsPlainText

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