feat: Add disabled option for pasting. (#364)
* feat: Add disabled option for pasting. * update bindings * -> none --------- Co-authored-by: CJ Pais <cj@cjpais.com>
This commit is contained in:
parent
9521ab9332
commit
c8389f34b2
5 changed files with 9 additions and 2 deletions
|
|
@ -141,6 +141,10 @@ pub fn paste(text: String, app_handle: AppHandle) -> Result<(), String> {
|
||||||
|
|
||||||
// Perform the paste operation
|
// Perform the paste operation
|
||||||
match paste_method {
|
match paste_method {
|
||||||
|
PasteMethod::None => {
|
||||||
|
// Intentionally do not perform any paste action; history/clipboard update
|
||||||
|
info!("PasteMethod::None selected - skipping paste action");
|
||||||
|
}
|
||||||
PasteMethod::CtrlV => paste_via_clipboard_ctrl_v(&text, &app_handle)?,
|
PasteMethod::CtrlV => paste_via_clipboard_ctrl_v(&text, &app_handle)?,
|
||||||
PasteMethod::Direct => paste_via_direct_input(&text)?,
|
PasteMethod::Direct => paste_via_direct_input(&text)?,
|
||||||
PasteMethod::ShiftInsert => paste_via_clipboard_shift_insert(&text, &app_handle)?,
|
PasteMethod::ShiftInsert => paste_via_clipboard_shift_insert(&text, &app_handle)?,
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,7 @@ pub enum ModelUnloadTimeout {
|
||||||
pub enum PasteMethod {
|
pub enum PasteMethod {
|
||||||
CtrlV,
|
CtrlV,
|
||||||
Direct,
|
Direct,
|
||||||
|
None,
|
||||||
ShiftInsert,
|
ShiftInsert,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -285,6 +285,7 @@ pub fn change_paste_method_setting(app: AppHandle, method: String) -> Result<(),
|
||||||
let parsed = match method.as_str() {
|
let parsed = match method.as_str() {
|
||||||
"ctrl_v" => PasteMethod::CtrlV,
|
"ctrl_v" => PasteMethod::CtrlV,
|
||||||
"direct" => PasteMethod::Direct,
|
"direct" => PasteMethod::Direct,
|
||||||
|
"none" => PasteMethod::None,
|
||||||
"shift_insert" => PasteMethod::ShiftInsert,
|
"shift_insert" => PasteMethod::ShiftInsert,
|
||||||
other => {
|
other => {
|
||||||
warn!("Invalid paste method '{}', defaulting to ctrl_v", other);
|
warn!("Invalid paste method '{}', defaulting to ctrl_v", other);
|
||||||
|
|
|
||||||
|
|
@ -607,7 +607,7 @@ export type ModelInfo = { id: string; name: string; description: string; filenam
|
||||||
export type ModelLoadStatus = { is_loaded: boolean; current_model: string | null }
|
export type ModelLoadStatus = { is_loaded: boolean; current_model: string | null }
|
||||||
export type ModelUnloadTimeout = "never" | "immediately" | "min_2" | "min_5" | "min_10" | "min_15" | "hour_1" | "sec_5"
|
export type ModelUnloadTimeout = "never" | "immediately" | "min_2" | "min_5" | "min_10" | "min_15" | "hour_1" | "sec_5"
|
||||||
export type OverlayPosition = "none" | "top" | "bottom"
|
export type OverlayPosition = "none" | "top" | "bottom"
|
||||||
export type PasteMethod = "ctrl_v" | "direct" | "shift_insert"
|
export type PasteMethod = "ctrl_v" | "direct" | "none" | "shift_insert"
|
||||||
export type PostProcessProvider = { id: string; label: string; base_url: string; allow_base_url_edit?: boolean; models_endpoint?: string | null }
|
export type PostProcessProvider = { id: string; label: string; base_url: string; allow_base_url_edit?: boolean; models_endpoint?: string | null }
|
||||||
export type RecordingRetentionPeriod = "never" | "preserve_limit" | "days_3" | "weeks_2" | "months_3"
|
export type RecordingRetentionPeriod = "never" | "preserve_limit" | "days_3" | "weeks_2" | "months_3"
|
||||||
export type ShortcutBinding = { id: string; name: string; description: string; default_binding: string; current_binding: string }
|
export type ShortcutBinding = { id: string; name: string; description: string; default_binding: string; current_binding: string }
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ const getPasteMethodOptions = (osType: string) => {
|
||||||
const baseOptions = [
|
const baseOptions = [
|
||||||
{ value: "ctrl_v", label: "Clipboard (Ctrl+V)" },
|
{ value: "ctrl_v", label: "Clipboard (Ctrl+V)" },
|
||||||
{ value: "direct", label: "Direct" },
|
{ value: "direct", label: "Direct" },
|
||||||
|
{ value: "none", label: "None" },
|
||||||
];
|
];
|
||||||
|
|
||||||
// Add Shift+Insert option for Windows and Linux only
|
// Add Shift+Insert option for Windows and Linux only
|
||||||
|
|
@ -44,7 +45,7 @@ export const PasteMethodSetting: React.FC<PasteMethodProps> = React.memo(
|
||||||
return (
|
return (
|
||||||
<SettingContainer
|
<SettingContainer
|
||||||
title="Paste Method"
|
title="Paste Method"
|
||||||
description="Clipboard (Ctrl+V) simulates Ctrl/Cmd+V keystrokes to paste from your clipboard. Direct tries to use system input methods if possible, otherwise inputs keystrokes one by one into the text field. Clipboard (Shift+Insert) uses the more universal Shift+Insert shortcut, ideal for terminal applications and SSH clients."
|
description="Ctrl+V: 'pastes' via ctrl+v. Direct: type text directly. Shift+Insert: pastes via shift+insert. None: skip paste; just update history/clipboard."
|
||||||
descriptionMode={descriptionMode}
|
descriptionMode={descriptionMode}
|
||||||
grouped={grouped}
|
grouped={grouped}
|
||||||
tooltipPosition="bottom"
|
tooltipPosition="bottom"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue