mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-06-06 13:53:54 +02:00
chore: adjust prettier config, .gitignore and use taplo to format toml files (#1728)
* chore: adjust prettier config, .gitignore and use taplo to format toml files This brings the plugins-workspace repository to the same code style of the main tauri repo * format toml * ignore examples gen dir * add .vscode/extensions.json * remove packageManager field * fmt * fix audit * taplo ignore permissions autogenerated files * remove create dummy dist * fix prettier workflow * install fmt in prettier workflow --------- Co-authored-by: Lucas Nogueira <lucas@tauri.app>
This commit is contained in:
@@ -1 +0,0 @@
|
||||
/.tauri
|
||||
@@ -10,12 +10,12 @@ repository = { workspace = true }
|
||||
links = "tauri-plugin-clipboard-manager"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
rustc-args = [ "--cfg", "docsrs" ]
|
||||
rustdoc-args = [ "--cfg", "docsrs" ]
|
||||
targets = [ "x86_64-unknown-linux-gnu", "x86_64-linux-android" ]
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
targets = ["x86_64-unknown-linux-gnu", "x86_64-linux-android"]
|
||||
|
||||
[build-dependencies]
|
||||
tauri-plugin = { workspace = true, features = [ "build" ] }
|
||||
tauri-plugin = { workspace = true, features = ["build"] }
|
||||
|
||||
[dependencies]
|
||||
serde = { workspace = true }
|
||||
|
||||
@@ -60,9 +60,15 @@ fn main() {
|
||||
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
|
||||
|
||||
```javascript
|
||||
import { writeText, readText, writeHtml, readHtml, clear } from "@tauri-apps/plugin-clipboard-manager";
|
||||
await writeText("Tauri is awesome!");
|
||||
assert(await readText(), "Tauri is awesome!");
|
||||
import {
|
||||
writeText,
|
||||
readText,
|
||||
writeHtml,
|
||||
readHtml,
|
||||
clear
|
||||
} from '@tauri-apps/plugin-clipboard-manager'
|
||||
await writeText('Tauri is awesome!')
|
||||
assert(await readText(), 'Tauri is awesome!')
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
@@ -20,4 +20,4 @@ We prefer to receive reports in English.
|
||||
|
||||
Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new).
|
||||
|
||||
Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app).
|
||||
Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app).
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
* @module
|
||||
*/
|
||||
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { Image, transformImage } from "@tauri-apps/api/image";
|
||||
import { invoke } from '@tauri-apps/api/core'
|
||||
import { Image, transformImage } from '@tauri-apps/api/image'
|
||||
|
||||
/**
|
||||
* Writes plain text to the clipboard.
|
||||
@@ -26,12 +26,12 @@ import { Image, transformImage } from "@tauri-apps/api/image";
|
||||
*/
|
||||
async function writeText(
|
||||
text: string,
|
||||
opts?: { label?: string },
|
||||
opts?: { label?: string }
|
||||
): Promise<void> {
|
||||
await invoke("plugin:clipboard-manager|write_text", {
|
||||
await invoke('plugin:clipboard-manager|write_text', {
|
||||
label: opts?.label,
|
||||
text,
|
||||
});
|
||||
text
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,7 +44,7 @@ async function writeText(
|
||||
* @since 2.0.0
|
||||
*/
|
||||
async function readText(): Promise<string> {
|
||||
return await invoke("plugin:clipboard-manager|read_text");
|
||||
return await invoke('plugin:clipboard-manager|read_text')
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,11 +66,11 @@ async function readText(): Promise<string> {
|
||||
* @since 2.0.0
|
||||
*/
|
||||
async function writeImage(
|
||||
image: string | Image | Uint8Array | ArrayBuffer | number[],
|
||||
image: string | Image | Uint8Array | ArrayBuffer | number[]
|
||||
): Promise<void> {
|
||||
await invoke("plugin:clipboard-manager|write_image", {
|
||||
image: transformImage(image),
|
||||
});
|
||||
await invoke('plugin:clipboard-manager|write_image', {
|
||||
image: transformImage(image)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,9 +86,9 @@ async function writeImage(
|
||||
* @since 2.0.0
|
||||
*/
|
||||
async function readImage(): Promise<Image> {
|
||||
return await invoke<number>("plugin:clipboard-manager|read_image").then(
|
||||
(rid) => new Image(rid),
|
||||
);
|
||||
return await invoke<number>('plugin:clipboard-manager|read_image').then(
|
||||
(rid) => new Image(rid)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,10 +106,10 @@ async function readImage(): Promise<Image> {
|
||||
* @since 2.0.0
|
||||
*/
|
||||
async function writeHtml(html: string, altHtml?: string): Promise<void> {
|
||||
await invoke("plugin:clipboard-manager|write_html", {
|
||||
await invoke('plugin:clipboard-manager|write_html', {
|
||||
html,
|
||||
altHtml,
|
||||
});
|
||||
altHtml
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -122,7 +122,7 @@ async function writeHtml(html: string, altHtml?: string): Promise<void> {
|
||||
* @since 2.0.0
|
||||
*/
|
||||
async function clear(): Promise<void> {
|
||||
await invoke("plugin:clipboard-manager|clear");
|
||||
await invoke('plugin:clipboard-manager|clear')
|
||||
}
|
||||
|
||||
export { writeText, readText, writeHtml, clear, readImage, writeImage };
|
||||
export { writeText, readText, writeHtml, clear, readImage, writeImage }
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import { createConfig } from "../../shared/rollup.config.js";
|
||||
import { createConfig } from '../../shared/rollup.config.js'
|
||||
|
||||
export default createConfig();
|
||||
export default createConfig()
|
||||
|
||||
Reference in New Issue
Block a user