Skip to content

Commit

Permalink
feat(blocks): mobile at menu
Browse files Browse the repository at this point in the history
  • Loading branch information
L-Sun committed Nov 7, 2024
1 parent fcd4f8c commit 559fc7c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
8 changes: 8 additions & 0 deletions packages/common/infra/src/modules/feature-flag/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',

Check failure on line 167 in packages/common/infra/src/modules/feature-flag/constant.ts

View workflow job for this annotation

GitHub Actions / Lint

Type '"enable_mobile_linked_doc_menu"' is not assignable to type 'keyof BlockSuiteFlags'.
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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ 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,

Check failure on line 8 in packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/widgets/linked.ts

View workflow job for this annotation

GitHub Actions / Lint

Module '"@blocksuite/affine/blocks"' has no exported member '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';

// TODO: fix the type
export function createLinkedWidgetConfig(
framework: FrameworkProvider
): Partial<Record<string, unknown>> {
): Partial<LinkedWidgetConfig> {
return {
getMenus: (
query: string,
Expand Down Expand Up @@ -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;
},
},
};
}

Expand Down

0 comments on commit 559fc7c

Please sign in to comment.