pengx17
2024-04-19 09:50:17 +00:00
parent 97669acb40
commit 94a70a5f3a
10 changed files with 108 additions and 100 deletions

View File

@@ -75,12 +75,12 @@
"zod": "^3.22.4"
},
"devDependencies": {
"@blocksuite/block-std": "0.14.0-canary-202404190214-78bb570",
"@blocksuite/blocks": "0.14.0-canary-202404190214-78bb570",
"@blocksuite/global": "0.14.0-canary-202404190214-78bb570",
"@blocksuite/block-std": "0.14.0-canary-202404190901-e1635aa",
"@blocksuite/blocks": "0.14.0-canary-202404190901-e1635aa",
"@blocksuite/global": "0.14.0-canary-202404190901-e1635aa",
"@blocksuite/icons": "2.1.46",
"@blocksuite/presets": "0.14.0-canary-202404190214-78bb570",
"@blocksuite/store": "0.14.0-canary-202404190214-78bb570",
"@blocksuite/presets": "0.14.0-canary-202404190901-e1635aa",
"@blocksuite/store": "0.14.0-canary-202404190901-e1635aa",
"@storybook/addon-actions": "^7.6.17",
"@storybook/addon-essentials": "^7.6.17",
"@storybook/addon-interactions": "^7.6.17",

View File

@@ -18,13 +18,13 @@
"@affine/graphql": "workspace:*",
"@affine/i18n": "workspace:*",
"@affine/templates": "workspace:*",
"@blocksuite/block-std": "0.14.0-canary-202404190214-78bb570",
"@blocksuite/blocks": "0.14.0-canary-202404190214-78bb570",
"@blocksuite/global": "0.14.0-canary-202404190214-78bb570",
"@blocksuite/block-std": "0.14.0-canary-202404190901-e1635aa",
"@blocksuite/blocks": "0.14.0-canary-202404190901-e1635aa",
"@blocksuite/global": "0.14.0-canary-202404190901-e1635aa",
"@blocksuite/icons": "2.1.46",
"@blocksuite/inline": "0.14.0-canary-202404190214-78bb570",
"@blocksuite/presets": "0.14.0-canary-202404190214-78bb570",
"@blocksuite/store": "0.14.0-canary-202404190214-78bb570",
"@blocksuite/inline": "0.14.0-canary-202404190901-e1635aa",
"@blocksuite/presets": "0.14.0-canary-202404190901-e1635aa",
"@blocksuite/store": "0.14.0-canary-202404190901-e1635aa",
"@dnd-kit/core": "^6.1.0",
"@dnd-kit/modifiers": "^7.0.0",
"@dnd-kit/sortable": "^8.0.0",

View File

@@ -1,7 +1,7 @@
import { assertExists } from '@blocksuite/global/utils';
import { AiIcon } from '@blocksuite/icons';
import { ChatPanel } from '@blocksuite/presets';
import { useCallback, useRef } from 'react';
import { useCallback, useEffect, useRef } from 'react';
import type { SidebarTab, SidebarTabProps } from '../sidebar-tab';
import * as styles from './chat.css';
@@ -17,6 +17,13 @@ const EditorChatPanel = ({ editor }: SidebarTabProps) => {
}
}, []);
useEffect(() => {
if (!editor) return;
editor.host.spec.getService('affine:page').slots.docLinkClicked.on(() => {
(chatPanelRef.current as ChatPanel).doc = editor.doc;
});
}, [editor]);
if (!editor) {
return;
}
@@ -27,6 +34,7 @@ const EditorChatPanel = ({ editor }: SidebarTabProps) => {
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];
}

View File

@@ -28,10 +28,10 @@
"@affine/env": "workspace:*",
"@affine/i18n": "workspace:*",
"@affine/native": "workspace:*",
"@blocksuite/block-std": "0.14.0-canary-202404190214-78bb570",
"@blocksuite/blocks": "0.14.0-canary-202404190214-78bb570",
"@blocksuite/presets": "0.14.0-canary-202404190214-78bb570",
"@blocksuite/store": "0.14.0-canary-202404190214-78bb570",
"@blocksuite/block-std": "0.14.0-canary-202404190901-e1635aa",
"@blocksuite/blocks": "0.14.0-canary-202404190901-e1635aa",
"@blocksuite/presets": "0.14.0-canary-202404190901-e1635aa",
"@blocksuite/store": "0.14.0-canary-202404190901-e1635aa",
"@electron-forge/cli": "^7.3.0",
"@electron-forge/core": "^7.3.0",
"@electron-forge/core-utils": "^7.3.0",