Style editor: Light theme, leave selection if unchanged

Since onStyleModified() is called when a style is loaded.
This commit is contained in:
Abe Jellinek 2022-06-28 15:12:57 -04:00
parent 9c837b3361
commit 1eb9718b6b

View file

@ -65,7 +65,10 @@ var Zotero_CSL_Editor = new function() {
pageList.selectedIndex = 0; pageList.selectedIndex = 0;
let editorWin = document.getElementById("zotero-csl-editor-iframe").contentWindow; 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; monaco = _monaco;
editor = _editor; editor = _editor;
@ -144,8 +147,12 @@ var Zotero_CSL_Editor = new function() {
return styleObject; return styleObject;
} }
this.onStyleModified = function(str) { this.onStyleModified = function () {
document.getElementById('zotero-csl-list').selectedIndex = -1; 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(); let styleObject = this.loadStyleFromEditor();