剪切,复制和粘贴不适用于Firefox 15单词吗?
我正在将netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect')用于Firefox.
I am using the netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect') for firefox.
我正面临浏览器与编辑器兼容性的问题.我们正在使用HTML EDITOR.
i am facing the problem for browser compatability for editor. we are using HTML EDITOR.
在IE中,所有版本的剪切,复制和粘贴均适用于此编辑器.
In IE all version cut, copy and paste is working for this editor.
在谈到mozilla时,它们仅在某些版本上有效.在Firefox 15上无法正常工作....
when comes to mozilla, these are working only upto some versions only. it is not working in firefox 15 onwords....
当我右键单击时,剪切,复制和粘贴被禁用.即使快捷键也不起作用.
when i right click, the cut, copy and paste are disabled. eventhough shotcut keys are also not working.
有人知道吗?请尽快澄清以上问题.
can any one know this? please clarify above issues ASAP.
我们正在将所选文本用于此副本.这是为此的示例代码:
we are using for this copy the selected text. here is a sample code for this:
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 ) ;
};
谢谢...
我们需要使用about:config不加引号来添加一些特权.
we need to add some privileges using about:config with out quotation.
user_pref("capability.policy.policynames","allowclipboard"); user_pref("capability.policy.allowclipboard.sites"," https://www.mozilla.org "); user_pref("capability.policy.allowclipboard.Clipboard.cutcopy","allAccess"); user_pref("capability.policy.allowclipboard.Clipboard.paste","allAccess");
user_pref("capability.policy.policynames", "allowclipboard"); user_pref("capability.policy.allowclipboard.sites", "https://www.mozilla.org"); user_pref("capability.policy.allowclipboard.Clipboard.cutcopy", "allAccess"); user_pref("capability.policy.allowclipboard.Clipboard.paste", "allAccess");