Closed warpech closed 9 years ago
I take this one.
This is a bit tricky.
After spending some time I was able to restore focus position and put cursor to the end of the field.
jsoneditor
uses <div contenteditable="true"></div>
instead of inputs, that is why I can't use standard input/textarea api to get/set cursor position, window.getSelection
should be used instead, but it does not work for elements inside shadow dom: http://stackoverflow.com/questions/23882272/contenteditable-in-shadow-dom.
The best way would be to apply changes on blur
instead of mouseup
, but this requires changes inside jsoneditor
.
Anyway, I think that restoring focused element and setting cursor to the end of the text is enough for now.
Let's keep it like this. If someone has a problem with it, they can report a bug. Thanks!
Using
starcounter-debug-aid@a7e1a95
andJuicy/juicy-jsoneditor@91bf34e
In InvoiceDemo, editing
Price#
via starcounter-debug-aid updatesTotal
as expected, but thePrice$
input element gets unfocused after each keystroke.