mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-11-05 16:16:49 +00:00
fix: run plugins' compose check in quick compose, keep a composer with one owner, and bring it back after a crash
The first version of quick compose skipped `onBeforeCompose`, a composer moved back could end up open in both windows, a reply moved back under Pro flagged the selected message, and a crashed pop-out came back blank. - A new message in a pop-out runs `onBeforeCompose` with the same result as the main window: a plugin that stops it closes the window. - The way back has two steps, so a pop-out that gave up can't leave a second owner. A handoff behind a plugin's gate makes it say busy. - A Pro tab made from a composer moved back answers its own message. - Each save writes `draft`, `account` and `owner` into the pop-out's address, which a reload after a crash starts from. What was typed since the last save, up to the 2 s autosave delay, is still lost. - The recorder refuses keys that type a character on this keyboard, and what the shell refuses from a page, and says why.
This commit is contained in:
@@ -333,7 +333,7 @@ describe('quick compose and the way back', () => {
|
||||
fakeBridge();
|
||||
render(<DesktopHost />);
|
||||
push.mockClear();
|
||||
offerReturnedComposer({ returnId: 'r1', payload: { mode: 'compose' }, answer: () => {} });
|
||||
offerReturnedComposer({ returnId: 'r1', payload: { mode: 'compose' }, answer: () => {}, sendReady: () => {} });
|
||||
expect(push).toHaveBeenCalledWith('/');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -337,6 +337,8 @@ describe('a composer that is all its window shows', () => {
|
||||
fireEvent.change(subjectField(), { target: { value: 'Autosaved' } });
|
||||
await waitFor(() => expect(creations).toHaveLength(1), { timeout: 4000 });
|
||||
await waitFor(() => expect(onDraftSaved).toHaveBeenCalled());
|
||||
// Says where it lives: a reload after a crash has only the address to go by.
|
||||
expect(onDraftSaved.mock.calls[0][1]).toEqual(expect.objectContaining({ localAccountId: expect.anything() }));
|
||||
expect(unload().defaultPrevented).toBe(false);
|
||||
expect(creations).toHaveLength(1);
|
||||
});
|
||||
|
||||
@@ -402,8 +402,12 @@ interface EmailComposerProps {
|
||||
ownWindow?: {
|
||||
/** The state as the window unloads, for a reload to start from. */
|
||||
onUnloadState?: (data: ComposerDraftData) => void;
|
||||
/** A save reached the server, for other windows showing the Drafts folder. */
|
||||
onDraftSaved?: (draftId: string) => void;
|
||||
/**
|
||||
* A save reached the server, for other windows showing the Drafts folder and for a
|
||||
* reload to find it. `accountId`: the account it lives in, when not the own one.
|
||||
* `localAccountId`: the login it was saved through.
|
||||
*/
|
||||
onDraftSaved?: (draftId: string, where: { accountId?: string; localAccountId?: string }) => void;
|
||||
/**
|
||||
* Hands a draft to another window to save as this one closes: a request
|
||||
* started now wouldn't survive. False when that can't be done safely.
|
||||
@@ -3155,7 +3159,7 @@ export function EmailComposer({
|
||||
// Only the save the user asked for is read out: autosave would say it
|
||||
// every minute, and the save before sending is followed by "Sent".
|
||||
if (opts.announce && id && !saveFailedRef.current) announceStatus(t('draft_saved'));
|
||||
if (id && !saveFailedRef.current) ownWindowRef.current?.onDraftSaved?.(id);
|
||||
if (id && !saveFailedRef.current) ownWindowRef.current?.onDraftSaved?.(id, { accountId: draftAccountIdRef.current, localAccountId: draftLocalAccountIdRef.current });
|
||||
return id;
|
||||
})();
|
||||
inflightSaveRef.current = promise;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { act, fireEvent, render, screen, waitFor } from '@testing-library/react';
|
||||
import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import type { Email, Mailbox } from '@/lib/jmap/types';
|
||||
import { useAuthStore } from '@/stores/auth-store';
|
||||
@@ -9,6 +9,10 @@ import { usePluginStore } from '@/stores/plugin-store';
|
||||
import { useThemeStore } from '@/stores/theme-store';
|
||||
import { handOffComposeTab, useProTabStore } from '@/stores/pro-tab-store';
|
||||
import { DEFAULT_SEARCH_FILTERS } from '@/lib/jmap/search-utils';
|
||||
import { emailHooks } from '@/lib/plugin-hooks';
|
||||
import { handOffNewMessage } from '@/lib/launch-handoff';
|
||||
import { commitReturnedComposer, dropReturnedComposer, offerReturnedComposer, takeReturnedComposer } from '@/lib/popout/return-to-main';
|
||||
import { EmbeddedContext } from '@/hooks/use-is-embedded';
|
||||
|
||||
// A reply crossing between a Pro compose tab and the standard composer answers
|
||||
// the message it was started from. The message selected in the mail list can be
|
||||
@@ -18,6 +22,7 @@ const seen = vi.hoisted(() => ({ sourceEmailId: undefined as string | undefined
|
||||
|
||||
vi.mock('@/components/email/email-composer', async () => {
|
||||
const { useEffect, useRef, useState } = await import('react');
|
||||
const { registerComposeFlush } = await import('@/lib/compose-flush-registry');
|
||||
return {
|
||||
EmailComposer: ({ initialData, onSaveState, onSend, sourceEmailId }: {
|
||||
initialData?: { subject?: string; mode?: string } | null;
|
||||
@@ -26,6 +31,7 @@ vi.mock('@/components/email/email-composer', async () => {
|
||||
sourceEmailId?: string;
|
||||
}) => {
|
||||
seen.sourceEmailId = sourceEmailId;
|
||||
useEffect(() => registerComposeFlush(async () => {}), []);
|
||||
const [subject, setSubject] = useState(initialData?.subject ?? '');
|
||||
const initial = useRef(subject);
|
||||
const latest = useRef(subject);
|
||||
@@ -172,3 +178,118 @@ describe('a reply handed from a Pro compose tab to the standard composer', () =>
|
||||
expect(tab?.composeData?.sourceEmailSource).toEqual(SOURCE_OF_A);
|
||||
});
|
||||
});
|
||||
|
||||
describe('a composer coming back from its own window', () => {
|
||||
const REPLY = { mode: 'reply' as const, sourceEmailId: 'a', sourceEmailSource: SOURCE_OF_A, initialData: { subject: 'Re: A', mode: 'reply' } as never };
|
||||
|
||||
afterEach(() => {
|
||||
takeReturnedComposer();
|
||||
cleanup();
|
||||
useProTabStore.setState({ tabs: [], activeTabId: null } as never);
|
||||
});
|
||||
|
||||
function comeBack(id: string, payload: Parameters<typeof offerReturnedComposer>[0]['payload'] = REPLY, ready: 'commit' | 'silent' = 'commit') {
|
||||
const answer = vi.fn();
|
||||
act(() => offerReturnedComposer({ returnId: id, payload, answer, sendReady: () => { if (ready === 'commit') commitReturnedComposer(id); } }));
|
||||
return answer;
|
||||
}
|
||||
|
||||
const showsMail = async () => {
|
||||
await screen.findByText('message list');
|
||||
await act(async () => { await new Promise((resolve) => setTimeout(resolve, 20)); });
|
||||
};
|
||||
|
||||
it('opens with its text, says so, and answers its own message', async () => {
|
||||
render(<MailApp />);
|
||||
await showsMail();
|
||||
const answer = comeBack('r1');
|
||||
expect(await screen.findByLabelText('stub subject')).toHaveProperty('value', 'Re: A');
|
||||
await waitFor(() => expect(answer).toHaveBeenCalledWith('shown'));
|
||||
expect(seen.sourceEmailId).toBe('a');
|
||||
});
|
||||
|
||||
it('under Mountain View too', async () => {
|
||||
useSettingsStore.setState({ interfaceLayout: 'mountain-view' } as never);
|
||||
render(<MailApp />);
|
||||
await act(async () => { await new Promise((resolve) => setTimeout(resolve, 50)); });
|
||||
const answer = comeBack('r1');
|
||||
expect(await screen.findByLabelText('stub subject')).toHaveProperty('value', 'Re: A');
|
||||
await waitFor(() => expect(answer).toHaveBeenCalledWith('shown'));
|
||||
expect(seen.sourceEmailId).toBe('a');
|
||||
useSettingsStore.setState({ interfaceLayout: 'default' } as never);
|
||||
});
|
||||
|
||||
it('under Pro it becomes a tab that answers its own message, not the one selected in the list', async () => {
|
||||
render(<EmbeddedContext.Provider value><MailApp /></EmbeddedContext.Provider>);
|
||||
await showsMail();
|
||||
comeBack('r1');
|
||||
await waitFor(() => expect(useProTabStore.getState().tabs.some((tab) => tab.kind === 'compose')).toBe(true));
|
||||
const tab = useProTabStore.getState().tabs.find((candidate) => candidate.kind === 'compose');
|
||||
expect(tab?.composeData?.initialData?.subject).toBe('Re: A');
|
||||
expect(tab?.composeData?.sourceEmailId).toBe('a');
|
||||
expect(tab?.composeData?.sourceEmailSource).toEqual(SOURCE_OF_A);
|
||||
});
|
||||
|
||||
it('a new message moved back under Pro answers nothing, whatever is selected', async () => {
|
||||
render(<EmbeddedContext.Provider value><MailApp /></EmbeddedContext.Provider>);
|
||||
await showsMail();
|
||||
comeBack('r1', { mode: 'compose', initialData: { subject: 'New', mode: 'compose' } as never });
|
||||
await waitFor(() => expect(useProTabStore.getState().tabs.some((tab) => tab.kind === 'compose')).toBe(true));
|
||||
const tab = useProTabStore.getState().tabs.find((candidate) => candidate.kind === 'compose');
|
||||
expect(tab?.composeData?.sourceEmailId).toBeNull();
|
||||
expect(tab?.composeData?.sourceEmailSource).toBeNull();
|
||||
});
|
||||
|
||||
it('with one open already it says busy and leaves that one be', async () => {
|
||||
render(<MailApp />);
|
||||
await showsMail();
|
||||
comeBack('r1');
|
||||
const first = await screen.findByLabelText('stub subject');
|
||||
fireEvent.change(first, { target: { value: 'Being written' } });
|
||||
const answer = comeBack('r2', { mode: 'compose', initialData: { subject: 'Second', mode: 'compose' } as never });
|
||||
await waitFor(() => expect(answer).toHaveBeenCalledWith('busy'));
|
||||
expect(screen.getByLabelText('stub subject')).toHaveProperty('value', 'Being written');
|
||||
});
|
||||
|
||||
it('a pop-out that gave up as this took it: nothing opens, so the draft has one owner', async () => {
|
||||
render(<MailApp />);
|
||||
await showsMail();
|
||||
const answer = comeBack('r1', REPLY, 'silent');
|
||||
await act(async () => { await new Promise((resolve) => setTimeout(resolve, 20)); });
|
||||
act(() => dropReturnedComposer('r1'));
|
||||
await act(async () => { await new Promise((resolve) => setTimeout(resolve, 20)); });
|
||||
expect(screen.queryByLabelText('stub subject')).toBeNull();
|
||||
expect(answer).not.toHaveBeenCalledWith('shown');
|
||||
});
|
||||
|
||||
it('a new message held up by a slow plugin gate says busy, and nothing replaces what comes after', async () => {
|
||||
let letThrough: (value: unknown) => void = () => {};
|
||||
const held = emailHooks.onBeforeCompose.register('test', ((options: unknown) => new Promise((resolve) => { letThrough = () => resolve(options); })) as never);
|
||||
try {
|
||||
render(<MailApp />);
|
||||
await showsMail();
|
||||
act(() => handOffNewMessage());
|
||||
await act(async () => { await new Promise((resolve) => setTimeout(resolve, 20)); });
|
||||
const answer = comeBack('r1');
|
||||
await waitFor(() => expect(answer).toHaveBeenCalledWith('busy'));
|
||||
expect(screen.queryByLabelText('stub subject')).toBeNull();
|
||||
await act(async () => { letThrough(undefined); await new Promise((resolve) => setTimeout(resolve, 20)); });
|
||||
expect(await screen.findByLabelText('stub subject')).toHaveProperty('value', '');
|
||||
} finally {
|
||||
held.dispose();
|
||||
}
|
||||
});
|
||||
|
||||
it('a handoff arriving while it is being claimed waits for it, and takes nothing over', async () => {
|
||||
render(<MailApp />);
|
||||
await showsMail();
|
||||
const answer = comeBack('r1', REPLY, 'silent');
|
||||
await act(async () => { await new Promise((resolve) => setTimeout(resolve, 10)); });
|
||||
act(() => handOffNewMessage());
|
||||
await act(async () => { await new Promise((resolve) => setTimeout(resolve, 20)); });
|
||||
expect(screen.queryByLabelText('stub subject')).toBeNull();
|
||||
act(() => commitReturnedComposer('r1'));
|
||||
expect(await screen.findByLabelText('stub subject')).toHaveProperty('value', 'Re: A');
|
||||
await waitFor(() => expect(answer).toHaveBeenCalledWith('shown'));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1497,6 +1497,7 @@ export function MailApp({ linkSegments: routeSegments }: MailAppProps = {}) {
|
||||
quoteWrapInBlockquote: composerQuoteHeader?.wrapInBlockquote,
|
||||
} : undefined);
|
||||
|
||||
const handedOff = handedOffSource?.session === composerSessionId ? handedOffSource : null;
|
||||
const effectiveMode = pendingDraft?.mode ?? composerMode;
|
||||
const title = buildComposeTabTitle({
|
||||
mode: effectiveMode,
|
||||
@@ -1515,8 +1516,9 @@ export function MailApp({ linkSegments: routeSegments }: MailAppProps = {}) {
|
||||
initialData: pendingDraft,
|
||||
prefill: composerPrefill,
|
||||
initialFiles: composerInitialFiles,
|
||||
sourceEmailId: selectedEmail?.id ?? null,
|
||||
sourceEmailSource: selectedEmail ? emailWriteSource(selectedEmail, client) : null,
|
||||
// A composer handed over answers its own message, not the one selected in the list.
|
||||
sourceEmailId: handedOff ? handedOff.emailId ?? null : selectedEmail?.id ?? null,
|
||||
sourceEmailSource: handedOff ? handedOff.source ?? null : selectedEmail ? emailWriteSource(selectedEmail, client) : null,
|
||||
title,
|
||||
});
|
||||
|
||||
@@ -1718,6 +1720,7 @@ export function MailApp({ linkSegments: routeSegments }: MailAppProps = {}) {
|
||||
// got what it holds. Under Pro a composer moves to its own tab, so nothing
|
||||
// waits long.
|
||||
const handoffOpeningRef = useRef(false);
|
||||
const returnOpeningRef = useRef(false);
|
||||
const handoffToldWaitingRef = useRef(new Set<string>());
|
||||
const composerInUseRef = useRef(false);
|
||||
const composerInUse = showComposer || pendingMailtoAccountChoice !== null
|
||||
@@ -1749,7 +1752,7 @@ export function MailApp({ linkSegments: routeSegments }: MailAppProps = {}) {
|
||||
};
|
||||
|
||||
const openNext = () => {
|
||||
if (handoffOpeningRef.current) return;
|
||||
if (handoffOpeningRef.current || returnOpeningRef.current) return;
|
||||
if (composerInUseRef.current) {
|
||||
const waiting = pendingHandoffs().find((handoff) => handoff.kind === 'compose');
|
||||
if (waiting && !handoffToldWaitingRef.current.has(waiting.id)) {
|
||||
@@ -1773,13 +1776,26 @@ export function MailApp({ linkSegments: routeSegments }: MailAppProps = {}) {
|
||||
}, [isAuthenticated, client, proTakingOver, routeOutsideDraft, withComposeGate, isMobile, composerInUse, handoffSettled]);
|
||||
|
||||
// A composer coming back from its own window. It has saved, and keeps its copy until
|
||||
// the composer is open here. One already open holds someone's text, so that says no.
|
||||
// the composer is open here. One already open holds someone's text, and so may one on its
|
||||
// way behind a plugin's onBeforeCompose, so either says no.
|
||||
useEffect(() => {
|
||||
if (!isAuthenticated || !client || proTakingOver) return;
|
||||
const adopt = () => {
|
||||
const adopt = async () => {
|
||||
const returned = takeReturnedComposer();
|
||||
if (!returned) return;
|
||||
if (composerInUseRef.current) {
|
||||
const busy = () => composerInUseRef.current || handoffOpeningRef.current;
|
||||
if (busy()) {
|
||||
returned.answer('busy');
|
||||
return;
|
||||
}
|
||||
// Holds back a handoff until this has gone one way or the other.
|
||||
returnOpeningRef.current = true;
|
||||
const go = await returned.claim().finally(() => {
|
||||
returnOpeningRef.current = false;
|
||||
setHandoffSettled((n) => n + 1);
|
||||
});
|
||||
if (!go) return;
|
||||
if (busy()) {
|
||||
returned.answer('busy');
|
||||
return;
|
||||
}
|
||||
@@ -1792,8 +1808,8 @@ export function MailApp({ linkSegments: routeSegments }: MailAppProps = {}) {
|
||||
setShowComposer(true);
|
||||
if (isMobile) setActiveView('viewer');
|
||||
};
|
||||
adopt();
|
||||
return onReturnedComposer(adopt);
|
||||
void adopt();
|
||||
return onReturnedComposer(() => void adopt());
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [isAuthenticated, client, proTakingOver, isMobile, composerSessionId]);
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-libra
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { FakeBroadcastChannel } from '@/lib/__tests__/fixtures/fake-broadcast-channel';
|
||||
import { openPopoutChannel, type PopoutMessage, type RescuedDraft } from '@/lib/popout/channel';
|
||||
import { createComposeHandoff, rememberComposePayload } from '@/lib/popout/compose-handoff';
|
||||
import { createComposeHandoff, rememberComposePayload, rememberedComposePayload } from '@/lib/popout/compose-handoff';
|
||||
import { useAuthStore } from '@/stores/auth-store';
|
||||
import { useIdentityStore } from '@/stores/identity-store';
|
||||
import { usePluginStore } from '@/stores/plugin-store';
|
||||
@@ -328,7 +328,9 @@ describe('back into the main window', () => {
|
||||
function mainWindowAnswers(status: 'shown' | 'busy' | null, accountIds = ['alice']) {
|
||||
const channel = openPopoutChannel((message) => {
|
||||
if (message.type === 'main-ping') channel?.post({ type: 'main-pong', windowId: 'main', accountIds });
|
||||
if (message.type === 'composer-return' && status) channel?.post({ type: 'composer-return-answer', returnId: message.returnId, status });
|
||||
if (message.type === 'composer-return' && status === 'busy') channel?.post({ type: 'composer-return-answer', returnId: message.returnId, status });
|
||||
if (message.type === 'composer-return' && status === 'shown') channel?.post({ type: 'composer-return-ready', returnId: message.returnId });
|
||||
if (message.type === 'composer-return-commit' && status) channel?.post({ type: 'composer-return-answer', returnId: message.returnId, status });
|
||||
})!;
|
||||
return channel;
|
||||
}
|
||||
@@ -346,7 +348,7 @@ describe('back into the main window', () => {
|
||||
window.bulwarkDesktop = { version: 1, platform: 'win32', windows: { focus } } as never;
|
||||
const main = mainWindowAnswers('shown');
|
||||
const props = await openComposer();
|
||||
await waitFor(() => expect((composer as unknown as { popOut?: unknown }).popOut).toBeTruthy());
|
||||
await waitFor(() => expect((composer as unknown as { popOut?: unknown }).popOut).toBeTruthy(), { timeout: 5000 });
|
||||
expect((composer as unknown as { popOutToMainLabel: string }).popOutToMainLabel).toBe('back_to_main');
|
||||
expect(props).toBeTruthy();
|
||||
main.close();
|
||||
@@ -377,12 +379,13 @@ describe('back into the main window', () => {
|
||||
window.bulwarkDesktop = { version: 1, platform: 'win32', windows: { focus } } as never;
|
||||
const main = mainWindowAnswers('shown');
|
||||
await openComposer();
|
||||
await waitFor(() => expect((composer as unknown as { popOut?: unknown }).popOut).toBeTruthy());
|
||||
await waitFor(() => expect((composer as unknown as { popOut?: unknown }).popOut).toBeTruthy(), { timeout: 5000 });
|
||||
const target = (composer as unknown as { popOut: () => { handOver: (state: object) => Promise<boolean> } }).popOut();
|
||||
const state = { mode: 'reply', subject: 'Back', draftId: 'd9', draftLocalAccountId: 'carol' };
|
||||
await act(async () => {
|
||||
await expect(target.handOver(state)).resolves.toBe(true);
|
||||
});
|
||||
expect(heard.map((message) => message.type)).toContain('composer-return-commit');
|
||||
const sent = heard.find((message) => message.type === 'composer-return') as Extract<PopoutMessage, { type: 'composer-return' }>;
|
||||
expect(sent.payload).toMatchObject({ mode: 'reply', initialData: state });
|
||||
// The draft's own login, which isn't always the window's.
|
||||
@@ -395,7 +398,7 @@ describe('back into the main window', () => {
|
||||
window.bulwarkDesktop = { version: 1, platform: 'win32', windows: { focus } } as never;
|
||||
const main = mainWindowAnswers('busy');
|
||||
await openComposer();
|
||||
await waitFor(() => expect((composer as unknown as { popOut?: unknown }).popOut).toBeTruthy());
|
||||
await waitFor(() => expect((composer as unknown as { popOut?: unknown }).popOut).toBeTruthy(), { timeout: 5000 });
|
||||
const target = (composer as unknown as { popOut: () => { handOver: (state: object) => Promise<boolean>; notShownMessage: () => string } }).popOut();
|
||||
await act(async () => {
|
||||
await expect(target.handOver({ mode: 'compose' })).resolves.toBe(false);
|
||||
@@ -405,3 +408,142 @@ describe('back into the main window', () => {
|
||||
main.close();
|
||||
});
|
||||
});
|
||||
|
||||
describe('a new message, with nothing handed over', () => {
|
||||
const hooks: Array<() => void> = [];
|
||||
const listen = (handler: (...args: never[]) => unknown) => {
|
||||
const held = emailHooks.onBeforeCompose.register('test', handler as never);
|
||||
hooks.push(() => held.dispose());
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
window.history.replaceState(null, '', '/en/popout/compose');
|
||||
usePluginStore.setState({ initializePlugins: vi.fn(async () => {}) } as never);
|
||||
useIdentityStore.setState({ identities: [{ id: 'id-1', email: 'me@example.org', name: 'Me' }] } as never);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
for (const stop of hooks.splice(0)) stop();
|
||||
window.bulwarkDesktop = undefined;
|
||||
});
|
||||
|
||||
type Prefill = { prefill?: { to?: string[]; subject?: string } | null };
|
||||
|
||||
it('with no plugin listening, opens empty', async () => {
|
||||
render(<PopoutComposeApp />);
|
||||
await waitFor(() => expect(screen.getByTestId('composer')).toBeTruthy());
|
||||
expect((composer as unknown as Prefill).prefill ?? null).toBeNull();
|
||||
});
|
||||
|
||||
it('a plugin that fills in fields fills them in, as in the main window', async () => {
|
||||
const seen: unknown[] = [];
|
||||
listen((options: unknown) => {
|
||||
seen.push(options);
|
||||
return { ...(options as object), to: ['from-plugin@example.org'], subject: 'From a plugin' };
|
||||
});
|
||||
render(<PopoutComposeApp />);
|
||||
await waitFor(() => expect(screen.getByTestId('composer')).toBeTruthy());
|
||||
expect((composer as unknown as Prefill).prefill).toEqual({ to: ['from-plugin@example.org'], subject: 'From a plugin' });
|
||||
expect(seen).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('a plugin that stops it stops it: no composer, and the window goes', async () => {
|
||||
const closeSelf = vi.fn();
|
||||
window.bulwarkDesktop = { version: 1, platform: 'win32', windows: { closeSelf } } as never;
|
||||
listen(() => false);
|
||||
render(<PopoutComposeApp />);
|
||||
await waitFor(() => expect(closeSelf).toHaveBeenCalled());
|
||||
expect(screen.queryByTestId('composer')).toBeNull();
|
||||
});
|
||||
|
||||
it('waits for plugins that are still starting before it asks them', async () => {
|
||||
let started: () => void = () => {};
|
||||
usePluginStore.setState({ initializePlugins: vi.fn(() => new Promise<void>((resolve) => { started = resolve; })) } as never);
|
||||
render(<PopoutComposeApp />);
|
||||
await settle();
|
||||
expect(screen.queryByTestId('composer')).toBeNull();
|
||||
listen(() => false);
|
||||
const closeSelf = vi.fn();
|
||||
window.bulwarkDesktop = { version: 1, platform: 'win32', windows: { closeSelf } } as never;
|
||||
await act(async () => started());
|
||||
await waitFor(() => expect(closeSelf).toHaveBeenCalled());
|
||||
expect(screen.queryByTestId('composer')).toBeNull();
|
||||
});
|
||||
|
||||
it('a draft or a handoff isn\'t asked about again: it was at its start', async () => {
|
||||
const hook = vi.fn(() => false);
|
||||
listen(hook);
|
||||
const handoff = createComposeHandoff()!;
|
||||
void handoff.complete(PAYLOAD);
|
||||
openAt(handoff.id);
|
||||
await waitFor(() => expect(screen.getByTestId('composer')).toBeTruthy());
|
||||
expect(hook).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('after this page crashed', () => {
|
||||
const LOGIN = 'alice@example.org@mail.example.org';
|
||||
const MAILBOXES = [{ id: 'mDrafts', role: 'drafts' }];
|
||||
const draft = {
|
||||
id: 'd7', subject: 'Saved before the crash', to: [], cc: [], bcc: [], from: [{ name: 'Me', email: 'me@example.org' }],
|
||||
keywords: { $draft: true }, mailboxIds: { mDrafts: true }, bodyValues: { t: { value: 'Text' } }, textBody: [{ partId: 't', type: 'text/plain' }], htmlBody: [], attachments: [],
|
||||
};
|
||||
const search = () => new URLSearchParams(window.location.search);
|
||||
|
||||
beforeEach(() => {
|
||||
useIdentityStore.setState({ identities: [{ id: 'id-1', email: 'me@example.org', name: 'Me' }] } as never);
|
||||
usePluginStore.setState({ initializePlugins: vi.fn(async () => {}) } as never);
|
||||
identityMocks.multi = { enabled: false, allIdentities: [], groups: [] };
|
||||
});
|
||||
|
||||
it('each save puts the draft, its login and its account in the address, on a window that started empty', async () => {
|
||||
window.history.replaceState(null, '', '/en/popout/compose');
|
||||
render(<PopoutComposeApp />);
|
||||
await waitFor(() => expect(screen.getByTestId('composer')).toBeTruthy());
|
||||
const own = (composer as unknown as { ownWindow: { onDraftSaved: (id: string, where: object) => void } }).ownWindow;
|
||||
act(() => own.onDraftSaved('d1', { localAccountId: LOGIN, accountId: 'shared' }));
|
||||
expect([search().get('draft'), search().get('account'), search().get('owner')]).toEqual(['d1', LOGIN, 'shared']);
|
||||
act(() => own.onDraftSaved('d2', { localAccountId: LOGIN }));
|
||||
expect([search().get('draft'), search().get('account'), search().get('owner')]).toEqual(['d2', LOGIN, null]);
|
||||
});
|
||||
|
||||
it('comes back on the saved draft, not blank', async () => {
|
||||
const getEmail = vi.fn(async () => draft);
|
||||
const client = { getEmail, getMailboxes: vi.fn(async () => MAILBOXES) };
|
||||
useAuthStore.setState({ getClientForAccount: (id: string) => (id === LOGIN ? client : undefined) } as never);
|
||||
window.history.replaceState(null, '', `/en/popout/compose?draft=d7&account=${encodeURIComponent(LOGIN)}`);
|
||||
render(<PopoutComposeApp />);
|
||||
await waitFor(() => expect(screen.getByTestId('composer').textContent).toBe('Saved before the crash'));
|
||||
expect(getEmail).toHaveBeenCalledWith('d7', undefined);
|
||||
});
|
||||
|
||||
it('with a handoff in the address too, the saved draft wins: nothing was remembered, so the page died', async () => {
|
||||
const getEmail = vi.fn(async () => draft);
|
||||
const client = { getEmail, getMailboxes: vi.fn(async () => MAILBOXES) };
|
||||
useAuthStore.setState({ getClientForAccount: (id: string) => (id === LOGIN ? client : undefined) } as never);
|
||||
window.history.replaceState(null, '', `/en/popout/compose?handoff=gone&draft=d7&account=${encodeURIComponent(LOGIN)}`);
|
||||
render(<PopoutComposeApp />);
|
||||
await waitFor(() => expect(screen.getByTestId('composer').textContent).toBe('Saved before the crash'));
|
||||
});
|
||||
|
||||
it('an ordinary reload goes on from what it remembered as it unloaded, which is newer than the draft', async () => {
|
||||
const getEmail = vi.fn(async () => draft);
|
||||
const client = { getEmail, getMailboxes: vi.fn(async () => MAILBOXES) };
|
||||
useAuthStore.setState({ getClientForAccount: (id: string) => (id === LOGIN ? client : undefined) } as never);
|
||||
rememberComposePayload('h1', { mode: 'compose', initialData: { subject: 'Typed since the save' } as never });
|
||||
window.history.replaceState(null, '', `/en/popout/compose?handoff=h1&draft=d7&account=${encodeURIComponent(LOGIN)}`);
|
||||
render(<PopoutComposeApp />);
|
||||
// A reload first hears what became of the text it handed over on the way out.
|
||||
await waitFor(() => expect(screen.getByTestId('composer').textContent).toBe('Typed since the save'), { timeout: 5000 });
|
||||
expect(getEmail).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('a save forgets what was remembered, so a later crash can\'t bring back older text', async () => {
|
||||
rememberComposePayload('h2', { mode: 'compose', initialData: { subject: 'Older' } as never });
|
||||
window.history.replaceState(null, '', '/en/popout/compose?handoff=h2');
|
||||
render(<PopoutComposeApp />);
|
||||
await waitFor(() => expect(screen.getByTestId('composer')).toBeTruthy(), { timeout: 5000 });
|
||||
act(() => (composer as unknown as { ownWindow: { onDraftSaved: (id: string, where: object) => void } }).ownWindow.onDraftSaved('d3', {}));
|
||||
expect(rememberedComposePayload('h2')).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -407,6 +407,11 @@ describe('a composer coming back', () => {
|
||||
const returned = takeReturnedComposer();
|
||||
expect(returned?.payload).toEqual(PAYLOAD);
|
||||
expect(lockRequests).toContain('bulwark-popout-return:r1');
|
||||
const claim = returned!.claim();
|
||||
await settle();
|
||||
expect(heard).toContainEqual({ type: 'composer-return-ready', returnId: 'r1' });
|
||||
popout.post({ type: 'composer-return-commit', returnId: 'r1' });
|
||||
await expect(claim).resolves.toBe(true);
|
||||
returned?.answer('shown');
|
||||
await settle();
|
||||
expect(heard).toContainEqual({ type: 'composer-return-answer', returnId: 'r1', status: 'shown' });
|
||||
@@ -433,6 +438,16 @@ describe('a composer coming back', () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('a call-off after the mail page took it stops the page opening it', async () => {
|
||||
render(<PopoutHost />);
|
||||
await settle();
|
||||
popout.post({ type: 'composer-return', returnId: 'r1', accountId: 'alice', payload: PAYLOAD });
|
||||
await settle();
|
||||
const claim = takeReturnedComposer()!.claim();
|
||||
popout.post({ type: 'composer-return-cancel', returnId: 'r1' });
|
||||
await expect(claim).resolves.toBe(false);
|
||||
});
|
||||
|
||||
it('goes when the pop-out calls it off', async () => {
|
||||
render(<PopoutHost />);
|
||||
await settle();
|
||||
|
||||
@@ -15,13 +15,14 @@ import { debug } from "@/lib/debug";
|
||||
import { composerSendOptions } from "@/lib/outgoing/composer-send-options";
|
||||
import { announceSent } from "@/lib/plugin-after-send";
|
||||
import { announceMailChanged, announceSentToMainWindow, askRescuedDraftId, watchMainWindow, type RescuedDraft } from "@/lib/popout/channel";
|
||||
import { acknowledgeComposeHandoff, receiveComposeHandoff, rememberComposePayload, rememberedComposePayload, watchHandoffCancel } from "@/lib/popout/compose-handoff";
|
||||
import { acknowledgeComposeHandoff, forgetComposePayload, receiveComposeHandoff, rememberComposePayload, rememberedComposePayload, watchHandoffCancel } from "@/lib/popout/compose-handoff";
|
||||
import type { ComposePopoutPayload } from "@/lib/popout/compose-payload";
|
||||
import { returnComposerToMain, type ReturnResult } from "@/lib/popout/return-to-main";
|
||||
import { closePopoutWindow } from "@/lib/popout/window-role";
|
||||
import { hasDesktopWindows } from "@/lib/popout/support";
|
||||
import { getDesktopBridge } from "@/lib/desktop/bridge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { composeOptionsFor, runBeforeCompose } from "@/lib/plugin-compose-gate";
|
||||
import { composerDataFromDraft, isRestorableDraft } from "@/lib/draft-composer-data";
|
||||
import { noteOpenDraft } from "@/lib/desktop/window-restore";
|
||||
import { findDraftIdentityIdForLogin } from "@/lib/draft-source";
|
||||
@@ -39,6 +40,9 @@ type SendData = Parameters<NonNullable<ComposerProps["onSend"]>>[0];
|
||||
|
||||
const EMPTY_PAYLOAD: ComposePopoutPayload = { mode: "compose" };
|
||||
|
||||
/** How long a new message waits for plugins to start, so that their onBeforeCompose gets its say. */
|
||||
const PLUGINS_WAIT_MS = 5000;
|
||||
|
||||
/** How often the window looks whether a main window holding its login is still there. */
|
||||
const MAIN_CHECK_MS = 1000;
|
||||
|
||||
@@ -167,6 +171,48 @@ function RestoredDraft({ draftId, accountId, ownerAccountId, onReady }: {
|
||||
return <PopoutSkeleton label={tWindows("opening")} />;
|
||||
}
|
||||
|
||||
/**
|
||||
* A new message with nothing handed over, from the desktop app's shortcut or File menu. Plugins
|
||||
* get the same say as in the main window: stop it, and nothing opens; or fill in fields.
|
||||
*/
|
||||
function NewMessageGate({ onReady }: { onReady: (payload: ComposePopoutPayload) => void }) {
|
||||
const t = useTranslations();
|
||||
const tWindows = useTranslations("pwaWindows");
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
void (async () => {
|
||||
await Promise.race([
|
||||
Promise.resolve(usePluginStore.getState().initializePlugins()).catch(() => {}),
|
||||
new Promise((resolve) => setTimeout(resolve, PLUGINS_WAIT_MS)),
|
||||
]);
|
||||
if (cancelled) return;
|
||||
if (emailHooks.onBeforeCompose.size === 0) {
|
||||
onReady(EMPTY_PAYLOAD);
|
||||
return;
|
||||
}
|
||||
const prefill = await runBeforeCompose(composeOptionsFor("compose", {
|
||||
ownEmails: useIdentityStore.getState().identities.map((identity) => identity.email).filter((email): email is string => Boolean(email)),
|
||||
replyPrefix: t("email_composer.prefix.reply"),
|
||||
forwardPrefix: t("email_composer.prefix.forward"),
|
||||
}));
|
||||
if (cancelled) return;
|
||||
if (!prefill) {
|
||||
closePopoutWindow();
|
||||
return;
|
||||
}
|
||||
onReady(Object.keys(prefill).length > 0 ? { ...EMPTY_PAYLOAD, prefill } : EMPTY_PAYLOAD);
|
||||
})();
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
// Once, as the window opens.
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
return <PopoutSkeleton label={tWindows("opening")} />;
|
||||
}
|
||||
|
||||
/** The composer alone, in its own window: sending, autosave and discard go through the shared stores, as in a Pro tab. */
|
||||
function PopoutComposer({ payload, handoffId }: { payload: ComposePopoutPayload; handoffId: string | null }) {
|
||||
const t = useTranslations();
|
||||
@@ -282,12 +328,13 @@ function PopoutComposer({ payload, handoffId }: { payload: ComposePopoutPayload;
|
||||
result = await returnComposerToMain(
|
||||
{ ...payload, mode: state.mode, replyTo: state.replyTo, initialData: state, initialDraftText: undefined, prefill: null },
|
||||
state.draftLocalAccountId ?? useAuthStore.getState().activeAccountId,
|
||||
() => mainWindow.alive(),
|
||||
);
|
||||
if (result === "shown") getDesktopBridge()?.windows?.focus?.();
|
||||
return result === "shown";
|
||||
},
|
||||
};
|
||||
}, [payload, tQuick]);
|
||||
}, [mainWindow, payload, tQuick]);
|
||||
|
||||
// The window that opened this one lets go of its copy now. Not without a
|
||||
// session: this one couldn't save or send the text.
|
||||
@@ -310,14 +357,19 @@ function PopoutComposer({ payload, handoffId }: { payload: ComposePopoutPayload;
|
||||
onUnloadState: (state: ComposerDraftData) => {
|
||||
if (handoffId) rememberComposePayload(handoffId, { ...payload, initialData: state, prefill: null });
|
||||
},
|
||||
onDraftSaved: (draftId: string) => {
|
||||
announceMailChanged(useAuthStore.getState().activeAccountId);
|
||||
// A save makes a new id, and this address is what a reload starts from.
|
||||
onDraftSaved: (draftId: string, where: { accountId?: string; localAccountId?: string } = {}) => {
|
||||
const active = useAuthStore.getState().activeAccountId;
|
||||
announceMailChanged(active);
|
||||
// A save makes a new id, and this address is what a reload starts from: also the
|
||||
// shell's reload after this page crashed, when nothing else of it survives.
|
||||
const url = new URL(window.location.href);
|
||||
if (url.searchParams.has("draft")) {
|
||||
url.searchParams.set("draft", draftId);
|
||||
window.history.replaceState(null, "", `${url.pathname}${url.search}`);
|
||||
}
|
||||
url.searchParams.set("draft", draftId);
|
||||
const login = where.localAccountId ?? url.searchParams.get("account") ?? active;
|
||||
if (login) url.searchParams.set("account", login);
|
||||
if (where.accountId) url.searchParams.set("owner", where.accountId);
|
||||
else url.searchParams.delete("owner");
|
||||
window.history.replaceState(null, "", `${url.pathname}${url.search}`);
|
||||
if (handoffId) forgetComposePayload(handoffId);
|
||||
},
|
||||
}), [handoffId, mainWindow, payload]);
|
||||
|
||||
@@ -348,8 +400,11 @@ function PopoutComposer({ payload, handoffId }: { payload: ComposePopoutPayload;
|
||||
/** `/popout/compose`: a draft handed over by another window, or a new message. */
|
||||
export function PopoutComposeApp() {
|
||||
const t = useTranslations("pwaWindows");
|
||||
const [{ handoffId, accountId, draftId, ownerAccountId }] = useState(readLaunch);
|
||||
const [payload, setPayload] = useState<ComposePopoutPayload | null>(handoffId || draftId ? null : EMPTY_PAYLOAD);
|
||||
const [{ handoffId: named, accountId, draftId, ownerAccountId }] = useState(readLaunch);
|
||||
// Saved on the server and nothing remembered: this page crashed or was killed, and the
|
||||
// draft is the newest there is. An ordinary reload remembers as it unloads.
|
||||
const [handoffId] = useState(() => (named && draftId && !rememberedComposePayload(named) ? null : named));
|
||||
const [payload, setPayload] = useState<ComposePopoutPayload | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (!handoffId) return;
|
||||
@@ -384,8 +439,9 @@ export function PopoutComposeApp() {
|
||||
return (
|
||||
<PopoutShell kind="compose" accountId={accountId}>
|
||||
{payload ? <PopoutComposer payload={payload} handoffId={handoffId} />
|
||||
: handoffId ? <PopoutSkeleton label={t("opening")} />
|
||||
: draftId ? <RestoredDraft draftId={draftId} accountId={accountId} ownerAccountId={ownerAccountId} onReady={setPayload} />
|
||||
: <PopoutSkeleton label={t("opening")} />}
|
||||
: <NewMessageGate onReady={setPayload} />}
|
||||
</PopoutShell>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import { useEmailStore } from "@/stores/email-store";
|
||||
import { toast } from "@/stores/toast-store";
|
||||
import { newPopoutId, openPopoutChannel, type PopoutChannel, type PopoutMessage, type PopoutSentNotice, type RescuedDraft, type SharedAccountSession } from "@/lib/popout/channel";
|
||||
import { keepRescuedDraft } from "@/lib/popout/rescued-drafts";
|
||||
import { dropReturnedComposer, offerReturnedComposer } from "@/lib/popout/return-to-main";
|
||||
import { commitReturnedComposer, dropReturnedComposer, offerReturnedComposer } from "@/lib/popout/return-to-main";
|
||||
import { credentialFingerprint, sealFor } from "@/lib/popout/sealed";
|
||||
import { changesAnyType, subscribePushStateChanges } from "@/lib/push-events";
|
||||
|
||||
@@ -182,10 +182,14 @@ export function PopoutHost() {
|
||||
returnId,
|
||||
payload,
|
||||
answer: (status) => channel?.post({ type: "composer-return-answer", returnId, status }),
|
||||
sendReady: () => channel?.post({ type: "composer-return-ready", returnId }),
|
||||
});
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "composer-return-commit":
|
||||
commitReturnedComposer(message.returnId);
|
||||
break;
|
||||
case "composer-return-cancel":
|
||||
dropReturnedComposer(message.returnId);
|
||||
break;
|
||||
|
||||
@@ -72,6 +72,46 @@ describe('DesktopQuickComposeSetting', () => {
|
||||
expect(screen.queryByTestId('quick-compose-recording')).toBeNull();
|
||||
});
|
||||
|
||||
it('refuses keys this keyboard types a character with, and says so', () => {
|
||||
const onChange = show({});
|
||||
fireEvent.click(screen.getByTestId('quick-compose-keys'));
|
||||
const recorder = screen.getByTestId('quick-compose-recording');
|
||||
fireEvent.keyDown(recorder, { key: '€', code: 'KeyE', ctrlKey: true, altKey: true });
|
||||
expect(onChange).not.toHaveBeenCalled();
|
||||
expect(screen.getByText('types_character')).toBeTruthy();
|
||||
// Still recording: the next try can be better.
|
||||
fireEvent.keyDown(recorder, { key: 'Enter', code: 'Enter', ctrlKey: true, altKey: true });
|
||||
expect(onChange).toHaveBeenCalledWith('CommandOrControl+Alt+Enter');
|
||||
});
|
||||
|
||||
it('refuses keys the system or every app uses, and says so', () => {
|
||||
const onChange = show({});
|
||||
fireEvent.click(screen.getByTestId('quick-compose-keys'));
|
||||
fireEvent.keyDown(screen.getByTestId('quick-compose-recording'), { key: 'V', code: 'KeyV', ctrlKey: true, shiftKey: true });
|
||||
expect(onChange).not.toHaveBeenCalled();
|
||||
expect(screen.getByText('reserved')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('refuses keys this keyboard types a character with, and says so', () => {
|
||||
const onChange = show({});
|
||||
fireEvent.click(screen.getByTestId('quick-compose-keys'));
|
||||
const recorder = screen.getByTestId('quick-compose-recording');
|
||||
fireEvent.keyDown(recorder, { key: '€', code: 'KeyE', ctrlKey: true, altKey: true });
|
||||
expect(onChange).not.toHaveBeenCalled();
|
||||
expect(screen.getByText('types_character')).toBeTruthy();
|
||||
// Still recording: the next try can be better.
|
||||
fireEvent.keyDown(recorder, { key: 'Enter', code: 'Enter', ctrlKey: true, altKey: true });
|
||||
expect(onChange).toHaveBeenCalledWith('CommandOrControl+Alt+Enter');
|
||||
});
|
||||
|
||||
it('refuses keys the system or every app uses, and says so', () => {
|
||||
const onChange = show({});
|
||||
fireEvent.click(screen.getByTestId('quick-compose-keys'));
|
||||
fireEvent.keyDown(screen.getByTestId('quick-compose-recording'), { key: 'V', code: 'KeyV', ctrlKey: true, shiftKey: true });
|
||||
expect(onChange).not.toHaveBeenCalled();
|
||||
expect(screen.getByText('reserved')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('Esc leaves things as they were', () => {
|
||||
const onChange = show({});
|
||||
fireEvent.click(screen.getByTestId('quick-compose-keys'));
|
||||
|
||||
@@ -1,12 +1,26 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { acceleratorFromKeyEvent, describeAccelerator, QUICK_COMPOSE_DEFAULT } from "@/lib/desktop/shortcut-keys";
|
||||
import { describeAccelerator, QUICK_COMPOSE_DEFAULT, readShortcutPress } from "@/lib/desktop/shortcut-keys";
|
||||
import type { DesktopQuickComposeStatus } from "@/lib/desktop/types";
|
||||
import { SettingItem, ToggleSwitch } from "./settings-section";
|
||||
|
||||
interface KeyboardMap {
|
||||
get: (code: string) => string | undefined;
|
||||
}
|
||||
|
||||
/** What each key gives alone on this keyboard. Not every browser has it, so it can be null. */
|
||||
async function readKeyboardMap(): Promise<KeyboardMap | null> {
|
||||
try {
|
||||
const keyboard = (navigator as unknown as { keyboard?: { getLayoutMap?: () => Promise<KeyboardMap> } }).keyboard;
|
||||
return (await keyboard?.getLayoutMap?.()) ?? null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The shortcut for a small composer window, on the desktop settings. What holds it is the
|
||||
* shell's business: this shows what it says, including that another app has the keys.
|
||||
@@ -18,10 +32,30 @@ export function DesktopQuickComposeSetting({ status, platform, onChange }: {
|
||||
}) {
|
||||
const t = useTranslations("desktopQuickCompose");
|
||||
const [recording, setRecording] = useState(false);
|
||||
const [refused, setRefused] = useState<"types-character" | "reserved" | null>(null);
|
||||
const keyboardMap = useRef<KeyboardMap | null>(null);
|
||||
const { shortcut, active, locked } = status;
|
||||
const keys = shortcut ? describeAccelerator(shortcut, platform) : "";
|
||||
|
||||
const description = recording ? t("recording_hint")
|
||||
useEffect(() => {
|
||||
if (!recording) return;
|
||||
let stale = false;
|
||||
void readKeyboardMap().then((map) => {
|
||||
if (!stale) keyboardMap.current = map;
|
||||
});
|
||||
return () => {
|
||||
stale = true;
|
||||
};
|
||||
}, [recording]);
|
||||
|
||||
const stopRecording = () => {
|
||||
setRecording(false);
|
||||
setRefused(null);
|
||||
};
|
||||
|
||||
const description = refused === "types-character" ? t("types_character")
|
||||
: refused === "reserved" ? t("reserved")
|
||||
: recording ? t("recording_hint")
|
||||
: !shortcut ? t("description_off")
|
||||
: active ? t("description", { keys })
|
||||
: t("taken", { keys });
|
||||
@@ -36,18 +70,21 @@ export function DesktopQuickComposeSetting({ status, platform, onChange }: {
|
||||
autoFocus
|
||||
className="text-xs h-7"
|
||||
data-testid="quick-compose-recording"
|
||||
onBlur={() => setRecording(false)}
|
||||
onBlur={stopRecording}
|
||||
onKeyDown={(event) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
if (event.key === "Escape") {
|
||||
setRecording(false);
|
||||
stopRecording();
|
||||
return;
|
||||
}
|
||||
const next = acceleratorFromKeyEvent(event, platform);
|
||||
if (!next) return;
|
||||
setRecording(false);
|
||||
onChange(next);
|
||||
const result = readShortcutPress(event, platform, keyboardMap.current?.get(event.code));
|
||||
if ("accelerator" in result) {
|
||||
stopRecording();
|
||||
onChange(result.accelerator);
|
||||
} else if (result.refused !== "incomplete") {
|
||||
setRefused(result.refused);
|
||||
}
|
||||
}}
|
||||
>
|
||||
{t("recording")}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { acceleratorFromKeyEvent, describeAccelerator, type ShortcutKeyEvent } from '../shortcut-keys';
|
||||
import { describeAccelerator, readShortcutPress, shortcutProblem, type ShortcutKeyEvent } from '../shortcut-keys';
|
||||
|
||||
const press = (key: string, code: string, modifiers: Partial<ShortcutKeyEvent> = {}): ShortcutKeyEvent => ({
|
||||
key,
|
||||
@@ -11,9 +11,11 @@ const press = (key: string, code: string, modifiers: Partial<ShortcutKeyEvent> =
|
||||
...modifiers,
|
||||
});
|
||||
|
||||
const CTRL_ALT = { ctrlKey: true, altKey: true };
|
||||
|
||||
describe('describeAccelerator', () => {
|
||||
it('names the keys as each OS does', () => {
|
||||
expect(describeAccelerator('CommandOrControl+Alt+N', 'win32')).toBe('Ctrl+Alt+N');
|
||||
expect(describeAccelerator('CommandOrControl+Alt+Enter', 'win32')).toBe('Ctrl+Alt+Enter');
|
||||
expect(describeAccelerator('CommandOrControl+Alt+N', 'linux')).toBe('Ctrl+Alt+N');
|
||||
expect(describeAccelerator('CommandOrControl+Alt+N', 'darwin')).toBe('⌥⌘N');
|
||||
expect(describeAccelerator('Super+Shift+F9', 'win32')).toBe('Win+Shift+F9');
|
||||
@@ -25,38 +27,85 @@ describe('describeAccelerator', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('acceleratorFromKeyEvent', () => {
|
||||
describe('readShortcutPress', () => {
|
||||
it('turns a press into what the shell takes', () => {
|
||||
expect(acceleratorFromKeyEvent(press('n', 'KeyN', { ctrlKey: true, altKey: true }), 'win32')).toBe('CommandOrControl+Alt+N');
|
||||
expect(acceleratorFromKeyEvent(press('m', 'KeyM', { metaKey: true, altKey: true }), 'darwin')).toBe('CommandOrControl+Alt+M');
|
||||
expect(acceleratorFromKeyEvent(press('7', 'Digit7', { ctrlKey: true, shiftKey: true }), 'linux')).toBe('CommandOrControl+Shift+7');
|
||||
expect(readShortcutPress(press('n', 'KeyN', CTRL_ALT), 'win32')).toEqual({ accelerator: 'CommandOrControl+Alt+N' });
|
||||
expect(readShortcutPress(press('j', 'KeyJ', { metaKey: true, altKey: true }), 'darwin')).toEqual({ accelerator: 'CommandOrControl+Alt+J' });
|
||||
// Cmd+Opt+M minimises every window on a Mac. Elsewhere those keys are free.
|
||||
expect(readShortcutPress(press('m', 'KeyM', { metaKey: true, altKey: true }), 'darwin')).toEqual({ refused: 'reserved' });
|
||||
expect(readShortcutPress(press('m', 'KeyM', CTRL_ALT), 'win32')).toEqual({ accelerator: 'CommandOrControl+Alt+M' });
|
||||
expect(readShortcutPress(press('7', 'Digit7', { ctrlKey: true, shiftKey: true }), 'linux')).toEqual({ accelerator: 'CommandOrControl+Shift+7' });
|
||||
expect(readShortcutPress(press('Enter', 'Enter', CTRL_ALT), 'win32')).toEqual({ accelerator: 'CommandOrControl+Alt+Enter' });
|
||||
});
|
||||
|
||||
it('uses the letter on the key, whatever the layout puts where', () => {
|
||||
expect(acceleratorFromKeyEvent(press('z', 'KeyY', { ctrlKey: true, altKey: true }), 'win32')).toBe('CommandOrControl+Alt+Z');
|
||||
expect(readShortcutPress(press('z', 'KeyY', CTRL_ALT), 'win32')).toEqual({ accelerator: 'CommandOrControl+Alt+Z' });
|
||||
});
|
||||
|
||||
it('falls back on the key itself when a modifier changed the character', () => {
|
||||
expect(acceleratorFromKeyEvent(press('˜', 'KeyN', { metaKey: true, altKey: true }), 'darwin')).toBe('CommandOrControl+Alt+N');
|
||||
it('falls back on the key itself when Cmd+Opt changed the character', () => {
|
||||
expect(readShortcutPress(press('˜', 'KeyN', { metaKey: true, altKey: true }), 'darwin')).toEqual({ accelerator: 'CommandOrControl+Alt+N' });
|
||||
});
|
||||
|
||||
it('keeps Ctrl on a Mac apart from Cmd, and the Windows key apart from Ctrl', () => {
|
||||
expect(acceleratorFromKeyEvent(press('n', 'KeyN', { ctrlKey: true, altKey: true }), 'darwin')).toBe('Control+Alt+N');
|
||||
expect(acceleratorFromKeyEvent(press('n', 'KeyN', { metaKey: true, altKey: true }), 'win32')).toBe('Super+Alt+N');
|
||||
it('keeps Ctrl on a Mac apart from Cmd', () => {
|
||||
expect(readShortcutPress(press('n', 'KeyN', { metaKey: true, ctrlKey: true }), 'darwin')).toEqual({ accelerator: 'CommandOrControl+Control+N' });
|
||||
});
|
||||
|
||||
it('needs two modifiers, so no key is taken away from every other app', () => {
|
||||
expect(acceleratorFromKeyEvent(press('c', 'KeyC', { ctrlKey: true }), 'win32')).toBeNull();
|
||||
expect(acceleratorFromKeyEvent(press('c', 'KeyC'), 'win32')).toBeNull();
|
||||
for (const [name, event, plainKey] of [
|
||||
['AltGr+N on a Czech keyboard, which types }', press('}', 'KeyN', CTRL_ALT), 'n'],
|
||||
['AltGr+E on a German keyboard, which types €', press('€', 'KeyE', CTRL_ALT), 'e'],
|
||||
['AltGr+N on a Polish keyboard, which types ń', press('ń', 'KeyN', CTRL_ALT), 'n'],
|
||||
['AltGr+Shift+N on a Polish keyboard, which types Ń', press('Ń', 'KeyN', { ...CTRL_ALT, shiftKey: true }), 'n'],
|
||||
['AltGr+2 on a German keyboard, which types ²', press('²', 'Digit2', CTRL_ALT), '2'],
|
||||
['a dead key', press('Dead', 'KeyE', CTRL_ALT), 'e'],
|
||||
['the same with no keyboard map to go by', press('}', 'KeyN', CTRL_ALT), undefined],
|
||||
['Option+Shift on a Mac, which types', press('Ñ', 'KeyN', { altKey: true, shiftKey: true }), 'n'],
|
||||
] as const) {
|
||||
it(`refuses ${name}`, () => {
|
||||
expect(readShortcutPress(event, name.includes('Mac') ? 'darwin' : 'win32', plainKey)).toEqual({ refused: 'types-character' });
|
||||
});
|
||||
}
|
||||
|
||||
it('takes Ctrl+Alt on a key that only gives its own letter there, as on a Russian keyboard', () => {
|
||||
expect(readShortcutPress(press('т', 'KeyN', CTRL_ALT), 'win32', 'т')).toEqual({ accelerator: 'CommandOrControl+Alt+N' });
|
||||
});
|
||||
|
||||
it('takes one modifier on a function key, and none is still not enough', () => {
|
||||
expect(acceleratorFromKeyEvent(press('F9', 'F9', { ctrlKey: true }), 'win32')).toBe('CommandOrControl+F9');
|
||||
expect(acceleratorFromKeyEvent(press('F9', 'F9'), 'win32')).toBeNull();
|
||||
it('a function key and Enter type nothing', () => {
|
||||
expect(readShortcutPress(press('F9', 'F9', CTRL_ALT), 'win32')).toEqual({ accelerator: 'CommandOrControl+Alt+F9' });
|
||||
expect(readShortcutPress(press('Enter', 'Enter', CTRL_ALT), 'win32')).toEqual({ accelerator: 'CommandOrControl+Alt+Enter' });
|
||||
});
|
||||
|
||||
it('waits while only modifiers are down', () => {
|
||||
expect(acceleratorFromKeyEvent(press('Control', 'ControlLeft', { ctrlKey: true }), 'win32')).toBeNull();
|
||||
expect(acceleratorFromKeyEvent(press('Alt', 'AltLeft', { ctrlKey: true, altKey: true }), 'win32')).toBeNull();
|
||||
for (const [name, event] of [
|
||||
['Ctrl+C', press('c', 'KeyC', { ctrlKey: true })],
|
||||
['Ctrl+V', press('v', 'KeyV', { ctrlKey: true })],
|
||||
['a letter alone', press('c', 'KeyC')],
|
||||
['Shift+A', press('A', 'KeyA', { shiftKey: true })],
|
||||
['Alt+Shift+A', press('A', 'KeyA', { altKey: true, shiftKey: true })],
|
||||
['Alt+F4', press('F4', 'F4', { altKey: true })],
|
||||
['Ctrl+F9', press('F9', 'F9', { ctrlKey: true })],
|
||||
['a function key alone', press('F9', 'F9')],
|
||||
['Ctrl down on its own', press('Control', 'ControlLeft', { ctrlKey: true })],
|
||||
['Ctrl and Alt down on their own', press('Alt', 'AltLeft', CTRL_ALT)],
|
||||
] as const) {
|
||||
it(`waits on ${name}: too few modifiers`, () => {
|
||||
expect(readShortcutPress(event, 'win32')).toEqual({ refused: 'incomplete' });
|
||||
});
|
||||
}
|
||||
|
||||
for (const [name, event, platform] of [
|
||||
['Ctrl+Shift+V, paste in every terminal', press('V', 'KeyV', { ctrlKey: true, shiftKey: true }), 'win32'],
|
||||
['the Windows key with Ctrl+Shift+S', press('S', 'KeyS', { metaKey: true, shiftKey: true, ctrlKey: true }), 'win32'],
|
||||
['Cmd+Shift+4, a Mac screenshot', press('4', 'Digit4', { metaKey: true, shiftKey: true }), 'darwin'],
|
||||
['Cmd+Ctrl+Q, a Mac lock', press('q', 'KeyQ', { metaKey: true, ctrlKey: true }), 'darwin'],
|
||||
] as const) {
|
||||
it(`refuses ${name}`, () => {
|
||||
expect(readShortcutPress(event, platform)).toEqual({ refused: 'reserved' });
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
describe('shortcutProblem', () => {
|
||||
it('counts Ctrl and CommandOrControl as one key off a Mac, and two on one', () => {
|
||||
expect(shortcutProblem('CommandOrControl+Control+N', 'win32')).toBe('incomplete');
|
||||
expect(shortcutProblem('CommandOrControl+Control+N', 'darwin')).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
/**
|
||||
* Global shortcuts as the shell takes them (Electron accelerators) and as people read them.
|
||||
* `shortcutProblem` is the shell's own rule (`isAccelerator` in src/main/features/os-rules.ts),
|
||||
* so the settings page can say why before the shell silently refuses.
|
||||
*/
|
||||
|
||||
/** Ctrl+Alt+N, Cmd+Opt+N. The shell's default too: src/main/features/os-rules.ts. */
|
||||
/**
|
||||
* What turning quick compose on gives when the shell doesn't say. On Windows the shell
|
||||
* answers Ctrl+Alt+Enter: Ctrl+Alt+N is AltGr+N, which types a character on many layouts.
|
||||
*/
|
||||
export const QUICK_COMPOSE_DEFAULT = 'CommandOrControl+Alt+N';
|
||||
|
||||
const MAC_SYMBOLS: Record<string, string> = {
|
||||
@@ -57,28 +62,83 @@ export interface ShortcutKeyEvent {
|
||||
metaKey: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* What a system or every app already uses, past the rule of two modifiers. Same list as the
|
||||
* shell's. `cmd` is Cmd on a Mac and Ctrl elsewhere.
|
||||
*/
|
||||
const RESERVED = new Set(['cmd+shift+A', 'cmd+shift+C', 'cmd+shift+V', 'cmd+shift+X', 'cmd+shift+Z']);
|
||||
const RESERVED_ON_MAC = new Set([
|
||||
'cmd+shift+3', 'cmd+shift+4', 'cmd+shift+5', 'cmd+shift+Q',
|
||||
'cmd+ctrl+Q', 'cmd+ctrl+F',
|
||||
'alt+cmd+D', 'alt+cmd+H', 'alt+cmd+M',
|
||||
]);
|
||||
|
||||
export type ShortcutPress =
|
||||
| { accelerator: string }
|
||||
/** Still pressing, or too few modifiers. */
|
||||
| { refused: 'incomplete' }
|
||||
/** This keyboard types a character with these keys, which would stop working in every app. */
|
||||
| { refused: 'types-character' }
|
||||
/** The system or every app uses these. */
|
||||
| { refused: 'reserved' };
|
||||
|
||||
/** The key's own letter where the layout gives one: Alt on a Mac turns N into a dead key. */
|
||||
function keyName(event: ShortcutKeyEvent): string | null {
|
||||
if (/^[a-zA-Z0-9]$/.test(event.key)) return event.key.toUpperCase();
|
||||
const code = /^(?:Key([A-Z])|Digit(\d)|(F\d{1,2}))$/.exec(event.code);
|
||||
return code ? (code[1] ?? code[2] ?? code[3]) : null;
|
||||
const code = /^(?:Key([A-Z])|Digit(\d)|(F\d{1,2})|(Enter))$/.exec(event.code);
|
||||
return code ? (code[1] ?? code[2] ?? code[3] ?? code[4]) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* A key press as a shortcut, or null while it can't be one. Two modifiers, since a global
|
||||
* Ctrl+C would take that key away from every other app. A function key is rare enough for one.
|
||||
* AltGr is Ctrl+Alt to Windows, so a press with both reports the character it types: `}` for
|
||||
* AltGr+N on a Czech keyboard. A letter of the layout's own is no such thing: Ctrl+Alt+N on a
|
||||
* Russian keyboard reports т, which is that key anyway. `plainKey` is what the key gives
|
||||
* alone, from the keyboard map; without one, anything but a plain letter or digit counts.
|
||||
*/
|
||||
export function acceleratorFromKeyEvent(event: ShortcutKeyEvent, platform: string | undefined): string | null {
|
||||
const key = keyName(event);
|
||||
if (!key) return null;
|
||||
function typesCharacter(event: ShortcutKeyEvent, platform: string | undefined, plainKey: string | undefined): boolean {
|
||||
const mac = platform === 'darwin';
|
||||
const modifiers = [
|
||||
const altGrShaped = mac ? event.altKey && !event.metaKey : event.ctrlKey && event.altKey;
|
||||
if (!altGrShaped) return false;
|
||||
if (event.key === 'Dead') return true;
|
||||
if ([...event.key].length !== 1) return false;
|
||||
if (/^[a-zA-Z0-9]$/.test(event.key)) return false;
|
||||
return !plainKey || event.key.toLowerCase() !== plainKey.toLowerCase();
|
||||
}
|
||||
|
||||
/** The shell's rule, for an accelerator in this file's own form. */
|
||||
export function shortcutProblem(accelerator: string, platform: string | undefined): 'incomplete' | 'reserved' | null {
|
||||
const parts = accelerator.split('+');
|
||||
const key = parts.pop() ?? '';
|
||||
const mac = platform === 'darwin';
|
||||
const modifiers = new Set(parts.map((part) => {
|
||||
const name = part.toLowerCase();
|
||||
if (name === 'commandorcontrol') return 'cmd';
|
||||
if (name === 'control') return mac ? 'ctrl' : 'cmd';
|
||||
return name;
|
||||
}));
|
||||
if (modifiers.has('super')) return 'reserved';
|
||||
if (modifiers.size < 2 || !(modifiers.has('cmd') || modifiers.has('ctrl'))) return 'incomplete';
|
||||
const named = `${[...modifiers].sort().join('+')}+${key}`;
|
||||
return RESERVED.has(named) || (mac && RESERVED_ON_MAC.has(named)) ? 'reserved' : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* A key press as a shortcut, or why not. Two modifiers with Ctrl or Cmd among them, since a
|
||||
* global Ctrl+C or Alt+F4 would take that key away from every other app.
|
||||
*/
|
||||
export function readShortcutPress(event: ShortcutKeyEvent, platform: string | undefined, plainKey?: string): ShortcutPress {
|
||||
if (typesCharacter(event, platform, plainKey)) return { refused: 'types-character' };
|
||||
const key = keyName(event);
|
||||
if (!key) return { refused: 'incomplete' };
|
||||
const mac = platform === 'darwin';
|
||||
const accelerator = [
|
||||
...((mac ? event.metaKey : event.ctrlKey) ? ['CommandOrControl'] : []),
|
||||
...(mac && event.ctrlKey ? ['Control'] : []),
|
||||
...(!mac && event.metaKey ? ['Super'] : []),
|
||||
...(event.altKey ? ['Alt'] : []),
|
||||
...(event.shiftKey ? ['Shift'] : []),
|
||||
];
|
||||
if (modifiers.length < (/^F\d/.test(key) ? 1 : 2)) return null;
|
||||
return [...modifiers, key].join('+');
|
||||
key,
|
||||
].join('+');
|
||||
const problem = shortcutProblem(accelerator, platform);
|
||||
return problem ? { refused: problem } : { accelerator };
|
||||
}
|
||||
|
||||
@@ -2,12 +2,13 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { FakeBroadcastChannel } from '@/lib/__tests__/fixtures/fake-broadcast-channel';
|
||||
import { registerComposeFlush } from '@/lib/compose-flush-registry';
|
||||
import { openPopoutChannel, type PopoutMessage } from '../channel';
|
||||
import { answerWhenComposerOpens, dropReturnedComposer, offerReturnedComposer, onReturnedComposer, onReturnedComposerElsewhere, returnComposerToMain, takeReturnedComposer } from '../return-to-main';
|
||||
import { answerWhenComposerOpens, commitReturnedComposer, dropReturnedComposer, offerReturnedComposer, onReturnedComposer, onReturnedComposerElsewhere, returnComposerToMain, takeReturnedComposer } from '../return-to-main';
|
||||
|
||||
// The way a composer goes back from its own window. The window lets go of its text only when
|
||||
// the main window says the composer is there, so every other outcome has to say so too.
|
||||
// the main window says the composer is there, and at no moment may both windows hold it.
|
||||
|
||||
const PAYLOAD = { mode: 'compose' as const, initialData: { subject: 'Hello' } as never };
|
||||
const alive = () => true;
|
||||
|
||||
beforeEach(() => {
|
||||
vi.stubGlobal('BroadcastChannel', FakeBroadcastChannel);
|
||||
@@ -21,45 +22,83 @@ afterEach(() => {
|
||||
});
|
||||
|
||||
/** Plays the main window's end of the channel. */
|
||||
function mainWindow(onReturn: (message: Extract<PopoutMessage, { type: 'composer-return' }>, post: (m: PopoutMessage) => void) => void) {
|
||||
function mainWindow(onMessage: (message: PopoutMessage, post: (m: PopoutMessage) => void) => void) {
|
||||
const heard: PopoutMessage[] = [];
|
||||
const channel = openPopoutChannel((message) => {
|
||||
heard.push(message);
|
||||
if (message.type === 'composer-return') onReturn(message, (m) => channel?.post(m));
|
||||
onMessage(message, (m) => channel?.post(m));
|
||||
});
|
||||
return heard;
|
||||
}
|
||||
|
||||
describe('from the pop-out', () => {
|
||||
it('sends the draft and its login, and goes by what the main window answers', async () => {
|
||||
it('sends the draft and its login, commits when the main window is ready, and goes by its answer', async () => {
|
||||
const seen: unknown[] = [];
|
||||
mainWindow((message, post) => {
|
||||
seen.push([message.accountId, message.payload]);
|
||||
post({ type: 'composer-return-answer', returnId: message.returnId, status: 'shown' });
|
||||
const heard = mainWindow((message, post) => {
|
||||
if (message.type === 'composer-return') {
|
||||
seen.push([message.accountId, message.payload]);
|
||||
post({ type: 'composer-return-ready', returnId: message.returnId });
|
||||
}
|
||||
if (message.type === 'composer-return-commit') post({ type: 'composer-return-answer', returnId: message.returnId, status: 'shown' });
|
||||
});
|
||||
await expect(returnComposerToMain(PAYLOAD, 'alice')).resolves.toBe('shown');
|
||||
await expect(returnComposerToMain(PAYLOAD, 'alice', alive)).resolves.toBe('shown');
|
||||
expect(seen).toEqual([['alice', PAYLOAD]]);
|
||||
expect(heard.map((message) => message.type)).toEqual(['composer-return', 'composer-return-commit']);
|
||||
});
|
||||
|
||||
it('hears that the main window is busy', async () => {
|
||||
mainWindow((message, post) => post({ type: 'composer-return-answer', returnId: message.returnId, status: 'busy' }));
|
||||
await expect(returnComposerToMain(PAYLOAD, 'alice')).resolves.toBe('busy');
|
||||
mainWindow((message, post) => {
|
||||
if (message.type === 'composer-return') post({ type: 'composer-return-answer', returnId: message.returnId, status: 'busy' });
|
||||
});
|
||||
await expect(returnComposerToMain(PAYLOAD, 'alice', alive)).resolves.toBe('busy');
|
||||
});
|
||||
|
||||
it('ignores an answer about another composer', async () => {
|
||||
mainWindow((_message, post) => post({ type: 'composer-return-answer', returnId: 'someone-else', status: 'shown' }));
|
||||
await expect(returnComposerToMain(PAYLOAD, 'alice', 60)).resolves.toBe('no-answer');
|
||||
it('ignores what is said about another composer', async () => {
|
||||
const heard = mainWindow((message, post) => {
|
||||
if (message.type !== 'composer-return') return;
|
||||
post({ type: 'composer-return-answer', returnId: 'someone-else', status: 'shown' });
|
||||
post({ type: 'composer-return-ready', returnId: 'someone-else' });
|
||||
});
|
||||
await expect(returnComposerToMain(PAYLOAD, 'alice', alive, 60)).resolves.toBe('no-answer');
|
||||
expect(heard.map((message) => message.type)).not.toContain('composer-return-commit');
|
||||
});
|
||||
|
||||
it('with no answer it keeps the text and calls the move off, so no second copy turns up', async () => {
|
||||
const heard = mainWindow(() => {});
|
||||
await expect(returnComposerToMain(PAYLOAD, 'alice', 30)).resolves.toBe('no-answer');
|
||||
await expect(returnComposerToMain(PAYLOAD, 'alice', alive, 30)).resolves.toBe('no-answer');
|
||||
await vi.waitFor(() => expect(heard.map((message) => message.type)).toEqual(['composer-return', 'composer-return-cancel']));
|
||||
});
|
||||
|
||||
it('once committed it doesn\'t give up on a slow main window, which has the text by then', async () => {
|
||||
let answer: (() => void) | null = null;
|
||||
mainWindow((message, post) => {
|
||||
if (message.type === 'composer-return') post({ type: 'composer-return-ready', returnId: message.returnId });
|
||||
if (message.type === 'composer-return-commit') answer = () => post({ type: 'composer-return-answer', returnId: message.returnId, status: 'shown' });
|
||||
});
|
||||
const result = returnComposerToMain(PAYLOAD, 'alice', alive, 30);
|
||||
let settled = false;
|
||||
void result.then(() => { settled = true; });
|
||||
await new Promise((resolve) => setTimeout(resolve, 120));
|
||||
expect(settled).toBe(false);
|
||||
expect(answer).not.toBeNull();
|
||||
answer!();
|
||||
await expect(result).resolves.toBe('shown');
|
||||
});
|
||||
|
||||
it('once committed it keeps the text if the main window goes away', async () => {
|
||||
mainWindow((message, post) => {
|
||||
if (message.type === 'composer-return') post({ type: 'composer-return-ready', returnId: message.returnId });
|
||||
});
|
||||
let there = true;
|
||||
const result = returnComposerToMain(PAYLOAD, 'alice', () => there, 30);
|
||||
await new Promise((resolve) => setTimeout(resolve, 60));
|
||||
there = false;
|
||||
await expect(result).resolves.toBe('no-answer');
|
||||
});
|
||||
});
|
||||
|
||||
describe('in the main window', () => {
|
||||
const returned = (id: string, answer = vi.fn()) => ({ returnId: id, payload: PAYLOAD, answer });
|
||||
const returned = (id: string, answer = vi.fn(), sendReady = vi.fn()) => ({ returnId: id, payload: PAYLOAD, answer, sendReady });
|
||||
|
||||
it('tells the mail page, and only the mail page, when it is there', () => {
|
||||
const mail = vi.fn();
|
||||
@@ -98,22 +137,39 @@ describe('in the main window', () => {
|
||||
expect(takeReturnedComposer()).toBeNull();
|
||||
});
|
||||
|
||||
it('claiming asks the pop-out, and only its go ahead lets the page open anything', async () => {
|
||||
const sendReady = vi.fn();
|
||||
offerReturnedComposer(returned('a', vi.fn(), sendReady));
|
||||
const taken = takeReturnedComposer()!;
|
||||
expect(sendReady).not.toHaveBeenCalled();
|
||||
const claim = taken.claim();
|
||||
expect(sendReady).toHaveBeenCalledOnce();
|
||||
commitReturnedComposer('a');
|
||||
await expect(claim).resolves.toBe(true);
|
||||
});
|
||||
|
||||
it('a pop-out that gave up as the page took it wins: nothing opens here', async () => {
|
||||
offerReturnedComposer(returned('a'));
|
||||
const taken = takeReturnedComposer()!;
|
||||
const claim = taken.claim();
|
||||
dropReturnedComposer('a');
|
||||
await expect(claim).resolves.toBe(false);
|
||||
});
|
||||
|
||||
it('silence after asking means no', async () => {
|
||||
vi.useFakeTimers();
|
||||
offerReturnedComposer(returned('a'));
|
||||
const claim = takeReturnedComposer()!.claim();
|
||||
await vi.advanceTimersByTimeAsync(6000);
|
||||
await expect(claim).resolves.toBe(false);
|
||||
});
|
||||
|
||||
it('says shown only when a composer has really opened', () => {
|
||||
const answer = vi.fn();
|
||||
answerWhenComposerOpens(returned('a', answer));
|
||||
answerWhenComposerOpens({ returnId: 'a', payload: PAYLOAD, answer, claim: async () => true });
|
||||
expect(answer).not.toHaveBeenCalled();
|
||||
const stop = registerComposeFlush(async () => {});
|
||||
expect(answer).toHaveBeenCalledWith('shown');
|
||||
stop();
|
||||
});
|
||||
|
||||
it('says nothing if no composer opens, so the pop-out stays with the text', () => {
|
||||
vi.useFakeTimers();
|
||||
const answer = vi.fn();
|
||||
answerWhenComposerOpens(returned('a', answer), 100);
|
||||
vi.advanceTimersByTime(200);
|
||||
const stop = registerComposeFlush(async () => {});
|
||||
expect(answer).not.toHaveBeenCalled();
|
||||
stop();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -97,6 +97,8 @@ export type PopoutMessage =
|
||||
| { type: 'rescue-query'; rescueKey: string }
|
||||
| { type: 'rescue-answer'; rescueKey: string; draftId: string | null }
|
||||
| { type: 'composer-return'; returnId: string; accountId?: string; payload: ComposePopoutPayload }
|
||||
| { type: 'composer-return-ready'; returnId: string }
|
||||
| { type: 'composer-return-commit'; returnId: string }
|
||||
| { type: 'composer-return-answer'; returnId: string; status: 'shown' | 'busy' }
|
||||
| { type: 'composer-return-cancel'; returnId: string }
|
||||
| { type: 'main-ping' }
|
||||
|
||||
@@ -115,6 +115,18 @@ export function rememberComposePayload(handoffId: string, payload: ComposePopout
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A newer version is on the server. What's remembered was written as the page last unloaded,
|
||||
* and a page that crashes writes nothing, so it would bring back older text than the draft.
|
||||
*/
|
||||
export function forgetComposePayload(handoffId: string): void {
|
||||
try {
|
||||
sessionStorage.removeItem(STORAGE_PREFIX + handoffId);
|
||||
} catch {
|
||||
// Unavailable: there's nothing remembered either.
|
||||
}
|
||||
}
|
||||
|
||||
/** The draft this window holds from before a reload. */
|
||||
export function rememberedComposePayload(handoffId: string): ComposePopoutPayload | null {
|
||||
try {
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
* compose-handoff.ts. The pop-out has saved by now and keeps its copy until the main
|
||||
* window says the composer is on screen there. A main window already busy with a message
|
||||
* says so and takes nothing, because a composer that is open holds someone's text.
|
||||
*
|
||||
* Only one window may end up with the text, so the move has two steps. The main window says
|
||||
* it's ready before it opens anything. The pop-out commits only if it hasn't given up, and
|
||||
* from then on it waits for as long as a main window is there: giving up after that would
|
||||
* leave the same draft open twice.
|
||||
*/
|
||||
|
||||
import { onComposerOpened } from '@/lib/compose-flush-registry';
|
||||
@@ -11,25 +16,42 @@ import type { ComposePopoutPayload } from './compose-payload';
|
||||
|
||||
/** Longer than a route change to the mail page takes; then the pop-out keeps the draft. */
|
||||
export const RETURN_WAIT_MS = 20_000;
|
||||
const OPEN_WAIT_MS = RETURN_WAIT_MS - 2000;
|
||||
/** How long a main window that said it's ready waits to hear go ahead. */
|
||||
const COMMIT_WAIT_MS = 5000;
|
||||
/** How often a pop-out that committed looks whether a main window is still there. */
|
||||
const ALIVE_CHECK_MS = 1000;
|
||||
|
||||
export type ReturnAnswer = 'shown' | 'busy';
|
||||
export type ReturnResult = ReturnAnswer | 'no-answer';
|
||||
|
||||
/** From a pop-out: `shown` once the composer is on screen in the main window. */
|
||||
export function returnComposerToMain(payload: ComposePopoutPayload, accountId?: string | null, waitMs = RETURN_WAIT_MS): Promise<ReturnResult> {
|
||||
export function returnComposerToMain(
|
||||
payload: ComposePopoutPayload,
|
||||
accountId: string | null | undefined,
|
||||
mainStillThere: () => boolean,
|
||||
waitMs = RETURN_WAIT_MS,
|
||||
): Promise<ReturnResult> {
|
||||
return new Promise((resolve) => {
|
||||
const returnId = newPopoutId();
|
||||
let aliveTimer: ReturnType<typeof setInterval> | null = null;
|
||||
const finish = (result: ReturnResult) => {
|
||||
clearTimeout(timer);
|
||||
if (aliveTimer) clearInterval(aliveTimer);
|
||||
channel?.close();
|
||||
resolve(result);
|
||||
};
|
||||
const channel = openPopoutChannel((message) => {
|
||||
if (message.type === 'composer-return-answer' && message.returnId === returnId) finish(message.status);
|
||||
if (!('returnId' in message) || message.returnId !== returnId) return;
|
||||
if (message.type === 'composer-return-answer') finish(message.status);
|
||||
if (message.type === 'composer-return-ready') {
|
||||
clearTimeout(timer);
|
||||
channel?.post({ type: 'composer-return-commit', returnId });
|
||||
aliveTimer = setInterval(() => {
|
||||
if (!mainStillThere()) finish('no-answer');
|
||||
}, ALIVE_CHECK_MS);
|
||||
}
|
||||
});
|
||||
const timer = setTimeout(() => {
|
||||
// It might still turn up there, next to the copy that stays here.
|
||||
channel?.post({ type: 'composer-return-cancel', returnId });
|
||||
finish('no-answer');
|
||||
}, waitMs);
|
||||
@@ -41,22 +63,38 @@ export interface ReturnedComposer {
|
||||
returnId: string;
|
||||
payload: ComposePopoutPayload;
|
||||
answer: (status: ReturnAnswer) => void;
|
||||
/** Asks the pop-out to go ahead. False: it has given up, and keeps the text. */
|
||||
claim: () => Promise<boolean>;
|
||||
}
|
||||
|
||||
let waiting: ReturnedComposer | null = null;
|
||||
const mailListeners = new Set<() => void>();
|
||||
const elsewhereListeners = new Set<() => void>();
|
||||
const commits = new Map<string, (go: boolean) => void>();
|
||||
|
||||
/**
|
||||
* In the main window. The mail page picks it up, or, with no mail page on screen, whoever
|
||||
* can go there does and the page picks it up as it mounts.
|
||||
*/
|
||||
export function offerReturnedComposer(returned: ReturnedComposer): void {
|
||||
export function offerReturnedComposer(incoming: Omit<ReturnedComposer, 'claim'> & { sendReady: () => void }): void {
|
||||
const { sendReady, ...returned } = incoming;
|
||||
if (waiting) {
|
||||
returned.answer('busy');
|
||||
return;
|
||||
}
|
||||
waiting = returned;
|
||||
waiting = {
|
||||
...returned,
|
||||
claim: () => new Promise((resolve) => {
|
||||
const settle = (go: boolean) => {
|
||||
clearTimeout(timer);
|
||||
commits.delete(returned.returnId);
|
||||
resolve(go);
|
||||
};
|
||||
const timer = setTimeout(() => settle(false), COMMIT_WAIT_MS);
|
||||
commits.set(returned.returnId, settle);
|
||||
sendReady();
|
||||
}),
|
||||
};
|
||||
for (const listener of [...(mailListeners.size > 0 ? mailListeners : elsewhereListeners)]) listener();
|
||||
}
|
||||
|
||||
@@ -66,9 +104,15 @@ export function takeReturnedComposer(): ReturnedComposer | null {
|
||||
return returned;
|
||||
}
|
||||
|
||||
/** The pop-out goes ahead. */
|
||||
export function commitReturnedComposer(returnId: string): void {
|
||||
commits.get(returnId)?.(true);
|
||||
}
|
||||
|
||||
/** The pop-out gave up waiting and keeps the draft. */
|
||||
export function dropReturnedComposer(returnId: string): void {
|
||||
if (waiting?.returnId === returnId) waiting = null;
|
||||
commits.get(returnId)?.(false);
|
||||
}
|
||||
|
||||
/** The mail page, for as long as it's there. */
|
||||
@@ -87,14 +131,13 @@ export function onReturnedComposerElsewhere(listener: () => void): () => void {
|
||||
};
|
||||
}
|
||||
|
||||
/** Lets the pop-out go once a composer has really opened here. Call before opening it. */
|
||||
export function answerWhenComposerOpens(returned: ReturnedComposer, waitMs = OPEN_WAIT_MS): void {
|
||||
const finish = () => {
|
||||
clearTimeout(timer);
|
||||
/**
|
||||
* Lets the pop-out go once a composer has really opened here. Call before opening it. There's
|
||||
* no time limit: the pop-out holds the text until then, and goes on holding it if this window goes.
|
||||
*/
|
||||
export function answerWhenComposerOpens(returned: ReturnedComposer): void {
|
||||
const stop = onComposerOpened(() => {
|
||||
stop();
|
||||
returned.answer('shown');
|
||||
};
|
||||
const stop = onComposerOpened(finish);
|
||||
// No answer means the pop-out stays with the text: nothing is lost by saying nothing.
|
||||
const timer = setTimeout(stop, waitMs);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6966,10 +6966,12 @@
|
||||
"taken": "يستخدم تطبيق آخر {keys}، لذلك لا يعمل هنا. اختر مفاتيح أخرى أو أغلق ذلك التطبيق.",
|
||||
"change": "تغيير المفاتيح: {keys}",
|
||||
"recording": "اضغط المفاتيح…",
|
||||
"recording_hint": "اضغط مع الاستمرار على مفتاحين من Ctrl وAlt وShift ومفتاح النظام، ثم اضغط حرفًا أو رقمًا. يلغي Esc العملية.",
|
||||
"recording_hint": "اضغط مع الاستمرار على Ctrl (أو Cmd في Mac) مع Alt أو Shift، ثم اضغط حرفًا أو رقمًا أو Enter أو مفتاح وظيفة. يلغي Esc العملية.",
|
||||
"back_to_main": "نقل إلى النافذة الرئيسية",
|
||||
"back_busy": "توجد رسالة مفتوحة بالفعل في النافذة الرئيسية. أغلقها ثم حاول مرة أخرى.",
|
||||
"back_no_answer": "لم تستجب النافذة الرئيسية. تبقى رسالتك هنا."
|
||||
"back_no_answer": "لم تستجب النافذة الرئيسية. تبقى رسالتك هنا.",
|
||||
"types_character": "تكتب هذه المفاتيح حرفًا على لوحة مفاتيحك، وسيتوقف عن العمل في كل التطبيقات. جرّب مفاتيح أخرى.",
|
||||
"reserved": "يستخدم النظام أو معظم التطبيقات هذه المفاتيح. جرّب مفاتيح أخرى."
|
||||
},
|
||||
"desktopReminders": {
|
||||
"generic_title": "تذكير",
|
||||
|
||||
@@ -6966,10 +6966,12 @@
|
||||
"taken": "Una altra aplicació fa servir {keys}, així que aquí no fa res. Tria altres tecles o tanca aquella aplicació.",
|
||||
"change": "Canvia les tecles: {keys}",
|
||||
"recording": "Prem les tecles…",
|
||||
"recording_hint": "Mantén premudes dues de Ctrl, Alt, Maj o la tecla del sistema, i prem una lletra o un número. Esc cancel·la.",
|
||||
"recording_hint": "Mantén premuda Ctrl (Cmd al Mac) amb Alt o Maj, i prem una lletra, un número, Retorn o una tecla de funció. Esc cancel·la.",
|
||||
"back_to_main": "Mou a la finestra principal",
|
||||
"back_busy": "La finestra principal ja té un missatge obert. Tanca'l i torna-ho a provar.",
|
||||
"back_no_answer": "La finestra principal no ha respost. El teu missatge es queda aquí."
|
||||
"back_no_answer": "La finestra principal no ha respost. El teu missatge es queda aquí.",
|
||||
"types_character": "Aquestes tecles escriuen un caràcter al teu teclat, i deixaria de funcionar a totes les aplicacions. Prova altres tecles.",
|
||||
"reserved": "El sistema o la majoria d'aplicacions fan servir aquestes tecles. Prova altres tecles."
|
||||
},
|
||||
"desktopReminders": {
|
||||
"generic_title": "Recordatori",
|
||||
|
||||
@@ -6966,10 +6966,12 @@
|
||||
"taken": "{keys} používá jiná aplikace, takže tady nic neudělá. Vyberte jiné klávesy nebo tu aplikaci zavřete.",
|
||||
"change": "Změnit klávesy: {keys}",
|
||||
"recording": "Stiskněte klávesy…",
|
||||
"recording_hint": "Podržte dvě z kláves Ctrl, Alt, Shift nebo systémovou klávesu a stiskněte písmeno nebo číslici. Esc zruší.",
|
||||
"recording_hint": "Podržte Ctrl (na Macu Cmd) spolu s Alt nebo Shift a stiskněte písmeno, číslici, Enter nebo funkční klávesu. Esc zruší.",
|
||||
"back_to_main": "Přesunout do hlavního okna",
|
||||
"back_busy": "V hlavním okně je už otevřená zpráva. Zavřete ji a zkuste to znovu.",
|
||||
"back_no_answer": "Hlavní okno neodpovědělo. Vaše zpráva zůstává tady."
|
||||
"back_no_answer": "Hlavní okno neodpovědělo. Vaše zpráva zůstává tady.",
|
||||
"types_character": "Tyto klávesy na vaší klávesnici píší znak, který by pak nefungoval v žádné aplikaci. Zkuste jiné klávesy.",
|
||||
"reserved": "Tyto klávesy používá systém nebo většina aplikací. Zkuste jiné klávesy."
|
||||
},
|
||||
"desktopReminders": {
|
||||
"generic_title": "Připomenutí",
|
||||
|
||||
@@ -6966,10 +6966,12 @@
|
||||
"taken": "En anden app bruger {keys}, så her sker der ikke noget. Vælg andre taster, eller luk den app.",
|
||||
"change": "Skift tasterne: {keys}",
|
||||
"recording": "Tryk på tasterne…",
|
||||
"recording_hint": "Hold to af Ctrl, Alt, Shift eller systemtasten nede, og tryk på et bogstav eller tal. Esc annullerer.",
|
||||
"recording_hint": "Hold Ctrl (Cmd på en Mac) nede sammen med Alt eller Shift, og tryk på et bogstav, tal, Enter eller en funktionstast. Esc annullerer.",
|
||||
"back_to_main": "Flyt til hovedvinduet",
|
||||
"back_busy": "Hovedvinduet har allerede en besked åben. Luk den, og prøv igen.",
|
||||
"back_no_answer": "Hovedvinduet svarede ikke. Din besked bliver her."
|
||||
"back_no_answer": "Hovedvinduet svarede ikke. Din besked bliver her.",
|
||||
"types_character": "Disse taster skriver et tegn på dit tastatur, og det ville holde op med at virke i alle apps. Prøv andre taster.",
|
||||
"reserved": "Dit system eller de fleste apps bruger disse taster. Prøv andre taster."
|
||||
},
|
||||
"desktopReminders": {
|
||||
"generic_title": "Påmindelse",
|
||||
|
||||
@@ -6966,10 +6966,12 @@
|
||||
"taken": "Eine andere App verwendet {keys}, daher passiert hier nichts. Wählen Sie andere Tasten, oder schließen Sie diese App.",
|
||||
"change": "Tasten ändern: {keys}",
|
||||
"recording": "Tasten drücken…",
|
||||
"recording_hint": "Halten Sie zwei der Tasten Strg, Alt, Umschalt oder die Systemtaste, und drücken Sie einen Buchstaben oder eine Zahl. Esc bricht ab.",
|
||||
"recording_hint": "Halten Sie Strg (auf dem Mac Cmd) mit Alt oder Umschalt, und drücken Sie einen Buchstaben, eine Zahl, die Eingabetaste oder eine Funktionstaste. Esc bricht ab.",
|
||||
"back_to_main": "In das Hauptfenster verschieben",
|
||||
"back_busy": "Im Hauptfenster ist bereits eine Nachricht geöffnet. Schließen Sie diese, und versuchen Sie es dann erneut.",
|
||||
"back_no_answer": "Das Hauptfenster hat nicht geantwortet. Ihre Nachricht bleibt hier."
|
||||
"back_no_answer": "Das Hauptfenster hat nicht geantwortet. Ihre Nachricht bleibt hier.",
|
||||
"types_character": "Diese Tasten erzeugen auf Ihrer Tastatur ein Zeichen, das dann in keiner App mehr funktionieren würde. Versuchen Sie andere Tasten.",
|
||||
"reserved": "Ihr System oder die meisten Apps verwenden diese Tasten. Versuchen Sie andere Tasten."
|
||||
},
|
||||
"desktopReminders": {
|
||||
"generic_title": "Erinnerung",
|
||||
|
||||
@@ -6966,10 +6966,12 @@
|
||||
"taken": "Another app is using {keys}, so it does nothing here. Pick other keys, or close that app.",
|
||||
"change": "Change the keys: {keys}",
|
||||
"recording": "Press the keys…",
|
||||
"recording_hint": "Hold two of Ctrl, Alt, Shift or the system key, and press a letter or number. Esc cancels.",
|
||||
"recording_hint": "Hold Ctrl (Cmd on a Mac) with Alt or Shift, and press a letter, number, Enter or function key. Esc cancels.",
|
||||
"back_to_main": "Move to the main window",
|
||||
"back_busy": "The main window already has a message open. Close that one, then try again.",
|
||||
"back_no_answer": "The main window did not answer. Your message stays here."
|
||||
"back_no_answer": "The main window did not answer. Your message stays here.",
|
||||
"types_character": "These keys type a character on your keyboard, and it would stop working in every app. Try other keys.",
|
||||
"reserved": "Your system or most apps use these keys. Try other keys."
|
||||
},
|
||||
"desktopReminders": {
|
||||
"generic_title": "Reminder",
|
||||
|
||||
@@ -6966,10 +6966,12 @@
|
||||
"taken": "Otra aplicación está usando {keys}, así que aquí no hace nada. Elige otras teclas o cierra esa aplicación.",
|
||||
"change": "Cambiar las teclas: {keys}",
|
||||
"recording": "Pulsa las teclas…",
|
||||
"recording_hint": "Mantén pulsadas dos de Ctrl, Alt, Mayús o la tecla del sistema, y pulsa una letra o un número. Esc cancela.",
|
||||
"recording_hint": "Mantén pulsada Ctrl (Cmd en Mac) con Alt o Mayús, y pulsa una letra, un número, Intro o una tecla de función. Esc cancela.",
|
||||
"back_to_main": "Mover a la ventana principal",
|
||||
"back_busy": "La ventana principal ya tiene un mensaje abierto. Ciérralo y vuelve a intentarlo.",
|
||||
"back_no_answer": "La ventana principal no respondió. Tu mensaje se queda aquí."
|
||||
"back_no_answer": "La ventana principal no respondió. Tu mensaje se queda aquí.",
|
||||
"types_character": "Estas teclas escriben un carácter en tu teclado, y dejaría de funcionar en todas las aplicaciones. Prueba otras teclas.",
|
||||
"reserved": "Tu sistema o la mayoría de las aplicaciones usan estas teclas. Prueba otras teclas."
|
||||
},
|
||||
"desktopReminders": {
|
||||
"generic_title": "Recordatorio",
|
||||
|
||||
@@ -6966,10 +6966,12 @@
|
||||
"taken": "{keys} on teise rakenduse kasutuses, seega siin ei juhtu midagi. Valige teised klahvid või sulgege see rakendus.",
|
||||
"change": "Muuda klahve: {keys}",
|
||||
"recording": "Vajutage klahve…",
|
||||
"recording_hint": "Hoidke all kahte klahvi Ctrl, Alt, Shift või süsteemiklahv ja vajutage tähte või numbrit. Esc tühistab.",
|
||||
"recording_hint": "Hoidke all Ctrl (Macis Cmd) koos Alt või Shiftiga ja vajutage tähte, numbrit, Enterit või funktsiooniklahvi. Esc tühistab.",
|
||||
"back_to_main": "Teisalda põhiaknasse",
|
||||
"back_busy": "Põhiaknas on juba kiri avatud. Sulgege see ja proovige uuesti.",
|
||||
"back_no_answer": "Põhiaken ei vastanud. Teie kiri jääb siia."
|
||||
"back_no_answer": "Põhiaken ei vastanud. Teie kiri jääb siia.",
|
||||
"types_character": "Need klahvid kirjutavad teie klaviatuuril märgi, mis lakkaks kõigis rakendustes töötamast. Proovige teisi klahve.",
|
||||
"reserved": "Neid klahve kasutab süsteem või enamik rakendusi. Proovige teisi klahve."
|
||||
},
|
||||
"desktopReminders": {
|
||||
"generic_title": "Meeldetuletus",
|
||||
|
||||
@@ -6966,10 +6966,12 @@
|
||||
"taken": "برنامه دیگری از {keys} استفاده میکند، پس اینجا کاری انجام نمیدهد. کلیدهای دیگری انتخاب کنید یا آن برنامه را ببندید.",
|
||||
"change": "تغییر کلیدها: {keys}",
|
||||
"recording": "کلیدها را فشار دهید…",
|
||||
"recording_hint": "دو کلید از Ctrl، Alt، Shift یا کلید سیستم را نگه دارید و یک حرف یا عدد را فشار دهید. Esc لغو میکند.",
|
||||
"recording_hint": "Ctrl (در Mac کلید Cmd) را همراه با Alt یا Shift نگه دارید و یک حرف، عدد، Enter یا کلید تابعی را فشار دهید. Esc لغو میکند.",
|
||||
"back_to_main": "انتقال به پنجره اصلی",
|
||||
"back_busy": "پنجره اصلی از قبل یک پیام باز دارد. آن را ببندید و دوباره امتحان کنید.",
|
||||
"back_no_answer": "پنجره اصلی پاسخ نداد. پیام شما اینجا میماند."
|
||||
"back_no_answer": "پنجره اصلی پاسخ نداد. پیام شما اینجا میماند.",
|
||||
"types_character": "این کلیدها روی صفحهکلید شما نویسهای مینویسند و آن نویسه دیگر در هیچ برنامهای کار نمیکند. کلیدهای دیگری را امتحان کنید.",
|
||||
"reserved": "سیستم یا بیشتر برنامهها از این کلیدها استفاده میکنند. کلیدهای دیگری را امتحان کنید."
|
||||
},
|
||||
"desktopReminders": {
|
||||
"generic_title": "یادآوری",
|
||||
|
||||
@@ -6966,10 +6966,12 @@
|
||||
"taken": "Une autre application utilise {keys}, ce raccourci n'a donc aucun effet ici. Choisissez d'autres touches ou fermez cette application.",
|
||||
"change": "Changer les touches : {keys}",
|
||||
"recording": "Appuyez sur les touches…",
|
||||
"recording_hint": "Maintenez deux touches parmi Ctrl, Alt, Maj ou la touche système, puis appuyez sur une lettre ou un chiffre. Échap annule.",
|
||||
"recording_hint": "Maintenez Ctrl (Cmd sur Mac) avec Alt ou Maj, puis appuyez sur une lettre, un chiffre, Entrée ou une touche de fonction. Échap annule.",
|
||||
"back_to_main": "Déplacer vers la fenêtre principale",
|
||||
"back_busy": "La fenêtre principale a déjà un message ouvert. Fermez-le, puis réessayez.",
|
||||
"back_no_answer": "La fenêtre principale n'a pas répondu. Votre message reste ici."
|
||||
"back_no_answer": "La fenêtre principale n'a pas répondu. Votre message reste ici.",
|
||||
"types_character": "Ces touches produisent un caractère sur votre clavier, et il ne fonctionnerait plus dans aucune application. Essayez d'autres touches.",
|
||||
"reserved": "Votre système ou la plupart des applications utilisent ces touches. Essayez d'autres touches."
|
||||
},
|
||||
"desktopReminders": {
|
||||
"generic_title": "Rappel",
|
||||
|
||||
@@ -6967,10 +6967,12 @@
|
||||
"taken": "אפליקציה אחרת משתמשת ב-{keys}, ולכן כאן זה לא עושה כלום. בחרו מקשים אחרים או סגרו את האפליקציה הזו.",
|
||||
"change": "שינוי המקשים: {keys}",
|
||||
"recording": "לחצו על המקשים…",
|
||||
"recording_hint": "החזיקו שניים מהמקשים Ctrl, Alt, Shift או מקש המערכת, ולחצו על אות או מספר. Esc מבטל.",
|
||||
"recording_hint": "החזיקו Ctrl (Cmd ב-Mac) יחד עם Alt או Shift, ולחצו על אות, מספר, Enter או מקש פונקציה. Esc מבטל.",
|
||||
"back_to_main": "העברה לחלון הראשי",
|
||||
"back_busy": "בחלון הראשי כבר פתוחה הודעה. סגרו אותה ונסו שוב.",
|
||||
"back_no_answer": "החלון הראשי לא ענה. ההודעה שלכם נשארת כאן."
|
||||
"back_no_answer": "החלון הראשי לא ענה. ההודעה שלכם נשארת כאן.",
|
||||
"types_character": "המקשים האלה מקלידים תו במקלדת שלכם, והוא יפסיק לעבוד בכל האפליקציות. נסו מקשים אחרים.",
|
||||
"reserved": "המערכת או רוב האפליקציות משתמשות במקשים האלה. נסו מקשים אחרים."
|
||||
},
|
||||
"desktopReminders": {
|
||||
"generic_title": "תזכורת",
|
||||
|
||||
@@ -6966,10 +6966,12 @@
|
||||
"taken": "A(z) {keys} billentyűket egy másik alkalmazás használja, így itt nem történik semmi. Válasszon más billentyűket, vagy zárja be azt az alkalmazást.",
|
||||
"change": "Billentyűk módosítása: {keys}",
|
||||
"recording": "Nyomja meg a billentyűket…",
|
||||
"recording_hint": "Tartson lenyomva kettőt a Ctrl, Alt, Shift vagy a rendszerbillentyű közül, és nyomjon meg egy betűt vagy számot. Az Esc megszakítja.",
|
||||
"recording_hint": "Tartsa lenyomva a Ctrl (Macen a Cmd) billentyűt az Alt vagy a Shift billentyűvel, és nyomjon meg egy betűt, számot, az Entert vagy egy funkcióbillentyűt. Az Esc megszakítja.",
|
||||
"back_to_main": "Áthelyezés a főablakba",
|
||||
"back_busy": "A főablakban már nyitva van egy üzenet. Zárja be, majd próbálja újra.",
|
||||
"back_no_answer": "A főablak nem válaszolt. Az üzenet itt marad."
|
||||
"back_no_answer": "A főablak nem válaszolt. Az üzenet itt marad.",
|
||||
"types_character": "Ezek a billentyűk karaktert írnak az Ön billentyűzetén, amely többé egyik alkalmazásban sem működne. Próbáljon más billentyűket.",
|
||||
"reserved": "Ezeket a billentyűket a rendszer vagy a legtöbb alkalmazás használja. Próbáljon más billentyűket."
|
||||
},
|
||||
"desktopReminders": {
|
||||
"generic_title": "Emlékeztető",
|
||||
|
||||
@@ -6966,10 +6966,12 @@
|
||||
"taken": "Un'altra app sta usando {keys}, quindi qui non succede nulla. Scegli altri tasti o chiudi quell'app.",
|
||||
"change": "Cambia i tasti: {keys}",
|
||||
"recording": "Premi i tasti…",
|
||||
"recording_hint": "Tieni premuti due tra Ctrl, Alt, Maiusc o il tasto di sistema e premi una lettera o un numero. Esc annulla.",
|
||||
"recording_hint": "Tieni premuto Ctrl (Cmd su Mac) con Alt o Maiusc e premi una lettera, un numero, Invio o un tasto funzione. Esc annulla.",
|
||||
"back_to_main": "Sposta nella finestra principale",
|
||||
"back_busy": "La finestra principale ha già un messaggio aperto. Chiudilo e riprova.",
|
||||
"back_no_answer": "La finestra principale non ha risposto. Il messaggio resta qui."
|
||||
"back_no_answer": "La finestra principale non ha risposto. Il messaggio resta qui.",
|
||||
"types_character": "Questi tasti scrivono un carattere sulla tua tastiera, che smetterebbe di funzionare in tutte le app. Prova altri tasti.",
|
||||
"reserved": "Il sistema o la maggior parte delle app usano questi tasti. Prova altri tasti."
|
||||
},
|
||||
"desktopReminders": {
|
||||
"generic_title": "Promemoria",
|
||||
|
||||
@@ -6966,10 +6966,12 @@
|
||||
"taken": "{keys} は別のアプリが使用中のため、ここでは動作しません。別のキーを選ぶか、そのアプリを閉じてください。",
|
||||
"change": "キーを変更: {keys}",
|
||||
"recording": "キーを押してください…",
|
||||
"recording_hint": "Ctrl、Alt、Shift、システムキーのうち 2 つを押したまま、文字か数字を押します。Esc でキャンセルします。",
|
||||
"recording_hint": "Ctrl (Mac では Cmd) と Alt または Shift を押したまま、文字、数字、Enter、ファンクションキーのいずれかを押します。Esc でキャンセルします。",
|
||||
"back_to_main": "メインウィンドウに移動",
|
||||
"back_busy": "メインウィンドウで別のメッセージが開いています。それを閉じてからもう一度お試しください。",
|
||||
"back_no_answer": "メインウィンドウから応答がありません。メッセージはここに残ります。"
|
||||
"back_no_answer": "メインウィンドウから応答がありません。メッセージはここに残ります。",
|
||||
"types_character": "このキーはお使いのキーボードで文字を入力します。割り当てると、すべてのアプリでその文字を入力できなくなります。別のキーをお試しください。",
|
||||
"reserved": "このキーはシステムまたは多くのアプリが使用しています。別のキーをお試しください。"
|
||||
},
|
||||
"desktopReminders": {
|
||||
"generic_title": "リマインダー",
|
||||
|
||||
@@ -6966,10 +6966,12 @@
|
||||
"taken": "다른 앱이 {keys}를 사용 중이라 여기서는 작동하지 않습니다. 다른 키를 고르거나 그 앱을 닫으세요.",
|
||||
"change": "키 변경: {keys}",
|
||||
"recording": "키를 누르세요…",
|
||||
"recording_hint": "Ctrl, Alt, Shift, 시스템 키 중 두 개를 누른 채 문자나 숫자를 누르세요. Esc를 누르면 취소됩니다.",
|
||||
"recording_hint": "Ctrl(Mac에서는 Cmd)과 Alt 또는 Shift를 누른 채 문자, 숫자, Enter 또는 기능 키를 누르세요. Esc를 누르면 취소됩니다.",
|
||||
"back_to_main": "기본 창으로 이동",
|
||||
"back_busy": "기본 창에 이미 열린 메시지가 있습니다. 그 메시지를 닫고 다시 시도하세요.",
|
||||
"back_no_answer": "기본 창이 응답하지 않았습니다. 메시지는 여기에 그대로 있습니다."
|
||||
"back_no_answer": "기본 창이 응답하지 않았습니다. 메시지는 여기에 그대로 있습니다.",
|
||||
"types_character": "이 키는 사용 중인 키보드에서 문자를 입력하며, 지정하면 모든 앱에서 그 문자를 입력할 수 없게 됩니다. 다른 키를 사용해 보세요.",
|
||||
"reserved": "시스템 또는 대부분의 앱이 이 키를 사용합니다. 다른 키를 사용해 보세요."
|
||||
},
|
||||
"desktopReminders": {
|
||||
"generic_title": "알림",
|
||||
|
||||
@@ -6966,10 +6966,12 @@
|
||||
"taken": "{keys} izmanto cita lietotne, tāpēc šeit nekas nenotiek. Izvēlieties citus taustiņus vai aizveriet šo lietotni.",
|
||||
"change": "Mainīt taustiņus: {keys}",
|
||||
"recording": "Nospiediet taustiņus…",
|
||||
"recording_hint": "Turiet nospiestus divus no Ctrl, Alt, Shift vai sistēmas taustiņa un nospiediet burtu vai ciparu. Esc atceļ.",
|
||||
"recording_hint": "Turiet nospiestu Ctrl (Mac datorā Cmd) kopā ar Alt vai Shift un nospiediet burtu, ciparu, Enter vai funkciju taustiņu. Esc atceļ.",
|
||||
"back_to_main": "Pārvietot uz galveno logu",
|
||||
"back_busy": "Galvenajā logā jau ir atvērta ziņa. Aizveriet to un mēģiniet vēlreiz.",
|
||||
"back_no_answer": "Galvenais logs neatbildēja. Jūsu ziņa paliek šeit."
|
||||
"back_no_answer": "Galvenais logs neatbildēja. Jūsu ziņa paliek šeit.",
|
||||
"types_character": "Šie taustiņi jūsu tastatūrā raksta rakstzīmi, kas pārstātu darboties visās lietotnēs. Izmēģiniet citus taustiņus.",
|
||||
"reserved": "Šos taustiņus izmanto sistēma vai lielākā daļa lietotņu. Izmēģiniet citus taustiņus."
|
||||
},
|
||||
"desktopReminders": {
|
||||
"generic_title": "Atgādinājums",
|
||||
|
||||
@@ -6966,10 +6966,12 @@
|
||||
"taken": "{keys}-г өөр апп ашиглаж байгаа тул энд ажиллахгүй. Өөр товч сонгох эсвэл тэр аппыг хаана уу.",
|
||||
"change": "Товчийг өөрчлөх: {keys}",
|
||||
"recording": "Товчнуудыг дарна уу…",
|
||||
"recording_hint": "Ctrl, Alt, Shift эсвэл системийн товчноос хоёрыг дарж байгаад үсэг эсвэл тоо дарна уу. Esc цуцална.",
|
||||
"recording_hint": "Ctrl (Mac дээр Cmd)-г Alt эсвэл Shift-тэй хамт дарж байгаад үсэг, тоо, Enter эсвэл функц товч дарна уу. Esc цуцална.",
|
||||
"back_to_main": "Үндсэн цонх руу зөөх",
|
||||
"back_busy": "Үндсэн цонхонд аль хэдийн мессеж нээлттэй байна. Түүнийг хаагаад дахин оролдоно уу.",
|
||||
"back_no_answer": "Үндсэн цонх хариу өгсөнгүй. Таны мессеж энд үлдэнэ."
|
||||
"back_no_answer": "Үндсэн цонх хариу өгсөнгүй. Таны мессеж энд үлдэнэ.",
|
||||
"types_character": "Эдгээр товч таны гар дээр тэмдэгт бичдэг тул тэр тэмдэгт бүх аппад ажиллахаа болино. Өөр товч туршина уу.",
|
||||
"reserved": "Систем эсвэл ихэнх апп эдгээр товчийг ашигладаг. Өөр товч туршина уу."
|
||||
},
|
||||
"desktopReminders": {
|
||||
"generic_title": "Сануулга",
|
||||
|
||||
@@ -6966,10 +6966,12 @@
|
||||
"taken": "En annen app bruker {keys}, så her skjer det ingenting. Velg andre taster, eller lukk den appen.",
|
||||
"change": "Endre tastene: {keys}",
|
||||
"recording": "Trykk på tastene…",
|
||||
"recording_hint": "Hold nede to av Ctrl, Alt, Shift eller systemtasten, og trykk på en bokstav eller et tall. Esc avbryter.",
|
||||
"recording_hint": "Hold Ctrl (Cmd på Mac) nede sammen med Alt eller Shift, og trykk på en bokstav, et tall, Enter eller en funksjonstast. Esc avbryter.",
|
||||
"back_to_main": "Flytt til hovedvinduet",
|
||||
"back_busy": "Hovedvinduet har allerede en melding åpen. Lukk den, og prøv igjen.",
|
||||
"back_no_answer": "Hovedvinduet svarte ikke. Meldingen din blir her."
|
||||
"back_no_answer": "Hovedvinduet svarte ikke. Meldingen din blir her.",
|
||||
"types_character": "Disse tastene skriver et tegn på tastaturet ditt, og det ville slutte å virke i alle apper. Prøv andre taster.",
|
||||
"reserved": "Systemet ditt eller de fleste apper bruker disse tastene. Prøv andre taster."
|
||||
},
|
||||
"desktopReminders": {
|
||||
"generic_title": "Påminnelse",
|
||||
|
||||
@@ -6966,10 +6966,12 @@
|
||||
"taken": "Een andere app gebruikt {keys}, dus hier gebeurt niets. Kies andere toetsen of sluit die app.",
|
||||
"change": "Toetsen wijzigen: {keys}",
|
||||
"recording": "Druk op de toetsen…",
|
||||
"recording_hint": "Houd twee van Ctrl, Alt, Shift of de systeemtoets vast en druk op een letter of cijfer. Esc annuleert.",
|
||||
"recording_hint": "Houd Ctrl (Cmd op een Mac) met Alt of Shift vast en druk op een letter, cijfer, Enter of functietoets. Esc annuleert.",
|
||||
"back_to_main": "Naar het hoofdvenster verplaatsen",
|
||||
"back_busy": "In het hoofdvenster staat al een bericht open. Sluit dat en probeer het opnieuw.",
|
||||
"back_no_answer": "Het hoofdvenster gaf geen antwoord. Je bericht blijft hier."
|
||||
"back_no_answer": "Het hoofdvenster gaf geen antwoord. Je bericht blijft hier.",
|
||||
"types_character": "Deze toetsen typen een teken op je toetsenbord, en dat zou in geen enkele app meer werken. Probeer andere toetsen.",
|
||||
"reserved": "Je systeem of de meeste apps gebruiken deze toetsen. Probeer andere toetsen."
|
||||
},
|
||||
"desktopReminders": {
|
||||
"generic_title": "Herinnering",
|
||||
|
||||
@@ -6966,10 +6966,12 @@
|
||||
"taken": "Inna aplikacja używa {keys}, więc tutaj nic się nie dzieje. Wybierz inne klawisze lub zamknij tę aplikację.",
|
||||
"change": "Zmień klawisze: {keys}",
|
||||
"recording": "Naciśnij klawisze…",
|
||||
"recording_hint": "Przytrzymaj dwa z klawiszy Ctrl, Alt, Shift lub klawisz systemowy i naciśnij literę albo cyfrę. Esc anuluje.",
|
||||
"recording_hint": "Przytrzymaj Ctrl (Cmd na Macu) razem z Alt lub Shift i naciśnij literę, cyfrę, Enter albo klawisz funkcyjny. Esc anuluje.",
|
||||
"back_to_main": "Przenieś do głównego okna",
|
||||
"back_busy": "W głównym oknie jest już otwarta wiadomość. Zamknij ją i spróbuj ponownie.",
|
||||
"back_no_answer": "Główne okno nie odpowiedziało. Wiadomość zostaje tutaj."
|
||||
"back_no_answer": "Główne okno nie odpowiedziało. Wiadomość zostaje tutaj.",
|
||||
"types_character": "Te klawisze wpisują znak na Twojej klawiaturze i przestałby on działać we wszystkich aplikacjach. Wypróbuj inne klawisze.",
|
||||
"reserved": "Te klawisze są używane przez system lub większość aplikacji. Wypróbuj inne klawisze."
|
||||
},
|
||||
"desktopReminders": {
|
||||
"generic_title": "Przypomnienie",
|
||||
|
||||
@@ -6966,10 +6966,12 @@
|
||||
"taken": "Outra aplicação está a usar {keys}, por isso aqui não faz nada. Escolha outras teclas ou feche essa aplicação.",
|
||||
"change": "Alterar as teclas: {keys}",
|
||||
"recording": "Prima as teclas…",
|
||||
"recording_hint": "Mantenha premidas duas de Ctrl, Alt, Shift ou a tecla do sistema e prima uma letra ou um número. Esc cancela.",
|
||||
"recording_hint": "Mantenha premida Ctrl (Cmd no Mac) com Alt ou Shift e prima uma letra, um número, Enter ou uma tecla de função. Esc cancela.",
|
||||
"back_to_main": "Mover para a janela principal",
|
||||
"back_busy": "A janela principal já tem uma mensagem aberta. Feche-a e tente de novo.",
|
||||
"back_no_answer": "A janela principal não respondeu. A sua mensagem fica aqui."
|
||||
"back_no_answer": "A janela principal não respondeu. A sua mensagem fica aqui.",
|
||||
"types_character": "Estas teclas escrevem um carácter no seu teclado, e ele deixaria de funcionar em todas as aplicações. Experimente outras teclas.",
|
||||
"reserved": "O seu sistema ou a maioria das aplicações usam estas teclas. Experimente outras teclas."
|
||||
},
|
||||
"desktopReminders": {
|
||||
"generic_title": "Lembrete",
|
||||
|
||||
@@ -6966,10 +6966,12 @@
|
||||
"taken": "Altă aplicație folosește {keys}, așa că aici nu face nimic. Alege alte taste sau închide aplicația respectivă.",
|
||||
"change": "Schimbă tastele: {keys}",
|
||||
"recording": "Apasă tastele…",
|
||||
"recording_hint": "Ține apăsate două dintre Ctrl, Alt, Shift sau tasta de sistem și apasă o literă sau o cifră. Esc anulează.",
|
||||
"recording_hint": "Ține apăsată tasta Ctrl (Cmd pe Mac) cu Alt sau Shift și apasă o literă, o cifră, Enter sau o tastă funcțională. Esc anulează.",
|
||||
"back_to_main": "Mută în fereastra principală",
|
||||
"back_busy": "Fereastra principală are deja un mesaj deschis. Închide-l și încearcă din nou.",
|
||||
"back_no_answer": "Fereastra principală nu a răspuns. Mesajul rămâne aici."
|
||||
"back_no_answer": "Fereastra principală nu a răspuns. Mesajul rămâne aici.",
|
||||
"types_character": "Aceste taste scriu un caracter pe tastatura ta, iar el n-ar mai funcționa în nicio aplicație. Încearcă alte taste.",
|
||||
"reserved": "Sistemul sau majoritatea aplicațiilor folosesc aceste taste. Încearcă alte taste."
|
||||
},
|
||||
"desktopReminders": {
|
||||
"generic_title": "Memento",
|
||||
|
||||
@@ -6966,10 +6966,12 @@
|
||||
"taken": "{keys} занято другим приложением, поэтому здесь сочетание не работает. Выберите другие клавиши или закройте это приложение.",
|
||||
"change": "Изменить клавиши: {keys}",
|
||||
"recording": "Нажмите клавиши…",
|
||||
"recording_hint": "Удерживайте две из клавиш Ctrl, Alt, Shift или системную клавишу и нажмите букву или цифру. Esc отменяет.",
|
||||
"recording_hint": "Удерживайте Ctrl (Cmd на Mac) вместе с Alt или Shift и нажмите букву, цифру, Enter или функциональную клавишу. Esc отменяет.",
|
||||
"back_to_main": "Переместить в главное окно",
|
||||
"back_busy": "В главном окне уже открыто письмо. Закройте его и попробуйте снова.",
|
||||
"back_no_answer": "Главное окно не ответило. Ваше письмо остаётся здесь."
|
||||
"back_no_answer": "Главное окно не ответило. Ваше письмо остаётся здесь.",
|
||||
"types_character": "На вашей клавиатуре эти клавиши вводят символ, и он перестал бы работать во всех приложениях. Попробуйте другие клавиши.",
|
||||
"reserved": "Эти клавиши использует система или большинство приложений. Попробуйте другие клавиши."
|
||||
},
|
||||
"desktopReminders": {
|
||||
"generic_title": "Напоминание",
|
||||
|
||||
@@ -6966,10 +6966,12 @@
|
||||
"taken": "{keys} používa iná aplikácia, takže tu nič neurobí. Vyberte iné klávesy alebo tú aplikáciu zatvorte.",
|
||||
"change": "Zmeniť klávesy: {keys}",
|
||||
"recording": "Stlačte klávesy…",
|
||||
"recording_hint": "Podržte dva z klávesov Ctrl, Alt, Shift alebo systémový kláves a stlačte písmeno alebo číslicu. Esc zruší.",
|
||||
"recording_hint": "Podržte Ctrl (na Macu Cmd) spolu s Alt alebo Shift a stlačte písmeno, číslicu, Enter alebo funkčný kláves. Esc zruší.",
|
||||
"back_to_main": "Presunúť do hlavného okna",
|
||||
"back_busy": "V hlavnom okne je už otvorená správa. Zatvorte ju a skúste to znova.",
|
||||
"back_no_answer": "Hlavné okno neodpovedalo. Vaša správa zostáva tu."
|
||||
"back_no_answer": "Hlavné okno neodpovedalo. Vaša správa zostáva tu.",
|
||||
"types_character": "Tieto klávesy na vašej klávesnici píšu znak, ktorý by potom nefungoval v žiadnej aplikácii. Skúste iné klávesy.",
|
||||
"reserved": "Tieto klávesy používa systém alebo väčšina aplikácií. Skúste iné klávesy."
|
||||
},
|
||||
"desktopReminders": {
|
||||
"generic_title": "Pripomienka",
|
||||
|
||||
@@ -6974,10 +6974,12 @@
|
||||
"taken": "แอปอื่นกำลังใช้ {keys} อยู่ จึงไม่มีผลที่นี่ เลือกปุ่มอื่นหรือปิดแอปนั้น",
|
||||
"change": "เปลี่ยนปุ่ม: {keys}",
|
||||
"recording": "กดปุ่ม…",
|
||||
"recording_hint": "กดค้างสองปุ่มจาก Ctrl, Alt, Shift หรือปุ่มระบบ แล้วกดตัวอักษรหรือตัวเลข กด Esc เพื่อยกเลิก",
|
||||
"recording_hint": "กด Ctrl (Cmd บน Mac) ค้างไว้พร้อม Alt หรือ Shift แล้วกดตัวอักษร ตัวเลข Enter หรือปุ่มฟังก์ชัน กด Esc เพื่อยกเลิก",
|
||||
"back_to_main": "ย้ายไปหน้าต่างหลัก",
|
||||
"back_busy": "หน้าต่างหลักมีข้อความเปิดอยู่แล้ว ปิดข้อความนั้นแล้วลองอีกครั้ง",
|
||||
"back_no_answer": "หน้าต่างหลักไม่ตอบสนอง ข้อความของคุณยังอยู่ที่นี่"
|
||||
"back_no_answer": "หน้าต่างหลักไม่ตอบสนอง ข้อความของคุณยังอยู่ที่นี่",
|
||||
"types_character": "ปุ่มเหล่านี้พิมพ์อักขระบนแป้นพิมพ์ของคุณ และอักขระนั้นจะใช้ไม่ได้ในทุกแอป ลองใช้ปุ่มอื่น",
|
||||
"reserved": "ระบบหรือแอปส่วนใหญ่ใช้ปุ่มเหล่านี้ ลองใช้ปุ่มอื่น"
|
||||
},
|
||||
"desktopReminders": {
|
||||
"generic_title": "การแจ้งเตือน",
|
||||
|
||||
@@ -6966,10 +6966,12 @@
|
||||
"taken": "{keys} başka bir uygulama tarafından kullanılıyor, bu yüzden burada bir şey yapmaz. Başka tuşlar seçin veya o uygulamayı kapatın.",
|
||||
"change": "Tuşları değiştir: {keys}",
|
||||
"recording": "Tuşlara basın…",
|
||||
"recording_hint": "Ctrl, Alt, Shift veya sistem tuşundan ikisini basılı tutun ve bir harfe ya da rakama basın. Esc iptal eder.",
|
||||
"recording_hint": "Ctrl (Mac'te Cmd) ile Alt veya Shift tuşunu basılı tutun ve bir harfe, rakama, Enter'a ya da işlev tuşuna basın. Esc iptal eder.",
|
||||
"back_to_main": "Ana pencereye taşı",
|
||||
"back_busy": "Ana pencerede zaten açık bir ileti var. Onu kapatın ve yeniden deneyin.",
|
||||
"back_no_answer": "Ana pencere yanıt vermedi. İletiniz burada kalıyor."
|
||||
"back_no_answer": "Ana pencere yanıt vermedi. İletiniz burada kalıyor.",
|
||||
"types_character": "Bu tuşlar klavyenizde bir karakter yazar ve bu karakter hiçbir uygulamada çalışmaz olur. Başka tuşlar deneyin.",
|
||||
"reserved": "Bu tuşları sisteminiz veya çoğu uygulama kullanıyor. Başka tuşlar deneyin."
|
||||
},
|
||||
"desktopReminders": {
|
||||
"generic_title": "Anımsatıcı",
|
||||
|
||||
@@ -6966,10 +6966,12 @@
|
||||
"taken": "{keys} використовує інший застосунок, тому тут нічого не відбувається. Виберіть інші клавіші або закрийте той застосунок.",
|
||||
"change": "Змінити клавіші: {keys}",
|
||||
"recording": "Натисніть клавіші…",
|
||||
"recording_hint": "Утримуйте дві з клавіш Ctrl, Alt, Shift або системну клавішу й натисніть літеру чи цифру. Esc скасовує.",
|
||||
"recording_hint": "Утримуйте Ctrl (Cmd на Mac) разом з Alt або Shift і натисніть літеру, цифру, Enter або функціональну клавішу. Esc скасовує.",
|
||||
"back_to_main": "Перемістити в головне вікно",
|
||||
"back_busy": "У головному вікні вже відкрито лист. Закрийте його й спробуйте ще раз.",
|
||||
"back_no_answer": "Головне вікно не відповіло. Ваш лист залишається тут."
|
||||
"back_no_answer": "Головне вікно не відповіло. Ваш лист залишається тут.",
|
||||
"types_character": "На вашій клавіатурі ці клавіші вводять символ, і він перестав би працювати в усіх застосунках. Спробуйте інші клавіші.",
|
||||
"reserved": "Ці клавіші використовує система або більшість застосунків. Спробуйте інші клавіші."
|
||||
},
|
||||
"desktopReminders": {
|
||||
"generic_title": "Нагадування",
|
||||
|
||||
@@ -6978,10 +6978,12 @@
|
||||
"taken": "Một ứng dụng khác đang dùng {keys}, nên phím tắt này không có tác dụng ở đây. Hãy chọn phím khác hoặc đóng ứng dụng đó.",
|
||||
"change": "Đổi phím: {keys}",
|
||||
"recording": "Nhấn các phím…",
|
||||
"recording_hint": "Giữ hai trong số Ctrl, Alt, Shift hoặc phím hệ thống, rồi nhấn một chữ cái hoặc chữ số. Esc để hủy.",
|
||||
"recording_hint": "Giữ Ctrl (Cmd trên Mac) cùng Alt hoặc Shift, rồi nhấn một chữ cái, chữ số, Enter hoặc phím chức năng. Esc để hủy.",
|
||||
"back_to_main": "Chuyển sang cửa sổ chính",
|
||||
"back_busy": "Cửa sổ chính đang mở một thư. Hãy đóng thư đó rồi thử lại.",
|
||||
"back_no_answer": "Cửa sổ chính không phản hồi. Thư của bạn vẫn ở đây."
|
||||
"back_no_answer": "Cửa sổ chính không phản hồi. Thư của bạn vẫn ở đây.",
|
||||
"types_character": "Các phím này gõ một ký tự trên bàn phím của bạn, và ký tự đó sẽ không dùng được trong mọi ứng dụng. Hãy thử phím khác.",
|
||||
"reserved": "Hệ thống hoặc hầu hết ứng dụng dùng các phím này. Hãy thử phím khác."
|
||||
},
|
||||
"desktopReminders": {
|
||||
"generic_title": "Lời nhắc",
|
||||
|
||||
@@ -6966,10 +6966,12 @@
|
||||
"taken": "另一個應用程式正在使用 {keys},所以在這裡沒有作用。請選擇其他按鍵,或關閉該應用程式。",
|
||||
"change": "變更按鍵:{keys}",
|
||||
"recording": "請按下按鍵…",
|
||||
"recording_hint": "按住 Ctrl、Alt、Shift 或系統鍵中的兩個,再按一個字母或數字。按 Esc 取消。",
|
||||
"recording_hint": "按住 Ctrl(Mac 上為 Cmd)和 Alt 或 Shift,再按一個字母、數字、Enter 或功能鍵。按 Esc 取消。",
|
||||
"back_to_main": "移到主視窗",
|
||||
"back_busy": "主視窗已有開啟的郵件。請先關閉它,然後再試一次。",
|
||||
"back_no_answer": "主視窗沒有回應。您的郵件仍在這裡。"
|
||||
"back_no_answer": "主視窗沒有回應。您的郵件仍在這裡。",
|
||||
"types_character": "這些鍵在您的鍵盤上會輸入一個字元,占用後該字元在所有應用程式中都無法輸入。請試試其他按鍵。",
|
||||
"reserved": "系統或大多數應用程式正在使用這些鍵。請試試其他按鍵。"
|
||||
},
|
||||
"desktopReminders": {
|
||||
"generic_title": "提醒",
|
||||
|
||||
@@ -6966,10 +6966,12 @@
|
||||
"taken": "另一个应用正在使用 {keys},所以在这里不起作用。请选择其他按键,或关闭那个应用。",
|
||||
"change": "更改按键:{keys}",
|
||||
"recording": "请按下按键…",
|
||||
"recording_hint": "按住 Ctrl、Alt、Shift 或系统键中的两个,再按一个字母或数字。按 Esc 取消。",
|
||||
"recording_hint": "按住 Ctrl(Mac 上为 Cmd)和 Alt 或 Shift,再按一个字母、数字、Enter 或功能键。按 Esc 取消。",
|
||||
"back_to_main": "移到主窗口",
|
||||
"back_busy": "主窗口中已有打开的邮件。请先关闭它,然后重试。",
|
||||
"back_no_answer": "主窗口没有响应。您的邮件仍在这里。"
|
||||
"back_no_answer": "主窗口没有响应。您的邮件仍在这里。",
|
||||
"types_character": "这些键在您的键盘上会输入一个字符,占用后该字符在所有应用中都无法输入。请试试其他按键。",
|
||||
"reserved": "系统或大多数应用在使用这些键。请试试其他按键。"
|
||||
},
|
||||
"desktopReminders": {
|
||||
"generic_title": "提醒",
|
||||
|
||||
Reference in New Issue
Block a user