Commit Graph
104 Commits
Author SHA1 Message Date
Dat H. Pham 67fa909722 Fix/composer embed code xss (#5070) 2026-11-02 11:05:37 +07:00
Dat Dang 5807b75604 2509 Sanitize composer reply/forward, mailto and pasted content (#5069) 2026-10-29 15:15:29 +07:00
dab246 65a2acd45c TF-4882 refactor(composer): Write zero-width chars in isEmptyListItem as unicode escapes 2026-10-14 17:39:25 +07:00
dab246 f4c8daa16c TF-4882 fix(composer): Skip Tab indent on the first list item to stop stray bullets 2026-10-14 17:39:25 +07:00
Benoit TELLIERandClaude Opus 5.5 e1e0c98899 TF-4882 fix(composer): Skip Tab list handling when list sits inside a table cell
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-14 17:39:25 +07:00
Benoit TELLIERandClaude Opus 5.5 810d7e0b99 TF-4882 feat(composer): Tab/Shift+Tab nest list items, Enter on empty nested item outdents
Summernote only binds Tab to list nesting when tabDisable is set, and even
then it inserts spaces. Register a keydown handler on the web editor that:
- delegates Tab / Shift+Tab inside a list item to the Summernote
  indent / outdent commands (same as the toolbar buttons);
- outdents an empty nested list item on Enter instead of leaving the list,
  like Gmail. Enter on an empty top-level item still exits the list.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-14 17:39:25 +07:00
dab246 1d33a46222 TF-4873 fix(eml-preview): drop email @page rules in CssScopeUtils so a mail cannot print text in the page margins 2026-10-12 19:04:35 +07:00
dab246 19ceb4c855 TF-4873 fix(eml-preview): stack the preview subject and attachments above the email body layer 2026-10-12 19:04:35 +07:00
dab246 d658fdfa3c TF-4873 fix(eml-preview): drop email @font-face rules in CssScopeUtils so a mail font cannot redraw the app header 2026-10-12 19:04:35 +07:00
dab246 b7b1748c74 TF-4873 fix(eml-preview): stack the preview header above an email-body-layer the email styles cannot reach 2026-10-12 19:04:35 +07:00
dab246 3e3430964f TF-4873 fix(eml-preview): rewrite html and body to :is(:where(:scope), <selector>) in CssScopeUtils to keep their specificity, and accept u+element selectors 2026-10-12 19:04:35 +07:00
dab246 828053e9db TF-4873 fix(eml-preview): escape </style in CssScopeUtils output so a neutralized brace cannot end the style element 2026-10-12 19:04:35 +07:00
dab246 dd23c0c311 TF-4873 fix(eml-preview): join html and body into one :scope only across CSS whitespace or > 2026-10-12 19:04:35 +07:00
dab246 42a88aa5ba TF-4873 fix(eml-preview): rewrite html and body type selectors to :scope in CssScopeUtils so mail body rules still apply 2026-10-12 19:04:35 +07:00
dab246 76a108462d TF-4873 refactor(eml-preview): model CssScopeUtils code units and lookahead as types to clear CodeScene Primitive Obsession 2026-10-12 19:04:35 +07:00
dab246 99c6b6daea TF-4873 fix(eml-preview): keep a CSS string open across the whitespace a hex escape swallows in CssScopeUtils 2026-10-12 19:04:35 +07:00
dab246 61b786127e TF-4873 fix(eml-preview): read <!-- as one CDO token in CssScopeUtils so a url( after it cannot hide the brace that closes @scope 2026-10-12 19:04:35 +07:00
Benoit TELLIERandClaude Opus 5.5 0ef8ecff7e TF-4873 refactor(eml-preview): split CSS tokenizer dispatch into smaller helpers
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-12 19:04:35 +07:00
Benoit TELLIERandClaude Opus 5.5 4d4f47851c TF-4873 fix(eml-preview): scope mail CSS to the email body
The EML preview renders the mail content in the same document as the
app-generated header (subject, sender, recipients, date), so global mail
rules such as '* { font-family: ... !important }' restyled that header.

Wrap every mail <style> into '@scope (.email-body) { ... }'. A CSS
tokenizer neutralizes any '}' that would close the @scope block early,
honoring comments, strings, escapes and url() tokens, and drops the CSS
when unicode-range tokenization differs between browsers.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-12 19:04:35 +07:00
Đặng Đạt 770bd30dfc 2509 Cover the noopener decision for links opened from the EML previewer
Addresses: 621393, 622054
https://ci.linagora.com/tddang/tmail-flutter/-/merge_requests/5#note_621393
https://ci.linagora.com/tddang/tmail-flutter/-/merge_requests/5#note_622054
2026-10-05 10:20:52 +07:00
Dang Dat 72cdf9900d 2509 Restrict which links open externally from email content
Links inside the EML preview opened new windows/tabs with plain
window.open, with no noopener and no scheme check. Pass
noopener,noreferrer and only open http, https and mailto targets.

Add ExternalLinkPolicy (http/https/tel allow-list) and route the mobile
email WebView's external-navigation handler through it, refusing the
app's own custom schemes so a link in received content can no longer
relaunch another app or the app itself.
2026-10-05 10:20:52 +07:00
Dang Dat 9e4152639f 2509 Escape header fields in the EML preview and remove the unused PDF viewer
The EML / full-message preview and the print page build their header
as an HTML string. Subject, sender, recipients, date, attachment names
and the attachment link were inserted unescaped, so a crafted header
value became markup in a same-origin page.
DownloadManager.openDownloadedFileWeb loaded pdf.js/pdfobject from a
CDN and put the file name unescaped into a blob page. Nothing calls it.

PreviewEmlFileUtils and PrintUtils escape every text field at the sink.
Callers pass raw strings and no longer pre-escape them. The attachment
link is attribute-escaped and built with Uri, so file names survive the
round-trip. The inline-image alt and id attributes are attribute-escaped.
openDownloadedFileWeb, its CDN loaders and js_interop_stub.dart are
removed, and DownloadManager no longer takes DeviceInfoPlugin.
2026-10-01 15:49:46 +07:00
Dat Vu 3debda2ba1 TF-4799 Fix HTML Mail be truncated in width (#4806) 2026-09-09 05:02:09 +07:00
Huy Quang Nguyen b4b73554ed TF-4744: Inherit typography from design system TwakeInter (#4749) 2026-08-14 14:33:17 +07:00
Dat Vu e9b412dbfa TF-4664 Fix can't set my break line in my answer where I want (#4734) 2026-08-06 18:07:03 +07:00
Dat Dang 129733d6d3 TF-4684 Add drive card hover close button (#4690) 2026-07-24 11:51:59 +07:00
Dat Dang 828f64ec34 Optimize Drive link UI (#4719) 2026-07-21 18:18:53 +07:00
Dat Dang 082efd797b HOTFIX Drive link card UI (#4709) 2026-07-21 12:02:49 +07:00
Dat Dang 38c1c22759 TF-4661 Improve drive link UI (#4676) 2026-07-14 19:39:53 +07:00
dab246 f7e871220b TF-4482 Fix invitation email content overflowing on narrow mobile screens 2026-05-25 15:50:47 +07:00
dab246 acc43e8332 TF-4532 Fix infinite ResizeObserver loop in HTML email viewer 2026-05-21 14:24:56 +07:00
Dat H. Pham 86c4b4ca2f fix: show orphaned inline attachments in email attachment panel
When a received email contains an inline attachment with a CID but no
matching img[src="cid:..."] in the HTML body, tmail previously hid it
completely — not shown in the body (no img tag) and not in the attachment
panel (isOutsideAttachment returned false due to hasCid+isDispositionInlined).

In GetEmailContentInteractor, extract referenced CIDs from the raw HTML
before transformation, then split allInlineImages into referenced (rendered
in body) and orphaned (no body reference). Orphaned attachments are promoted
to the attachment panel so users can see and download them.
2026-05-15 13:13:29 +07:00
dab246 5e1d99125e TF-4265 Exclude our signature by add removeTMailSignature option to extractPlainText method 2026-04-07 13:20:25 +07:00
Théo Poizat 1e43ac510b Increase Scribe mobile inline button size 2026-03-25 11:52:35 +07:00
Théo Poizat 03a03b9088 Fix Scribe on responsive mobile
- Button was not added in MobileResponsiveAppBar
- Mobile behavior related scripts were not correctly added for web composer
- Mobile behavior related scripts return value was not properly handled for web composer
- In responsive web, bottomsheet modal clicks were intercepted by iframe behind
2026-03-25 11:52:35 +07:00
Théo Poizat b5606626f4 Fix more Scribe mobile issues
- Add getSavedSelection to check saved selection without consuming it
- Distinguish between setText (replace all) and insertText (at cursor) operations
- Fix replace callback to use setText when no selection exists
- Clean up saved selection state after restoration in HTML utils
- Move mobile editor focus and selection restore to appropriate callbacks
2026-03-25 11:52:35 +07:00
Théo Poizat be7f28f270 Fix Scribe mobile issues
- Fix Scribe replace on mobile when opened from menu bar (to be complete
this fix needs this PR https://github.com/Enough-Software/enough_html_editor/pull/37)
- Ensure all mobile editor call are awaited
- Do not clear text if a selection has been restored (which mean we replace a selection)
- Avoid collapseToEnd crash
2026-03-25 11:52:35 +07:00
Théo Poizat 84176cb113 Hide keyboard and selection icons when Scribe mobile modal opened
When opening Scribe mobile modal, we now unfocus the composer to hide the keyboard and the selection start and end icons from the OS.

Add new methods to save, restore, and clear text selection in HTML editor. These methods allow preserving and restoring user selection state when opening the Scribe mobile modal so that the "replace" action still works.
2026-03-25 11:52:35 +07:00
Théo Poizat 03c70922a0 Fix selection coordinates in mobile
Because the HTML editor is different, we need a different selector to get the editable element.

We also need to add a small offset to the coordinates to avoid positionning the overlay icon above native selection UI in mobile. For example, Android adds a marker at the beginning and the end of the selection and we do not want to display the Scribe overlay icon above this marker.
2026-03-25 11:52:35 +07:00
dab246 50671b98ee fix(mu): avoid unwanted word-break in table elements
(cherry picked from commit b9cd9933a4)
2026-01-12 05:16:02 +07:00
dab246 a23d15a9ca TF-4136 refactor(logging): replace logError with logWarning for non-critical cases 2026-01-06 13:53:22 +07:00
Dang Dat 060416292f fixup! TF-4224 Reduce ReDoS vulnerability 2026-01-06 10:16:26 +07:00
Dang Dat a8f90ec700 fixup! TF-4224 Reduce ReDoS vulnerability 2026-01-06 10:16:26 +07:00
Dang Dat 86dec27d67 fixup! TF-4224 Reduce ReDoS vulnerability 2026-01-06 10:16:26 +07:00
Dang Dat 2b909aeb1c TF-4224 Reduce ReDoS vulnerability 2026-01-06 10:16:26 +07:00
Dang Dat a31898185e [Memory leak] Handle dispose in MobileEditorWidget 2025-12-29 10:11:56 +07:00
dab246 2b70b660f0 hotfix(ai-scribe): With a lot of content and selecting all content, do not see the AI selection button 2025-12-23 17:26:28 +07:00
Dat H. Pham 0a8ec3fbc0 fix: add console error to log text selection failed 2025-12-19 19:03:39 +07:00
dab246 6e09d853fd feat(ai-scribe): Fix the English locale file `(intl_en.arb)` is missing all three AI Scribe keys
feat(ai-scribe): Fix async function declared without proper return type annotation.

feat(ai-scribe): Fix Async operations not properly awaited.

feat(ai-scribe): Fix inconsistent capitalization between button labels.

feat(ai-scribe): Fix GenerateAITextFailure check will never match.

feat(ai-scribe): Fix consider validating text input for predefined actions.

feat(ai-scribe): Using a subshell for directory isolation.

feat(ai-scribe): Fix verify the mock usage or document intent.

feat(ai-scribe): Using a more conventional import for Offset.

feat(ai-scribe): Adding error handling for consistency

feat(ai-scribe): Remove `fromJson` and `toJson` of AIResponse

feat(ai-scribe): Using constants for role values.

feat(ai-scribe): Using a more specific import.

feat(ai-scribe): Using Timer for cleaner lifecycle management

feat(ai-scribe): Adding error handling to fromMap() for consistency.

feat(ai-scribe): Disposing the ValueNotifier

feat(ai-scribe): Redundant null check after assignment

feat(ai-scribe): Fix calling `registerSelectionChangeListener` multiple times may be inefficient.

feat(ai-scribe): Safer type handling for JavaScript callback args

feat(ai-scribe): Fix async callbacks not awaited in switch statement.

feat(ai-scribe): Fix binding lifecycle mismatch for GetAIScribeConfigInteractor

feat(ai-scribe): Fix ai prompts

feat(ai-scribe): Fix unawaited async call to `_setupSelectionListener`

feat(ai-scribe): Fix switch cases use top-origin coordinates while `PositionedDirectional(bottom:)`` expects bottom-origin coordinates.

feat(ai-scribe): Adding error handling for selection listener setup.
2025-12-19 19:03:39 +07:00
Théo Poizat 1a79445711 Add a method to delete selection content 2025-12-19 19:03:39 +07:00