Fix error copying from note if note Quick Copy format is "HTML"
In this case, Note Markdown wouldn't be preloaded, but it's always used for copying from the note editor, and since the note editor uses `noWait`, this would result in "Code promise is not resolved in noWait mode".
This commit is contained in:
parent
cbb1ebad33
commit
b5ce8b655a
1 changed files with 12 additions and 7 deletions
|
@ -325,14 +325,19 @@ Zotero.QuickCopy = new function() {
|
|||
var _loadNoteOutputFormat = async function () {
|
||||
var format = Zotero.Prefs.get("export.noteQuickCopy.setting");
|
||||
format = Zotero.QuickCopy.unserializeSetting(format);
|
||||
// If virtual "Markdown + Rich Text" translator is selected, preload Note Markdown and
|
||||
// Note HTML translators
|
||||
if (format.id == Zotero.Translators.TRANSLATOR_ID_MARKDOWN_AND_RICH_TEXT) {
|
||||
await _preloadFormat({ mode: 'export', id: Zotero.Translators.TRANSLATOR_ID_NOTE_MARKDOWN, options: format.markdownOptions });
|
||||
await _preloadFormat({ mode: 'export', id: Zotero.Translators.TRANSLATOR_ID_NOTE_HTML, options: format.htmlOptions });
|
||||
return;
|
||||
|
||||
// Always preload Note Markdown and Note HTML translators. They're both needed for note
|
||||
// dragging if the format is "Markdown + Rich Text", HTML is needed for note dragging if
|
||||
// the format is "HTML", and they're both needed for copying or dragging from the note
|
||||
// editor, which uses `noWait`.
|
||||
await _preloadFormat({ mode: 'export', id: Zotero.Translators.TRANSLATOR_ID_NOTE_MARKDOWN });
|
||||
await _preloadFormat({ mode: 'export', id: Zotero.Translators.TRANSLATOR_ID_NOTE_HTML });
|
||||
|
||||
// If there's another format, preload it for note item dragging
|
||||
if (format.id != Zotero.Translators.TRANSLATOR_ID_MARKDOWN_AND_RICH_TEXT
|
||||
&& format.id != Zotero.Translators.TRANSLATOR_ID_NOTE_HTML) {
|
||||
await _preloadFormat(format);
|
||||
}
|
||||
return _preloadFormat(format);
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue