Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的 cms 中有一个小小的 html-wysiwyg 编辑器,我想知道 - 是否有一个用于整理 html 客户端的好脚本?我主要是在处理从 winword 粘贴的 html。也许一些正则表达式会有所帮助。
提前致谢
从 WORD 粘贴到 WYSIWYG 编辑器通常是个坏主意。有些编辑试图清理它,但没有一个能做得完美。FCK 编辑器具有strip-WORD 功能,但并非万无一失。
WORD 会做一些愚蠢的事情,例如: <bold>some <bold></bold> words</bold>,程序很难检测和修复。你最终会得到各种可能把事情搞砸的多余标记。
<bold>some <bold></bold> words</bold>
唯一安全的选择是删除所有标记(即使其成为纯文本)并允许用户在编辑器中对其进行修复。