@@ -8,13 +8,11 @@ import { I18nService } from '@affine/core/modules/i18n';
8
8
import { UrlService } from '@affine/core/modules/url' ;
9
9
import { WorkspaceService } from '@affine/core/modules/workspace' ;
10
10
import { useI18n } from '@affine/i18n' ;
11
- import { TextSelection } from '@blocksuite/affine/block-std' ;
12
11
import { useService , useServiceOptional } from '@toeverything/infra' ;
13
12
import { useStore } from 'jotai' ;
14
13
import { useTheme } from 'next-themes' ;
15
14
import { useEffect } from 'react' ;
16
15
17
- import type { AffineEditorContainer } from '../../blocksuite/block-suite-editor' ;
18
16
import { usePageHelper } from '../../blocksuite/block-suite-page-list/utils' ;
19
17
import {
20
18
PreconditionStrategy ,
@@ -29,40 +27,19 @@ import {
29
27
} from '../../commands' ;
30
28
import { EditorSettingService } from '../../modules/editor-setting' ;
31
29
import { CMDKQuickSearchService } from '../../modules/quicksearch/services/cmdk' ;
32
- import { useActiveBlocksuiteEditor } from './use-block-suite-editor' ;
33
30
import { useNavigateHelper } from './use-navigate-helper' ;
34
31
35
- function hasLinkPopover ( editor : AffineEditorContainer | null ) {
36
- const textSelection = editor ?. host ?. std . selection . find ( TextSelection ) ;
37
- if ( editor && textSelection && textSelection . from . length > 0 ) {
38
- const formatBar = editor . host ?. querySelector ( 'affine-format-bar-widget' ) ;
39
- if ( formatBar ) {
40
- return true ;
41
- }
42
- }
43
- return false ;
44
- }
45
-
46
- function registerCMDKCommand (
47
- service : CMDKQuickSearchService ,
48
- editor : AffineEditorContainer | null
49
- ) {
32
+ function registerCMDKCommand ( service : CMDKQuickSearchService ) {
50
33
return registerAffineCommand ( {
51
34
id : 'affine:show-quick-search' ,
52
35
preconditionStrategy : PreconditionStrategy . Never ,
53
36
category : 'affine:general' ,
54
37
keyBinding : {
55
38
binding : '$mod+K' ,
56
- capture : true ,
57
39
} ,
58
40
label : '' ,
59
41
icon : '' ,
60
42
run ( ) {
61
- // Due to a conflict with the shortcut for creating a link after selecting text in blocksuite,
62
- // opening the quick search modal is disabled when link-popup is visitable.
63
- if ( hasLinkPopover ( editor ) ) {
64
- return ;
65
- }
66
43
service . toggle ( ) ;
67
44
} ,
68
45
} ) ;
@@ -76,7 +53,6 @@ export function useRegisterWorkspaceCommands() {
76
53
const urlService = useService ( UrlService ) ;
77
54
const pageHelper = usePageHelper ( currentWorkspace . docCollection ) ;
78
55
const navigationHelper = useNavigateHelper ( ) ;
79
- const [ editor ] = useActiveBlocksuiteEditor ( ) ;
80
56
const cmdkQuickSearchService = useService ( CMDKQuickSearchService ) ;
81
57
const editorSettingService = useService ( EditorSettingService ) ;
82
58
const workspaceDialogService = useService ( WorkspaceDialogService ) ;
@@ -88,12 +64,12 @@ export function useRegisterWorkspaceCommands() {
88
64
useServiceOptional ( DesktopApiService ) ?. handler . updater . quitAndInstall ;
89
65
90
66
useEffect ( ( ) => {
91
- const unsub = registerCMDKCommand ( cmdkQuickSearchService , editor ) ;
67
+ const unsub = registerCMDKCommand ( cmdkQuickSearchService ) ;
92
68
93
69
return ( ) => {
94
70
unsub ( ) ;
95
71
} ;
96
- } , [ cmdkQuickSearchService , editor ] ) ;
72
+ } , [ cmdkQuickSearchService ] ) ;
97
73
98
74
// register AffineUpdatesCommands
99
75
useEffect ( ( ) => {
0 commit comments