mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
Merge branch 'polyfill/vision' of gitlab.alibaba-inc.com:ali-lowcode/ali-lowcode-engine into polyfill/vision
This commit is contained in:
commit
a064b93aff
@ -15,7 +15,12 @@ export class DesignerView extends Component<DesignerProps & {
|
||||
constructor(props: any) {
|
||||
super(props);
|
||||
const { designer, ...designerProps } = props;
|
||||
this.designer = designer || new Designer(designerProps);
|
||||
if (designer) {
|
||||
this.designer = designer;
|
||||
designer.setProps(designerProps);
|
||||
} else {
|
||||
this.designer = new Designer(designerProps);
|
||||
}
|
||||
}
|
||||
|
||||
shouldComponentUpdate(nextProps: DesignerProps) {
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
import Editor from '@ali/lowcode-editor-core';
|
||||
import OutlinePane from '@ali/lowcode-plugin-outline-pane';
|
||||
import SettingsPane from '@ali/lowcode-plugin-settings-pane';
|
||||
import Designer from '@ali/lowcode-plugin-designer';
|
||||
import DesignerView from '@ali/lowcode-plugin-designer';
|
||||
import { registerSetters } from '@ali/lowcode-setters';
|
||||
import { Skeleton } from './skeleton/skeleton';
|
||||
import { Designer } from 'designer/src/designer';
|
||||
|
||||
registerSetters();
|
||||
|
||||
@ -11,14 +12,14 @@ export const editor = new Editor();
|
||||
|
||||
export const skeleton = new Skeleton(editor);
|
||||
|
||||
export const designer = new Designer();
|
||||
export const designer = new Designer({editor});
|
||||
|
||||
editor.set('designer', designer)
|
||||
|
||||
skeleton.mainArea.add({
|
||||
name: 'designer',
|
||||
type: 'Widget',
|
||||
content: Designer,
|
||||
content: DesignerView,
|
||||
});
|
||||
skeleton.rightArea.add({
|
||||
name: 'settingsPane',
|
||||
|
||||
@ -1,48 +1,15 @@
|
||||
import { Selection, Node } from '@ali/lowcode-designer';
|
||||
import { editor, designer } from './editor';
|
||||
|
||||
let currentSelection: Selection;
|
||||
|
||||
// get selection async
|
||||
editor.once('designer.ready', () => {
|
||||
const getSelection = () => {
|
||||
if (editor.designer.currentSelection) {
|
||||
currentSelection = editor.designer.currentSelection;
|
||||
|
||||
currentSelection.onSelectionChange(() => {
|
||||
// const nodes = currentSelection.getNodes();
|
||||
// console.log(nodes);
|
||||
});
|
||||
} else {
|
||||
// console.log('waiting ...');
|
||||
requestAnimationFrame(getSelection);
|
||||
}
|
||||
};
|
||||
getSelection();
|
||||
});
|
||||
import { Node } from '@ali/lowcode-designer';
|
||||
import { designer } from './editor';
|
||||
|
||||
export default {
|
||||
select: (node: Node) => {
|
||||
if (!node) {
|
||||
return designer.currentSelection?.clear();
|
||||
}
|
||||
currentSelection.select(node.id);
|
||||
designer.currentSelection?.select(node.id);
|
||||
},
|
||||
getSelected: () => {
|
||||
const nodes = currentSelection.getNodes();
|
||||
const nodes = designer.currentSelection?.getNodes();
|
||||
return nodes;
|
||||
},
|
||||
// 以下废弃
|
||||
// hover: (node: Node) => {
|
||||
// hovering.hover(node);
|
||||
// },
|
||||
// getDropping: () => {
|
||||
// return null;
|
||||
// },
|
||||
// onIntoView: (func: (node: any, insertion: Insertion) => any) => {
|
||||
// currentSelection.onSelectionChange((ids) => {
|
||||
// console.log(ids);
|
||||
// });
|
||||
// return null;
|
||||
// },
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user