From ade4cbffaa9660b01bcd2ce7e6e2d6bb0a1ca3c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Sun, 27 Mar 2022 17:22:20 +0900 Subject: [PATCH] Add a nop clipboard provider for wasm --- helix-view/src/clipboard.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/helix-view/src/clipboard.rs b/helix-view/src/clipboard.rs index 5cc5cad89..8cd7983ba 100644 --- a/helix-view/src/clipboard.rs +++ b/helix-view/src/clipboard.rs @@ -75,7 +75,13 @@ pub fn get_clipboard_provider() -> Box { } } -#[cfg(not(any(windows, target_os = "macos")))] +#[cfg(target_os = "wasm32")] +pub fn get_clipboard_provider() -> Box { + // TODO: + Box::new(provider::NopProvider::new()) +} + +#[cfg(not(any(windows, target_os = "wasm32", target_os = "macos")))] pub fn get_clipboard_provider() -> Box { use provider::command::{env_var_is_set, exists, is_exit_success}; // TODO: support for user-defined provider, probably when we have plugin support by setting a @@ -201,6 +207,7 @@ fn set_contents(&mut self, contents: String, clipboard_type: ClipboardType) -> R } } + #[cfg(not(target_arch = "wasm32"))] pub mod command { use super::*; use anyhow::{bail, Context as _, Result};