mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-18 02:26:21 +08:00
11dfc1d1df
Close [BS-3404](https://linear.app/affine-design/issue/BS-3404/通过embed-doc时,插入的doc还是card-view,应该要默认embed-view) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added the ability to insert and display embedded synced documents, supporting different link types based on editor mode and user preferences. - Introduced new UI interactions and view options for embedded synced documents in edgeless mode. - **Bug Fixes** - Updated UI selectors and preference keys to ensure consistent behavior and correct application of user settings. - **Tests** - Added and updated end-to-end tests for embedding synced documents, including header interactions and viewport fitting. - Improved test coverage for quick search insertion and edgeless embed synced doc features. - **Chores** - Renamed settings and updated exports to align with new embedding functionality. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
import { createIdentifier } from '@blocksuite/global/di';
|
|
import type { DeepPartial } from '@blocksuite/global/utils';
|
|
import type { ExtensionType } from '@blocksuite/store';
|
|
import type { Signal } from '@preact/signals-core';
|
|
import { z } from 'zod';
|
|
|
|
import { NodePropsSchema } from '../utils/index.js';
|
|
|
|
export const GeneralSettingSchema = z
|
|
.object({
|
|
edgelessScrollZoom: z.boolean().default(false),
|
|
edgelessDisableScheduleUpdate: z.boolean().default(false),
|
|
docCanvasPreferView: z
|
|
.enum(['affine:embed-linked-doc', 'affine:embed-synced-doc'])
|
|
.default('affine:embed-synced-doc'),
|
|
})
|
|
.merge(NodePropsSchema);
|
|
|
|
export type EditorSetting = z.infer<typeof GeneralSettingSchema>;
|
|
|
|
export interface EditorSettingService {
|
|
setting$: Signal<DeepPartial<EditorSetting>>;
|
|
set?: (
|
|
key: keyof EditorSetting,
|
|
value: EditorSetting[keyof EditorSetting]
|
|
) => void;
|
|
}
|
|
|
|
export const EditorSettingProvider = createIdentifier<EditorSettingService>(
|
|
'AffineEditorSettingProvider'
|
|
);
|
|
|
|
export function EditorSettingExtension(
|
|
service: EditorSettingService
|
|
): ExtensionType {
|
|
return {
|
|
setup: di => {
|
|
di.override(EditorSettingProvider, () => service);
|
|
},
|
|
};
|
|
}
|