diff --git a/plugins/clipboard-manager/src/api-iife.js b/plugins/clipboard-manager/src/api-iife.js index 8dc516551..bbf9cff62 100644 --- a/plugins/clipboard-manager/src/api-iife.js +++ b/plugins/clipboard-manager/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_PLUGIN_CLIPBOARDMANAGER__=function(e){"use strict";async function n(e,n={},r){return window.__TAURI_INTERNALS__.invoke(e,n,r)}return"function"==typeof SuppressedError&&SuppressedError,e.readText=async function(){return(await n("plugin:clipboard-manager|read")).plainText.text},e.writeText=async function(e,r){return n("plugin:clipboard-manager|write",{data:{plainText:{label:r?.label,text:e}}})},e}({});Object.defineProperty(window.__TAURI__,"clipboardManager",{value:__TAURI_PLUGIN_CLIPBOARDMANAGER__})} +if("__TAURI__"in window){var __TAURI_PLUGIN_CLIPBOARDMANAGER__=function(n){"use strict";async function r(n,r={},a){return window.__TAURI_INTERNALS__.invoke(n,r,a)}return"function"==typeof SuppressedError&&SuppressedError,n.clear=async function(){await r("plugin:clipboard-manager|clear")},n.readText=async function(){return(await r("plugin:clipboard-manager|read")).plainText.text},n.writeHtml=async function(n,a){return r("plugin:clipboard-manager|write_html",{data:{html:{html:n,altHtml:a}}})},n.writeText=async function(n,a){return r("plugin:clipboard-manager|write",{data:{plainText:{label:a?.label,text:n}}})},n}({});Object.defineProperty(window.__TAURI__,"clipboardManager",{value:__TAURI_PLUGIN_CLIPBOARDMANAGER__})} diff --git a/plugins/clipboard-manager/src/desktop.rs b/plugins/clipboard-manager/src/desktop.rs index 86ff08628..acf63c800 100644 --- a/plugins/clipboard-manager/src/desktop.rs +++ b/plugins/clipboard-manager/src/desktop.rs @@ -29,12 +29,10 @@ pub struct Clipboard { impl Clipboard { pub fn write(&self, kind: ClipKind) -> crate::Result<()> { match kind { - ClipKind::PlainText { text, .. } => { - match &self.clipboard { - Ok(clipboard) => clipboard.lock().unwrap().set_text(text).map_err(Into::into), - Err(e) => Err(crate::Error::Clipboard(e.to_string())), - } - } + ClipKind::PlainText { text, .. } => match &self.clipboard { + Ok(clipboard) => clipboard.lock().unwrap().set_text(text).map_err(Into::into), + Err(e) => Err(crate::Error::Clipboard(e.to_string())), + }, _ => Err(crate::Error::Clipboard("Invalid clip kind!".to_string())), } } @@ -52,18 +50,20 @@ impl Clipboard { pub fn write_html(&self, kind: ClipKind) -> crate::Result<()> { match kind { ClipKind::Html { html, alt_html, .. } => match &self.clipboard { - Ok(clipboard) => clipboard.lock().unwrap().set_html(html, alt_html).map_err(Into::into), + Ok(clipboard) => clipboard + .lock() + .unwrap() + .set_html(html, alt_html) + .map_err(Into::into), Err(e) => Err(crate::Error::Clipboard(e.to_string())), - } + }, _ => Err(crate::Error::Clipboard("Invalid clip kind!".to_string())), - } } + } pub fn clear(&self) -> crate::Result<()> { match &self.clipboard { - Ok(clipboard) => { - clipboard.lock().unwrap().clear().map_err(Into::into) - } + Ok(clipboard) => clipboard.lock().unwrap().clear().map_err(Into::into), Err(e) => Err(crate::Error::Clipboard(e.to_string())), } } diff --git a/plugins/clipboard-manager/src/lib.rs b/plugins/clipboard-manager/src/lib.rs index 3f830e161..bbfe59189 100644 --- a/plugins/clipboard-manager/src/lib.rs +++ b/plugins/clipboard-manager/src/lib.rs @@ -55,8 +55,6 @@ pub fn init() -> TauriPlugin { #[cfg(desktop)] commands::write_html, #[cfg(desktop)] - commands::read_html, - #[cfg(desktop)] commands::clear ]) .setup(|app, api| { diff --git a/plugins/clipboard-manager/src/models.rs b/plugins/clipboard-manager/src/models.rs index 110ab3334..bb8c9b543 100644 --- a/plugins/clipboard-manager/src/models.rs +++ b/plugins/clipboard-manager/src/models.rs @@ -7,12 +7,18 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub enum ClipKind { - PlainText { label: Option, text: String }, - Html { html: String, alt_html: Option } + PlainText { + label: Option, + text: String, + }, + Html { + html: String, + alt_html: Option, + }, } #[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub enum ClipboardContents { - PlainText { text: String } + PlainText { text: String }, }