BACK-208-Add-paste-as-markdown-support-in-Web-UI#646
Open
kuwork wants to merge 2 commits into
Open
Conversation
(cherry picked from commit e1ea342)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements automatic conversion of rich text content to Markdown when pasting into task and document editors in the Web UI. Users can now seamlessly paste content from Word, Google Docs, web pages, and other sources while maintaining proper Markdown formatting. The feature is delivered in two phases:
Phase 1 — Text, Tables, Lists, Formatting: A new
PasteAwareMDEditorwrapper interceptsonPasteevents, detects rich-text HTML on the clipboard, cleans Word-specific garbage, and converts to Markdown via Turndown with GFM support.Phase 2 — Images: Pasted images (screenshots, HTML
<img>tags, data URIs) are extracted, uploaded tobacklog/assets/.temp/, and promoted to permanent storage on save. This avoids orphaned images and base64 bloat that would cause textarea lag.Also includes three bugfixes (2026-05-09) for Excel table paste not converting to Markdown, Excel paste losing screenshot images, and Word
file://image references.Related Tasks
closes BACK-208
Task Checklist
backlog/tasks/Testing
Phase 1 — Rich text conversion:
<colgroup>/colstripping allows Turndown GFM table rule to recognise tablesPhase 2 — Image handling:
.temp/, preview works, promoted on save<img src="data:...">— base64 extracted and uploadedfile://images are silently removed (browser cannot read them).temp/files older than 30 minutesBackend & security:
localhost,127.0.0.1,::1, private IP ranges (10.x,172.16-31.x,192.168.x) are rejectedimage/*content types rejectedClientErrorcorrectly mapped to HTTP 400Automated tests:
bun test src/test/assets.test.ts— 113 lines coveringAssetManagerupload, promote, cleanup, anddownloadImagesecurity rulesbun test src/test/server-upload-promote.test.ts— 245 lines covering upload handlers, promotion edge cases, URL mapping, and error responses