1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2026-01-03 23:42:28 +03:00

WYSIWYG: Code & table fixes

- Fixed new code block insertion to remove selection area instead of
  just adding after.
- Added default table column widths to not be collapsed
- Updated table dom export to not duplicate colgroups.
This commit is contained in:
Dan Brown
2024-10-05 12:42:47 +01:00
parent 9b2520aa0c
commit c314a60a16
5 changed files with 40 additions and 30 deletions

View File

@@ -74,8 +74,12 @@ export class EditorTableCreator extends EditorUiElement {
return;
}
const targetColWidth = Math.min(Math.round(840 / columns), 240);
const colWidths = Array(columns).fill(targetColWidth + 'px');
this.getContext().editor.update(() => {
const table = $createTableNodeWithDimensions(rows, columns, false) as CustomTableNode;
table.setColWidths(colWidths);
$insertNewBlockNodeAtSelection(table);
});
}