mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Koenig - Enable line-wrapping for HTML card's CodeMirror instance
refs https://github.com/TryGhost/Ghost/issues/9505 - pass `lineWrapping` option through to CodeMirror in `{{gh-cm-editor}}` - add cascade overrides for the `pre` line-wrapping styles needed by CodeMirror
This commit is contained in:
parent
923a1f8372
commit
761e841875
3 changed files with 13 additions and 3 deletions
|
@ -16,11 +16,12 @@ const CmEditorComponent = Component.extend({
|
|||
isInitializingCodemirror: true,
|
||||
|
||||
// options for the editor
|
||||
lineNumbers: true,
|
||||
autofocus: false,
|
||||
indentUnit: 4,
|
||||
lineNumbers: true,
|
||||
lineWrapping: false,
|
||||
mode: 'htmlmixed',
|
||||
theme: 'xq-light',
|
||||
autofocus: false,
|
||||
|
||||
_editor: null, // reference to CodeMirror editor
|
||||
|
||||
|
@ -74,7 +75,7 @@ const CmEditorComponent = Component.extend({
|
|||
}),
|
||||
|
||||
_initCodeMirror() {
|
||||
let options = this.getProperties('lineNumbers', 'indentUnit', 'mode', 'theme', 'autofocus');
|
||||
let options = this.getProperties('lineNumbers', 'lineWrapping', 'indentUnit', 'mode', 'theme', 'autofocus');
|
||||
assign(options, {value: this.get('_value')});
|
||||
|
||||
let textarea = this.element.querySelector('textarea');
|
||||
|
|
|
@ -307,6 +307,14 @@
|
|||
margin-right: 0;
|
||||
}
|
||||
|
||||
.koenig-card-html--editor .CodeMirror pre {
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.koenig-card-html--editor .CodeMirror-wrap pre {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
/* Markdown */
|
||||
|
||||
.koenig-editor .gh-markdown-editor {
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
{{gh-cm-editor payload.html
|
||||
class="koenig-card-html--editor"
|
||||
autofocus=true
|
||||
lineWrapping=true
|
||||
update=(action "updateHtml")
|
||||
}}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue