Revert "Add: save usercss from multi-section editor"
This reverts commit da5626a6d7
.
This commit is contained in:
parent
50a5bbecfa
commit
8007f47c09
|
@ -787,18 +787,10 @@
|
|||
"message": "Enter a name.",
|
||||
"description": "Error displayed when user saves without providing a name"
|
||||
},
|
||||
"stylePasteMozillaFormat": {
|
||||
"message": "The code you pasted looks like mozilla format style. Would you like to import it?",
|
||||
"description": "The confirmation to import mozilla format style from pasted text"
|
||||
},
|
||||
"styleSaveLabel": {
|
||||
"message": "Save",
|
||||
"description": "Label for save button for style editing"
|
||||
},
|
||||
"styleSaveAsUsercss": {
|
||||
"message": "The source code contains usercss metadata. Would you like to save the source code as usercss?",
|
||||
"description": "The confirmation to create usercss from the editor"
|
||||
},
|
||||
"styleSectionsTitle": {
|
||||
"message": "Sections",
|
||||
"description": "Title for the style sections section"
|
||||
|
|
24
edit/edit.js
24
edit/edit.js
|
@ -306,8 +306,7 @@ function setupCodeMirror(textarea, index) {
|
|||
if (
|
||||
text.includes('@-moz-document') &&
|
||||
text.replace(/\/\*[\s\S]*?\*\//g, '')
|
||||
.match(/@-moz-document[\s\r\n]+(url|url-prefix|domain|regexp)\(/) &&
|
||||
confirm(t('stylePasteMozillaFormat'))
|
||||
.match(/@-moz-document[\s\r\n]+(url|url-prefix|domain|regexp)\(/)
|
||||
) {
|
||||
event.preventDefault();
|
||||
fromMozillaFormat();
|
||||
|
@ -1487,28 +1486,7 @@ function save() {
|
|||
editor.save();
|
||||
}
|
||||
|
||||
function isUsercssSourceCode() {
|
||||
const sourceCode = editors[0].getValue();
|
||||
return /==UserStyle==[\s\S]+==\/UserStyle==/i.test(sourceCode);
|
||||
}
|
||||
|
||||
function saveSectionStyle() {
|
||||
if (!styleId && isUsercssSourceCode() && confirm(t('styleSaveAsUsercss'))) {
|
||||
const sourceCode = editors[0].getValue();
|
||||
onBackgroundReady()
|
||||
.then(() => BG.usercssHelper.save({
|
||||
reason: 'editSave',
|
||||
sourceCode,
|
||||
enabled: $('#enabled').checked
|
||||
}))
|
||||
.then(style => {
|
||||
window.onbeforeunload = null;
|
||||
location.href = `/edit.html?id=${style.id}`;
|
||||
})
|
||||
.catch(alert);
|
||||
return;
|
||||
}
|
||||
|
||||
updateLintReportIfEnabled(null, 0);
|
||||
|
||||
// save the contents of the CodeMirror editors back into the textareas
|
||||
|
|
Loading…
Reference in New Issue
Block a user