For rich text editing I have a UIWebView where I load a local html content with some contenteditable
div.
When user is pressing some keys on keyboard I want to detect content changes within that div, resize it accordingly and scroll properly to position cursor above the keyboard.
I'm able to do this using onkeyup
event handler:
<div id="contents" onkeyup="keyup()" onpaste="paste()" contenteditable="true">...</div>
In iOS 8 keyboard now has the Quicktype panel with some suggestion words to quickly paste into editable area. How to detect the action of pasting the suggestion text into div?
Event handler like onkeyup
doesn't help as the text is pasted without pressing keyboard buttons, onpaste
event is not get called.
I also tried to implement MutationObserver to detect DOM changes when something is pasted - doesn't help too.
I'm struggling trying to find the working solution. Any advice is appreciated. Thanks!
In Mobile Safari the iOS 8 Quicktype words fire two (maybe identical?) input
events.
Try this in the developer console:
$('input[type=text]').on("input", console.log.bind(console, "input!"));
In UIWebView I have not tried...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With