The RTE component in AEM has mainly two paste modes (wordhtml and plaintext). Plain text mode scraps all the mark-up as the mode name suggests. While “wordhtml” keeps the markups and works well for most of the tags. But when authors copy any list (ordered / unordered) from Microsoft Word document ( Desktop application ) and try to paste in RTE directly, it doesn’t paste it well. It creates individual <p> tags with dot (.) and 6 span tags instead of ul or ol as shown below.
Solution:
To resolve this, the JavaScript of the OOTB EditToolsPlugin was customized -:
Create a custom clientlibs for the RTE, applying it specifically to the RTE component.
Override the EditToolsPlugin.js to intercept the paste operation, clean MS Word formatting, and convert the list to proper <ul> or <ol> tags while preserving other styles (bold, italics, etc.).
Configure default paste mode as "wordhtml" for consistent handling of Word content.
Optional toolbar customization to enable the "paste as wordhtml" option