A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
editor: prevent table column size reset in readonly mode (#2586)
Muhammad Ali283efa6e4134
diff --git a/packages/editor/src/extensions/table/table.ts b/packages/editor/src/extensions/table/table.tsindex 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 <http://www.gnu.org/licenses/>.*/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<TableOptions>({addProseMirrorPlugins() {@@ -35,10 +36,20 @@ export const Table = TiptapTable.extend<TableOptions>({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) }+ }+ });+}