Skip to content

Commit

Permalink
pnpm run build and cargo fmt
Browse files Browse the repository at this point in the history
Signed-off-by: TukanDev <contact@tukandev.com>
  • Loading branch information
TukanDev committed Feb 25, 2024
1 parent 64e8b35 commit 1312cb0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion plugins/clipboard-manager/src/api-iife.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions plugins/clipboard-manager/src/desktop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@ pub struct Clipboard<R: Runtime> {
impl<R: Runtime> Clipboard<R> {
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())),
}
}
Expand All @@ -52,18 +50,20 @@ impl<R: Runtime> Clipboard<R> {
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())),
}
}
Expand Down
2 changes: 0 additions & 2 deletions plugins/clipboard-manager/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
#[cfg(desktop)]
commands::write_html,
#[cfg(desktop)]
commands::read_html,
#[cfg(desktop)]
commands::clear
])
.setup(|app, api| {
Expand Down
12 changes: 9 additions & 3 deletions plugins/clipboard-manager/src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@ use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClipKind {
PlainText { label: Option<String>, text: String },
Html { html: String, alt_html: Option<String> }
PlainText {
label: Option<String>,
text: String,
},
Html {
html: String,
alt_html: Option<String>,
},
}

#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClipboardContents {
PlainText { text: String }
PlainText { text: String },
}

0 comments on commit 1312cb0

Please sign in to comment.