mirror of
https://github.com/thomiceli/opengist.git
synced 2025-01-08 17:42:40 +00:00
Wrap editor code in DOMContentLoaded
This commit is contained in:
parent
2aee52e06c
commit
0eb1b103d0
1 changed files with 139 additions and 134 deletions
7
public/editor.js
vendored
7
public/editor.js
vendored
|
@ -2,6 +2,7 @@ import {EditorView, gutter, keymap, lineNumbers} from "@codemirror/view"
|
|||
import {Compartment, EditorState, Facet, SelectionRange} from "@codemirror/state"
|
||||
import {indentLess} from "@codemirror/commands";
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
EditorView.theme({}, {dark: true})
|
||||
|
||||
let editorsjs = []
|
||||
|
@ -103,7 +104,10 @@ function changeBySelectedLine(state, f) {
|
|||
line = state.doc.lineAt(line.number + 1)
|
||||
}
|
||||
let changeSet = state.changes(changes)
|
||||
return {changes, range: new SelectionRange(changeSet.mapPos(range.anchor, 1), changeSet.mapPos(range.head, 1))}
|
||||
return {
|
||||
changes,
|
||||
range: new SelectionRange(changeSet.mapPos(range.anchor, 1), changeSet.mapPos(range.head, 1))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -155,3 +159,4 @@ document.querySelector('form#create').onsubmit = () => {
|
|||
document.onsubmit = () => {
|
||||
window.onbeforeunload = null;
|
||||
}
|
||||
})
|
Loading…
Reference in a new issue