fix(ui): keep composer zoom on interface scale
The composer also mounts CodeMirror, so Mini Chat focus incorrectly changed the file editor font size. Exclude the explicit chat-input owner from file-editor zoom routing. Validated the ThemeProvider focus regression, including a focused CodeMirror composer.
This commit is contained in:
@@ -59,6 +59,17 @@ test('zoom works without App menu listeners and routes by focused content', asyn
|
||||
await act(async () => zoom('zoom-reset'));
|
||||
expect(useUIStore.getState().fontSize).toBe(100);
|
||||
expect(document.documentElement.style.fontSize).toBe('');
|
||||
const composer = document.createElement('div');
|
||||
composer.dataset.chatInput = 'true';
|
||||
composer.className = 'cm-editor';
|
||||
const composerInput = document.createElement('textarea');
|
||||
composer.append(composerInput);
|
||||
container.append(composer);
|
||||
composerInput.focus();
|
||||
await act(async () => zoom('zoom-in'));
|
||||
expect(useUIStore.getState().fontSize).toBe(110);
|
||||
expect(useUIStore.getState().editorFontSize).toBe(12);
|
||||
await act(async () => zoom('zoom-reset'));
|
||||
await act(async () => root.unmount());
|
||||
zoom('zoom-in');
|
||||
expect(useUIStore.getState().fontSize).toBe(100);
|
||||
|
||||
@@ -27,7 +27,8 @@ export const ThemeProvider: React.FC<ThemeProviderProps> = ({ children }) => {
|
||||
const state = useUIStore.getState();
|
||||
const isTerminal = isTerminalEventTarget(active)
|
||||
|| active?.matches('[data-terminal-hidden-input="true"]') === true;
|
||||
const isEditor = active?.closest('.cm-editor') != null;
|
||||
const isEditor = active?.closest('.cm-editor') != null
|
||||
&& active?.closest('[data-chat-input="true"]') == null;
|
||||
if (action === 'zoom-reset') {
|
||||
if (isTerminal) state.setTerminalFontSize(14);
|
||||
else if (isEditor) state.setEditorFontSize(13);
|
||||
|
||||
Reference in New Issue
Block a user