feat(ui): attach large text pastes as virtual files
Offer to turn sufficiently large plain-text clipboard pastes into pasted-context-N.txt attachments instead of inserting them into the composer, with ask/attach/inline composer settings. Co-authored-by: Serhii Dziupin <makeittech@users.noreply.github.com>
This commit is contained in:
co-authored by
Serhii Dziupin
parent
f47110c66f
commit
ef11ab5b14
@@ -25,6 +25,16 @@ export type WeekStartPreference = 'auto' | 'sunday' | 'monday';
|
||||
export type DesktopWindowControlsPosition = 'left' | 'right';
|
||||
export type DesktopWindowControlsStyle = 'classic' | 'traffic-lights';
|
||||
export type FileEditorKeymap = 'default' | 'vim';
|
||||
export type LargeTextPasteBehavior = 'ask' | 'attach' | 'inline';
|
||||
|
||||
export const DEFAULT_LARGE_TEXT_PASTE_BEHAVIOR: LargeTextPasteBehavior = 'ask';
|
||||
|
||||
export const normalizeLargeTextPasteBehavior = (value: unknown): LargeTextPasteBehavior => {
|
||||
if (value === 'attach' || value === 'inline' || value === 'ask') {
|
||||
return value;
|
||||
}
|
||||
return DEFAULT_LARGE_TEXT_PASTE_BEHAVIOR;
|
||||
};
|
||||
|
||||
function normalizeFileEditorKeymap(value: unknown): FileEditorKeymap {
|
||||
return value === 'vim' ? 'vim' : 'default';
|
||||
@@ -690,6 +700,7 @@ interface UIStore {
|
||||
showOpenCodeUpdateNotifications: boolean;
|
||||
agentControlToolEnabled: boolean;
|
||||
inputSpellcheckEnabled: boolean;
|
||||
largeTextPasteBehavior: LargeTextPasteBehavior;
|
||||
wideChatLayoutEnabled: boolean;
|
||||
codeBlockLineWrap: boolean;
|
||||
showToolFileIcons: boolean;
|
||||
@@ -851,6 +862,7 @@ interface UIStore {
|
||||
setShowOpenCodeUpdateNotifications: (value: boolean) => void;
|
||||
setAgentControlToolEnabled: (value: boolean) => void;
|
||||
setInputSpellcheckEnabled: (value: boolean) => void;
|
||||
setLargeTextPasteBehavior: (value: LargeTextPasteBehavior) => void;
|
||||
setWideChatLayoutEnabled: (value: boolean) => void;
|
||||
setCodeBlockLineWrap: (value: boolean) => void;
|
||||
setShowToolFileIcons: (value: boolean) => void;
|
||||
@@ -1001,6 +1013,7 @@ export const useUIStore = create<UIStore>()(
|
||||
showOpenCodeUpdateNotifications: !isWindowsArm64(),
|
||||
agentControlToolEnabled: true,
|
||||
inputSpellcheckEnabled: false,
|
||||
largeTextPasteBehavior: DEFAULT_LARGE_TEXT_PASTE_BEHAVIOR,
|
||||
wideChatLayoutEnabled: false,
|
||||
codeBlockLineWrap: true,
|
||||
showToolFileIcons: true,
|
||||
@@ -2152,6 +2165,9 @@ export const useUIStore = create<UIStore>()(
|
||||
setInputSpellcheckEnabled: (value) => {
|
||||
set({ inputSpellcheckEnabled: value });
|
||||
},
|
||||
setLargeTextPasteBehavior: (value) => {
|
||||
set({ largeTextPasteBehavior: normalizeLargeTextPasteBehavior(value) });
|
||||
},
|
||||
setWideChatLayoutEnabled: (value) => {
|
||||
set({ wideChatLayoutEnabled: value });
|
||||
},
|
||||
@@ -2377,6 +2393,7 @@ export const useUIStore = create<UIStore>()(
|
||||
}
|
||||
|
||||
state.fileEditorKeymap = normalizeFileEditorKeymap(state.fileEditorKeymap);
|
||||
state.largeTextPasteBehavior = normalizeLargeTextPasteBehavior(state.largeTextPasteBehavior);
|
||||
|
||||
if (typeof state.autoSaveEnabled !== 'boolean') {
|
||||
state.autoSaveEnabled = true;
|
||||
@@ -2461,6 +2478,7 @@ export const useUIStore = create<UIStore>()(
|
||||
showOpenCodeUpdateNotifications: state.showOpenCodeUpdateNotifications,
|
||||
agentControlToolEnabled: state.agentControlToolEnabled,
|
||||
inputSpellcheckEnabled: state.inputSpellcheckEnabled,
|
||||
largeTextPasteBehavior: state.largeTextPasteBehavior,
|
||||
wideChatLayoutEnabled: state.wideChatLayoutEnabled,
|
||||
codeBlockLineWrap: state.codeBlockLineWrap,
|
||||
showToolFileIcons: state.showToolFileIcons,
|
||||
|
||||
Reference in New Issue
Block a user