mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-14 18:49:02 +08:00
codestyle
This commit is contained in:
parent
48cc408a97
commit
cf4efcbac7
@ -29,15 +29,16 @@ export default class TrailingNode extends Extension {
|
|||||||
view: () => ({
|
view: () => ({
|
||||||
update: view => {
|
update: view => {
|
||||||
const { state } = view
|
const { state } = view
|
||||||
const { doc } = state
|
|
||||||
const insertNodeAtEnd = plugin.getState(state)
|
const insertNodeAtEnd = plugin.getState(state)
|
||||||
|
|
||||||
if (!insertNodeAtEnd) {
|
if (!insertNodeAtEnd) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const type = state.schema.nodes[this.options.node]
|
const { doc, schema, tr } = state
|
||||||
view.dispatch(view.state.tr.insert(doc.content.size, type.create()))
|
const type = schema.nodes[this.options.node]
|
||||||
|
const transaction = tr.insert(doc.content.size, type.create())
|
||||||
|
view.dispatch(transaction)
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
state: {
|
state: {
|
||||||
@ -45,9 +46,9 @@ export default class TrailingNode extends Extension {
|
|||||||
const lastNode = state.tr.doc.lastChild
|
const lastNode = state.tr.doc.lastChild
|
||||||
return !nodeEqualsType({ node: lastNode, types: disabledNodes })
|
return !nodeEqualsType({ node: lastNode, types: disabledNodes })
|
||||||
},
|
},
|
||||||
apply: (tr, oldState) => {
|
apply: (tr, value) => {
|
||||||
if (!tr.docChanged) {
|
if (!tr.docChanged) {
|
||||||
return oldState
|
return value
|
||||||
}
|
}
|
||||||
|
|
||||||
const lastNode = tr.doc.lastChild
|
const lastNode = tr.doc.lastChild
|
||||||
|
Loading…
Reference in New Issue
Block a user