Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions packages/core/src/extensions/TableHandles/TableHandles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,9 @@ export class TableHandlesView implements PluginView {
any
>,
private readonly pmView: EditorView,
emitUpdate: (state: TableHandlesState) => void,
emitUpdate: (state: TableHandlesState | undefined) => void,
) {
this.emitUpdate = () => {
if (!this.state) {
throw new Error("Attempting to update uninitialized image toolbar");
}

emitUpdate(this.state);
};

Expand Down Expand Up @@ -298,7 +294,7 @@ export class TableHandlesView implements PluginView {

const hideHandles =
// always hide handles when the actively hovered table changed
this.state?.block.id !== tableBlock.id ||
this.state?.block?.id !== tableBlock.id ||
// make sure we don't hide existing handles (keep col / row index) when
// we're hovering just above or to the right of a table
event.clientX > tableRect.right ||
Expand Down Expand Up @@ -543,9 +539,9 @@ export class TableHandlesView implements PluginView {
// because yjs replaces the element when for example you change the color via the side menu
!this.tableElement?.isConnected
) {
this.state.show = false;
this.state.showAddOrRemoveRowsButton = false;
this.state.showAddOrRemoveColumnsButton = false;
this.state = undefined;
this.tableId = undefined;
this.tableElement = undefined;
this.emitUpdate();

return;
Expand Down Expand Up @@ -628,7 +624,7 @@ export const TableHandlesExtension = createExtension(({ editor }) => {
view: (editorView) => {
view = new TableHandlesView(editor as any, editorView, (state) => {
store.setState(
state.block
state?.block
? {
...state,
draggingState: state.draggingState
Expand Down