fix(extension-table): update insertion position of new tables fix #5143

Typically when inserting a new table we want to select within the first cell of the newly inserted
table. This change should ensure that occurs even if original selection's head precedes the anchor.

fix #5143
This commit is contained in:
Wilson Zhong 2024-06-07 10:30:06 -04:00 committed by GitHub
parent e542330170
commit b45fb70fa8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -302,7 +302,7 @@ export const Table = Node.create<TableOptions>({
const node = createTable(editor.schema, rows, cols, withHeaderRow)
if (dispatch) {
const offset = tr.selection.anchor + 1
const offset = tr.selection.from + 1
tr.replaceSelectionWith(node)
.scrollIntoView()