Added option to hide toolbar in editor

This commit is contained in:
Djamil Legato
2016-03-02 16:39:54 -08:00
parent f1d61742b8
commit e54db86256
8 changed files with 20 additions and 13 deletions

View File

@@ -107,6 +107,10 @@ export default class EditorField {
textarea.data('codemirror', editor);
textarea.data('toolbar', new Toolbar(textarea));
if (options.toolbar === false) {
textarea.data('toolbar').ui.navigation.addClass('grav-editor-hide-toolbar');
}
editor.on('change', () => editor.save());
}
@@ -131,12 +135,6 @@ export class Toolbar {
<div class="grav-editor-actions"></div>
<div class="grav-editor-modes"></div>
</div>
`,
states: `
<div class="grav-editor-states">
<div class="grav-editor-info"></div>
<div class="grav-editor-modes"></div>
</div>
`
};
}
@@ -146,8 +144,7 @@ export class Toolbar {
this.codemirror = this.editor.data('codemirror');
this.buttons = Buttons.navigation;
this.ui = {
navigation: $(Toolbar.templates().navigation),
states: $(Toolbar.templates().states)
navigation: $(Toolbar.templates().navigation)
};
this.editor.parent('.grav-editor-content')

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -788,6 +788,12 @@ form {
}
}
#admin-main .grav-editor-hide-toolbar + div {
border: 1px solid $form-border;
border-top-right-radius: $border-radius;
border-top-left-radius: $border-radius;
}
.grav-editor-content, .grav-editor-preview {
border: 1px solid $form-border;
border-top: 0;

View File

@@ -77,6 +77,10 @@
}
}
.grav-editor-hide-toolbar {
display: none;
}
.grav-editor-toolbar .grav-editor-modes {
li {
&:first-child a {