mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-12 07:36:42 +08:00
6c125d9a38
fix AF-2420, AF-2391, AF-2265
74 lines
2.2 KiB
TypeScript
74 lines
2.2 KiB
TypeScript
import { z } from 'zod';
|
|
|
|
export const workbenchViewIconNameSchema = z.enum([
|
|
'trash',
|
|
'allDocs',
|
|
'collection',
|
|
'tag',
|
|
'doc', // refers to a doc whose mode is not yet being resolved
|
|
'page',
|
|
'edgeless',
|
|
'journal',
|
|
'attachment',
|
|
'pdf',
|
|
]);
|
|
|
|
export const workbenchViewMetaSchema = z.object({
|
|
id: z.string(),
|
|
path: z
|
|
.object({
|
|
pathname: z.string().optional(),
|
|
hash: z.string().optional(),
|
|
search: z.string().optional(),
|
|
})
|
|
.optional(),
|
|
// todo: move title/module to cached stated
|
|
title: z.string().optional(),
|
|
iconName: workbenchViewIconNameSchema.optional(),
|
|
});
|
|
|
|
export const workbenchMetaSchema = z.object({
|
|
id: z.string(),
|
|
activeViewIndex: z.number(),
|
|
pinned: z.boolean().optional(),
|
|
basename: z.string(),
|
|
views: z.array(workbenchViewMetaSchema),
|
|
});
|
|
|
|
export const tabViewsMetaSchema = z.object({
|
|
activeWorkbenchId: z.string().optional(),
|
|
workbenches: z.array(workbenchMetaSchema).default([]),
|
|
});
|
|
|
|
export const TabViewsMetaKey = 'tabViewsMetaSchema';
|
|
export type TabViewsMetaSchema = z.infer<typeof tabViewsMetaSchema>;
|
|
export type WorkbenchMeta = z.infer<typeof workbenchMetaSchema>;
|
|
export type WorkbenchViewMeta = z.infer<typeof workbenchViewMetaSchema>;
|
|
export type WorkbenchViewModule = z.infer<typeof workbenchViewIconNameSchema>;
|
|
|
|
export const SpellCheckStateSchema = z.object({
|
|
enabled: z.boolean().optional(),
|
|
});
|
|
|
|
export const SpellCheckStateKey = 'spellCheckState' as const;
|
|
// eslint-disable-next-line no-redeclare
|
|
export type SpellCheckStateSchema = z.infer<typeof SpellCheckStateSchema>;
|
|
|
|
export const MeetingSettingsKey = 'meetingSettings' as const;
|
|
export const MeetingSettingsSchema = z.object({
|
|
// global meeting feature control
|
|
enabled: z.boolean().default(false),
|
|
|
|
// when recording is saved, where to create the recording block
|
|
recordingSavingMode: z.enum(['new-doc', 'journal-today']).default('new-doc'),
|
|
|
|
// whether to enable auto transcription for new meeting recordings
|
|
autoTranscription: z.boolean().default(true),
|
|
|
|
// recording reactions to new meeting events
|
|
recordingMode: z.enum(['none', 'prompt', 'auto-start']).default('prompt'),
|
|
});
|
|
|
|
// eslint-disable-next-line no-redeclare
|
|
export type MeetingSettingsSchema = z.infer<typeof MeetingSettingsSchema>;
|