diff --git a/packages/editor/src/extensions/table/table.ts b/packages/editor/src/extensions/table/table.ts
index 0ecc73bc5..0338e3861 100644
--- a/packages/editor/src/extensions/table/table.ts
+++ b/packages/editor/src/extensions/table/table.ts
@@ -18,8 +18,9 @@ along with this program. If not, see .
*/
import { Table as TiptapTable, TableOptions } from "@tiptap/extension-table";
-import { columnResizing, tableEditing } from "@tiptap/pm/tables";
+import { tableEditing, columnResizing, TableView } from "@tiptap/pm/tables";
import { TableNodeView } from "./component";
+import { Plugin, PluginKey } from "prosemirror-state";
export const Table = TiptapTable.extend({
addProseMirrorPlugins() {
@@ -35,10 +36,20 @@ export const Table = TiptapTable.extend({
lastColumnResizable: this.options.lastColumnResizable
})
]
- : []),
+ : [tiptapTableView(this.options.cellMinWidth)]),
tableEditing({
allowTableNodeSelection: this.options.allowTableNodeSelection
})
];
}
});
+
+const TiptapTableViewPluginKey = new PluginKey("TiptapTableView");
+function tiptapTableView(cellMinWidth: number): Plugin {
+ return new Plugin({
+ key: TiptapTableViewPluginKey,
+ props: {
+ nodeViews: { [Table.name]: (node) => new TableView(node, cellMinWidth) }
+ }
+ });
+}