nest code editor instance to avoid visibility issues

This commit is contained in:
zadam 2019-07-03 20:37:59 +02:00
parent e5036318af
commit bf3360572a
3 changed files with 9 additions and 3 deletions

View File

@ -14,6 +14,7 @@ class NoteDetailCode {
this.ctx = ctx; this.ctx = ctx;
this.codeEditor = null; this.codeEditor = null;
this.$component = ctx.$tabContent.find('.note-detail-code'); this.$component = ctx.$tabContent.find('.note-detail-code');
this.$editorEl = this.$component.find('.note-detail-code-editor');
this.$executeScriptButton = ctx.$tabContent.find(".execute-script-button"); this.$executeScriptButton = ctx.$tabContent.find(".execute-script-button");
utils.bindElShortcut(ctx.$tabContent, "ctrl+return", () => this.executeCurrentNote()); utils.bindElShortcut(ctx.$tabContent, "ctrl+return", () => this.executeCurrentNote());
@ -34,7 +35,7 @@ class NoteDetailCode {
CodeMirror.modeURL = 'libraries/codemirror/mode/%N/%N.js'; CodeMirror.modeURL = 'libraries/codemirror/mode/%N/%N.js';
this.codeEditor = CodeMirror(this.$component[0], { this.codeEditor = CodeMirror(this.$editorEl[0], {
value: "", value: "",
viewportMargin: Infinity, viewportMargin: Infinity,
indentUnit: 4, indentUnit: 4,

View File

@ -357,10 +357,13 @@ div.ui-tooltip {
} }
.note-detail-code { .note-detail-code {
min-height: 200px;
overflow: auto; overflow: auto;
} }
.note-detail-code-editor {
min-height: 200px;
}
.note-detail-render { .note-detail-render {
min-height: 200px; min-height: 200px;
} }

View File

@ -15,7 +15,9 @@
<div class="note-detail-text-editor" tabindex="10000"></div> <div class="note-detail-text-editor" tabindex="10000"></div>
</div> </div>
<div class="note-detail-code note-detail-component"></div> <div class="note-detail-code note-detail-component">
<div class="note-detail-code-editor"></div>
</div>
<% include details/empty.ejs %> <% include details/empty.ejs %>