插入表单时如何删除 Word 标记垃圾?
我正在用 PHP 构建一个 CMS,我担心的一个问题是用户必须从现有的 Word(和 Excel,但不用担心)文档中填写数据。 现在,我已经看到了当他们不小心从 Word 复制并粘贴到文本区域时会发生什么:数据库充满了垃圾标记。
现在,我当然可以自己删除所有标记,但我必须首先开始学习它。 所以我问你:你是否测试过一些功能 - 常见的插件(tinyMCE、FCKeditor 等)在这里有帮助? 侵入性最小的解决方案的奖励。
I'm building a CMS in PHP and one dread I have is that the users will have to fill the data in from existing Word (and Excel, but nevermind that) documents. Now, I've seen what happens when they carelessly copy and paste from Word to a textarea: the database got filled with crap markup.
Now, I could certainly strip all markup myself, but I'd have to start learning about it first. So I ask you: have you tested some functionality - plugins of the usual suspects (tinyMCE, FCKeditor, etc) that helps here? Bonus for the least intrusive solution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
遗憾的是,我使用过的大多数 HTML 编辑器控件:
如果你把它留给一个按钮,那么通常非技术用户会忘记按下它,因为他们不(有些人会说“不应该”)关心它:(
稍微玩弄一下常规表达式(现在你遇到了另一个问题;))你可以做类似于2的事情,但只是针对word xml。
Sadly most of the HTML editor controls I've used either:
If you leave it to a button, then generally the non-technical users will forget to press it because they don't (some would say "shouldn't have to") care about it :(
With a bit of playing around with Regular Expressions (now you have another problem ;)) you could do something similar to 2 but just for word xml.
我发现 FCKEditor 可以处理从 Word 文档中拉出和抛出的文本,比tinyMCE 好得多。
I have found FCKEditor to handle text yanked and thrown at it from Word documents, much better than tinyMCE.
好的,我发现 TinyMCE 插件 显然可以满足我的需求。 尽管如此,这仍然要求用户按下按钮进行粘贴,这有点不太理想。 还有更好的吗?
Ok, I found a plugin for TinyMCE that apparently does what I wanted. Still, this asks for the users to press a button to paste, which is a bit less than ideal. Anything better?
ASP.NET? Telerik 的 RadEditor 对我来说效果很好
ASP.NET? Telerik's RadEditor has worked very well for me