有没有办法从textarea找到编辑部分? [英] is there any way to find edited portion from textarea?

查看:83
本文介绍了有没有办法从textarea找到编辑部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述







在我的mvc3项目中,一个文件有一个html控件textarea.in我添加了一些细节并保存之后我再次打开它来编辑textarea中的细节。



我的问题是如何从textarea找到编辑过的部分。





谢谢...

Hi,


in my mvc3 project, a file have a html control textarea.in which i added some details and saved it.after that i again opend it for editing the details in textarea.

my question is how to find the edited portion from textarea.


Thanks...

推荐答案

这是不可能的,首先是因为你几乎无法定义什么是编辑部分。用户不仅可以插入一些文本,还可以在此处进行编辑。一般情况下,没有编辑部分这样的东西。



尽管如此,还有所谓的差异算法,这些算法确实非常有用且有用。它们提供的输出显示了新旧文本,您可以走的方式抛出一系列不匹配。请参阅,例如: http://ejohn.org/projects/javascript-diff-algorithm/ [ ^ ]。



-SA
It is impossible, first of all because you hardly can define what is the "edited portion". The user may not just insert some text, but edit here and there. In general case, there is no such thing as "edited portion".

Nevertheless, there are so called "diff" algorithms which are really informative and useful. They provide the output showing both old and new text the way you can walk throw a sequence of mismatches. Please see, for example: http://ejohn.org/projects/javascript-diff-algorithm/[^].

—SA


这篇关于有没有办法从textarea找到编辑部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆