From 4eb80d446e751cb2e1f2485ad8d72ddd754931e2 Mon Sep 17 00:00:00 2001 From: AndyJin Date: Fri, 22 Mar 2024 17:20:47 +0800 Subject: [PATCH] fix(plugin-outline): fix the unsynchronized display of the outline tree during history undo --- packages/plugin-outline-pane/src/index.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/plugin-outline-pane/src/index.tsx b/packages/plugin-outline-pane/src/index.tsx index 822c503f2..ba3d1f077 100644 --- a/packages/plugin-outline-pane/src/index.tsx +++ b/packages/plugin-outline-pane/src/index.tsx @@ -27,6 +27,11 @@ export function OutlinePaneContext(props: { }); }, []); + useEffect(() => { + return props.pluginContext?.project?.currentDocument?.history.onChangeCursor(() => { + setMasterPaneController(new PaneController(props.paneName || MasterPaneName, treeMaster)); + }); + }, [treeMaster]); return ( { treeTitleExtra: config.get('treeTitleExtra'), treeMaster, paneName: MasterPaneName, + pluginContext: ctx, + options, }, }); @@ -91,6 +98,8 @@ export const OutlinePlugin = (ctx: IPublicModelPluginContext, options: any) => { contentProps: { paneName: BackupPaneName, treeMaster, + pluginContext: ctx, + options, }, index: 1, });