actually replace 'usercssTemplate'
This commit is contained in:
parent
9279390e8c
commit
487bc77baa
|
@ -214,25 +214,22 @@ function createSourceEditor(style) {
|
||||||
if (!dirty.isDirty()) {
|
if (!dirty.isDirty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const code = cm.getValue();
|
||||||
return onBackgroundReady()
|
return onBackgroundReady()
|
||||||
.then(() => BG.usercssHelper.save({
|
.then(() => BG.usercssHelper.save({
|
||||||
reason: 'editSave',
|
reason: 'editSave',
|
||||||
id: style.id,
|
id: style.id,
|
||||||
enabled: style.enabled,
|
enabled: style.enabled,
|
||||||
sourceCode: cm.getValue(),
|
sourceCode: code,
|
||||||
}))
|
}))
|
||||||
.then(replaceStyle)
|
.then(replaceStyle)
|
||||||
.then(() => cm.setOption('mode', cm.doc.mode))
|
.then(() => cm.setOption('mode', cm.doc.mode))
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
if (err.message === t('styleMissingMeta', 'name')) {
|
if (err.message === t('styleMissingMeta', 'name')) {
|
||||||
messageBox.confirm(t('usercssReplaceTemplateConfirmation')).then(ok => ok &&
|
messageBox.confirm(t('usercssReplaceTemplateConfirmation')).then(ok => ok &&
|
||||||
BG.chromeSync.setLZValue('usercssTemplate', style.sourceCode)
|
BG.chromeSync.setLZValue('usercssTemplate', code)
|
||||||
.then(() => BG.chromeSync.getLZValue('usercssTemplate'))
|
.then(() => BG.chromeSync.getLZValue('usercssTemplate'))
|
||||||
.then(saved => {
|
.then(saved => saved !== code && messageBox.alert(t('syncStorageErrorSaving'))));
|
||||||
if (saved !== style.sourceCode) {
|
|
||||||
messageBox.alert(t('syncStorageErrorSaving'));
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const contents = Array.isArray(err) ?
|
const contents = Array.isArray(err) ?
|
||||||
|
|
Loading…
Reference in New Issue
Block a user