Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat(chat-input): replace input markdown lab with a paste auto-convert setting (#22183)

Inneic0c4a2db5290
diff --git a/locales/en-US/labs.json b/locales/en-US/labs.json
index c6ebd851457..1e727dff433 100644
--- a/locales/en-US/labs.json
+++ b/locales/en-US/labs.json
@@ -28,8 +28,6 @@
"features.imessage.title": "iMessage Channel",
"features.inAppBrowser.desc": "Show the Browser tab in the conversation side panel: an embedded browser that opens search results in place and lets agents browse visibly.",
"features.inAppBrowser.title": "In-App Browser",
- "features.inputMarkdown.desc": "Render Markdown in the input area in real time (bold text, code blocks, tables, etc.).",
- "features.inputMarkdown.title": "Input Markdown Rendering",
"features.messageTextSelectionActions.desc": "Show a quick action when selecting text in chat messages so the selected text can be added to the next conversation context.",
"features.messageTextSelectionActions.title": "Message Text Selection Actions",
"features.oauthApps.desc": "Show OAuth app management in personal and workspace settings. This feature is hidden by default.",
diff --git a/locales/en-US/setting.json b/locales/en-US/setting.json
index 2ba55fdc342..eb493a7dba3 100644
--- a/locales/en-US/setting.json
+++ b/locales/en-US/setting.json
@@ -1497,6 +1497,8 @@
"settingChatAppearance.linkIcon.previewMessage": "Check out <site></site> and <repo></repo> for more details.",
"settingChatAppearance.linkIcon.title": "Show icons in message links",
"settingChatAppearance.mermaidTheme.title": "Mermaid Theme",
+ "settingChatAppearance.pasteAutoConvert.desc": "Pasted Markdown turns into formatted text in the input. Turn this off to keep text exactly as copied. Press ⇧⌘V (Ctrl+Shift+V on Windows) to paste plain text anytime.",
+ "settingChatAppearance.pasteAutoConvert.title": "Format Markdown on Paste",
"settingChatAppearance.title": "Chat Appearance",
"settingChatAppearance.transitionMode.desc": "Choose how chat messages appear",
"settingChatAppearance.transitionMode.options.fadeIn": "Fade In",
diff --git a/locales/zh-CN/labs.json b/locales/zh-CN/labs.json
index 3c12bb39e4e..7e7a0fde9d8 100644
--- a/locales/zh-CN/labs.json
+++ b/locales/zh-CN/labs.json
@@ -28,8 +28,6 @@
"features.imessage.title": "iMessage 渠道",
"features.inAppBrowser.desc": "在会话侧边栏显示「浏览器」标签页:内嵌浏览器可就地打开搜索结果,并让 Agent 的浏览操作实时可见。",
"features.inAppBrowser.title": "内置浏览器",
- "features.inputMarkdown.desc": "在输入区域实时渲染 Markdown(粗体、代码块、表格等)",
- "features.inputMarkdown.title": "输入框 Markdown 渲染",
"features.messageTextSelectionActions.desc": "在聊天消息中选中文本时显示快捷操作,可将选中的文本加入下一次对话上下文。",
"features.messageTextSelectionActions.title": "消息文本选择操作",
"features.oauthApps.desc": "在个人和工作区设置中显示 OAuth 应用管理入口。此功能默认隐藏。",
diff --git a/locales/zh-CN/setting.json b/locales/zh-CN/setting.json
index 9f00f30e5bd..ce216a18132 100644
--- a/locales/zh-CN/setting.json
+++ b/locales/zh-CN/setting.json
@@ -1497,6 +1497,8 @@
"settingChatAppearance.linkIcon.previewMessage": "查看 <site></site> 和 <repo></repo> 了解更多。",
"settingChatAppearance.linkIcon.title": "在消息链接中显示图标",
"settingChatAppearance.mermaidTheme.title": "Mermaid 主题",
+ "settingChatAppearance.pasteAutoConvert.desc": "粘贴的 Markdown 会在输入框中显示为格式化文本。关闭后按原文粘贴。随时可按 ⇧⌘V(Windows 为 Ctrl+Shift+V)粘贴纯文本。",
+ "settingChatAppearance.pasteAutoConvert.title": "粘贴时转换 Markdown",
"settingChatAppearance.title": "聊天外观",
"settingChatAppearance.transitionMode.desc": "选择聊天消息的显示方式",
"settingChatAppearance.transitionMode.options.fadeIn": "淡入",
diff --git a/packages/const/src/user.ts b/packages/const/src/user.ts
index 29b8f116da5..277e383e761 100644
--- a/packages/const/src/user.ts
+++ b/packages/const/src/user.ts
@@ -9,7 +9,6 @@ export const DEFAULT_PREFERENCE: UserPreference = {
},
lab: {
enableAgentGraphConfig: false,
- enableInputMarkdown: true,
enableMessageTextSelectionActions: false,
enableOAuthApps: false,
},
diff --git a/packages/locales/src/default/labs.ts b/packages/locales/src/default/labs.ts
index 385d01d3ebc..296b58c0e3e 100644
--- a/packages/locales/src/default/labs.ts
+++ b/packages/locales/src/default/labs.ts
@@ -42,9 +42,6 @@ export default {
'features.inAppBrowser.title': 'In-App Browser',
'features.groupChat.desc': 'Enable multi-agent group chat coordination.',
'features.groupChat.title': 'Group Chat (Multi-Agent)',
- 'features.inputMarkdown.desc':
- 'Render Markdown in the input area in real time (bold text, code blocks, tables, etc.).',
- 'features.inputMarkdown.title': 'Input Markdown Rendering',
'features.messageTextSelectionActions.desc':
'Show a quick action when selecting text in chat messages so the selected text can be added to the next conversation context.',
'features.messageTextSelectionActions.title': 'Message Text Selection Actions',
diff --git a/packages/locales/src/default/setting.ts b/packages/locales/src/default/setting.ts
index a523c596099..ef4c5f20a9f 100644
--- a/packages/locales/src/default/setting.ts
+++ b/packages/locales/src/default/setting.ts
@@ -1376,6 +1376,9 @@ export default {
'Check out <site></site> and <repo></repo> for more details.',
'settingChatAppearance.linkIcon.title': 'Show icons in message links',
'settingChatAppearance.mermaidTheme.title': 'Mermaid Theme',
+ 'settingChatAppearance.pasteAutoConvert.desc':
+ 'Pasted Markdown turns into formatted text in the input. Turn this off to keep text exactly as copied. Press ⇧⌘V (Ctrl+Shift+V on Windows) to paste plain text anytime.',
+ 'settingChatAppearance.pasteAutoConvert.title': 'Format Markdown on Paste',
'settingChatAppearance.title': 'Chat Appearance',
'settingChatAppearance.transitionMode.desc': 'Choose how chat messages appear',
'settingChatAppearance.transitionMode.options.fadeIn': 'Fade In',
diff --git a/packages/types/src/user/preference.ts b/packages/types/src/user/preference.ts
index 144c0e07d56..fa2b28cae90 100644
--- a/packages/types/src/user/preference.ts
+++ b/packages/types/src/user/preference.ts
@@ -199,7 +199,9 @@ export const UserLabSchema = z.object({
*/
enableImessage: z.boolean().optional(),
/**
- * enable markdown rendering in chat input editor
+ * @deprecated The chat input always uses the rich editor; paste conversion moved to
+ * `settings.general.enablePasteAutoConvert`. Kept so a write from an older released
+ * client is not stripped by the schema, and to seed that setting for users who had it off.
*/
enableInputMarkdown: z.boolean().optional(),
/**
diff --git a/packages/types/src/user/settings/general.ts b/packages/types/src/user/settings/general.ts
index d33ce911354..bc209ebed5a 100644
--- a/packages/types/src/user/settings/general.ts
+++ b/packages/types/src/user/settings/general.ts
@@ -21,6 +21,12 @@ export interface UserGeneralConfig {
* @default true
*/
enableMessageLinkIcon?: boolean;
+ /**
+ * Whether Markdown pasted into the chat input is converted into rich text.
+ * Off keeps the pasted text verbatim.
+ * @default true
+ */
+ enablePasteAutoConvert?: boolean;
/**
* Whether a turn's tool workflow starts expanded while the agent is still
* running. Off keeps the running turn to a single live headline row.
diff --git a/src/features/ChatInput/ActionBar/ActionToolbar.test.tsx b/src/features/ChatInput/ActionBar/ActionToolbar.test.tsx
index db10f512263..df33840a23c 100644
--- a/src/features/ChatInput/ActionBar/ActionToolbar.test.tsx
+++ b/src/features/ChatInput/ActionBar/ActionToolbar.test.tsx
@@ -18,7 +18,8 @@ vi.mock('../ActionBar/config', async () => {
'data-testid': 'probe',
});
};
- return { actionMap: { search: ContextProbe } };
+ const TypoProbe = () => createElement('div', { 'data-testid': 'typo' });
+ return { actionMap: { search: ContextProbe, typo: TypoProbe } };
});
vi.mock('@lobehub/editor/react', () => ({
@@ -39,21 +40,13 @@ vi.mock('@/store/global/selectors', () => ({
systemStatusSelectors: { expandInputActionbar: () => false },
}));
-vi.mock('@/store/user', () => ({
- useUserStore: (selector: (state: object) => unknown) => selector({}),
-}));
-
-vi.mock('@/store/user/slices/preference/selectors', () => ({
- labPreferSelectors: { enableInputMarkdown: () => false },
-}));
-
vi.mock('../hooks/useChatInputResourceAccess', () => ({
useChatInputResourceAccess: () => ({ canConfigureResource: true, canShowControls: true }),
}));
vi.mock('../store', () => ({
useChatInputStore: (selector: (state: object) => unknown) =>
- selector({ leftActions: ['search'], mobile: false }),
+ selector({ leftActions: ['search', 'typo'], mobile: false }),
}));
describe('ActionToolbar', () => {
@@ -71,6 +64,12 @@ describe('ActionToolbar', () => {
expect(probe.dataset.borderRadius).toBe('12');
});
+ it('always shows the typography action', () => {
+ render(createElement(ActionToolbar));
+
+ expect(screen.getByTestId('typo')).toBeDefined();
+ });
+
it('leaves the action size unset without an outer context', () => {
render(createElement(ActionToolbar));
diff --git a/src/features/ChatInput/ActionBar/index.tsx b/src/features/ChatInput/ActionBar/index.tsx
index 02028eaa66d..e2ad8b9f7f1 100644
--- a/src/features/ChatInput/ActionBar/index.tsx
+++ b/src/features/ChatInput/ActionBar/index.tsx
@@ -4,8 +4,6 @@ import { memo, useMemo } from 'react';
import { useGlobalStore } from '@/store/global';
import { systemStatusSelectors } from '@/store/global/selectors';
-import { useUserStore } from '@/store/user';
-import { labPreferSelectors } from '@/store/user/slices/preference/selectors';
import { type ActionKey, type ActionKeys } from '../ActionBar/config';
import { actionMap } from '../ActionBar/config';
@@ -63,13 +61,11 @@ const ActionToolbar = memo<ActionToolbarProps>(
systemStatusSelectors.expandInputActionbar(s),
s.toggleExpandInputActionbar,
]);
- const enableRichRender = useUserStore(labPreferSelectors.enableInputMarkdown);
const { canConfigureResource, canShowControls } = useChatInputResourceAccess();
- const leftActions = useChatInputStore((s) => {
- const actions = s.leftActions.filter((item) => (enableRichRender ? true : item !== 'typo'));
- return canConfigureResource ? actions : filterChatOnlyActions(actions);
- });
+ const leftActions = useChatInputStore((s) =>
+ canConfigureResource ? s.leftActions : filterChatOnlyActions(s.leftActions),
+ );
const mobile = useChatInputStore((s) => s.mobile);
diff --git a/src/features/ChatInput/InputEditor/index.test.tsx b/src/features/ChatInput/InputEditor/index.test.tsx
index e188d4668d4..da28c891c10 100644
--- a/src/features/ChatInput/InputEditor/index.test.tsx
+++ b/src/features/ChatInput/InputEditor/index.test.tsx
@@ -12,6 +12,10 @@ const platform = vi.hoisted(() => ({
isMobile: false,
}));
+const userSettings = vi.hoisted(() => ({
+ enablePasteAutoConvert: true,
+}));
+
const mocks = vi.hoisted(() => {
const chatInputState = {
clearInputCompletionError: vi.fn(() => {
@@ -67,6 +71,15 @@ const getAutoCompleteProps = async (): Promise<AutoCompleteProps> => {
return autoCompleteProps!;
};
+const getEditorProps = async () => {
+ const { Editor } = await import('@lobehub/editor/react');
+ const props = vi.mocked(Editor).mock.lastCall?.[0] as Record<string, unknown> | undefined;
+
+ expect(props).toBeDefined();
+
+ return props!;
+};
+
const getEditorStyle = async () => {
const { Editor } = await import('@lobehub/editor/react');
const props = vi.mocked(Editor).mock.lastCall?.[0] as
@@ -197,11 +210,13 @@ vi.mock('@/store/user', () => {
return { useUserStore };
});
vi.mock('@/store/user/selectors', () => ({
- labPreferSelectors: { enableInputMarkdown: () => false },
settingsSelectors: { getHotkeyById: () => () => 'alt+enter' },
systemAgentSelectors: {
inputCompletion: () => mocks.inputCompletionConfig,
},
+ userGeneralSettingsSelectors: {
+ enablePasteAutoConvert: () => userSettings.enablePasteAutoConvert,
+ },
userProfileSelectors: { userId: () => 'user-id' },
}));
@@ -241,8 +256,7 @@ vi.mock('./Placeholder', () => ({
default: () => <span>placeholder</span>,
}));
vi.mock('./plugins', () => ({
- CHAT_INPUT_EMBED_PLUGINS: [],
- createChatInputRichPlugins: () => [],
+ createChatInputRichPlugins: () => ['rich-plugins'],
}));
vi.mock('./ReferTopic', () => ({ INSERT_REFER_TOPIC_COMMAND: 'insert-refer-topic' }));
vi.mock('./LocalFileTag', () => ({
@@ -261,6 +275,7 @@ describe('ChatInput InputEditor', () => {
vi.clearAllMocks();
permission.allowed = false;
platform.isMobile = false;
+ userSettings.enablePasteAutoConvert = true;
mocks.inputCompletionConfig.enabled = false;
mocks.inputCompletionConfig.model = 'gpt-4o-mini';
mocks.inputCompletionConfig.provider = 'openai';
@@ -290,6 +305,32 @@ describe('ChatInput InputEditor', () => {
);
});
+ it('always mounts the rich text plugins with markdown shortcuts', async () => {
+ render(<InputEditor />);
+
+ const props = await getEditorProps();
+ expect(props.plugins).toEqual(['rich-plugins']);
+ expect(props.markdownOption).toBeUndefined();
+ });
+
+ it('converts pasted markdown when paste auto-convert is on', async () => {
+ render(<InputEditor />);
+
+ const props = await getEditorProps();
+ expect(props.enablePasteMarkdown).toBe(true);
+ expect(props.pasteAsPlainText).toBe(true);
+ });
+
+ it('pastes verbatim when paste auto-convert is off', async () => {
+ userSettings.enablePasteAutoConvert = false;
+
+ render(<InputEditor />);
+
+ const props = await getEditorProps();
+ expect(props.enablePasteMarkdown).toBe(false);
+ expect(props.pasteAsPlainText).toBe(true);
+ });
+
it('renders the editor at 16px on mobile', async () => {
permission.allowed = true;
platform.isMobile = true;
diff --git a/src/features/ChatInput/InputEditor/index.tsx b/src/features/ChatInput/InputEditor/index.tsx
index bebf61ff837..73ed9f7fcf5 100644
--- a/src/features/ChatInput/InputEditor/index.tsx
+++ b/src/features/ChatInput/InputEditor/index.tsx
@@ -30,9 +30,9 @@ import { useChatStore } from '@/store/chat';
import { useServerConfigStore } from '@/store/serverConfig';
import { useUserStore } from '@/store/user';
import {
- labPreferSelectors,
settingsSelectors,
systemAgentSelectors,
+ userGeneralSettingsSelectors,
userProfileSelectors,
} from '@/store/user/selectors';
@@ -53,7 +53,7 @@ import InputHistoryPopup, { getHistoryPreviewText } from './InputHistoryPopup';
import { INSERT_LOCAL_FILE_TAG_COMMAND } from './LocalFileTag';
import { mentionPlainClassName } from './mentionStyle';
import Placeholder, { type PlaceholderVariant } from './Placeholder';
-import { CHAT_INPUT_EMBED_PLUGINS, createChatInputRichPlugins } from './plugins';
+import { createChatInputRichPlugins } from './plugins';
import { INSERT_REFER_TOPIC_COMMAND } from './ReferTopic';
import { useLocalFileTag } from './useLocalFileTag';
import { useMentionCategories } from './useMentionCategories';
@@ -255,7 +255,7 @@ const InputEditor = memo<{
};
}, [state.isEmpty]);
- const enableRichRender = useUserStore(labPreferSelectors.enableInputMarkdown);
+ const enablePasteAutoConvert = useUserStore(userGeneralSettingsSelectors.enablePasteAutoConvert);
const slashActionItems = useSlashActionItems();
const slashItems = useCallback(
@@ -507,17 +507,11 @@ const InputEditor = memo<{
[isSlashEnabled, slashItems],
);
- const richRenderProps = useMemo(() => {
- const basePlugins = !enableRichRender
- ? CHAT_INPUT_EMBED_PLUGINS
- : createChatInputRichPlugins({ linkPlugin: false });
+ const plugins = useMemo(() => {
+ const basePlugins = createChatInputRichPlugins({ linkPlugin: false });
- const plugins = autoCompletePlugin ? [...basePlugins, autoCompletePlugin] : basePlugins;
-
- return !enableRichRender
- ? { enablePasteMarkdown: false, markdownOption: false, plugins }
- : { plugins };
- }, [enableRichRender, autoCompletePlugin]);
+ return autoCompletePlugin ? [...basePlugins, autoCompletePlugin] : basePlugins;
+ }, [autoCompletePlugin]);
const handleEditorInit = useCallback(
(editor: IEditor) => {
@@ -562,8 +556,9 @@ const InputEditor = memo<{
editor={editor}
getPopupContainer={() => (slashMenuRef as any)?.current ?? null}
{...{ slashPlacement }}
- {...richRenderProps}
+ enablePasteMarkdown={enablePasteAutoConvert}
mentionOption={mentionOption}
+ plugins={plugins}
slashOption={slashOption}
type={'text'}
variant={'chat'}
diff --git a/src/features/Settings/chat-appearance/features/ChatAppearance/index.tsx b/src/features/Settings/chat-appearance/features/ChatAppearance/index.tsx
index 90a956d5b36..eda33ea0a52 100644
--- a/src/features/Settings/chat-appearance/features/ChatAppearance/index.tsx
+++ b/src/features/Settings/chat-appearance/features/ChatAppearance/index.tsx
@@ -11,7 +11,7 @@ import { SettingsSectionSkeleton } from '@/components/Skeleton';
import { FORM_STYLE } from '@/const/layoutTokens';
import { useSaveState } from '@/hooks/useSaveState';
import { useUserStore } from '@/store/user';
-import { settingsSelectors } from '@/store/user/selectors';
+import { settingsSelectors, userGeneralSettingsSelectors } from '@/store/user/selectors';
import ChatTransitionPreview from './ChatTransitionPreview';
import HighlighterPreview from './HighlighterPreview';
@@ -21,6 +21,7 @@ import MermaidPreview from './MermaidPreview';
const ChatAppearance = memo(() => {
const { t } = useTranslation('setting');
const { general } = useUserStore(settingsSelectors.currentSettings, isEqual);
+ const enablePasteAutoConvert = useUserStore(userGeneralSettingsSelectors.enablePasteAutoConvert);
const [setSettings, isUserStateInit] = useUserStore((s) => [s.setSettings, s.isUserStateInit]);
const { status: saveStatus, lastSavedAt, save, retry } = useSaveState();
const [savingKey, setSavingKey] = useState<string>();
@@ -120,6 +121,20 @@ const ChatAppearance = memo(() => {
label: t('settingChatAppearance.linkIcon.title'),
minWidth: undefined,
},
+ {
+ children: (
+ <Flexbox horizontal align={'center'} gap={8}>
+ {renderSaveHint('enablePasteAutoConvert')}
+ <Switch
+ checked={enablePasteAutoConvert}
+ onChange={(checked) => handleChange('enablePasteAutoConvert', checked)}
+ />
+ </Flexbox>
+ ),
+ desc: t('settingChatAppearance.pasteAutoConvert.desc'),
+ label: t('settingChatAppearance.pasteAutoConvert.title'),
+ minWidth: undefined,
+ },
],
title: t('settingChatAppearance.chatBehavior.title'),
},
diff --git a/src/features/Settings/labs/features.ts b/src/features/Settings/labs/features.ts
index 7be68d521f0..1909d3ee99f 100644
--- a/src/features/Settings/labs/features.ts
+++ b/src/features/Settings/labs/features.ts
@@ -24,7 +24,6 @@ type LabFeatureI18nKey =
| 'goals'
| 'heteroSessionImport'
| 'imessage'
- | 'inputMarkdown'
| 'messageTextSelectionActions'
| 'oauthApps'
| 'projects'
@@ -57,12 +56,6 @@ const ALL_LAB_FEATURES: LabFeatureItem[] = [
searchKeywords: ['agent graph', 'graph runtime'],
stage: 'alpha',
},
- {
- flag: 'enableInputMarkdown',
- i18nKey: 'inputMarkdown',
- searchKeywords: ['markdown', 'input markdown'],
- stage: 'beta',
- },
{
flag: 'enableMessageTextSelectionActions',
i18nKey: 'messageTextSelectionActions',
diff --git a/src/features/Settings/labs/index.test.tsx b/src/features/Settings/labs/index.test.tsx
index 684561745af..d77f15ad98e 100644
--- a/src/features/Settings/labs/index.test.tsx
+++ b/src/features/Settings/labs/index.test.tsx
@@ -175,8 +175,8 @@ describe('Labs settings page', () => {
const claudeCodeSdk = screen.getByText('features.claudeCodeSdk.title');
expect(within(claudeCodeSdk).getByText('stage.alpha.label')).toBeDefined();
- const inputMarkdown = screen.getByText('features.inputMarkdown.title');
- expect(within(inputMarkdown).getByText('stage.beta.label')).toBeDefined();
+ const goals = screen.getByText('features.goals.title');
+ expect(within(goals).getByText('stage.beta.label')).toBeDefined();
});
it('explains what each stage means via the tag tooltip', () => {
diff --git a/src/store/user/slices/preference/selectors/labPrefer.ts b/src/store/user/slices/preference/selectors/labPrefer.ts
index f09ad66bec2..26b964830f5 100644
--- a/src/store/user/slices/preference/selectors/labPrefer.ts
+++ b/src/store/user/slices/preference/selectors/labPrefer.ts
@@ -18,8 +18,6 @@ export const labPreferSelectors = {
enableHeteroSessionImport: (s: UserState): boolean =>
s.preference.lab?.enableHeteroSessionImport ?? false,
enableImessage: (s: UserState): boolean => s.preference.lab?.enableImessage ?? false,
- enableInputMarkdown: (s: UserState): boolean =>
- s.preference.lab?.enableInputMarkdown ?? DEFAULT_PREFERENCE.lab?.enableInputMarkdown ?? true,
enableMessageTextSelectionActions: (s: UserState): boolean =>
s.preference.lab?.enableMessageTextSelectionActions ??
DEFAULT_PREFERENCE.lab?.enableMessageTextSelectionActions ??
diff --git a/src/store/user/slices/settings/selectors/general.test.ts b/src/store/user/slices/settings/selectors/general.test.ts
index e17573d2127..d58eb3cba9d 100644
--- a/src/store/user/slices/settings/selectors/general.test.ts
+++ b/src/store/user/slices/settings/selectors/general.test.ts
@@ -58,6 +58,39 @@ describe('settingsSelectors', () => {
});
});
+ describe('enablePasteAutoConvert', () => {
+ it('should default to true when unset', () => {
+ expect(userGeneralSettingsSelectors.enablePasteAutoConvert(initialState as UserStore)).toBe(
+ true,
+ );
+ });
+
+ it('should return false when turned off', () => {
+ const s: UserState = merge(initialState, {
+ settings: { general: { enablePasteAutoConvert: false } },
+ });
+
+ expect(userGeneralSettingsSelectors.enablePasteAutoConvert(s as UserStore)).toBe(false);
+ });
+
+ it('should default to false for users who turned off the retired input markdown lab', () => {
+ const s: UserState = merge(initialState, {
+ preference: { lab: { enableInputMarkdown: false } },
+ });
+
+ expect(userGeneralSettingsSelectors.enablePasteAutoConvert(s as UserStore)).toBe(false);
+ });
+
+ it('should let the explicit setting win over the retired lab', () => {
+ const s: UserState = merge(initialState, {
+ preference: { lab: { enableInputMarkdown: false } },
+ settings: { general: { enablePasteAutoConvert: true } },
+ });
+
+ expect(userGeneralSettingsSelectors.enablePasteAutoConvert(s as UserStore)).toBe(true);
+ });
+ });
+
describe('currentResponseLanguage', () => {
it('should prefer the saved response language', () => {
const s: UserState = merge(initialState, {
diff --git a/src/store/user/slices/settings/selectors/general.ts b/src/store/user/slices/settings/selectors/general.ts
index df7fa0b4030..a17e68fb122 100644
--- a/src/store/user/slices/settings/selectors/general.ts
+++ b/src/store/user/slices/settings/selectors/general.ts
@@ -40,6 +40,9 @@ const currentTimezone = (s: UserStore): string | undefined =>
const enableAutoScrollOnStreaming = (s: UserStore) =>
generalConfig(s).enableAutoScrollOnStreaming ?? true;
const enableMessageLinkIcon = (s: UserStore) => generalConfig(s).enableMessageLinkIcon ?? true;
+// Users who switched off the retired `enableInputMarkdown` lab did so to keep pasted text verbatim.
+const enablePasteAutoConvert = (s: UserStore) =>
+ generalConfig(s).enablePasteAutoConvert ?? s.preference.lab?.enableInputMarkdown !== false;
const fontAntialiasing = (s: UserStore) => generalConfig(s).fontAntialiasing ?? true;
/** The setting is a boolean: either the live tool list is open or it is a
* summary row. "Open" means the full list — the height-capped middle level
@@ -53,6 +56,7 @@ export const userGeneralSettingsSelectors = {
contextMenuMode,
enableAutoScrollOnStreaming,
enableMessageLinkIcon,
+ enablePasteAutoConvert,
fontAntialiasing,
fontSize,
highlighterTheme,