Preserve formatting on Hide/Show editor

This commit is contained in:
fbennett 2017-01-05 09:57:37 +09:00 committed by Dan Stillman
parent 2538e258b6
commit 4d8d4bcdbc

View file

@ -41,6 +41,7 @@ var Zotero_Citation_Dialog = new function () {
var _previewShown = false;
var _suppressNextTreeSelect = false;
var _suppressNextListSelect = false;
var _customHTML = false;
var _locatorIndexArray = {};
var _locatorNameArray = {};
var _autoRegeneratePref;
@ -556,6 +557,9 @@ var Zotero_Citation_Dialog = new function () {
if(_previewShown) {
document.documentElement.getButton("extra2").label = Zotero.getString("citation.hideEditor");
if (!text && _customHTML) {
text = _customHTML;
}
if(text) {
io.preview().then(function(preview) {
_originalHTML = preview;
@ -565,6 +569,11 @@ var Zotero_Citation_Dialog = new function () {
_updatePreview();
}
} else {
if (editor.initialized) {
if (editor.value) {
_customHTML = editor.value;
}
}
document.documentElement.getButton("extra2").label = Zotero.getString("citation.showEditor");
}
}
@ -795,4 +804,4 @@ var Zotero_Citation_Dialog = new function () {
function _clearCitationList() {
while(_citationList.firstChild) _citationList.removeChild(_citationList.firstChild);
}
}
}