From 1eb9718b6bf58b102d54f578dd97d0624585b309 Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Tue, 28 Jun 2022 15:12:57 -0400 Subject: [PATCH] Style editor: Light theme, leave selection if unchanged Since onStyleModified() is called when a style is loaded. --- chrome/content/zotero/tools/csledit.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/tools/csledit.js b/chrome/content/zotero/tools/csledit.js index 42f7250505..6547de9ba1 100644 --- a/chrome/content/zotero/tools/csledit.js +++ b/chrome/content/zotero/tools/csledit.js @@ -65,7 +65,10 @@ var Zotero_CSL_Editor = new function() { pageList.selectedIndex = 0; let editorWin = document.getElementById("zotero-csl-editor-iframe").contentWindow; - let { monaco: _monaco, editor: _editor } = await editorWin.loadMonaco({ language: 'xml' }); + let { monaco: _monaco, editor: _editor } = await editorWin.loadMonaco({ + language: 'xml', + theme: 'vs-light' + }); monaco = _monaco; editor = _editor; @@ -144,8 +147,12 @@ var Zotero_CSL_Editor = new function() { return styleObject; } - this.onStyleModified = function(str) { - document.getElementById('zotero-csl-list').selectedIndex = -1; + this.onStyleModified = function () { + let xml = editor.getValue(); + let cslList = document.getElementById('zotero-csl-list'); + if (xml !== Zotero.Styles.get(cslList.value)?.getXML()) { + cslList.selectedIndex = -1; + } let styleObject = this.loadStyleFromEditor();