diff --git a/projects/tui-editor/components/editor-socket/styles/table.less b/projects/tui-editor/components/editor-socket/styles/table.less index b981f67f1..83229a9be 100644 --- a/projects/tui-editor/components/editor-socket/styles/table.less +++ b/projects/tui-editor/components/editor-socket/styles/table.less @@ -2,7 +2,7 @@ table { border-collapse: collapse; - table-layout: fixed; + table-layout: unset; width: 100%; margin: 0; overflow: hidden; diff --git a/projects/tui-editor/extensions/default-editor-extensions/default-editor-extensions.ts b/projects/tui-editor/extensions/default-editor-extensions/default-editor-extensions.ts index 252d8b6c9..284dc95b8 100644 --- a/projects/tui-editor/extensions/default-editor-extensions/default-editor-extensions.ts +++ b/projects/tui-editor/extensions/default-editor-extensions/default-editor-extensions.ts @@ -29,8 +29,10 @@ export const defaultEditorExtensions = [ import(`@tinkoff/tui-editor/extensions/table`).then(({TuiTable}) => TuiTable.configure({resizable: true}), ), + import(`@tinkoff/tui-editor/extensions/table-cell`).then( + ({TuiTableCell}) => TuiTableCell, + ), import(`@tiptap/extension-table-row`).then(({default: TableRow}) => TableRow), - import(`@tiptap/extension-table-cell`).then(({default: TableCell}) => TableCell), import(`@tiptap/extension-table-header`).then(({TableHeader}) => TableHeader), import(`@tinkoff/tui-editor/extensions/indent-outdent`).then( ({TuiTabExtension}) => TuiTabExtension, diff --git a/projects/tui-editor/extensions/table-cell/index.ts b/projects/tui-editor/extensions/table-cell/index.ts new file mode 100644 index 000000000..01643f0f5 --- /dev/null +++ b/projects/tui-editor/extensions/table-cell/index.ts @@ -0,0 +1 @@ +export * from './table'; diff --git a/projects/tui-editor/extensions/table-cell/ng-package.json b/projects/tui-editor/extensions/table-cell/ng-package.json new file mode 100644 index 000000000..bebf62dcb --- /dev/null +++ b/projects/tui-editor/extensions/table-cell/ng-package.json @@ -0,0 +1,5 @@ +{ + "lib": { + "entryFile": "index.ts" + } +} diff --git a/projects/tui-editor/extensions/table-cell/table.ts b/projects/tui-editor/extensions/table-cell/table.ts new file mode 100644 index 000000000..db0377126 --- /dev/null +++ b/projects/tui-editor/extensions/table-cell/table.ts @@ -0,0 +1,14 @@ +import {mergeAttributes} from '@tiptap/core'; +import TableCell from '@tiptap/extension-table-cell'; + +export const TuiTableCell = TableCell.extend({ + renderHTML({HTMLAttributes}) { + const attrs = mergeAttributes(this.options.HTMLAttributes, HTMLAttributes); + + if (attrs.colwidth) { + attrs.style = `width: ${attrs.colwidth}px`; + } + + return [`td`, attrs, 0]; + }, +}); diff --git a/tsconfig.build.json b/tsconfig.build.json index 981aa7d43..fa0f634bf 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -17,7 +17,7 @@ "@taiga-ui/core": ["./taiga-ui/dist/core/index"], "@taiga-ui/core/*": ["./taiga-ui/dist/core/*"], "@taiga-ui/i18n": ["./taiga-ui/dist/i18n/index"], - "@taiga-ui/i18n/*": ["./taiga-ui/dist/i18n/*"], + "@taiga-ui/i18n/*": ["./taiga-ui/dist/i18n/*"] } } }