๐ Capacitor Doctor ๐
Latest Dependencies:
@capacitor/cli: 1.3.0
@capacitor/core: 1.3.0
@capacitor/android: 1.3.0
@capacitor/ios: 1.3.0
Installed Dependencies:
@capacitor/cli 1.3.0
@capacitor/core 1.3.0
@capacitor/android 1.3.0
@capacitor/ios 1.3.0
[fatal] Platform electron is not valid.
[success] Android looking great! ๐
Found 3 Capacitor plugins for ios:
cordova-plugin-inappbrowser (3.1.0)
cordova-plugin-ionic (5.4.5)
cordova-plugin-whitelist (1.3.4)
[success] iOS looking great! ๐
โจ Done in 8.91s.
When I try to copy text using Clipboard.write({string: value}), it works on Chrome/Firefox/Android/iOS but not Safari.
Non-Error promise rejection captured with value: Clipboard API not available in this browser
I expect copying to work in Safari as it does on all other browsers/platforms.
import { Plugins } from '@capacitor/core';
const { Clipboard } = Plugins;
Clipboard.write({ string: "Text To Copy" })
Just try to use the basic Clipboard.write() function in Safari.
yarn --version output: 1.19.1
node --version output: v13.1.0
Non-Error promise rejection captured with value: Clipboard API not available in this browser
Capacitor is not magical, if an API is not supported in a browser we can't do anything about it. I think the message is clear enough, Clipboard API not available in Safari. https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API
The Capacitor Clipboard API (https://capacitor.ionicframework.com/docs/apis/clipboard/) is the one I was talking about, and while it certainly might rely on the browser's Clipboard API, it's not restricted to that. It was my understanding that part of the role of Capacitor was to handle fall-backs for different platforms, and it seems people have had luck with other strategies of implementing copy in Safari that Capacitor could use if needed.
e.g. https://gist.github.com/rproenca/64781c6a1329b48a455b645d361a9aa3
We started using capacitor's Clipboard Plugin expecting it to take care of different platforms, adding polyfills if needed. Isn't that the goal of this plugin?
cc @jcesarmobile
Most helpful comment
The Capacitor Clipboard API (https://capacitor.ionicframework.com/docs/apis/clipboard/) is the one I was talking about, and while it certainly might rely on the browser's Clipboard API, it's not restricted to that. It was my understanding that part of the role of Capacitor was to handle fall-backs for different platforms, and it seems people have had luck with other strategies of implementing copy in Safari that Capacitor could use if needed.
e.g. https://gist.github.com/rproenca/64781c6a1329b48a455b645d361a9aa3