diff --git a/chrome/content/zotero/fileInterface.js b/chrome/content/zotero/fileInterface.js index 2b2b484c95..acbcd111f6 100644 --- a/chrome/content/zotero/fileInterface.js +++ b/chrome/content/zotero/fileInterface.js @@ -123,6 +123,9 @@ Zotero_File_Exporter.prototype.save = async function () { } async function _exportDone(obj, worked) { + // Close the items exported indicator + Zotero_File_Interface.Progress.close(); + if (!worked) { Zotero.alert( null, @@ -132,27 +135,9 @@ Zotero_File_Exporter.prototype.save = async function () { Zotero_File_Interface.Progress.close(); return; } - - // For Note Markdown translator replace zotero:// URI scheme, - // if the current app is not Zotero - if (io.selectedTranslator.translatorID == '154c2785-ec83-4c27-8a8a-d27b3a2eded1' - && ZOTERO_CONFIG.ID != 'zotero') { - let text = obj.string; - text = text.replace(/zotero:\/\//g, ZOTERO_CONFIG.ID + '://'); - await Zotero.File.putContentsAsync(fp.file, text); - } - - // Close the items exported indicator - Zotero_File_Interface.Progress.close(); } - // Post process and save translator output in _exportDone, if using - // Note Markdown translator and the current app is not Zotero. - // For other translators setLocation is better because it uses streaming - if (!(io.selectedTranslator.translatorID == '154c2785-ec83-4c27-8a8a-d27b3a2eded1' - && ZOTERO_CONFIG.ID != 'zotero')) { - translation.setLocation(Zotero.File.pathToFile(fp.file)); - } + translation.setLocation(Zotero.File.pathToFile(fp.file)); translation.setTranslator(io.selectedTranslator); translation.setDisplayOptions(io.displayOptions); translation.setHandler("itemDone", function () { diff --git a/chrome/content/zotero/xpcom/translation/translate_firefox.js b/chrome/content/zotero/xpcom/translation/translate_firefox.js index 00160e28ef..2a55aa5eb8 100644 --- a/chrome/content/zotero/xpcom/translation/translate_firefox.js +++ b/chrome/content/zotero/xpcom/translation/translate_firefox.js @@ -809,9 +809,20 @@ Zotero.Translate.IO.Write.prototype = { this._charset = charset; }, + /** + * Set a function to modify data on each write() + */ + setDataProcessor: function (processor) { + this._processor = processor; + }, + "write":function(data) { if(!this._charset) this.setCharacterSet("UTF-8"); + if (this._processor) { + data = this._processor(data); + } + if(!this._writtenToStream && this._charset.substr(this._charset.length-4) == "xBOM" && BOMs[this._charset.substr(0, this._charset.length-4).toUpperCase()]) { // If stream has not yet been written to, and a UTF type has been selected, write BOM