For editing extended text, I have a UIWebView where I load local html content with some contenteditable div. When the user presses some keys on the keyboard, I want to detect changes in the content inside this div, resize it accordingly and scroll to position the cursor over the keyboard.
I can do this with the onkeyup event onkeyup :
<div id="contents" onkeyup="keyup()" onpaste="paste()" contenteditable="true">...</div>
The iOS 8 keyboard now has a Quicktype panel with some tips for quickly pasting into an editable area. How to determine the effect of inserting sentence text in a div?
An event handler such as onkeyup does not help when inserting text without pressing the keyboard keys; the onpaste event onpaste not raised. I also tried to implement MutationObserver to detect DOM changes when something is inserted - also does not help.
I am struggling to find a working solution. Any advice is appreciated. Thanks!
source share