Browse Source

Workaround click response offset issue

pull/6/head
Menci 6 years ago
parent
commit
d4d0d9e662
  1. 17
      static/self/monaco-editor.css
  2. 7
      static/self/monaco-editor.js

17
static/self/monaco-editor.css

@ -10,6 +10,13 @@
outline: none; outline: none;
} }
.editor > .editor-wrapped {
position: absolute;
width: 100%;
height: 100%;
top: 9px;
}
.editor.editor-with-border:focus-within { .editor.editor-with-border:focus-within {
border-color: #85b7d9; border-color: #85b7d9;
} }
@ -19,7 +26,6 @@
} }
.editor.editor-with-border .monaco-editor .lines-content.monaco-editor-background { .editor.editor-with-border .monaco-editor .lines-content.monaco-editor-background {
margin-top: 9px;
margin-left: 4px; margin-left: 4px;
} }
@ -58,10 +64,19 @@
} }
.editor.editor-with-border .monaco-editor .monaco-scrollable-element .scrollbar.vertical { .editor.editor-with-border .monaco-editor .monaco-scrollable-element .scrollbar.vertical {
top: -9px !important;
background: rgba(0,0,0,.1); background: rgba(0,0,0,.1);
border-radius: 0; border-radius: 0;
} }
.editor.editor-with-border .monaco-editor .monaco-scrollable-element.editor-scrollable {
overflow: visible !important;
}
.editor.editor-with-border .monaco-editor .overflow-guard {
overflow: visible !important;
}
.editor.editor-with-border .monaco-editor .monaco-scrollable-element .scrollbar.vertical .slider { .editor.editor-with-border .monaco-editor .monaco-scrollable-element .scrollbar.vertical .slider {
border-radius: 5px; border-radius: 5px;
background: rgba(0,0,0,.25); background: rgba(0,0,0,.25);

7
static/self/monaco-editor.js

@ -609,8 +609,11 @@ require(['vs/editor/editor.main'], function () {
}); });
}; };
window.createMarkdownEditor = function (editorElement, content, input) { window.createMarkdownEditor = function (wrapperElement, content, input) {
editorElement.innerHTML = ''; wrapperElement.innerHTML = '';
var editorElement = document.createElement('div');
editorElement.classList.add('editor-wrapped');
wrapperElement.appendChild(editorElement);
var editor = monaco.editor.create(editorElement, { var editor = monaco.editor.create(editorElement, {
value: content, value: content,
language: 'markdown', language: 'markdown',

Loading…
Cancel
Save