From e4b674e575bf94be29a3a85951a0b4fbba6d2781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bok=C5=A1a?= Date: Mon, 29 Jul 2024 17:13:49 +0200 Subject: [PATCH] chore(extension-table): remove unnecessary @ts-ignore, update view type (#5387) --- packages/extension-table/src/table.ts | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/packages/extension-table/src/table.ts b/packages/extension-table/src/table.ts index 5a6fa4fb816..5edd03a4148 100644 --- a/packages/extension-table/src/table.ts +++ b/packages/extension-table/src/table.ts @@ -1,7 +1,7 @@ import { callOrReturn, getExtensionField, mergeAttributes, Node, ParentConfig, } from '@tiptap/core' -import { DOMOutputSpec } from '@tiptap/pm/model' +import { DOMOutputSpec, Node as ProseMirrorNode } from '@tiptap/pm/model' import { TextSelection } from '@tiptap/pm/state' import { addColumnAfter, @@ -22,7 +22,7 @@ import { toggleHeader, toggleHeaderCell, } from '@tiptap/pm/tables' -import { NodeView } from '@tiptap/pm/view' +import { EditorView, NodeView } from '@tiptap/pm/view' import { TableView } from './TableView.js' import { createColGroup } from './utilities/createColGroup.js' @@ -62,7 +62,7 @@ export interface TableOptions { * The node view to render the table. * @default TableView */ - View: NodeView + View: (new (node: ProseMirrorNode, cellMinWidth: number, view: EditorView) => NodeView) | null /** * Enables the resizing of the last column. @@ -98,7 +98,7 @@ declare module '@tiptap/core' { * Add a column before the current column * @returns True if the command was successful, otherwise false * @example editor.commands.addColumnBefore() - */ + */ addColumnBefore: () => ReturnType /** @@ -234,11 +234,11 @@ declare module '@tiptap/core' { tableRole?: | string | ((this: { - name: string - options: Options - storage: Storage - parent: ParentConfig>['tableRole'] - }) => string) + name: string + options: Options + storage: Storage + parent: ParentConfig>['tableRole'] + }) => string) } } @@ -431,10 +431,7 @@ export const Table = Node.create({ columnResizing({ handleWidth: this.options.handleWidth, cellMinWidth: this.options.cellMinWidth, - // @ts-ignore (incorrect type) View: this.options.View, - // TODO: PR for @types/prosemirror-tables - // @ts-ignore (incorrect type) lastColumnResizable: this.options.lastColumnResizable, }), ]