feat: add html and source editing support#12269
Conversation
|
Greta and I had a co-working call about HTML support for CKEditor. The original issue is "Not able to configure a pure HTML signature without getting it defaced by the editor." By defaced I mean CKEditor rewrites the provided HTML markup to a version that only uses elements it allows. Some attributes, classes or style definitions are kept, others are silently dropped. This limits what users can do when designing their signatures. For context, Outlook and Gmail also do not allow arbitrary HTML injection and provide a simple editor like we do. Thunderbird on the other hand allows full freedom in signatures and emails. I acknowledge that this is one of the issues in Mail that gets the most upvotes; I would rather not go too far down that rabbit hole though. That said, we can break it down into actionable work packages.
|
82b08aa to
d4a8743
Compare
2468695 to
5dace15
Compare
dc9cbd5 to
e60ea28
Compare
e60ea28 to
142b86a
Compare
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds HTML source-editing support to the rich-text editor by switching from DecoupledEditor to ClassicEditor, registering CKEditor's SourceEditing plugin, wiring a debounced input listener so edits in source mode propagate back to the editor, and broadening the HTML allow-list to include tables, figures, anchors, and image attributes/styles.
Changes:
- Switch editor type to
ClassicEditorand register theSourceEditingplugin/toolbar button. - Add register/unregister logic with a debounced
inputhandler that callsSourceEditing.updateEditorData(), plusbeforeDestroycleanup. - Expand
htmlSupport.allowrules and tweak signature settings dropdown max-width.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/components/TextEditor.vue | Switches to ClassicEditor, adds SourceEditing plugin and debounced source-mode sync logic, expands HTML allow-list. |
| src/components/SignatureSettings.vue | Reduces dropdown panel max-width and adds an explanatory comment. |
| src/tests/unit/components/TextEditor.spec.js | Adds a unit test verifying source-edit input triggers updateEditorData(). |
| if (this.editorInstance?.plugins.has('SourceEditing') && this.sourceEditingModeHandler) { | ||
| this.editorInstance.plugins.get('SourceEditing').off('change:isSourceEditingMode', this.sourceEditingModeHandler) | ||
| } |
AI-assisted: OpenCode (gpt-5.4) AI-assisted: Claude Code (Claude Sonnet 4.6) Signed-off-by: greta <gretadoci@gmail.com> Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
142b86a to
0eaad6f
Compare
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
fixes #4557
Todos: