feat(placeholders): add {%mail_typed_html%} placeholder and HTML sanitization - #846
feat(placeholders): add {%mail_typed_html%} placeholder and HTML sanitization#846tonicofonico wants to merge 4 commits into
Conversation
…t support and HTML sanitization
… clean_embedded_images prompt property
Summary of Implementation & Technical Evaluation: Embedded Image Tokenization & RestorationThis PR adds support for Embedded Image Tokenization and Automatic Restoration to resolve payload size limits and "message too long" errors when processing emails containing embedded base64 images. Key Additions & Features
|
|
Thank you for your PR, I'll check it after releasing version 5.0.0. |
|
I read the summary of your PR. You should also rebase the PRs to the v5.0.0 branch and check what I've done for the HTML sanitization, because I did many modifications on that part. Thank you! |
Summary of Changes
This PR introduces the new
{%mail_typed_html%}placeholder and improves the HTML rendering pipeline when substituting AI responses into Thunderbird's compose editor.1. New Placeholder
{%mail_typed_html%}<b>,<i>,<u>,<ul>,<li>,<p>, font sizes, etc.) before any quoted reply or forward blocks (.moz-cite-prefix,.moz-forward-container).js/mzta-placeholders.jsas a built-in placeholder withtype: 2(composing mode).placeholder_mail_typed_htmlin_locales/en/messages.jsonwith a tip on using recommended system instructions.claude-spec/03-placeholders.md.2. Automatic HTML Rendering & Sanitization
replaceSelectedTextinjs/mzta-compose-script.jsto parse HTML strings and insert actual DOM child nodes (DocumentFragment) instead of inserting raw<body>or text nodes.<button>,<svg>,<form>,<script>,<style>) and extracts clean content directly from.markdownor assistant response wrappers.<p>) before DOM parsing to prevent raw tags from appearing as literal text in the email.{ html: true }inapi_webchat/streamingMessage.jsso raw HTML tags are preserved across WebChat stream responses.Files Changed:
_locales/en/messages.jsonapi_webchat/streamingMessage.jsclaude-spec/03-placeholders.mdjs/mzta-compose-script.jsjs/mzta-menus.jsjs/mzta-placeholders.jsjs/mzta-utils-prompt.js