obsidian-advanced-uri icon indicating copy to clipboard operation
obsidian-advanced-uri copied to clipboard

exception when involved from markdownload

Open pcause opened this issue 1 year ago • 3 comments

When I try to send a page from my browser to Obsidian using markdownload, advanced URI shows this error in the console:

ncaught (in promise) DOMException: Failed to execute 'readText' on 'Clipboard': Document is not focused. at eval (plugin:obsidian-advanced-uri:4764:53) at t (app://obsidian.md/app.js:1:2296691) at :1:52 at node:electron/js2c/renderer_init:2:16470 at IpcRendererInternal. (node:electron/js2c/renderer_init:2:10723) at IpcRendererInternal.emit (node:events:519:28) at Object.onMessage (node:electron/js2c/renderer_init:2:8837) app.js:1 Received URL action Object

pcause avatar Aug 15 '24 16:08 pcause

Seems like it requires the app to be focused for the clipboard's content to be accessed. Shouldn't the launch of the uri focus the app? I haven't used markdownload, though.

Vinzent03 avatar Aug 15 '24 19:08 Vinzent03

I have the same issue.

I can reproduce using a uri like:

obsidian://advanced-uri?vault=Myvault&clipboard=true&mode=new&filepath=90 - Web Clippings/test.md

This is the uri that markdownload is triggering

If I remove the clipboard query parameter the page gets created (without content as expected, but without errors).

I tried with both, Obsidian already open or closed.

brpaz avatar Sep 19 '24 20:09 brpaz

Seems like it requires the app to be focused for the clipboard's content to be accessed. Shouldn't the launch of the uri focus the app? I haven't used markdownload, though.

I am not sure if it will be helpful but I dig their code for this line: https://github.com/deathau/markdownload/blob/7e8cc1a2156a5b413db133677641c3f8a23cd39d/src/contentScript/contentScript.js#L106

Bug behavior:

  • If Obsidian is closed, clicking on "Send to Obsidian" option in MarkDownload works perfect
  • If Obsidian is opened, it's switching focus from browser to obsidian but nothing is happening
  • If Obsidian is opened, and after clicking "Send to Obsidian" I focus on the app really fast, it works again

M4NH3X avatar Sep 25 '24 15:09 M4NH3X