使用 jscript 跟踪对网页字段所做的更改?

发布于 2024-10-01 18:41:10 字数 384 浏览 0 评论 0原文

我们有一位客户向我们即将启动的项目添加了新的“要求”,这让我们有点困惑。从最终用户的角度来看,这很简单,但作为开发人员,我不知道如何实现它!

我们的用户想要的是一个网络表单文本框(最好是富文本编辑器,例如 CKEditor)来跟踪用户对内容所做的更改。请注意,这并不是为了跟踪是否进行了更改,而是为了实际突出显示这些更改。基本上他们是在追求 Microsoft Word 的“跟踪更改”功能!

这个想法是,当请求在用户之间传递时,如果一个用户更改了包含大量文本的文本框,则下一个用户将能够轻松识别更改的内容。

我很想听听是否有人做过类似的事情,或者有人对它是否或如何可能有什么想法?

We've had a a client add a new "requirement" to a project we're about to start and it's thrown us a little bit. From the end users perspective it's simple, but as a developer I have no idea how to implement it!

What our user would like is for a web form text box (ideally a rich text editor, such as CKEditor) to track the changes a user makes to the content. Note this is not to track if a change has been made but to actually highlight those changes. Basically they're after Microsoft Word's "Track Changes" feature!

The idea is as a request goes between users if one users alters a text box containing a large amount of text the next user will be easily able to identify what's changed.

I'd love to hear if anybody has ever done something similar or anybody's thoughts on if or how it may be possible?

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

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

发布评论

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

评论(3

懷念過去 2024-10-08 18:41:10

嗯......好吧,你可以将盒子的内容存储在一个变量中,然后使用 diff 算法(肯定有一些)来检查 onChange 和格式的更改是否适当,但只会在用户时显示差异在框外点击。这样就足够了吗?如果没有,您可以将 onkeypress 事件与 onkeyup 事件进行比较,并对差异应用格式?

Hmmm... well you could store the contents of the box in a variable, then use a diff algorithm (there must be some out there, surely) to check the changes onChange and format appropriately, but will only display the difference when the user clicks outside the box. Will that be good enough? If not, you could compare the onkeypress event with the onkeyup event, and apply formatting to the difference?

海风掠过北极光 2024-10-08 18:41:10

那么,您需要某种内容管理解决方案。它需要具有版本控制,以便您可以存储内容的不同版本。如果您的内容只是文本,那么进行差异并不难。如果它以某种方式构建(HTML 或其他不同于文本的格式),则可能很难识别更改。
我认为在后一种情况下,您可以使用不可见标签标记新文本,例如 编辑器将突出显示的。您还可以为已删除的文本创建标签。您可以不突出显示文本,也不将删除显示为选项。

Well, you need some kind of content management solution for that. It needs to have versioning so you can store different versions of the content. If your content is just text it won't be hard to do diff. If it is structured in some way (HTML or other format different from text) it might be pretty hard to identify changes.
I think in the latter case you could mark new text with invisible tags, something like <edition version="1.0"> </edition> that the editor will highlight. You could also make tag for deleted text. And you could just not highlight the text and don't show the deletions as an option.

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