feat(editor): detect image URLs on paste and display as image blocks#121
Merged
feat(editor): detect image URLs on paste and display as image blocks#121
Conversation
HTTPS image URLs pasted into the editor are now detected via a multi-stage pipeline (extension check → known domain heuristic → async HEAD Content-Type check) and rendered as image blocks instead of plain links. A three-tier naming strategy is applied: page title → filename without extension → "image". Also fixes RenameDialog focus issues by moving it outside BlockNoteView, adds a read-only path row with copy button to the dialog, and strips the extension from local image upload names for consistency. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
"image"Changes
New files
src/features/editor/lib/imageUrlDetection.ts— sync image URL detection utilities (extension, domain, LRU cache)src/features/editor/api/imageUrlDetection.ts— frontend wrapper for Rust HEAD commandsrc/features/editor/lib/__tests__/imageUrlDetection.test.ts— 30 unit testsvitest.config.ts— test runner configurationModified files
src-tauri/src/link_preview.rs— addcheck_url_content_typecommand (HEAD with Range fallback)src-tauri/src/lib.rs— register new command in invoke_handlersrc-tauri/tauri.conf.json— addhttps:to CSPimg-srcfor remote image displaysrc/features/editor/hooks/useLinkPreview.ts— multi-stage paste handler with async title fallbacksrc/features/editor/ui/Editor.tsx— move RenameDialog outside BlockNoteViewsrc/features/editor/ui/RenameDialog.tsx— accept editor as prop, add PathRow componentsrc/features/editor/ui/RenameButton.tsx— passurlprop to dialog statesrc/features/editor/api/imageUpload.ts— strip extension from uploaded image namesTest plan
.jpg,.png) → image block rendered immediately🤖 Generated with Claude Code