2f5e583653
* feat(export): make annotation export link type configurable Add an Annotation Link selector (App / Web) to the Export Annotations dialog. Defaults to the app deeplink in the native app and the universal web link on the web, so web exports no longer emit readest:// links that only the desktop/mobile app can open. The default markdown template now uses the configurable annotation.link variable. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(annotations): move Moon+ Reader import into a dedicated Import Annotations modal Replace the single 'Import from Moon+ Reader' menu item with an 'Import Annotations' entry (below 'Export Annotations') that opens a dedicated modal listing import sources. Currently lists Moon+ Reader; the boxed-list layout makes adding future providers a one-row change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { buildAnnotationUrl } from '../../utils/deeplink';
|
|
|
|
describe('buildAnnotationUrl', () => {
|
|
const link = { bookHash: 'abc', noteId: 'n1', cfi: '/6/4!/4/2' };
|
|
|
|
it('builds the custom-scheme app URL when linkType is "app"', () => {
|
|
const url = buildAnnotationUrl(link, 'app');
|
|
expect(url.startsWith('readest://book/abc/annotation/n1')).toBe(true);
|
|
});
|
|
|
|
it('builds the HTTPS web URL when linkType is "web"', () => {
|
|
const url = buildAnnotationUrl(link, 'web');
|
|
expect(url.startsWith('https://')).toBe(true);
|
|
expect(url).toContain('/o/book/abc/annotation/n1');
|
|
});
|
|
|
|
it('preserves the cfi query for both link types', () => {
|
|
const encoded = encodeURIComponent(link.cfi);
|
|
expect(buildAnnotationUrl(link, 'app')).toContain(`cfi=${encoded}`);
|
|
expect(buildAnnotationUrl(link, 'web')).toContain(`cfi=${encoded}`);
|
|
});
|
|
|
|
it('omits the cfi query when no cfi is provided', () => {
|
|
const url = buildAnnotationUrl({ bookHash: 'abc', noteId: 'n1' }, 'app');
|
|
expect(url).toBe('readest://book/abc/annotation/n1');
|
|
});
|
|
});
|