Fix: toggle style outside of the editor
This commit is contained in:
parent
9770523660
commit
96a046f774
|
@ -1909,7 +1909,8 @@ function getParams() {
|
|||
chrome.runtime.onMessage.addListener(onRuntimeMessage);
|
||||
|
||||
function replaceStyle(request) {
|
||||
if (!isClean() && !confirm(t('styleUpdateDiscardChanges'))) {
|
||||
const codeIsUpdated = request.codeIsUpdated !== false;
|
||||
if (!isClean() && (!codeIsUpdated || !confirm(t('styleUpdateDiscardChanges')))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1918,11 +1919,7 @@ function replaceStyle(request) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (request.codeIsUpdated === false) {
|
||||
editor.updateStyleMeta(request.style);
|
||||
} else {
|
||||
editor.replaceStyle(request.style);
|
||||
}
|
||||
editor.replaceStyle(request.style, codeIsUpdated);
|
||||
}
|
||||
|
||||
function onRuntimeMessage(request) {
|
||||
|
|
|
@ -609,11 +609,6 @@ ${section}
|
|||
dirty.clear();
|
||||
}
|
||||
|
||||
function updateStyleMeta(newStyle) {
|
||||
dirty.modify('enabled', style.enabled, newStyle.enabled);
|
||||
style.enabled = newStyle.enabled;
|
||||
}
|
||||
|
||||
function toggleStyle() {
|
||||
const value = !style.enabled;
|
||||
dirty.modify('enabled', style.enabled, value);
|
||||
|
@ -645,7 +640,6 @@ ${section}
|
|||
replaceStyle,
|
||||
save,
|
||||
toggleStyle,
|
||||
updateStyleMeta,
|
||||
isDirty: dirty.isDirty,
|
||||
getStyle: () => style
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user