Minor tweaks
This commit is contained in:
parent
511b32b6e9
commit
ebacb7c5e6
28
edit.js
28
edit.js
|
@ -100,7 +100,12 @@ function setCleanItem(node, isClean) {
|
||||||
function isCleanGlobal() {
|
function isCleanGlobal() {
|
||||||
var clean = Object.keys(dirty).length == 0;
|
var clean = Object.keys(dirty).length == 0;
|
||||||
setDirtyClass(document.body, !clean);
|
setDirtyClass(document.body, !clean);
|
||||||
document.getElementById("save-button").disabled = clean;
|
var saveBtn = document.getElementById("save-button")
|
||||||
|
if (clean){
|
||||||
|
//saveBtn.removeAttribute('disabled');
|
||||||
|
}else{
|
||||||
|
//saveBtn.setAttribute('disabled', true);
|
||||||
|
}
|
||||||
return clean;
|
return clean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,17 +216,17 @@ function initCodeMirror() {
|
||||||
// user option values
|
// user option values
|
||||||
CM.getOption = function (o) {
|
CM.getOption = function (o) {
|
||||||
return CodeMirror.defaults[o];
|
return CodeMirror.defaults[o];
|
||||||
}
|
};
|
||||||
CM.setOption = function (o, v) {
|
CM.setOption = function (o, v) {
|
||||||
CodeMirror.defaults[o] = v;
|
CodeMirror.defaults[o] = v;
|
||||||
editors.forEach(function(editor) {
|
editors.forEach(function(editor) {
|
||||||
editor.setOption(o, v);
|
editor.setOption(o, v);
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
CM.prototype.getSection = function() {
|
CM.prototype.getSection = function() {
|
||||||
return this.display.wrapper.parentNode;
|
return this.display.wrapper.parentNode;
|
||||||
}
|
};
|
||||||
|
|
||||||
// preload the theme so that CodeMirror can calculate its metrics in DOMContentLoaded->setupLivePrefs()
|
// preload the theme so that CodeMirror can calculate its metrics in DOMContentLoaded->setupLivePrefs()
|
||||||
var theme = prefs.get("editor.theme");
|
var theme = prefs.get("editor.theme");
|
||||||
|
@ -435,7 +440,7 @@ window.onbeforeunload = function() {
|
||||||
}
|
}
|
||||||
updateLintReport(null, 0);
|
updateLintReport(null, 0);
|
||||||
return confirm(t('styleChangesNotSaved'));
|
return confirm(t('styleChangesNotSaved'));
|
||||||
}
|
};
|
||||||
|
|
||||||
function addAppliesTo(list, name, value) {
|
function addAppliesTo(list, name, value) {
|
||||||
var showingEverything = list.querySelector(".applies-to-everything") != null;
|
var showingEverything = list.querySelector(".applies-to-everything") != null;
|
||||||
|
@ -528,7 +533,11 @@ function removeSection(event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeAreaAndSetDirty(area) {
|
function removeAreaAndSetDirty(area) {
|
||||||
area.querySelectorAll('.style-contributor').some(function(node) {
|
var contributors = area.querySelectorAll('.style-contributor');
|
||||||
|
if(!contributors.length){
|
||||||
|
setCleanItem(area, false);
|
||||||
|
}
|
||||||
|
contributors.some(function(node) {
|
||||||
if (node.savedValue) {
|
if (node.savedValue) {
|
||||||
// it's a saved section, so make it dirty and stop the enumeration
|
// it's a saved section, so make it dirty and stop the enumeration
|
||||||
setCleanItem(area, false);
|
setCleanItem(area, false);
|
||||||
|
@ -561,7 +570,7 @@ function setupGlobalSearch() {
|
||||||
findNext: CodeMirror.commands.findNext,
|
findNext: CodeMirror.commands.findNext,
|
||||||
findPrev: CodeMirror.commands.findPrev,
|
findPrev: CodeMirror.commands.findPrev,
|
||||||
replace: CodeMirror.commands.replace
|
replace: CodeMirror.commands.replace
|
||||||
}
|
};
|
||||||
var originalOpenDialog = CodeMirror.prototype.openDialog;
|
var originalOpenDialog = CodeMirror.prototype.openDialog;
|
||||||
var originalOpenConfirm = CodeMirror.prototype.openConfirm;
|
var originalOpenConfirm = CodeMirror.prototype.openConfirm;
|
||||||
|
|
||||||
|
@ -1616,12 +1625,13 @@ function getParams() {
|
||||||
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
|
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
|
||||||
switch (request.method) {
|
switch (request.method) {
|
||||||
case "styleUpdated":
|
case "styleUpdated":
|
||||||
if (styleId && styleId == request.style.id) {
|
if (styleId && styleId == request.id) {
|
||||||
initWithStyle(request.style);
|
initWithStyle(request.style);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "styleDeleted":
|
case "styleDeleted":
|
||||||
if (styleId && styleId == request.style.id) {
|
if (styleId && styleId == request.id) {
|
||||||
|
window.onbeforeunload = function() {};
|
||||||
window.close();
|
window.close();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user