don't preview unsaved styles
This commit is contained in:
parent
bb34538da0
commit
9affcd13bc
|
@ -540,6 +540,17 @@ onDOMscriptReady('/codemirror.js').then(() => {
|
||||||
setTimeout(setupLivePreview);
|
setTimeout(setupLivePreview);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!styleId) {
|
||||||
|
new MutationObserver((_, observer) => {
|
||||||
|
if (!styleId) return;
|
||||||
|
observer.disconnect();
|
||||||
|
setupLivePreview();
|
||||||
|
}).observe($('#preview-label'), {
|
||||||
|
attributes: true,
|
||||||
|
attributeFilter: ['class'],
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
$('#editor.livePreview').onchange = function () {
|
$('#editor.livePreview').onchange = function () {
|
||||||
const previewing = this.checked;
|
const previewing = this.checked;
|
||||||
editors.forEach(cm => cm[previewing ? 'on' : 'off']('changes', updatePreview));
|
editors.forEach(cm => cm[previewing ? 'on' : 'off']('changes', updatePreview));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user