mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-04 17:27:09 +00:00
feat: 🎸 polyfill exchange
This commit is contained in:
parent
c0c8760936
commit
707055748f
@ -15,7 +15,12 @@ export class DesignerView extends Component<DesignerProps & {
|
|||||||
constructor(props: any) {
|
constructor(props: any) {
|
||||||
super(props);
|
super(props);
|
||||||
const { designer, ...designerProps } = 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) {
|
shouldComponentUpdate(nextProps: DesignerProps) {
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
import Editor from '@ali/lowcode-editor-core';
|
import Editor from '@ali/lowcode-editor-core';
|
||||||
import OutlinePane from '@ali/lowcode-plugin-outline-pane';
|
import OutlinePane from '@ali/lowcode-plugin-outline-pane';
|
||||||
import SettingsPane from '@ali/lowcode-plugin-settings-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 { registerSetters } from '@ali/lowcode-setters';
|
||||||
import { Skeleton } from './skeleton/skeleton';
|
import { Skeleton } from './skeleton/skeleton';
|
||||||
|
import { Designer } from 'designer/src/designer';
|
||||||
|
|
||||||
registerSetters();
|
registerSetters();
|
||||||
|
|
||||||
@ -11,14 +12,14 @@ export const editor = new Editor();
|
|||||||
|
|
||||||
export const skeleton = new Skeleton(editor);
|
export const skeleton = new Skeleton(editor);
|
||||||
|
|
||||||
export const designer = new Designer();
|
export const designer = new Designer({editor});
|
||||||
|
|
||||||
editor.set('designer', designer)
|
editor.set('designer', designer)
|
||||||
|
|
||||||
skeleton.mainArea.add({
|
skeleton.mainArea.add({
|
||||||
name: 'designer',
|
name: 'designer',
|
||||||
type: 'Widget',
|
type: 'Widget',
|
||||||
content: Designer,
|
content: DesignerView,
|
||||||
});
|
});
|
||||||
skeleton.rightArea.add({
|
skeleton.rightArea.add({
|
||||||
name: 'settingsPane',
|
name: 'settingsPane',
|
||||||
|
|||||||
@ -1,48 +1,15 @@
|
|||||||
import { Selection, Node } from '@ali/lowcode-designer';
|
import { Node } from '@ali/lowcode-designer';
|
||||||
import { editor, designer } from './editor';
|
import { 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();
|
|
||||||
});
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
select: (node: Node) => {
|
select: (node: Node) => {
|
||||||
if (!node) {
|
if (!node) {
|
||||||
return designer.currentSelection?.clear();
|
return designer.currentSelection?.clear();
|
||||||
}
|
}
|
||||||
currentSelection.select(node.id);
|
designer.currentSelection?.select(node.id);
|
||||||
},
|
},
|
||||||
getSelected: () => {
|
getSelected: () => {
|
||||||
const nodes = currentSelection.getNodes();
|
const nodes = designer.currentSelection?.getNodes();
|
||||||
return nodes;
|
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