donteatfriedrice
2024-05-10 03:46:10 +00:00
parent 06890d67c7
commit 203459679c
8 changed files with 100 additions and 97 deletions

View File

@@ -18,13 +18,13 @@
"@affine/graphql": "workspace:*",
"@affine/i18n": "workspace:*",
"@affine/templates": "workspace:*",
"@blocksuite/block-std": "0.14.0-canary-202405082235-4e0896c",
"@blocksuite/blocks": "0.14.0-canary-202405082235-4e0896c",
"@blocksuite/global": "0.14.0-canary-202405082235-4e0896c",
"@blocksuite/block-std": "0.14.0-canary-202405100201-e591bb8",
"@blocksuite/blocks": "0.14.0-canary-202405100201-e591bb8",
"@blocksuite/global": "0.14.0-canary-202405100201-e591bb8",
"@blocksuite/icons": "2.1.50",
"@blocksuite/inline": "0.14.0-canary-202405082235-4e0896c",
"@blocksuite/presets": "0.14.0-canary-202405082235-4e0896c",
"@blocksuite/store": "0.14.0-canary-202405082235-4e0896c",
"@blocksuite/inline": "0.14.0-canary-202405100201-e591bb8",
"@blocksuite/presets": "0.14.0-canary-202405100201-e591bb8",
"@blocksuite/store": "0.14.0-canary-202405100201-e591bb8",
"@dnd-kit/core": "^6.1.0",
"@dnd-kit/modifiers": "^7.0.0",
"@dnd-kit/sortable": "^8.0.0",

View File

@@ -19,9 +19,14 @@ const EditorChatPanel = ({ editor }: SidebarTabProps) => {
useEffect(() => {
if (!editor) return;
editor.host.spec.getService('affine:page').slots.docLinkClicked.on(() => {
const pageService = editor.host.spec.getService('affine:page');
pageService.slots.docLinkClicked.on(() => {
(chatPanelRef.current as ChatPanel).doc = editor.doc;
});
pageService.slots.editorModeSwitch.on(() => {
(chatPanelRef.current as ChatPanel).host = editor.host;
});
}, [editor]);
if (!editor) {
@@ -32,11 +37,9 @@ const EditorChatPanel = ({ editor }: SidebarTabProps) => {
chatPanelRef.current = new ChatPanel();
}
if (editor !== chatPanelRef.current?.editor) {
(chatPanelRef.current as ChatPanel).editor = editor;
(chatPanelRef.current as ChatPanel).doc = editor.doc;
// (copilotPanelRef.current as CopilotPanel).fitPadding = [20, 20, 20, 20];
}
(chatPanelRef.current as ChatPanel).host = editor.host;
(chatPanelRef.current as ChatPanel).doc = editor.doc;
// (copilotPanelRef.current as CopilotPanel).fitPadding = [20, 20, 20, 20];
return <div className={styles.root} ref={onRefChange} />;
};