Enable mobile apps to use clipboard

I created a plugin that copies the content of the current note to the clipboard as HTML and noticed it doesn’t work on Android (likely neither on iOS) app.

I guess it comes from the fact that plugins are running into the WebView context of the app, and that it blocks writing to clipboard by default.

Nevertheless, I read that there are possibilities to implement a native copy to clipboard and to expose it to the JavaScript layer, perhaps with the postMessage API.

Is it plan to offer such support for plugin developers?

1 Like

I think this works.

window.navigator.clipboard.writeText(content);
app.dom.appContainerEl.win.navigator.clipboard.writeText(content);

The first one definitely does not, that’s what I tried: obsidian-export-to-html/src/main.ts at main · kalvn/obsidian-export-to-html · GitHub

But I’ll give a try to the other option, thanks for the idea!

Unfortunately it doesn’t work :frowning: