Skip to content

Commit

Permalink
chore(extension-table): remove unnecessary @ts-ignore, update view ty…
Browse files Browse the repository at this point in the history
…pe (#5387)
  • Loading branch information
martinboksa authored and nperez0111 committed Aug 6, 2024
1 parent da35cf5 commit e4b674e
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions packages/extension-table/src/table.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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'
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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

/**
Expand Down Expand Up @@ -234,11 +234,11 @@ declare module '@tiptap/core' {
tableRole?:
| string
| ((this: {
name: string
options: Options
storage: Storage
parent: ParentConfig<NodeConfig<Options>>['tableRole']
}) => string)
name: string
options: Options
storage: Storage
parent: ParentConfig<NodeConfig<Options>>['tableRole']
}) => string)
}
}

Expand Down Expand Up @@ -431,10 +431,7 @@ export const Table = Node.create<TableOptions>({
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,
}),
]
Expand Down

0 comments on commit e4b674e

Please sign in to comment.