简体   繁体   English

Javascript RTF编辑器,可锁定区域

[英]Javascript rich text editor that allows locking regions

I'm looking for a rich text editor that allows for locking regions so that they can't be edited by the user. 我正在寻找一个富文本编辑器,该编辑器允许锁定区域,以便用户无法对其进行编辑。 These locked regions would contain markup, not just plain text. 这些锁定的区域将包含标记,而不仅仅是纯文本。 TinyMCE has a plugin to support this but it is quite buggy. TinyMCE有一个支持此功能的插件,但是它有很多问题。

Rather than having the RTE contain the content you don't want edited, why not just put multiple editors around only the areas you want users to edit? 为什么不让RTE包含您不想编辑的内容,为什么不只在您要用户编辑的区域周围放置多个编辑器呢?

The problem I see with doing it the other way is that you could have individual nodes within the editable text with contenteditable off, but those nodes could still be part of a larger edit (eg, they could be deleted). 我用另一种方式看到的问题是,您可以在可编辑文本中包含单个节点,而禁用contenteditable ,但是这些节点仍可能是较大编辑的一部分(例如,可以将其删除)。 To truly prevent them being edited you'd have to check the current selection whenever it changed and disable all user actions until the selection didn't include the locked content. 为了真正防止它们被编辑,您必须在更改当前选择时检查当前选择,并禁用所有用户操作,直到选择不包括锁定的内容为止。 Even if you did that, it would be tricky to make sure that a user didn't add content in a place they weren't supposed to (before the first node, say, assuming the first node was locked). 即使您这样做了,要确保用户没有在他们不应该添加的地方添加内容也很棘手(例如,在第一个节点之前,假设第一个节点已锁定)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM