Jul 24 - Update Rich-text editor to enhance table editor 6
This commit is contained in:
@@ -128,10 +128,18 @@ shows only `is_published` topics (sections with no published topics are hidden).
|
||||
load still leaves a working editor + textarea. Registration and keyboard bindings
|
||||
(`QuillTableBetter.keyboardBindings`) live in `topic_form.html`.
|
||||
- **Save/load round-trip (critical):** save with `deleteTableTemporary()` then
|
||||
`quill.getSemanticHTML()`. **Load must NOT use `dangerouslyPasteHTML`/`setContents`**
|
||||
— quill-table-better renders tables *blank* that way. Instead convert then apply:
|
||||
`quill.root.innerHTML` — **NOT `getSemanticHTML()`**, which rewrites Quill's
|
||||
`ql-align-*` class as an inline `text-align` style; quill-table-better's
|
||||
`getAlign()` reads only the class, so semantic HTML makes the cell-properties
|
||||
dialog always show "left". **Load must NOT use `dangerouslyPasteHTML`/`setContents`**
|
||||
either — that renders tables *blank*. Instead convert then apply:
|
||||
`quill.updateContents(quill.clipboard.convert({html}), 'user')`. The non-table
|
||||
fallback path still uses `dangerouslyPasteHTML`.
|
||||
- **Alignment is a CSS class, not inline style.** Cell alignment = Quill's default
|
||||
class-based align (`ql-align-center` on the cell `<p>`). The sanitizer therefore
|
||||
allows `class` on p/table tags (also needed for `ql-table-block`), and the public
|
||||
page styles `.prose .ql-align-*`. Do NOT register `attributors/style/align` — it
|
||||
breaks the properties-dialog readback described above.
|
||||
- **Sanitize on save:** `sanitize_html()` (bleach) runs on every `body_html`
|
||||
write — `ALLOWED_TAGS`/`ALLOWED_ATTRS` cover `img` + full table tags with
|
||||
`colspan/rowspan/data-*/style`; a `CSSSanitizer` (bleach[css] + `tinycss2`)
|
||||
|
||||
Reference in New Issue
Block a user