Skip to content

Commit

Permalink
Fix CI, update README
Browse files Browse the repository at this point in the history
  • Loading branch information
HuakunShen committed May 1, 2024
1 parent 63aabc3 commit 63c0b21
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 30 deletions.
19 changes: 19 additions & 0 deletions .changes/v0.6.8-win-html-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

---
"tauri-plugin-clipboard": patch
---

# v0.6.8

> 2024-05-01
Fix Windows html write bug.

> On windows, writing large chunks of html to clipboard fails. Data truncated.
This was fixed in `clipboard-rs` in v0.1.7.

Issues:
- https://github.com/CrossCopy/tauri-plugin-clipboard/issues/29
- https://github.com/ChurchTao/clipboard-rs/issues/23

4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
check:
cargo fmt
cargo clippy --all-targets --all-features -- -D warnings

9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Tauri Plugin clipboard

[![Deploy VitePress site to Pages](https://github.com/CrossCopy/tauri-plugin-clipboard/actions/workflows/docs.yml/badge.svg)](https://github.com/CrossCopy/tauri-plugin-clipboard/actions/workflows/docs.yml)
[![Clippy](https://github.com/CrossCopy/tauri-plugin-clipboard/actions/workflows/clippy.yml/badge.svg)](https://github.com/CrossCopy/tauri-plugin-clipboard/actions/workflows/clippy.yml)
[![Format](https://github.com/CrossCopy/tauri-plugin-clipboard/actions/workflows/format.yml/badge.svg)](https://github.com/CrossCopy/tauri-plugin-clipboard/actions/workflows/format.yml)
[![Test](https://github.com/CrossCopy/tauri-plugin-clipboard/actions/workflows/test.yml/badge.svg)](https://github.com/CrossCopy/tauri-plugin-clipboard/actions/workflows/test.yml)
![Crates.io Version](https://img.shields.io/crates/v/tauri-plugin-clipboard)
![NPM Version](https://img.shields.io/npm/v/tauri-plugin-clipboard-api)
[![Documentation](https://docs.rs/tauri-plugin-clipboard/badge.svg)](https://docs.rs/tauri-plugin-clipboard)
![GitHub License](https://img.shields.io/github/license/CrossCopy/tauri-plugin-clipboard)

## Documentation Website: https://crosscopy.github.io/tauri-plugin-clipboard

> A Tauri plugin for clipboard read/write/monitor. Support text, rich text, HTML, files and image.
Expand Down
22 changes: 0 additions & 22 deletions src/bin/files.rs

This file was deleted.

18 changes: 10 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ where
fn on_clipboard_change(&mut self) {
let _ = self.app_handle.emit_all(
"plugin:clipboard://clipboard-monitor/update",
format!("clipboard update"),
"clipboard update",
);
}
}
Expand All @@ -46,14 +46,16 @@ pub struct ClipboardManager {
watcher_shutdown: Arc<Mutex<Option<WatcherShutdown>>>,
}

impl ClipboardManager {
pub fn default() -> Self {
return ClipboardManager {
clipboard: Arc::new(Mutex::from(ClipboardContext::new().unwrap())),
impl Default for ClipboardManager {
fn default() -> Self {
Self {
clipboard: Arc::new(Mutex::new(ClipboardContext::new().unwrap())),
watcher_shutdown: Arc::default(),
};
}
}
}

impl ClipboardManager {
pub fn has(&self, format: ContentFormat) -> Result<bool, String> {
Ok(self
.clipboard
Expand Down Expand Up @@ -132,7 +134,7 @@ impl ClipboardManager {
.iter()
.map(|file| {
if file.starts_with("file://") {
file[7..].to_string()
file.strip_prefix("file://").unwrap().to_string()
} else {
file.to_string()
}
Expand Down Expand Up @@ -179,7 +181,7 @@ impl ClipboardManager {
/// read image from clipboard and return a base64 string
pub fn read_image_base64(&self) -> Result<String, String> {
let image_bytes = self.read_image_binary()?;
let base64_str = general_purpose::STANDARD_NO_PAD.encode(&image_bytes);
let base64_str = general_purpose::STANDARD_NO_PAD.encode(image_bytes);
Ok(base64_str)
}

Expand Down

0 comments on commit 63c0b21

Please sign in to comment.