mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 12:55:00 +00:00
chore(core): bump blocksuite (#6525)
## Features - https://github.com/toeverything/BlockSuite/pull/6728 @fundon - https://github.com/toeverything/BlockSuite/pull/6714 @doouding - https://github.com/toeverything/BlockSuite/pull/6733 @pengx17 - https://github.com/toeverything/BlockSuite/pull/6560 @golok727 - https://github.com/toeverything/BlockSuite/pull/6727 @pengx17 - https://github.com/toeverything/BlockSuite/pull/6645 @regischen - https://github.com/toeverything/BlockSuite/pull/6724 @fundon - https://github.com/toeverything/BlockSuite/pull/6719 @zzj3720 - https://github.com/toeverything/BlockSuite/pull/6682 @donteatfriedrice ## Bugfix - https://github.com/toeverything/BlockSuite/pull/6734 @Flrande - https://github.com/toeverything/BlockSuite/pull/6732 @fourdim - https://github.com/toeverything/BlockSuite/pull/6726 @pengx17 - https://github.com/toeverything/BlockSuite/pull/6721 @Flrande - https://github.com/toeverything/BlockSuite/pull/6725 @fundon - https://github.com/toeverything/BlockSuite/pull/6716 @golok727 - https://github.com/toeverything/BlockSuite/pull/6723 @donteatfriedrice - https://github.com/toeverything/BlockSuite/pull/6722 @pengx17 - https://github.com/toeverything/BlockSuite/pull/6718 @donteatfriedrice - https://github.com/toeverything/BlockSuite/pull/6702 @Tzyito - https://github.com/toeverything/BlockSuite/pull/6711 @Tzyito - https://github.com/toeverything/BlockSuite/pull/6694 @fundon - https://github.com/toeverything/BlockSuite/pull/6717 @golok727 ## Refactor - https://github.com/toeverything/BlockSuite/pull/6672 @Saul-Mirone ## Misc - https://github.com/toeverything/BlockSuite/pull/6720 @raintoway
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import { useWorkspaceEnabledFeatures } from '@affine/core/hooks/use-workspace-features';
|
||||
import { FeatureType } from '@affine/graphql';
|
||||
import { assertExists } from '@blocksuite/global/utils';
|
||||
import { AiIcon } from '@blocksuite/icons';
|
||||
import { ChatPanel } from '@blocksuite/presets';
|
||||
import { useService, Workspace } from '@toeverything/infra';
|
||||
import { useCallback, useRef } from 'react';
|
||||
|
||||
import type { SidebarTab, SidebarTabProps } from '../sidebar-tab';
|
||||
@@ -8,14 +11,21 @@ import * as styles from './chat.css';
|
||||
|
||||
// A wrapper for CopilotPanel
|
||||
const EditorChatPanel = ({ editor }: SidebarTabProps) => {
|
||||
const workspace = useService(Workspace);
|
||||
const copilotEnabled = useWorkspaceEnabledFeatures(workspace.meta).includes(
|
||||
FeatureType.Copilot
|
||||
);
|
||||
const chatPanelRef = useRef<ChatPanel | null>(null);
|
||||
|
||||
const onRefChange = useCallback((container: HTMLDivElement | null) => {
|
||||
if (container) {
|
||||
assertExists(chatPanelRef.current, 'chat panel should be initialized');
|
||||
container.append(chatPanelRef.current);
|
||||
}
|
||||
}, []);
|
||||
const onRefChange = useCallback(
|
||||
(container: HTMLDivElement | null) => {
|
||||
if (container && copilotEnabled) {
|
||||
assertExists(chatPanelRef.current, 'chat panel should be initialized');
|
||||
container.append(chatPanelRef.current);
|
||||
}
|
||||
},
|
||||
[copilotEnabled]
|
||||
);
|
||||
|
||||
if (!editor) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user