mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-06-07 17:43:49 +08:00
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:
parent
e542330170
commit
b45fb70fa8
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user