chore(core): remove affine/cmdk package (#5552)

patch cmdk based on https://github.com/pengx17/cmdk/tree/patch-1
fix https://github.com/toeverything/AFFiNE/issues/5548
This commit is contained in:
Peng Xiao
2024-01-10 05:25:37 +00:00
committed by 李华桥
parent 99371be7e8
commit 4d16229fea
14 changed files with 243 additions and 1410 deletions
+1 -1
View File
@@ -17,7 +17,6 @@
},
"dependencies": {
"@affine-test/fixtures": "workspace:*",
"@affine/cmdk": "workspace:*",
"@affine/component": "workspace:*",
"@affine/debug": "workspace:*",
"@affine/electron-api": "workspace:*",
@@ -55,6 +54,7 @@
"async-call-rpc": "^6.3.1",
"bytes": "^3.1.2",
"clsx": "^2.0.0",
"cmdk": "patch:cmdk@npm%3A0.2.0#~/.yarn/patches/cmdk-npm-0.2.0-302237a911.patch",
"css-spring": "^4.1.0",
"cssnano": "^6.0.1",
"dayjs": "^1.11.10",
@@ -1,4 +1,3 @@
import { commandScore } from '@affine/cmdk';
import { useCollectionManager } from '@affine/component/page-list';
import {
useBlockSuitePageMeta,
@@ -19,6 +18,7 @@ import {
type CommandCategory,
PreconditionStrategy,
} from '@toeverything/infra/command';
import { commandScore } from 'cmdk';
import { atom, useAtomValue } from 'jotai';
import { groupBy } from 'lodash-es';
import { useCallback, useEffect, useMemo, useState } from 'react';
@@ -1,11 +1,10 @@
import { Command } from '@affine/cmdk';
import { useCommandState } from '@affine/cmdk';
import { formatDate } from '@affine/component/page-list';
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
import { useAFFiNEI18N } from '@affine/i18n/hooks';
import type { PageMeta } from '@blocksuite/store';
import type { CommandCategory } from '@toeverything/infra/command';
import clsx from 'clsx';
import { Command, useCommandState } from 'cmdk';
import { useAtom, useAtomValue } from 'jotai';
import {
Suspense,
@@ -225,17 +224,6 @@ export const CMDKContainer = ({
className={clsx(className, styles.panelContainer)}
value={value}
onValueChange={setValue}
// Handle KeyboardEvent conflicts with blocksuite
onKeyDown={(e: React.KeyboardEvent) => {
if (
e.key === 'ArrowDown' ||
e.key === 'ArrowUp' ||
e.key === 'ArrowLeft' ||
e.key === 'ArrowRight'
) {
e.stopPropagation();
}
}}
>
{/* todo: add page context here */}
{isInEditor ? (
@@ -1,5 +1,5 @@
import { useCommandState } from '@affine/cmdk';
import { SearchIcon } from '@blocksuite/icons';
import { useCommandState } from 'cmdk';
import { useAtomValue } from 'jotai';
import { cmdkQueryAtom } from './data';