Convert contenteditable div's content to plaintext via javascript
I'm trying to make custom lightweight rich text editor with just one
feature - adding links. I did some research and desided iframe is the best
choice. After some messing around it works with one exception - I need to
run some code on keyup event. I read everything I found on the internet
and nothing helped, still doesn't work...
iframe.document.designMode = 'On';
iframe.document.open();
iframe.document.write(someHTML);
iframe.document.close();
var keyupHandle = function() { /* some code */ };
var iframeDoc = document.getElementById('iframe').contentWindow.document;
if(iframeDoc.addEventListener) {
iframeDoc.addEventListener('keyup', keyupHandle(), true);
} else {
iframeDoc.attachEvent('onkeyup', keyupHandle());
}
No comments:
Post a Comment