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 ?
Re: how to dispatchEvent ?
Re: how to dispatchEvent ?
Re: how to dispatchEvent ?
viewtopic.php?p=59078#p59078