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
parent dd671c8764
commit 275ea74772
14 changed files with 243 additions and 1410 deletions

View File

@@ -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';

View File

@@ -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 ? (

View File

@@ -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';