diff options
author | Julius Härtl <jus@bitgrid.net> | 2019-05-09 15:22:48 +0300 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2019-05-09 15:22:48 +0300 |
commit | 7650dd68cc5c3d8f78b8ee28d1df678131ea8d87 (patch) | |
tree | 207b0b864c2c90be57964319b90efc45b698c19e /src/components/ReadOnlyEditor.vue | |
parent | a872e65325ddb3b4693905e73e234d2c14191a29 (diff) |
Code style and remove jQuery usage
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'src/components/ReadOnlyEditor.vue')
-rw-r--r-- | src/components/ReadOnlyEditor.vue | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/src/components/ReadOnlyEditor.vue b/src/components/ReadOnlyEditor.vue index 666a027e6..47883ace1 100644 --- a/src/components/ReadOnlyEditor.vue +++ b/src/components/ReadOnlyEditor.vue @@ -21,51 +21,51 @@ --> <template> - <div id="remote" ref="remote"></div> + <div id="remote" ref="remote" /> </template> <script> - import {EditorState} from 'prosemirror-state' - import {EditorView} from 'prosemirror-view' - import {exampleSetup} from 'prosemirror-example-setup' - import {schema, defaultMarkdownParser} from 'prosemirror-markdown' +import { EditorState } from 'prosemirror-state' +import { EditorView } from 'prosemirror-view' +import { exampleSetup } from 'prosemirror-example-setup' +import { schema, defaultMarkdownParser } from 'prosemirror-markdown' - export default { - name: 'ReadOnlyEditor', - props: { - content: { - type: String, - required: true - }, - }, - data: () => { - return { - remoteView: null +export default { + name: 'ReadOnlyEditor', + props: { + content: { + type: String, + required: true + } + }, + data: () => { + return { + remoteView: null + } + }, + mounted() { + this.initRemoteView() + }, + beforeDestroy() { + this.remoteView.destroy() + }, + methods: { + initRemoteView() { + if (this.remoteView) { + return } - }, - mounted() { - this.initRemoteView() - }, - beforeDestroy() { - this.remoteView.destroy() - }, - methods: { - initRemoteView() { - if (this.remoteView) { - return; - } - this.remoteView = new EditorView(this.$refs.remote, { - state: EditorState.create({ - doc: defaultMarkdownParser.parse(this.content), - plugins: [ - ...exampleSetup({schema}) - ] - }), + this.remoteView = new EditorView(this.$refs.remote, { + state: EditorState.create({ + doc: defaultMarkdownParser.parse(this.content), + plugins: [ + ...exampleSetup({ schema }) + ] }) - this.remoteView.setProps({editable: () => false}) - }, + }) + this.remoteView.setProps({ editable: () => false }) } } +} </script> <style scoped> |