Commit graph

223 commits

Author SHA1 Message Date
tcyeee
fe9ad6d042 chore(release): bump version to 1.3.7
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-10 17:27:38 +08:00
tcyeee
4ff21baf2c feat: add per-image exclude/delete actions and precise multi-image drag-out
- Show exclude/delete buttons on hover for images inside a group; deleting an
  image still referenced elsewhere in the vault now asks for confirmation
  before touching the original file.
- Track each image's own start/end offset within its line (getImageMatches)
  so dragging one image out of a line with multiple images no longer removes
  or disturbs its neighbors.
- Group the image settings panel into labeled sections (Canvas size /
  Appearance) for clarity.

Also satisfies Obsidian's plugin lint pass: bump tsconfig `lib` to ES2019
(Object.entries/Array.flat were silently type-checked only via @types/node's
hidden lib reference, not the project's own lib config), switch remaining
bare `document` event listeners to `activeDocument` for popout-window
compatibility, and replace `el.closest(...) as HTMLElement | null` with the
explicit `el.closest<HTMLElement>(...)` generic form (the `as` cast was
itself supplying the contextual type that made the assertion look
redundant to `no-unnecessary-type-assertion`).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-10 17:27:13 +08:00
tcyeee
5f3c0b9cd8 fix: declare @codemirror/state and @codemirror/view as explicit devDependencies
Source imports EditorView directly from @codemirror/view (used by
editor-drop-target.ts, hover-group-trigger.ts, image-drag-source.ts,
markdown/persistence.ts), but these packages only existed as peer-dependency
resolutions of obsidian, not as top-level devDependencies. Locally pnpm
auto-hoists them so the build worked, but CI's `pnpm install --frozen-lockfile`
did not reliably hoist them, causing tsc to fail with "Cannot find module
'@codemirror/view'" — this is why the pushed 1.3.6 tag's release workflow
run failed and no GitHub release was ever created for it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-10 14:30:23 +08:00
tcyeee
0a6ce2da53 fix: patch js-yaml override that still allowed the vulnerable version
The pnpm override pinned js-yaml to ^4.1.1, but the DoS advisory
(GHSA-h67p-54hq-rp68) covers <=4.1.1 with the fix landing in 4.2.0 —
so the override was resolving straight to the vulnerable version.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-10 14:27:19 +08:00
tcyeee
ed6954a22b ci: publish releases directly instead of leaving them as drafts
gh release create --draft has been requiring a manual "Publish release"
click on GitHub after every CI run since this workflow was added; if that
step gets forgotten, Obsidian's manifest.json version has no matching
public release ("No release matches your manifest version"). Every prior
release was published this way by hand. Drop --draft so a green CI run is
itself the publish step, and pull release notes from the pushed annotated
tag's message (with --generate-notes as a fallback for lightweight tags)
instead of leaving the release body empty.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-09 21:25:23 +08:00
tcyeee
5c87a76e9b chore(release): bump version to 1.3.6
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-09 21:14:25 +08:00
tcyeee
1f58cbf7a8 refactor: trigger Group button on focus-within instead of hover
The native edit-block-button on an ungrouped image embed appears on
:focus-within, not :hover — anchoring the injected Group button to the
same trigger keeps the two visually and behaviorally consistent (previously
the Group button showed on .cm-embed-block:hover, which could appear/disappear
independently of the native button). Switches the button to a real <button>
element, resets its native button chrome (background/border/height) to match
the plain-div edit-block-button, and raises its own CSS specificity so it
reliably sits above the native button's focus z-index without !important.

Also resolves the event target via UIEvent.targetNode (Node) instead of the
raw EventTarget from e.target, so the eligibility check can use Obsidian's
cross-window-safe .instanceOf() instead of a bare instanceof that breaks for
notes opened in a popout window.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-09 20:59:25 +08:00
tcyeee
9df9d5d7a8 feat: add option to trim solid-color borders from generated thumbnails
Design-mockup exports and screenshots often carry a solid-color canvas
border (e.g. black padding), which a plain center-square crop bakes into
the thumbnail whenever the padded side is the one left untouched by the
crop. detectContentRect heuristically finds and trims that border before
cropping. Off by default risk of false positives on content that's itself
close to a solid background is mitigated by a settings toggle
(enableThumbnailBorderTrim, on by default) to fall back to the old
full-image center crop.

Also fixes thumbnail generation to update every <img> waiting on a given
thumbnail path, not just the one passed into the first call — the same
thumbnail can be requested by multiple re-renders of the same code block
before generation finishes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-09 20:56:52 +08:00
tcyeee
0253c9e8bd fix: eliminate races between Live Preview re-renders and image-group persistence
Dragging a standalone image into a group could silently fail (optimistic
temp wrapper never rolled back) because persistDragInsertToSource read the
file via vault.read(), which measurably lags behind the live CodeMirror
editor buffer for a currently-open file — an in-bounds line index computed
from the editor would come back out-of-bounds a moment later. Reading from
the live editor buffer instead (readCurrentContent) removes the stale-read
window entirely; persistence calls now also report success/failure so the
caller can roll back the optimistic DOM insert on failure, and are queued
per file path so overlapping drags can't interleave their reads and writes.

Also guards the code-block re-render lifecycle: rapid re-renders of the same
`el` (e.g. triggered by the plugin's own writes) could leave a stale
container's settingWrapper/click-listener/drag-sort bindings alive alongside
the new render, causing duplicated event handling and drag indicator glitches.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-09 20:54:32 +08:00
tcyeee
76446c9552 fix: immediately remove source wrapper during drag-out to prevent thumbnail flicker 2026-07-04 17:45:51 +08:00
tcyeee
741a6cf0a5 refactor: simplify Group button by anchoring it to native edit-block-button
Instead of tracking hover state and positioning the Group button manually,
inject it once next to the native edit-block-button and let CSS hover rules
handle show/hide together.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-04 15:06:11 +08:00
tcyeee
d99225812c fix: remove stray Group hover button after dragging its image into a group
The button is a fixed-position element appended to document.body and
only cleaned up via mouseover/mouseout. Native drag-and-drop suppresses
those events for the drag's duration, so when the hovered image was
dragged into a group the underlying <img> was removed by the editor
re-render but the floating button was never told to clean up, leaving
it stuck at the image's old position. Removing it on dragstart for the
active image closes that gap.
2026-07-04 14:18:18 +08:00
tcyeee
a81a0dab2f fix: prevent dragging out of a group from embedding the cache thumbnail
The <img> is draggable by the browser by default, so starting a drag
on it made the browser treat the <img> itself as the native drag
source and auto-populate drag data from img.src, which points at the
cached thumbnail rather than the original file. This raced with the
plugin's own wrapper-level drag payload and let Obsidian's drop
handling embed the cache path instead. Disabling native drag on the
<img> forces the wrapper (which carries the correct markdown line) to
be the sole drag source.
2026-07-04 14:18:13 +08:00
tcyeee
d763516289 docs: describe drag-to-group setting as bidirectional 2026-07-04 01:54:54 +08:00
tcyeee
093de0203c style: add drop-line indicator for dragging an image out of a group 2026-07-03 16:33:04 +08:00
tcyeee
e1fe59a73f feat: wire up editor drop target in plugin entry point 2026-07-03 16:31:32 +08:00
tcyeee
213d0c84e1 feat: add editor drop target for dragging an image out of a group 2026-07-03 16:28:50 +08:00
tcyeee
2703f5f796 feat: add persistDragOutToSource to move an image from a group into the document 2026-07-03 16:25:40 +08:00
tcyeee
457db3f8b7 feat: record group-drag state when dragging a wrapper inside an image group 2026-07-03 16:23:12 +08:00
tcyeee
ff1127ada1 feat: add drag state for dragging an image out of an image group 2026-07-03 16:21:08 +08:00
tcyeee
00f9107a60 docs: add design spec for dragging an image out of an image group 2026-07-03 16:02:52 +08:00
tcyeee
1fdba6c029 feat: highlight image group on drag-over and allow dropping in blank space
Adds a container-level drag target highlight and a row-based nearest-
image fallback so dropping between images or in trailing blank space
inserts at the expected position, not just directly on a wrapper.
2026-07-03 15:49:14 +08:00
tcyeee
ffcc28ac1a feat: allow dragging a standalone image into an existing image group
Reuses the CM6-based line mapping from the hover-to-group button to
identify the drag source, and performs the removal + insertion as a
single vault read-modify-write to avoid a two-write race. Guards
against cross-file drags and same-line multi-image cases.
2026-07-03 15:33:11 +08:00
tcyeee
e0ca92d898 feat: add hover-to-group button for standalone images in Live Preview
Avoids conflicting with other plugins' image right-click menus by
triggering the imgs-block conversion via a hover overlay button
instead, using CM6's public EditorView API to map the DOM image back
to its source line.
2026-07-03 14:57:00 +08:00
tcyeee
862eec2a92 feat(panel): implement delayed close functionality for settings panel 2026-06-30 13:51:15 +08:00
tcyeee
5c5c752262 chore(release): bump version to 1.3.5
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 12:14:06 +08:00
tcyeee
b0c223867f feat: add margin-left CSS variable for container settings in layout and styles 2026-06-30 12:12:50 +08:00
tcyeee
e32d5b489e feat: add padding-left configuration option and update related settings in the image cluster plugin 2026-06-30 12:09:53 +08:00
tcyeee
994a65b2e1 fix: update package name and description, set author in package.json; improve menu item title and use activeWindow for panel positioning 2026-06-17 23:18:45 +08:00
tcyeee
a34fa9d2a1 feat(thumbnail): add thumbnail generation functionality with concurrency handling
refactor(styles): update styles to use CSS variables for better theming support

chore(versions): update versioning to include new release
2026-06-11 15:57:38 +08:00
tcyeee
a93efb8805 Bump version to 1.3.4: use setIcon API and optimize file lookup
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-24 14:15:37 +08:00
tcyeee
8f26c9cbc6 Bump version to 1.3.3
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-24 13:32:47 +08:00
tcyeee
dd83b99bfb Migrate to pnpm, refactor DOM helpers to Obsidian APIs, and use activeWindow/activeDocument globals
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-24 13:30:22 +08:00
tcyeee
277c09263a Update version to 1.3.2 in manifest.json and version.md. Enhance zoom functionality by centering zoom on cursor position for scroll and pinch gestures, and improve drag interactions by disabling CSS transitions during drag events to prevent flickering. 2026-03-26 01:02:26 +08:00
tcyeee
ed240b06ce Update version to 1.3.2 in manifest.json and version.md. Enhance zoom functionality by centering zoom on cursor position for scroll and pinch gestures, and improve drag interactions by disabling CSS transitions during drag events to prevent flickering. 2026-03-26 00:59:42 +08:00
tcyeee
6ccee6dee6 Add touch event handling for pinch gestures in image processing. Implement logic to prevent closing the preview during pinch actions, enhancing user experience on mobile devices. 2026-03-26 00:38:06 +08:00
tcyeee
dc200d1a31 Refactor image processing to improve touch and click interactions for mobile and desktop. Introduce touch event handling for drag and pinch gestures, and enhance click detection to prevent unintended actions. Update utility functions for better readability. 2026-03-26 00:28:07 +08:00
tcyeee
10112c720d Update version to 1.3.2, adding support for Obsidian wiki-link syntax in image blocks, fixing memory leaks, and resolving the "+N" mask click issue. Enhance UI synchronization for limit checkbox on mask click. 2026-03-25 23:53:14 +08:00
tcyeee
1227613904 Update version in manifest.json from 1.4.0 to 1.3.1 2026-03-25 14:14:57 +08:00
tcyeee
931113c210 Add support for tall image previews with scrollable overlay. Implement adaptive styling based on aspect ratio and enhance wheel zoom functionality to prevent overlay scrolling during zoom actions. 2026-03-24 15:53:20 +08:00
tcyeee
2243fd380a Add support for tall image previews with scrollable overlay. Implement adaptive styling based on aspect ratio and enhance wheel zoom functionality to prevent overlay scrolling during zoom actions. 2026-03-24 15:52:29 +08:00
tcyeee
13a41f05e7
Update manifest.json 2026-03-23 10:28:31 +08:00
tcyeee
5544cb2955 Refactor image styling updates to use setCssProps for better maintainability. Improve cursor handling during drag events and enhance image transition animations for smoother visual effects. 2026-03-23 09:55:23 +08:00
tcyeee
b883c6c480 Add safe zone for image panel to prevent premature closure on mouse leave. Update event handling for panel visibility based on mouse interactions with the safe zone. 2026-03-23 01:58:43 +08:00
tcyeee
d9c4c7b4ef Add safe zone for image panel to prevent premature closure on mouse leave. Update event handling for panel visibility based on mouse interactions with the safe zone. 2026-03-23 01:42:48 +08:00
tcyeee
5350a5d186 Add settings management to ImgRowPlugin, including loading and saving user preferences. Introduce a settings tab for user configuration and ensure default settings are applied immediately. 2026-03-23 01:30:17 +08:00
tcyeee
3f13d2d804 Add drag-and-drop sorting functionality for images in edit mode. Update styles for draggable elements and implement persistence of new order to the Markdown source. 2026-03-23 01:28:07 +08:00
tcyeee
7132ad9474 Add drag-and-drop functionality for image preview with scaling support. Update styles for cursor interaction and enhance image transition animations. 2026-03-23 01:23:32 +08:00
tcyeee
d8775c2d65 Refactor image setting panel positioning to use fixed positioning, improving interaction and visibility by detaching from CodeMirror's rendering context. Update event handling for panel visibility based on user interactions. 2026-03-23 01:12:48 +08:00
tcyeee
1a3bf3df69 Adjust positioning of image setting outer container for improved layout and visibility in the preview code block. 2026-03-23 01:04:25 +08:00