Fix editor sizing

This commit is contained in:
Giuseppe Criscione 2022-12-05 23:58:29 +01:00
parent 815f3122aa
commit 3a867f528b
11 changed files with 28 additions and 14 deletions

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

@ -3,9 +3,12 @@ import Modals from '../modals';
import Utils from '../utils';
import 'codemirror/mode/markdown/markdown.js';
import 'codemirror/addon/display/placeholder.js';
import 'codemirror/addon/edit/continuelist.js';
export default function Editor(textarea) {
var height = textarea.offsetHeight;
var editor = CodeMirror.fromTextArea(textarea, {
mode: {
name: 'markdown',
@ -30,6 +33,8 @@ export default function Editor(textarea) {
var activeLines = [];
editor.getWrapperElement().style.height = height + 'px';
$('[data-command=bold]', toolbar).addEventListener('click', function () {
insertAtCursor('**');
});

View File

@ -80,9 +80,8 @@ select {
textarea {
overflow: auto;
height: 4 * $input-line-height * $input-font-size + $input-padding-v * 2;
min-height: 2 * $input-font-size * $input-line-height + $input-padding-v * 2;
max-height: 12 * $input-font-size * $input-line-height + $input-padding-v * 2;
min-height: 3 * $input-font-size * $input-line-height + $input-padding-v * 2;
max-height: 30 * $input-font-size * $input-line-height + $input-padding-v * 2;
resize: vertical;
@extend input;
}

View File

@ -29,7 +29,8 @@
}
.editor-textarea {
min-height: 15 * $font-size-m * $base-line-height + $editor-textarea-padding-v * 2;
min-height: 3 * $font-size-m * $base-line-height + $editor-textarea-padding-v * 2;
max-height: 30 * $font-size-m * $base-line-height + $editor-textarea-padding-v * 2;
padding: $editor-textarea-padding-v $editor-textarea-padding-h;
border: $input-border-width solid $color-base-500;
border-radius: $input-border-radius;
@ -42,7 +43,8 @@
}
.CodeMirror {
min-height: 15 * $font-size-m * $base-line-height + $editor-textarea-padding-v * 2;
min-height: 3 * $font-size-m * $base-line-height + $editor-textarea-padding-v * 2;
max-height: 30 * $font-size-m * $base-line-height + $editor-textarea-padding-v * 2;
padding: 0 $editor-textarea-padding-h;
border: $input-border-width solid $color-base-500;
border-radius: $input-border-radius;
@ -51,6 +53,11 @@
color: $color-base-100;
font-family: $base-font-family;
font-size: $font-size-m;
resize: vertical;
}
.CodeMirror-wrap pre.CodeMirror-line-like.CodeMirror-placeholder {
color: $color-base-300;
}
.CodeMirror-lines {

View File

@ -18,13 +18,11 @@
'class' => 'editor-textarea',
'id' => $field->name(),
'name' => $field->formName(),
'value' => $field->value(),
'placeholder' => $field->placeholder(),
'minlength' => $field->get('min'),
'maxlength' => $field->get('max'),
'autocomplete' => $field->get('autocomplete', 'off'),
'rows' => $field->get('rows'),
'cols' => $field->get('cols'),
'rows' => $field->get('rows', 15),
'required' => $field->isRequired(),
'disabled' => $field->isDisabled(),
'hidden' => $field->isHidden()

View File

@ -3,6 +3,7 @@
'id' => $field->name(),
'name' => $field->formName(),
'placeholder' => $field->placeholder(),
'rows' => $field->get('rows', 5),
'required' => $field->isRequired(),
'disabled' => $field->isDisabled(),
'hidden' => $field->isHidden()

View File

@ -1211,7 +1211,7 @@ __metadata:
"fsevents@patch:fsevents@~2.3.2#~builtin<compat/fsevents>":
version: 2.3.2
resolution: "fsevents@patch:fsevents@npm%3A2.3.2#~builtin<compat/fsevents>::version=2.3.2&hash=18f3a7"
resolution: "fsevents@patch:fsevents@npm%3A2.3.2#~builtin<compat/fsevents>::version=2.3.2&hash=df0bf1"
dependencies:
node-gyp: latest
conditions: os=darwin
@ -2493,7 +2493,7 @@ __metadata:
"resolve@patch:resolve@^1.10.0#~builtin<compat/resolve>, resolve@patch:resolve@^1.17.0#~builtin<compat/resolve>, resolve@patch:resolve@^1.19.0#~builtin<compat/resolve>":
version: 1.22.1
resolution: "resolve@patch:resolve@npm%3A1.22.1#~builtin<compat/resolve>::version=1.22.1&hash=07638b"
resolution: "resolve@patch:resolve@npm%3A1.22.1#~builtin<compat/resolve>::version=1.22.1&hash=c3c19d"
dependencies:
is-core-module: ^2.9.0
path-parse: ^1.0.7

View File

@ -21,6 +21,9 @@ layout:
fields: [postsPerPage, published, publishDate, unpublishDate, routable, listed, cacheable]
fields:
content:
rows: 5
postsPerPage:
type: select
label: '{{panel.pages.page.posts-per-page}}'

View File

@ -11,12 +11,13 @@ num: date
layout:
sections:
content:
fields: [title, image, tags, content, summary]
fields: [title, image, tags, summary, content]
fields:
summary:
type: markdown
label: '{{panel.pages.summary}}'
rows: 5
image:
type: image