Fix csledit

Closes #1149

(There's an additional change in #1149, but as far as I can tell it's
not necessary for csledit.xul.)
This commit is contained in:
Dan Stillman 2017-02-03 00:53:43 -05:00
parent 3a2fb2938d
commit a57ea28d42
2 changed files with 5 additions and 2 deletions

View File

@ -35,7 +35,7 @@ var Zotero_CSL_Editor = new function() {
var lastStyle = Zotero.Prefs.get('export.lastStyle'); var lastStyle = Zotero.Prefs.get('export.lastStyle');
var styles = Zotero.Styles.getAll(); var styles = Zotero.Styles.getVisible();
var currentStyle = null; var currentStyle = null;
for (let style of styles) { for (let style of styles) {
if (style.source) { if (style.source) {
@ -119,7 +119,7 @@ var Zotero_CSL_Editor = new function() {
function loadCSL(cslID) { function loadCSL(cslID) {
var editor = document.getElementById('zotero-csl-editor'); var editor = document.getElementById('zotero-csl-editor');
var style = Zotero.Styles.get(cslID); var style = Zotero.Styles.get(cslID);
editor.value = Zotero.File.getContents(style.file); editor.value = style.getXML();
editor.cslID = cslID; editor.cslID = cslID;
editor.doCommand(); editor.doCommand();
document.getElementById('zotero-csl-list').value = cslID; document.getElementById('zotero-csl-list').value = cslID;

View File

@ -595,6 +595,9 @@ Zotero.Style = function (style, path) {
this.path = path; this.path = path;
this.fileName = OS.Path.basename(path); this.fileName = OS.Path.basename(path);
} }
else {
this.string = style;
}
this.styleID = Zotero.Utilities.xpathText(doc, '/csl:style/csl:info[1]/csl:id[1]', this.styleID = Zotero.Utilities.xpathText(doc, '/csl:style/csl:info[1]/csl:id[1]',
Zotero.Styles.ns); Zotero.Styles.ns);