adblock-filter-analyzer icon indicating copy to clipboard operation
adblock-filter-analyzer copied to clipboard

hitting enter then typing types in the old spot - bad cursor position when hitting enter

Open RedDragonWebDesign opened this issue 5 years ago • 4 comments

RedDragonWebDesign avatar Jul 02 '20 17:07 RedDragonWebDesign

Have you considered a parser like jquery's $(selector).text() instead of innerHTML? It strips tags. Using that might save the headache of trying to count how many tags you inserted or removed... it would just give the text content as opposed to the length of the HTML.

RedDragonWebDesign avatar Jul 14 '20 07:07 RedDragonWebDesign

Can potentially solve this by using document.execCommand(hiliteColor, ??, "Orange"), instead of converting to string then adding spans

RedDragonWebDesign avatar Jul 14 '20 13:07 RedDragonWebDesign

Try some of the ideas from Stack Overflow bounty

https://stackoverflow.com/questions/62705449/fix-cursor-position-when-replacing-innerhtml-of-div-contenteditable-true

RedDragonWebDesign avatar Jul 15 '20 09:07 RedDragonWebDesign

This recent StackOverflow answer looks promising: https://stackoverflow.com/a/78955367/3480193

RedDragonWebDesign avatar Sep 09 '24 04:09 RedDragonWebDesign