Improved edit mode handling.

Now edit mode is only exited when all editor panels are closed.
This commit is contained in:
WrinklyNinja
2014-07-20 12:58:20 +01:00
parent 95f7e4d90f
commit fb45224650
2 changed files with 24 additions and 12 deletions
+4 -4
View File
@@ -360,16 +360,16 @@ td input {
#pluginsNav .priority {
display: none;
}
#pluginsNav.editMode li:hover .priority {
body.editMode #pluginsNav li:hover .priority {
display: inline;
}
#pluginsNav.editMode li:hover .name {
body.editMode #pluginsNav li:hover .name {
display: none;
}
header.editMode {
body.editMode header {
color: #999;
}
header.editMode #headerOverlay {
body.editMode header #headerOverlay {
z-index: 3;
width: 100%;
height: 100%;
+20 -8
View File
@@ -163,11 +163,15 @@ var pluginCardProto = Object.create(HTMLElement.prototype, {
}
}
/* Disable priority hover in plugins list. */
document.getElementById('pluginsNav').classList.toggle('editMode', false);
/* Disable priority hover in plugins list and enable header
buttons if this is the only editor instance. */
var numEditors = parseInt(document.body.getAttribute('data-editors'), 10);
--numEditors;
/* Enable header buttons. */
document.getElementsByTagName('header')[0].classList.toggle('editMode', false);
if (numEditors == 0) {
document.body.classList.remove('editMode');
}
document.body.setAttribute('data-editors', numEditors);
/* Hide editor. */
card.classList.toggle('flip');
@@ -204,10 +208,18 @@ var pluginCardProto = Object.create(HTMLElement.prototype, {
}
}
/* Enable priority hover in plugins list. */
document.getElementById('pluginsNav').classList.toggle('editMode', true);
/* Disable header buttons. */
document.getElementsByTagName('header')[0].classList.toggle('editMode', true);
/* Enable priority hover in plugins list and enable header
buttons if this is the only editor instance. */
var numEditors = 0;
if (document.body.hasAttribute('data-editors')) {
numEditors = parseInt(document.body.getAttribute('data-editors'), 10);
}
++numEditors;
if (numEditors == 1) {
document.body.classList.add('editMode');
}
document.body.setAttribute('data-editors', numEditors);
/* Now show editor. */
this.classList.toggle('flip');