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

This commit is contained in:
2026-07-24 11:21:03 -04:00
parent 931cfc0f64
commit 2e65745aed
3 changed files with 20 additions and 2 deletions
+13 -1
View File
@@ -168,7 +168,19 @@
}
var quill = new Quill(editorEl, { theme: 'snow', modules: modules });
if (ta.value.trim()) quill.clipboard.dangerouslyPasteHTML(ta.value);
// Load existing body. quill-table-better warns that setContents /
// dangerouslyPasteHTML make tables render blank, so convert the saved HTML
// to a delta and apply it with updateContents instead.
if (ta.value.trim()) {
if (hasTables) {
var delta = quill.clipboard.convert({ html: ta.value });
quill.updateContents(delta, Quill.sources.USER);
quill.setSelection(delta.length(), Quill.sources.SILENT);
} else {
quill.clipboard.dangerouslyPasteHTML(ta.value);
}
}
var csrf = document.querySelector('meta[name="csrf-token"]').content;