mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-22 23:31:48 +03:00
feat(mobile): enable mobile keyboard toolbar (#8633)
This commit is contained in:
parent
8f95cc7b80
commit
50bae9c3e6
@ -3,6 +3,7 @@ import type { FlagInfo } from './types';
|
|||||||
const isNotStableBuild = BUILD_CONFIG.appBuildType !== 'stable';
|
const isNotStableBuild = BUILD_CONFIG.appBuildType !== 'stable';
|
||||||
const isDesktopEnvironment = BUILD_CONFIG.isElectron;
|
const isDesktopEnvironment = BUILD_CONFIG.isElectron;
|
||||||
const isCanaryBuild = BUILD_CONFIG.appBuildType === 'canary';
|
const isCanaryBuild = BUILD_CONFIG.appBuildType === 'canary';
|
||||||
|
const isMobile = BUILD_CONFIG.isMobileEdition;
|
||||||
|
|
||||||
export const AFFINE_FLAGS = {
|
export const AFFINE_FLAGS = {
|
||||||
enable_ai: {
|
enable_ai: {
|
||||||
@ -153,6 +154,14 @@ export const AFFINE_FLAGS = {
|
|||||||
configurable: true,
|
configurable: true,
|
||||||
defaultState: false,
|
defaultState: false,
|
||||||
},
|
},
|
||||||
|
enable_mobile_keyboard_toolbar: {
|
||||||
|
category: 'blocksuite',
|
||||||
|
bsFlag: 'enable_mobile_keyboard_toolbar',
|
||||||
|
displayName: 'Mobile Keyboard Toolbar',
|
||||||
|
description: 'Enables the mobile keyboard toolbar.',
|
||||||
|
configurable: false,
|
||||||
|
defaultState: isMobile,
|
||||||
|
},
|
||||||
} satisfies { [key in string]: FlagInfo };
|
} satisfies { [key in string]: FlagInfo };
|
||||||
|
|
||||||
export type AFFINE_FLAGS = typeof AFFINE_FLAGS;
|
export type AFFINE_FLAGS = typeof AFFINE_FLAGS;
|
||||||
|
@ -24,6 +24,7 @@ import { DisposableGroup } from '@blocksuite/affine/global/utils';
|
|||||||
import { type AffineEditorContainer } from '@blocksuite/affine/presets';
|
import { type AffineEditorContainer } from '@blocksuite/affine/presets';
|
||||||
import {
|
import {
|
||||||
DocService,
|
DocService,
|
||||||
|
FeatureFlagService,
|
||||||
FrameworkScope,
|
FrameworkScope,
|
||||||
GlobalContextService,
|
GlobalContextService,
|
||||||
useLiveData,
|
useLiveData,
|
||||||
@ -41,15 +42,21 @@ import { PageHeaderMenuButton } from './page-header-more-button';
|
|||||||
import { PageHeaderShareButton } from './page-header-share-button';
|
import { PageHeaderShareButton } from './page-header-share-button';
|
||||||
|
|
||||||
const DetailPageImpl = () => {
|
const DetailPageImpl = () => {
|
||||||
const { editorService, docService, workspaceService, globalContextService } =
|
const {
|
||||||
useServices({
|
editorService,
|
||||||
WorkbenchService,
|
docService,
|
||||||
ViewService,
|
workspaceService,
|
||||||
EditorService,
|
globalContextService,
|
||||||
DocService,
|
featureFlagService,
|
||||||
WorkspaceService,
|
} = useServices({
|
||||||
GlobalContextService,
|
WorkbenchService,
|
||||||
});
|
ViewService,
|
||||||
|
EditorService,
|
||||||
|
DocService,
|
||||||
|
WorkspaceService,
|
||||||
|
GlobalContextService,
|
||||||
|
FeatureFlagService,
|
||||||
|
});
|
||||||
const editor = editorService.editor;
|
const editor = editorService.editor;
|
||||||
const workspace = workspaceService.workspace;
|
const workspace = workspaceService.workspace;
|
||||||
const docCollection = workspace.docCollection;
|
const docCollection = workspace.docCollection;
|
||||||
@ -62,6 +69,8 @@ const DetailPageImpl = () => {
|
|||||||
const { openPage, jumpToPageBlock } = useNavigateHelper();
|
const { openPage, jumpToPageBlock } = useNavigateHelper();
|
||||||
const editorContainer = useLiveData(editor.editorContainer$);
|
const editorContainer = useLiveData(editor.editorContainer$);
|
||||||
|
|
||||||
|
const enableKeyboardToolbar =
|
||||||
|
featureFlagService.flags.enable_mobile_keyboard_toolbar.value;
|
||||||
const { setDocReadonly } = useDocMetaHelper();
|
const { setDocReadonly } = useDocMetaHelper();
|
||||||
|
|
||||||
// TODO(@eyhn): remove jotai here
|
// TODO(@eyhn): remove jotai here
|
||||||
@ -90,8 +99,8 @@ const DetailPageImpl = () => {
|
|||||||
}, [doc, globalContext, mode]);
|
}, [doc, globalContext, mode]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setDocReadonly(doc.id, true);
|
if (!enableKeyboardToolbar) setDocReadonly(doc.id, true);
|
||||||
}, [doc.id, setDocReadonly]);
|
}, [enableKeyboardToolbar, doc.id, setDocReadonly]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
globalContext.isTrashDoc.set(!!isInTrash);
|
globalContext.isTrashDoc.set(!!isInTrash);
|
||||||
|
Loading…
Reference in New Issue
Block a user