editor: use a class on body to toggle the grid's visibility

This commit is contained in:
jean-emmanuel 2016-12-13 13:20:30 +01:00
parent 2437c07ff4
commit cf8130e589
2 changed files with 12 additions and 8 deletions

View file

@ -122,6 +122,8 @@ module.exports = {
$('.enable-editor').addClass('on')
$('.disable-editor').removeClass('on')
$('body').addClass('editor-enabled')
.toggleClass('no-grid', GRIDWIDTH==1)
EDITING = true
@ -135,6 +137,7 @@ module.exports = {
if (isNaN(v)) return
i.val(v)
GRIDWIDTH = v
$('body').toggleClass('no-grid', GRIDWIDTH==1)
document.documentElement.style.setProperty("--grid-width",GRIDWIDTH)
})
})

View file

@ -291,14 +291,15 @@
// GRID
.editor-enabled {
.tab:not(.has-tabs), .panel {
background-image: linear-gradient(to bottom, var(--color-grid) 1rem, transparent 1rem),
linear-gradient(to right, var(--color-grid) 1rem, transparent 1rem);
--size: calc(var(--grid-width) * calc(var(--grid-width) - 1) / calc(var(--grid-width) - 1) * 1rem);
background-size: var(--size) var(--size);
background-attachment: local;
background-position: -1rem -1rem;
&:not(.no-grid) {
.tab:not(.has-tabs), .panel {
background-image: linear-gradient(to bottom, var(--color-grid) 1rem, transparent 1rem),
linear-gradient(to right, var(--color-grid) 1rem, transparent 1rem);
--size: calc(var(--grid-width) * 1rem);
background-size: var(--size) var(--size);
background-attachment: local;
background-position: -1rem -1rem;
}
}
}