Voog / wysihtml

Open source rich text editor for the modern web

Home Page:http://wysihtml.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IE11, deleting all WYSIHTML content leads to dropping WYSIHTML DOM Element

starlocke opened this issue · comments

I'm using some version 0.5.5 of WYSIHTML.

I haven't fully pinpointed the root cause yet, but in IE11 (not Edge, haven't tested older versions), the WYSIHTML DOM Element for editing can be dropped (read: deleted) when a user presses on DELETE to delete all the content and then the keyboard repeat or another "make sure to get it done" DELETE key press event happens.

Something along the lines of: WYSIHTML content becomes empty, focus shifts elsewhere, IE11 position's the "cursor" atop the WYSIHTML DOM element in some sense, the next DELETE action will delete it.

Has anyone else experienced this?

If it can't be reproduced with vanilla WYSIHTML, then, I'll suppose one of the special "add-on" input adjustment methods I've created is introducing the bug.

I just experienced this myself. Version 0.6.0-beta1, so I guess it's a problem spanning multiple releases.
Whenever the content of the editor is empty in IE11 and you click backspace, the entire editor gets removed.
The toolbar remains, but not the input field.

For whatever it's wroth, I'm using wysihtml on a div, not a textarea.

UPDATE: @pulges
The line to blame is
if (removeOldWrapper) { node.parentNode.removeChild(node); }
in the function transferContentTo: function(targetNode, removeOldWrapper) that's called from fixDeleteInTheBeginningOfControlSelection on line 282 of composer.observe.js.

All of this happens as a result of handleDeleteKeyPress being called when you click Backspace. I don't have time to look more into it just now, but I assume it's not as easy as just removing that line, as that might mess something else up.