Skip to content

Commit

Permalink
select new row/column (#2094)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andres-CT98 authored Sep 21, 2023
1 parent e808fbf commit 43da112
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Disposable from '../../../pluginUtils/Disposable';
import TableEditFeature from './TableEditorFeature';
import { createElement, getIntersectedRect, normalizeRect, VTable } from 'roosterjs-editor-dom';
import { CreateElementData, IEditor, TableOperation } from 'roosterjs-editor-types';
import { CreateElementData, IEditor, TableOperation, TableSelection } from 'roosterjs-editor-types';

const INSERTER_COLOR = '#4A4A4A';
const INSERTER_COLOR_DARK_MODE = 'white';
Expand Down Expand Up @@ -118,6 +118,21 @@ class TableInsertHandler implements Disposable {
vtable.writeBack();

this.onInsert(vtable.table);

// Select newly inserted row or column
if (vtable.row != undefined && vtable.col != undefined && vtable.cells) {
const inserted: TableSelection = this.isHorizontal
? {
firstCell: { x: 0, y: vtable.row + 1 },
lastCell: { x: vtable.cells[vtable.row].length - 1, y: vtable.row + 1 },
}
: {
firstCell: { x: vtable.col + 1, y: 0 },
lastCell: { x: vtable.col + 1, y: vtable.cells.length - 1 },
};

this.editor.select(vtable.table, inserted);
}
};
}

Expand Down

0 comments on commit 43da112

Please sign in to comment.