mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-12 11:20:11 +00:00
feat: fix the problem of plugin outline tree in workspace mode
This commit is contained in:
parent
2f69837002
commit
631b566932
@ -11,6 +11,10 @@ export interface ITreeBoard {
|
|||||||
export class TreeMaster {
|
export class TreeMaster {
|
||||||
readonly pluginContext: IPublicModelPluginContext;
|
readonly pluginContext: IPublicModelPluginContext;
|
||||||
|
|
||||||
|
private boards = new Set<ITreeBoard>();
|
||||||
|
|
||||||
|
private treeMap = new Map<string, Tree>();
|
||||||
|
|
||||||
constructor(pluginContext: IPublicModelPluginContext) {
|
constructor(pluginContext: IPublicModelPluginContext) {
|
||||||
this.pluginContext = pluginContext;
|
this.pluginContext = pluginContext;
|
||||||
let startTime: any;
|
let startTime: any;
|
||||||
@ -70,8 +74,6 @@ export class TreeMaster {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boards = new Set<ITreeBoard>();
|
|
||||||
|
|
||||||
addBoard(board: ITreeBoard) {
|
addBoard(board: ITreeBoard) {
|
||||||
this.boards.add(board);
|
this.boards.add(board);
|
||||||
}
|
}
|
||||||
@ -84,8 +86,6 @@ export class TreeMaster {
|
|||||||
// todo others purge
|
// todo others purge
|
||||||
}
|
}
|
||||||
|
|
||||||
private treeMap = new Map<string, Tree>();
|
|
||||||
|
|
||||||
get currentTree(): Tree | null {
|
get currentTree(): Tree | null {
|
||||||
const doc = this.pluginContext.project.getCurrentDocument();
|
const doc = this.pluginContext.project.getCurrentDocument();
|
||||||
if (doc) {
|
if (doc) {
|
||||||
@ -100,15 +100,3 @@ export class TreeMaster {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mastersMap = new Map<string, TreeMaster>();
|
|
||||||
export function getTreeMaster(pluginContext: IPublicModelPluginContext): TreeMaster {
|
|
||||||
const key = pluginContext.project.currentDocument?.id || 'unknown';
|
|
||||||
let master = mastersMap.get(key);
|
|
||||||
if (!master) {
|
|
||||||
master = new TreeMaster(pluginContext);
|
|
||||||
pluginContext.logger.info('TreeMaster is created');
|
|
||||||
mastersMap.set(key, master);
|
|
||||||
}
|
|
||||||
return master;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { IconOutline } from './icons/outline';
|
|||||||
import { IPublicModelPluginContext, IPublicModelDocumentModel } from '@alilc/lowcode-types';
|
import { IPublicModelPluginContext, IPublicModelDocumentModel } from '@alilc/lowcode-types';
|
||||||
import { enUS, zhCN } from './locale';
|
import { enUS, zhCN } from './locale';
|
||||||
import { MasterPaneName, BackupPaneName } from './helper/consts';
|
import { MasterPaneName, BackupPaneName } from './helper/consts';
|
||||||
import { getTreeMaster } from './controllers/tree-master';
|
import { TreeMaster } from './controllers/tree-master';
|
||||||
import { PaneController } from './controllers/pane-controller';
|
import { PaneController } from './controllers/pane-controller';
|
||||||
|
|
||||||
export const OutlinePlugin = (ctx: IPublicModelPluginContext, options: any) => {
|
export const OutlinePlugin = (ctx: IPublicModelPluginContext, options: any) => {
|
||||||
@ -26,7 +26,7 @@ export const OutlinePlugin = (ctx: IPublicModelPluginContext, options: any) => {
|
|||||||
masterPane: false,
|
masterPane: false,
|
||||||
backupPane: false,
|
backupPane: false,
|
||||||
};
|
};
|
||||||
const treeMaster = getTreeMaster(ctx);
|
const treeMaster = new TreeMaster(ctx);
|
||||||
let masterPaneController: PaneController | null = null;
|
let masterPaneController: PaneController | null = null;
|
||||||
let backupPaneController: PaneController | null = null;
|
let backupPaneController: PaneController | null = null;
|
||||||
return {
|
return {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user