revert: "fix(vue-3): fix editor.state updating too late during a transaction due to reactiveState fixes #4870 (#5252)"

This reverts commit 509676ed4a.
This commit is contained in:
Nick the Sick 2024-07-15 12:21:12 +02:00
parent 0879c7df7d
commit dbab8e42ea
No known key found for this signature in database
GPG Key ID: F575992F156E5BCC
3 changed files with 2 additions and 8 deletions

View File

@ -406,11 +406,6 @@ export class Editor extends EventEmitter<EditorEvents> {
const state = this.state.apply(transaction)
const selectionHasChanged = !this.state.selection.eq(state.selection)
this.emit('beforeTransaction', {
editor: this,
transaction,
nextState: state,
})
this.view.updateState(state)
this.emit('transaction', {
editor: this,

View File

@ -50,7 +50,6 @@ export interface EditorEvents {
}
update: { editor: Editor; transaction: Transaction }
selectionUpdate: { editor: Editor; transaction: Transaction }
beforeTransaction: { editor: Editor; transaction: Transaction, nextState: EditorState }
transaction: { editor: Editor; transaction: Transaction }
focus: { editor: Editor; event: FocusEvent; transaction: Transaction }
blur: { editor: Editor; event: FocusEvent; transaction: Transaction }

View File

@ -50,8 +50,8 @@ export class Editor extends CoreEditor {
this.reactiveState = useDebouncedRef(this.view.state)
this.reactiveExtensionStorage = useDebouncedRef(this.extensionStorage)
this.on('beforeTransaction', ({ nextState }) => {
this.reactiveState.value = nextState
this.on('transaction', () => {
this.reactiveState.value = this.view.state
this.reactiveExtensionStorage.value = this.extensionStorage
})