分享

Extended ExtJS HtmlEditor to handle paste from Microsoft Word and table manipulations

 quasiceo 2015-01-07

Extended ExtJS HtmlEditor to handle paste from Microsoft Word and table manipulations

, 3 Oct 2011 CPOL
   0.00 (No votes)
Sample regular expression set to filter unwanted Microsoft Word paste tags and characters


ContextKnowledge Center Site
NeedAllow for pages with predefined styles to be added
FeatureSupport a template engine in combination with a set of stylesheets
RequirementImplement an editor for manipulating text, images, and tables without interfering with stylesheets' fonts, colors, alignments, and overall structure.
 
There are a number of available WYSIWYG editors, such as CKEditor[^] and TinyMCE[^]. However, with their full spectrum of functionality, they are heavy-weight and detract from the predictability of the content layout. While a much simpler tool is required, it seems uneffective to implement one from scratch.
 
It was decided to use the ExtJS Ext.form.HtmlEditor[^] component as the system already uses the ExtJS framework. But in order for this to work, the component had to be configured correctly and extended to handle:
 
The copy and paste problem turns out to be a little tricky. There are a lot of bits and pieces of information on the web that, when collected, seemed random (and inconsistent):
clean-microsoft-word-pasted-text-using-javascript[^]
JS (Server) removal of MS Word HTML/XML[^]
Cleaning Word's Nasty HTML[^]
MS Word Special Character Scrubber[^]
 
I ended up refining and splitting the set into tag replacement and character replacement sets that work in the Ext HtmlEditor component (and do not interfere with its tags). Maybe somebody will find this information useful.
 
See also:
Introduction to Ranges[^]
Intercepting the Clipboard data on Paste[^]

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多