fix(types): fix link and table type errors (#3208)

This commit is contained in:
John Franey
2022-09-20 18:54:36 -03:00
committed by GitHub
parent a3978353ff
commit ae13cf61ad
2 changed files with 5 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
import { Mark, markPasteRule, mergeAttributes } from '@tiptap/core' import { Mark, markPasteRule, mergeAttributes } from '@tiptap/core'
import { find, registerCustomProtocol } from 'linkifyjs' import { find, registerCustomProtocol } from 'linkifyjs'
import { Plugin } from 'prosemirror-state'
import { autolink } from './helpers/autolink' import { autolink } from './helpers/autolink'
import { clickHandler } from './helpers/clickHandler' import { clickHandler } from './helpers/clickHandler'
@@ -162,7 +163,7 @@ export const Link = Mark.create<LinkOptions>({
}, },
addProseMirrorPlugins() { addProseMirrorPlugins() {
const plugins = [] const plugins: Plugin[] = []
if (this.options.autolink) { if (this.options.autolink) {
plugins.push(autolink({ plugins.push(autolink({

View File

@@ -5,8 +5,8 @@ import { getTableNodeTypes } from './getTableNodeTypes'
export function createTable(schema: Schema, rowsCount: number, colsCount: number, withHeaderRow: boolean, cellContent?: Fragment | ProsemirrorNode | Array<ProsemirrorNode>): ProsemirrorNode { export function createTable(schema: Schema, rowsCount: number, colsCount: number, withHeaderRow: boolean, cellContent?: Fragment | ProsemirrorNode | Array<ProsemirrorNode>): ProsemirrorNode {
const types = getTableNodeTypes(schema) const types = getTableNodeTypes(schema)
const headerCells = [] const headerCells: ProsemirrorNode[] = []
const cells = [] const cells: ProsemirrorNode[] = []
for (let index = 0; index < colsCount; index += 1) { for (let index = 0; index < colsCount; index += 1) {
const cell = createCell(types.cell, cellContent) const cell = createCell(types.cell, cellContent)
@@ -24,7 +24,7 @@ export function createTable(schema: Schema, rowsCount: number, colsCount: number
} }
} }
const rows = [] const rows: ProsemirrorNode[] = []
for (let index = 0; index < rowsCount; index += 1) { for (let index = 0; index < rowsCount; index += 1) {
rows.push(types.row.createChecked(null, withHeaderRow && index === 0 ? headerCells : cells)) rows.push(types.row.createChecked(null, withHeaderRow && index === 0 ? headerCells : cells))