mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-11 22:18:54 +08:00
feat(mobile): mobile at menu (#8727)
Close [BS-1608](https://linear.app/affine-design/issue/BS-1608/mobile-menu), related PR: https://github.com/toeverything/blocksuite/pull/8681
This commit is contained in:
@@ -162,6 +162,14 @@ export const AFFINE_FLAGS = {
|
|||||||
configurable: false,
|
configurable: false,
|
||||||
defaultState: isMobile,
|
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: {
|
enable_snapshot_import_export: {
|
||||||
category: 'affine',
|
category: 'affine',
|
||||||
displayName: 'Enable Snapshot Import Export',
|
displayName: 'Enable Snapshot Import Export',
|
||||||
|
|||||||
+16
-2
@@ -4,7 +4,10 @@ import { JournalService } from '@affine/core/modules/journal';
|
|||||||
import { I18n } from '@affine/i18n';
|
import { I18n } from '@affine/i18n';
|
||||||
import { track } from '@affine/track';
|
import { track } from '@affine/track';
|
||||||
import type { EditorHost } from '@blocksuite/affine/block-std';
|
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 { LinkedWidgetUtils } from '@blocksuite/affine/blocks';
|
||||||
import type { DocMeta } from '@blocksuite/affine/store';
|
import type { DocMeta } from '@blocksuite/affine/store';
|
||||||
import { type FrameworkProvider, WorkspaceService } from '@toeverything/infra';
|
import { type FrameworkProvider, WorkspaceService } from '@toeverything/infra';
|
||||||
@@ -74,7 +77,7 @@ function createNewDocMenuGroup(
|
|||||||
// TODO: fix the type
|
// TODO: fix the type
|
||||||
export function createLinkedWidgetConfig(
|
export function createLinkedWidgetConfig(
|
||||||
framework: FrameworkProvider
|
framework: FrameworkProvider
|
||||||
): Partial<Record<string, unknown>> {
|
): Partial<LinkedWidgetConfig> {
|
||||||
return {
|
return {
|
||||||
getMenus: (
|
getMenus: (
|
||||||
query: string,
|
query: string,
|
||||||
@@ -142,6 +145,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;
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user