hi,
I'm trying to dispatch newly created event. it doesn't show error but newly added event doesn't input new code in editor window. I think there is something wrong in dispatching event.
This code works in FCKEditor 2.4.x
I'm trying to dispatch newly created event. it doesn't show error but newly added event doesn't input new code in editor window. I think there is something wrong in dispatching event.
var newEvent = document.createEvent("KeyEvents"); newEvent.initKeyEvent("keypress", true, true, window,false, false, false, false, 0, codes[whichChar]); console.log(charCode + ' = ' + whichChar + ' ' + newKey + ' ' + txt); e.data.preventDefault(); var x = document.getElementById('editor2'); x.dispatchEvent(newEvent);
This code works in FCKEditor 2.4.x
var newEvent = null; try { var newEvent = document.createEvent("KeyEvents"); newEvent.initKeyEvent("keypress", true, true, window,false, false, false, false, 0, codes[whichChar]); } catch(ex) { newEvent = document.createEvent("KeyboardEvents"); newEvent.initKeyEvent('keypress', false, true, window, false, false, false, false, codes[whichChar], 0); } e.preventDefault(); e.target.dispatchEvent(newEvent);
Re: how to dispatchEvent ?
anyone ? need urgent ..
Re: how to dispatchEvent ?
Check this: viewtopic.php?p=59078#p59078
I didn't had to change that part of code to make it work, so your problem might be elsewhere.
Re: how to dispatchEvent ?
So this is working ? I will try this
Re: how to dispatchEvent ?
It is indeed working great.
viewtopic.php?p=59078#p59078