瀏覽代碼

docs(clipboard): Added allowlist section to the Clipboard module (#5014)

Mateo Gallardo 3 年之前
父節點
當前提交
d35cc77831
共有 1 個文件被更改,包括 17 次插入0 次删除
  1. 17 0
      tooling/api/src/clipboard.ts

+ 17 - 0
tooling/api/src/clipboard.ts

@@ -6,6 +6,23 @@
  * Read and write to the system clipboard.
  *
  * This package is also accessible with `window.__TAURI__.clipboard` when [`build.withGlobalTauri`](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in `tauri.conf.json` is set to `true`.
+ *
+ * The APIs must be added to [`tauri.allowlist.clipboard`](https://tauri.app/v1/api/config/#allowlistconfig.clipboard) in `tauri.conf.json`:
+ * ```json
+ * {
+ *   "tauri": {
+ *     "allowlist": {
+ *       "clipboard": {
+ *         "all": true, // enable all Clipboard APIs
+ *         "writeText": true,
+ *         "readText": true
+ *       }
+ *     }
+ *   }
+ * }
+ * ```
+ * It is recommended to allowlist only the APIs you use for optimal bundle size and security.
+ *
  * @module
  */