Skip to content

Commit

Permalink
Use editor.replaceSelection instead of editor.replaceRange to allow i…
Browse files Browse the repository at this point in the history
…mage paste *before* the cursor
  • Loading branch information
Talal-A committed Aug 30, 2024
1 parent c95dea9 commit 1276880
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class ImageSelectorModal extends Modal {
const imgElement = imageDiv.createEl("img");
imgElement.src = thumbUrl;
imgElement.width = (totalWidth / 2) - 1;
imgElement.onclick = () => this.editor.replaceRange(insertionText, this.editor.getCursor());
imgElement.onclick = () => this.editor.replaceSelection(insertionText);
}

}, {threshold: [0.1]});
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "obsidian-immich",
"name": "Immich",
"version": "0.0.1",
"version": "0.0.2",
"minAppVersion": "0.15.0",
"description": "Link your Immich images within Obsidian.",
"author": "Talal Abou Haiba",
Expand Down

0 comments on commit 1276880

Please sign in to comment.