Jul 24 - Update Rich-text editor to enhance table editor 6

This commit is contained in:
2026-07-24 15:35:12 -04:00
parent 22754f6ae8
commit a321a881d8
5 changed files with 33 additions and 19 deletions
+10 -8
View File
@@ -97,21 +97,23 @@ ALLOWED_TAGS = [
# tables (quill-table-better: resizable cols, aligned/styled cells)
"table", "thead", "tbody", "tr", "td", "th", "col", "colgroup",
]
# quill-table-better carries column widths, alignment, borders and background
# as inline `style` on the table/cell tags, plus data-* bookkeeping attributes.
# quill-table-better carries column widths, borders and background as inline
# `style`, plus data-* bookkeeping attributes. Cell alignment is Quill's
# `ql-align-*` CSS class on the cell's <p> block, and quill-table-better also
# tags blots with `ql-table-block`/`table-th-block` classes — all of which must
# survive so the table (and its alignment) round-trips back into the editor.
_TABLE_CELL_ATTRS = [
"data-row", "data-cell", "data-class", "colspan", "rowspan",
"width", "height", "style",
"width", "height", "style", "class",
]
ALLOWED_ATTRS = {
"a": ["href", "title", "target", "rel"],
"img": ["src", "alt", "width", "height"],
# cell alignment lives as inline `text-align` on the cell's <p> block
"p": ["style"],
"p": ["style", "class", "data-cell", "data-row"],
"table": ["class", "style", "align", "width", "height", "data-class"],
"colgroup": ["style"],
"col": ["width", "span", "style"],
"tr": ["data-row", "style"],
"colgroup": ["style", "class"],
"col": ["width", "span", "style", "class"],
"tr": ["data-row", "style", "class"],
"td": _TABLE_CELL_ATTRS,
"th": _TABLE_CELL_ATTRS,
}