import type { Editor } from '@tiptap/react' import { createContentEditorTableNode } from '@admin/utils/editor/create-content-editor-table-node' import { DEFAULT_CONTENT_EDITOR_TABLE_COLS } from '@admin/utils/editor/default-content-editor-table-cols' import { DEFAULT_CONTENT_EDITOR_TABLE_ROWS } from '@admin/utils/editor/default-content-editor-table-rows' export function insertContentEditorTable( editor: Editor, rows: number = DEFAULT_CONTENT_EDITOR_TABLE_ROWS, cols: number = DEFAULT_CONTENT_EDITOR_TABLE_COLS ): boolean { return editor.chain().focus().insertContent(createContentEditorTableNode(rows, cols)).run() }