feat: bump blocksuite (#5624)

This commit is contained in:
regischen
2024-01-18 17:26:31 +08:00
committed by GitHub
parent c3fda80599
commit 8b1b5b2e93
17 changed files with 168 additions and 168 deletions

View File

@@ -1,9 +1,9 @@
import {
registerFramePanelComponents,
registerTOCPanelComponents,
registerOutlinePanelComponents,
} from '@blocksuite/presets';
registerTOCPanelComponents(components => {
registerOutlinePanelComponents(components => {
for (const compName in components) {
if (window.customElements.get(compName)) continue;

View File

@@ -1,7 +1,7 @@
import { useActiveBlocksuiteEditor } from '@affine/core/hooks/use-block-suite-editor';
import { assertExists } from '@blocksuite/global/utils';
import { TocIcon } from '@blocksuite/icons';
import { TOCPanel } from '@blocksuite/presets';
import { OutlinePanel } from '@blocksuite/presets';
import { useCallback, useRef } from 'react';
import type { EditorExtension } from '../types';
@@ -9,13 +9,13 @@ import * as styles from './outline.css';
// A wrapper for TOCNotesPanel
const EditorOutline = () => {
const tocPanelRef = useRef<TOCPanel | null>(null);
const outlinePanelRef = useRef<OutlinePanel | null>(null);
const [editor] = useActiveBlocksuiteEditor();
const onRefChange = useCallback((container: HTMLDivElement | null) => {
if (container) {
assertExists(tocPanelRef.current, 'toc panel should be initialized');
container.append(tocPanelRef.current);
assertExists(outlinePanelRef.current, 'toc panel should be initialized');
container.append(outlinePanelRef.current);
}
}, []);
@@ -23,13 +23,13 @@ const EditorOutline = () => {
return;
}
if (!tocPanelRef.current) {
tocPanelRef.current = new TOCPanel();
if (!outlinePanelRef.current) {
outlinePanelRef.current = new OutlinePanel();
}
if (editor !== tocPanelRef.current?.editor) {
(tocPanelRef.current as TOCPanel).editor = editor;
(tocPanelRef.current as TOCPanel).fitPadding = [20, 20, 20, 20];
if (editor !== outlinePanelRef.current?.editor) {
(outlinePanelRef.current as OutlinePanel).editor = editor;
(outlinePanelRef.current as OutlinePanel).fitPadding = [20, 20, 20, 20];
}
return <div className={styles.root} ref={onRefChange} />;