Conversation
Contributor
Author
Collaborator
|
感谢提交!粘贴流水线 + 工具条 + lightbox 的方向我们很认可,这会是图片功能的主体实现。 合并前有三个必改项:
修完这三项我们会尽快再审一轮。 |
…gration Image input now saves to an assets/ folder beside the document instead of leaking base64 into the source (marswaveai#21): - Intercept clipboard and drops (incl. rich-text data: URIs from WeChat or browsers), persist images with SHA-256 content-hash names, insert relative-path references; untitled docs are asked to save first - Floating toolbar on selection: width presets, drag-resize handle, caption/alt editing, replace, copy, reveal-in-folder, delete; applied widths persist as inline <img … width> (Typora model) - Double-click opens a fullscreen viewer: wheel zoom, drag pan, arrow-key navigation across document images, Esc to close - Broken image references render an inline action box (relocate/reveal) instead of a silent broken glyph - Legacy documents with inline base64 get a one-click extract-to-files banner; source mode wraps long tokens instead of scrolling sideways Design reference: MarkText imageAction hook and hash naming, VS Code markdown copyFiles untitled rule (both MIT), Zettlr clipboard intent rule (ideas only, GPL). Registered in design.md §图片 and feature-requests.md.
Interaction rework after side-by-side comparison with Feishu: - Toolbar floats in on hover (no selection needed), centered above the image; percentage width presets removed - Four corner dot handles resize proportionally from any corner (left handles shrink toward drag direction); a plain click on a handle no longer rewrites the document - Caption (alt) renders centered below the image in both node view and inline-HTML view instead of an overlay input - Lightbox: fixed double-shrink (CSS max-width stacked with the fit transform, opening huge images at ~29%); fit is now transform-only and fills the viewport Stability hardening from stress testing: - Save guard: autosave/⌘S/close snapshots wait for in-flight image asset writes so placeholder blob: URLs never reach disk - Exports hide the toolbar/handles first - Undo can no longer cross the document-load boundary (⌘Z spam used to roll the editor back to the welcome document and autosave would then overwrite the user's file with it) — found by GUI stress testing Node-level stress suite: 40-URI (2 MB) migration in 4 ms, 200-URI dedup to 2 files, sha256 hash naming/dedup, escaping, garbage-URI tolerance.
…mage Shrinking an image exposed the missing alignment story: a narrow image sat hard-left and the caption drifted with it. Following Feishu: - Toolbar gains an alignment trio (left/center/right, linear SVG icons, current state highlighted) ahead of the caption group - Alignment persists as inline HTML (style="display:block;margin:..."); width+align mutations now parse the html value, patch one field and rebuild it (no regex residue), and dropping every HTML-specific feature (no width, left-aligned) restores plain markdown image syntax - Inline-HTML image wrappers become block units so the caption sits under the image and follows its alignment (fixes the caption drifting beside resized images) - Every in-place html update rebinds the toolbar to the rebuilt node view - previously the overlay kept pointing at the detached img, so the alignment highlight went stale
Alignment was written as the CSS shorthand (margin:0 0 0 auto) but read back with a margin-left:auto regex, so after a right-align the toolbar kept highlighting left and the caption stayed put. Read the alignment via CSSOM (img.style.marginLeft), which expands shorthands, and refresh the feature-request notes to match the shipped interaction.
Right-aligning an image dragged the caption to the column edge and left-aligning pinned it to the far left — the caption was aligned to the text column instead of the picture. Inline-HTML images now render img + caption inside a shrink-to-fit frame that owns the alignment margins (moved off the img at render time), so the caption is always centered under the picture whatever the alignment is. The persisted img style is untouched, and the caption is still just the standard markdown alt text.
moyu12-ae
force-pushed
the
feat/image-pipeline
branch
from
September 7, 2026 12:28
b22ca5e to
0886813
Compare
Collaborator
|
维护者决定不做这个方案,关闭本 PR。你之前的 #68、#70 都合了、质量很扎实,所以这次的判断需要说清楚——不是实现问题,是方向问题:
其中 base64 → assets 本地化这一件事本身有价值(内嵌图片会让 感谢这份投入,抱歉方向没对上。 |
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
Reopens #21 (removed before v1.9.0 for reliability) with a full image experience, designed against Typora / Obsidian / Feishu / VS Code and stress-tested.
Image input (fixes the base64 leak)
assets/folder beside the document (SHA-256 content-hash filenames, deduplicated) and insert relative-path referencesdata:URIs (WeChat / browsers) are intercepted, so base64 never reaches the markdown sourceresolveImagePaths/restoreImagePathsround-tripImage interaction (Feishu-style)
<img … width style>(Typora model), and dropping every HTML-specific feature restores plain![]()Legacy document cleanup
Stability hardening (found by stress testing)
blob:URLs never reach diskVerification
tsc(main/preload/renderer),electron-vite build, theme color contract: all greenDocs
design.md§图片 (new),docs/feature-requests.md(功能需求 #21 → implemented),resources/demo/changelog.md(Unreleased)Closes #21