fx115: replace text/unicode with text/plain in clipboard code (#3945)
This commit is contained in:
parent
8b37a9889a
commit
49923780ca
4 changed files with 11 additions and 11 deletions
|
@ -279,8 +279,8 @@ var Zotero_File_Interface = new function() {
|
|||
let str = Components.classes['@mozilla.org/supports-string;1']
|
||||
.createInstance(Components.interfaces.nsISupportsString);
|
||||
str.data = text;
|
||||
transferable.addDataFlavor('text/unicode');
|
||||
transferable.setTransferData('text/unicode', str, text.length * 2);
|
||||
transferable.addDataFlavor('text/plain');
|
||||
transferable.setTransferData('text/plain', str, text.length * 2);
|
||||
|
||||
// Add HTML
|
||||
str = Components.classes['@mozilla.org/supports-string;1']
|
||||
|
@ -502,7 +502,7 @@ var Zotero_File_Interface = new function() {
|
|||
* Imports from clipboard
|
||||
*/
|
||||
this.importFromClipboard = Zotero.Promise.coroutine(function* () {
|
||||
var str = Zotero.Utilities.Internal.getClipboard("text/unicode");
|
||||
var str = Zotero.Utilities.Internal.getClipboard("text/plain");
|
||||
if(!str) {
|
||||
var ps = Services.prompt;
|
||||
ps.alert(
|
||||
|
@ -823,8 +823,8 @@ var Zotero_File_Interface = new function() {
|
|||
var str = Components.classes["@mozilla.org/supports-string;1"].
|
||||
createInstance(Components.interfaces.nsISupportsString);
|
||||
str.data = output;
|
||||
transferable.addDataFlavor("text/unicode");
|
||||
transferable.setTransferData("text/unicode", str, output.length * 2);
|
||||
transferable.addDataFlavor("text/plain");
|
||||
transferable.setTransferData("text/plain", str, output.length * 2);
|
||||
|
||||
clipboardService.setData(transferable, null, Components.interfaces.nsIClipboard.kGlobalClipboard);
|
||||
|
||||
|
|
|
@ -2101,7 +2101,7 @@ var Zotero_QuickFormat = new function () {
|
|||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
||||
var str = Zotero.Utilities.Internal.getClipboard("text/unicode");
|
||||
var str = Zotero.Utilities.Internal.getClipboard("text/plain");
|
||||
if (str) {
|
||||
isPaste = true;
|
||||
this.value += str.replace(/[\r\n]/g, " ").trim();
|
||||
|
|
|
@ -2354,7 +2354,7 @@ Zotero.Utilities.Internal = {
|
|||
let targetInput = targetInputWeak.deref();
|
||||
if (!targetInput) return;
|
||||
targetInput.focus();
|
||||
targetInput.value = Zotero.Utilities.Internal.getClipboard('text/unicode') || '';
|
||||
targetInput.value = Zotero.Utilities.Internal.getClipboard('text/plain') || '';
|
||||
targetInput.dispatchEvent(new Event('input'));
|
||||
});
|
||||
editMenuItems.push(pasteMenuitem);
|
||||
|
|
|
@ -156,7 +156,7 @@ describe("Zotero_File_Interface", function() {
|
|||
assert.equal(str, '(<i>A</i>, 2016; <i>B</i>, 2016)');
|
||||
|
||||
// Plain text
|
||||
str = getDataForFlavor('text/unicode');
|
||||
str = getDataForFlavor('text/plain');
|
||||
assert.equal(str, '(A, 2016; B, 2016)');
|
||||
});
|
||||
|
||||
|
@ -173,7 +173,7 @@ describe("Zotero_File_Interface", function() {
|
|||
assert.include(str, '<i>B</i>');
|
||||
|
||||
// Plain text
|
||||
str = getDataForFlavor('text/unicode');
|
||||
str = getDataForFlavor('text/plain');
|
||||
assert.equal(str, 'A. (2016).\nB. (2016).\n');
|
||||
});
|
||||
|
||||
|
@ -193,7 +193,7 @@ describe("Zotero_File_Interface", function() {
|
|||
assert.equal(str, '(<i>A</i>, 2016; <i>B</i>, 2016)');
|
||||
|
||||
// Plain text
|
||||
str = getDataForFlavor('text/unicode');
|
||||
str = getDataForFlavor('text/plain');
|
||||
assert.equal(str, '(<i>A</i>, 2016; <i>B</i>, 2016)');
|
||||
});
|
||||
|
||||
|
@ -211,7 +211,7 @@ describe("Zotero_File_Interface", function() {
|
|||
assert.include(str, '<i>B</i>');
|
||||
|
||||
// Plain text
|
||||
str = getDataForFlavor('text/unicode');
|
||||
str = getDataForFlavor('text/plain');
|
||||
assert.include(str, 'line-height');
|
||||
assert.include(str, '<i>A</i>');
|
||||
assert.include(str, '<i>B</i>');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue