tiff / wysihtml5

Open source rich text editor based on HTML5 and the progressive-enhancement approach. Uses a sophisticated security concept and aims to generate fully valid HTML5 markup by preventing unmaintainable tag soups and inline styles.
http://xing.github.com/wysihtml5/
MIT License
6.48k stars 995 forks source link

"Un"styling a complete paragraph removes subsequent text. #469

Open BobMabena opened 10 years ago

BobMabena commented 10 years ago

Having the following text in my editor:

Line one

Line 2

Line3

Line 4

When in HTML view, and I try to un-bold Line3, Line 4 completely disappears.

Note: Double clicking on "Line3" causes this issue, however, when using the cursor keys to select the text, the issue DOES NOT happen.

dave-shaw commented 10 years ago

This bug does not occur in Mac/Chrome or Mac/Safari

This bug does occur when using Mac/Firefox 29.0.1 As stated this bug does not occur when using Shift+Arrow keys to select text. This only occurs when double clicking or click+dragging to select the text.

Steps to reproduce: 1) Type a line of text into Firefox WYSIWYG. 2) Type a second line of text into Firefox WYSIWYG 3) Bold both lines of text 4) Now select by double clicking or clicking and dragging ONLY the first line and click 'bold' again to un-bold the first line of text. 5) The second line of text (and any other text after that) will disappear!

This bug also happens with italics and underline in Firefox.

Looking at the Firefox 'Firebug' error console while the text disappears shows the following error: HierarchyRequestError: Node cannot be inserted at the specified point in the hierarchy

The error points to this fuction: function insertAfter(node, precedingNode) { var nextNode = precedingNode.nextSibling, parent = precedingNode.parentNode; if (nextNode) { parent.insertBefore(node, nextNode); } else { parent.appendChild(node); } return node; }