Skip to content

Commit

Permalink
refactor: add isInLiveEditing api to canvas for refactoring of hotkey…
Browse files Browse the repository at this point in the history
… plugin as a standalone one
  • Loading branch information
JackLian committed Jan 13, 2023
1 parent bb6acd9 commit 9a40072
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions packages/shell/src/api/canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
ScrollTarget as InnerScrollTarget,
IDesigner,
} from '@alilc/lowcode-designer';
import { Editor, globalContext } from '@alilc/lowcode-editor-core';
import { editorSymbol, designerSymbol, nodeSymbol } from '../symbols';
import {
Dragon as ShellDragon,
Expand All @@ -38,19 +37,7 @@ export class Canvas implements IPublicApiCanvas {
}

get isInLiveEditing(): boolean {
const workspace = globalContext.has('workspace') && globalContext.get('workspace');
if (workspace?.isActive) {
return Boolean(
workspace.window.editor.get('designer')?.project?.simulator?.liveEditing?.editing,
);
}

if (globalContext.has(Editor)) {
return Boolean(
globalContext.get(Editor).get('designer')?.project?.simulator?.liveEditing?.editing,
);
}
return false;
return Boolean(this[editorSymbol].get('designer')?.project?.simulator?.liveEditing?.editing);
}

constructor(editor: IPublicModelEditor, readonly workspaceMode: boolean = false) {
Expand Down

0 comments on commit 9a40072

Please sign in to comment.