Hi, we have upgraded Infragisic WebHtmlEditor Control from 11.1 to 15.2. We are facing problem while copying from MS Word to the control. We are losing some text and bullets if we are copying from MS Word having some styles like paragrphs and bullets. We are using IE11 browser. This issue does not occur with chrome. Please let me know how to fix this issue. Thanks in advance.
Hello Teena,Thank you for posting in our community!
We had several IE11 specific reports regarding how this browser handles Word formatting after pasting and deleting. These can include excess empty lines, misaligned bullets, etc and could be caused either by improper formatting in Word itself (in the case of distorted/style bullets) as well because of the IE default handling (empty lines).
For example in the case of excess empty lines to produce <p> tag be default on empty content (happens on start and when everything is deleted) and the same behavior can be reproduced with no controls whatsoever - try the steps here: https://jsfiddle.net/wru17eL6/ Since <p> tags cannot contain themselves (what gets pasted are more <p>-s) the DOM breaks them down and you get more lines than before.
The browser would provide a placeholder html container when executing delete on the entire content. Most browsers will provide "<div><br></div>" while IE will do the same but with paragraphs instead. This means the placeholder becomes the default input focus and pasting rich content inside the paragraph causes the html engine to begin fixing tags as the <p> can only contain phrasing elements, thus the first pasted DIV breaks the validity and starts closing (producing "<p><br></p><p class="original" for most) and essentially creating a new paragraph before almost every original in the pasted content. Thus plenty of new lines. There's no way to modify such content with event handling without affecting the default undo/redo stack or changing default browser behavior others might rely on. Two possible workarounds – one is removing the extra content similar to https://es.infragistics.com/community/forums/f/ultimate-ui-for-asp-net/68038/webhtmleditor---required-field-validator (breaking undo/redo) or using “DefaultParagraphSeparator” command that will not break undo/redo but is only available since IE11.
Pasting lists has being tested across multiple samples (the one with 15.2 attached, live 16.1 sample and a simple JSfiddle with no controls ) – and I cannot reproduce the issue in either Chrome, Opera or Edge. So far it seems the only way to get such behavior is IE11 and it also requires the initial Word source to be miss-formatted as well. I’m attaching a Word doc I used for testing with 3 versions of the bullets – of which the top is Copied text and formatted but the unordered bullets I formatted as separate lists as well as the numbered lists are formatted separately. The second one I manually typed as a list (tab for hierarchy) and changed the child list to number after. First one (guessing that is the customer issue) produces 4 separate standalone lists (which considering the way the source is formatted is actually correct output) but since the ordered lists are outside the other list there is no padding. The second manually typed version correctly outputs ordered lists nested in another list so they gain proper padding. See screenshots. NOTE: The above is valid not just for our editor, but IE11 in general (try with fiddle) because there’s a special handling for pasted content: See “Pasting Lists as HTML Lists” section in this blog - https://blogs.msdn.microsoft.com/ie/2013/10/24/enhanced-rich-editing-experiences-in-ie11/ - Currently IE11 is the only browser to convert Word formatting into “proper” HTML and will probably be the only one ever, since that feature has been removed in Edge.