Fix whitespace in prose.js

pull/383/head
Matt Baer 4 years ago
parent 61daca2b0d
commit da8c08668f
  1. 35
      prose/prose.js

@ -15,24 +15,25 @@ import {schema, defaultMarkdownParser, defaultMarkdownSerializer} from "prosemir
import {exampleSetup} from "prosemirror-example-setup" import {exampleSetup} from "prosemirror-example-setup"
class ProseMirrorView { class ProseMirrorView {
constructor(target, content) { constructor(target, content) {
this.view = new EditorView(target, { this.view = new EditorView(target, {
state: EditorState.create({ state: EditorState.create({
doc: defaultMarkdownParser.parse(content), doc: defaultMarkdownParser.parse(content),
plugins: exampleSetup({schema}) plugins: exampleSetup({schema})
}), dispatchTransaction(transaction) { }),
document.querySelector('#content').value = defaultMarkdownSerializer.serialize(transaction.doc) dispatchTransaction(transaction) {
let newState = this.state.apply(transaction) document.querySelector('#content').value = defaultMarkdownSerializer.serialize(transaction.doc)
this.updateState(newState) let newState = this.state.apply(transaction)
} this.updateState(newState)
}) }
} })
}
get content() { get content() {
return defaultMarkdownSerializer.serialize(this.view.state.doc) return defaultMarkdownSerializer.serialize(this.view.state.doc)
} }
focus() { this.view.focus() } focus() { this.view.focus() }
destroy() { this.view.destroy() } destroy() { this.view.destroy() }
} }
let place = document.querySelector("#editor") let place = document.querySelector("#editor")

Loading…
Cancel
Save