From 081793f72f65a691484b95adf901b473170c8e1e Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 28 Feb 2018 21:10:55 -0500 Subject: [PATCH] Disable auto_focus for TinyMCE TinyMCE triggers a focus on the window itself, which means that the window steals focus when an attachment is created even if another Zotero window is in front. Instead, do a manual focus in the external note window, which is the one place I could find where we rely on it (though there might be others). --- chrome/content/zotero/bindings/styled-textbox.xml | 6 ++++-- chrome/content/zotero/note.js | 1 + resource/tinymce/note.html | 1 - 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/bindings/styled-textbox.xml b/chrome/content/zotero/bindings/styled-textbox.xml index dcb35ae1e..22c487ea8 100644 --- a/chrome/content/zotero/bindings/styled-textbox.xml +++ b/chrome/content/zotero/bindings/styled-textbox.xml @@ -709,8 +709,10 @@ self.value = self._value; } if (self._focus) { - self._iframe.focus(); - self._editor.focus(); + setTimeout(function () { + self._iframe.focus(); + self._editor.focus(); + }); self._focus = false; } diff --git a/chrome/content/zotero/note.js b/chrome/content/zotero/note.js index 2240e01b5..aa5cd6dc9 100644 --- a/chrome/content/zotero/note.js +++ b/chrome/content/zotero/note.js @@ -70,6 +70,7 @@ async function onLoad() { noteEditor.refresh(); } + noteEditor.focus(); notifierUnregisterID = Zotero.Notifier.registerObserver(NotifyCallback, 'item', 'noteWindow'); } diff --git a/resource/tinymce/note.html b/resource/tinymce/note.html index b62c42ba1..003bbe05e 100644 --- a/resource/tinymce/note.html +++ b/resource/tinymce/note.html @@ -10,7 +10,6 @@ body_id: "zotero-tinymce-note", content_css: "css/note-content.css", - auto_focus: "tinymce", browser_spellcheck: true, convert_urls: false, entity_encoding: 'raw',