Skip to content

Commit

Permalink
Fix fullscreen editor (#1093)
Browse files Browse the repository at this point in the history
  • Loading branch information
david-szabo97 authored and rhukster committed Apr 28, 2017
1 parent e1f0786 commit bc0bf6b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
9 changes: 5 additions & 4 deletions themes/grav/app/forms/fields/editor/buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,10 @@ export default {
let previewContainer = textarea.data('grav-editor-preview-container');
let content = textarea.parent('.grav-editor-content');

content.css('display', 'block');
content.addClass('is-active');
ui.navigation.find('.grav-editor-actions').css('visibility', 'visible');
if (previewContainer) {
previewContainer.css('display', 'none');
previewContainer.removeClass('is-active');
}
});
}
Expand Down Expand Up @@ -338,8 +338,9 @@ export default {
textarea.data('grav-editor-preview-container', previewContainer);
}

previewContainer.css({ height: content.height(), display: 'block' });
content.css('display', 'none');
previewContainer.css({ height: content.height() });
previewContainer.addClass('is-active');
content.removeClass('is-active');
ui.navigation.find('.grav-editor-actions').css('visibility', 'hidden');

let url = `${textarea.data('grav-urlpreview')}/task${config.param_sep}processmarkdown`;
Expand Down
9 changes: 9 additions & 0 deletions themes/grav/scss/template/_editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@
.grav-editor-resizer {
display: none;
}

.grav-editor-content.is-active {
display: flex;
}
}

.grav-editor-toolbar {
Expand Down Expand Up @@ -146,6 +150,11 @@
.grav-editor-content, .grav-editor-preview {
@include clearfix;
cursor: text;
display: none;

&.is-active {
display: block;
}
}

.grav-editor-content {
Expand Down
2 changes: 1 addition & 1 deletion themes/grav/templates/forms/fields/editor/editor.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{% block field %}
<div class="form-field {{ field.classes|default('') }}">
<div class="form-data grav-editor">
<div class="grav-editor-content">
<div class="grav-editor-content is-active">
<textarea
data-grav-editor="{{ {'codemirror': codemirrorOptions} | json_encode|e('html_attr') }}"
data-grav-editor-mode="editor"
Expand Down

0 comments on commit bc0bf6b

Please sign in to comment.