1- import { Scrollable , useHasScrollTop } from '@affine/component' ;
1+ import { notify , Scrollable , useHasScrollTop } from '@affine/component' ;
22import { PageDetailSkeleton } from '@affine/component/page-detail-skeleton' ;
33import type { ChatPanel } from '@affine/core/blocksuite/presets/ai' ;
44import { AIProvider } from '@affine/core/blocksuite/presets/ai' ;
@@ -9,6 +9,7 @@ import { useDocMetaHelper } from '@affine/core/components/hooks/use-block-suite-
99import { EditorService } from '@affine/core/modules/editor' ;
1010import { RecentDocsService } from '@affine/core/modules/quicksearch' ;
1111import { ViewService } from '@affine/core/modules/workbench/services/view' ;
12+ import { useI18n } from '@affine/i18n' ;
1213import { RefNodeSlotsProvider } from '@blocksuite/blocks' ;
1314import { DisposableGroup } from '@blocksuite/global/utils' ;
1415import { AiIcon , FrameIcon , TocIcon , TodayIcon } from '@blocksuite/icons/rc' ;
@@ -94,6 +95,8 @@ const DetailPageImpl = memo(function DetailPageImpl() {
9495 // TODO(@eyhn): remove jotai here
9596 const [ _ , setActiveBlockSuiteEditor ] = useActiveBlocksuiteEditor ( ) ;
9697
98+ const t = useI18n ( ) ;
99+
97100 useEffect ( ( ) => {
98101 if ( isActiveView ) {
99102 setActiveBlockSuiteEditor ( editorContainer ) ;
@@ -187,6 +190,22 @@ const DetailPageImpl = memo(function DetailPageImpl() {
187190 }
188191 }
189192
193+ disposable . add (
194+ AIProvider . slots . requestRunInEdgeless . on ( ( { host } ) => {
195+ if ( host === editorHost ) {
196+ notify . warning ( {
197+ title : t [ 'com.affine.ai.action.edgeless-only.dialog-title' ] ( ) ,
198+ action : {
199+ label : t [ 'Switch' ] ( ) ,
200+ onClick : ( ) => {
201+ editor . setMode ( 'edgeless' ) ;
202+ } ,
203+ } ,
204+ } ) ;
205+ }
206+ } )
207+ ) ;
208+
190209 editor . setEditorContainer ( editorContainer ) ;
191210 const unbind = editor . bindEditorContainer (
192211 editorContainer ,
@@ -199,7 +218,7 @@ const DetailPageImpl = memo(function DetailPageImpl() {
199218 disposable . dispose ( ) ;
200219 } ;
201220 } ,
202- [ editor , openPage , docCollection . id , jumpToPageBlock ]
221+ [ editor , openPage , docCollection . id , jumpToPageBlock , t ]
203222 ) ;
204223
205224 const [ refCallback , hasScrollTop ] = useHasScrollTop ( ) ;
0 commit comments