diff --git a/packages/common/infra/src/modules/feature-flag/constant.ts b/packages/common/infra/src/modules/feature-flag/constant.ts index f045e65135b5d..29ab2c2f7989c 100644 --- a/packages/common/infra/src/modules/feature-flag/constant.ts +++ b/packages/common/infra/src/modules/feature-flag/constant.ts @@ -162,6 +162,14 @@ export const AFFINE_FLAGS = { configurable: false, defaultState: isMobile, }, + enable_mobile_linked_doc_menu: { + category: 'blocksuite', + bsFlag: 'enable_mobile_linked_doc_menu', + displayName: 'Mobile Linked Doc Widget', + description: 'Enables the mobile linked doc menu.', + configurable: false, + defaultState: isMobile, + }, enable_snapshot_import_export: { category: 'affine', displayName: 'Enable Snapshot Import Export', diff --git a/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/widgets/linked.ts b/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/widgets/linked.ts index e9d490c7e14a9..15e33e7c204a5 100644 --- a/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/widgets/linked.ts +++ b/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/widgets/linked.ts @@ -3,7 +3,10 @@ import { JournalService } from '@affine/core/modules/journal'; import { I18n } from '@affine/i18n'; import { track } from '@affine/track'; import type { EditorHost } from '@blocksuite/affine/block-std'; -import type { AffineInlineEditor } from '@blocksuite/affine/blocks'; +import type { + AffineInlineEditor, + LinkedWidgetConfig, +} from '@blocksuite/affine/blocks'; import { LinkedWidgetUtils } from '@blocksuite/affine/blocks'; import type { DocMeta } from '@blocksuite/affine/store'; import { type FrameworkProvider, WorkspaceService } from '@toeverything/infra'; @@ -11,7 +14,7 @@ import { type FrameworkProvider, WorkspaceService } from '@toeverything/infra'; // TODO: fix the type export function createLinkedWidgetConfig( framework: FrameworkProvider -): Partial> { +): Partial { return { getMenus: ( query: string, @@ -78,6 +81,17 @@ export function createLinkedWidgetConfig( ), ]); }, + mobile: { + useScreenHeight: BUILD_CONFIG.isIOS, + scrollContainer: window, + scrollTopOffset: () => { + const header = document.querySelector('header'); + if (!header) return 0; + + const { y, height } = header.getBoundingClientRect(); + return y + height; + }, + }, }; }