I am encountering an issue with browser compatibility for the HTML editor while using netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect') in Firefox.
In Internet Explorer, all versions have functioning cut, copy, and paste capabilities in the editor.
However, in Mozilla Firefox, these features are only supported up to certain versions and do not work from Firefox 15 onwards. When attempting to right-click, the cut, copy, and paste options are disabled, and even shortcut keys fail to work.
If anyone has knowledge regarding this issue, please provide clarification as soon as possible.
We use the following code snippet to copy selected text:
PasteText.prototype.execute = function()
{
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
if (!clip) {
return;
}
var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
if (!trans) {
return;
}
trans.addDataFlavor('text/unicode');
clip.getData(trans,clip.kGlobalClipboard);
var str = new Object();
var len = new Object();
try {
trans.getTransferData('text/unicode',str,len);
}
catch(error) { return; }
if (str) {
if (Components.interfaces.nsISupportsWString) {
str=str.value.QueryInterface(Components.interfaces.nsISupportsWString);
} else if (Components.interfaces.nsISupportsString) {
str=str.value.QueryInterface(Components.interfaces.nsISupportsString);
} else {
str = null;
}
}
if (str) {
var code = str.data.substring(0,len.value / 2);
}
code = code.replace( /\n/g, '<br/>' ) ;
window.activeEditor._inserthtml( code ) ;
};
Thank you...