mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 09:41:57 +00:00
feat: 🎸 polyfill exchange
vision exchange api
This commit is contained in:
parent
e49a02e37c
commit
286e7d8f45
@ -157,7 +157,7 @@ export class Selection {
|
||||
return nodes;
|
||||
}
|
||||
|
||||
onSelectionChange(fn: (ids: string[]) => void): () => void {
|
||||
onSelectionChange(fn: () => void): () => void {
|
||||
this.emitter.on('selectionchange', fn);
|
||||
return () => {
|
||||
this.emitter.removeListener('selectionchange', fn);
|
||||
|
||||
@ -1,23 +1,20 @@
|
||||
import { Selection, DocumentModel, Node } from '@ali/lowcode-designer';
|
||||
import editor from './editor';
|
||||
import { Selection, Node } from '@ali/lowcode-designer';
|
||||
import { editor } from './editor';
|
||||
|
||||
let currentSelection: Selection;
|
||||
// let currentDocument: DocumentModel;
|
||||
|
||||
// get selection async
|
||||
editor.once('designer.ready', () => {
|
||||
const getSelection = () => {
|
||||
if (editor.designer.currentSelection) {
|
||||
currentSelection = editor.designer.currentSelection;
|
||||
// currentDocument = editor.designer.currentDocument;
|
||||
|
||||
currentSelection.onSelectionChange((ids: string[]) => {
|
||||
// console.log(ids);
|
||||
// const nodes = ids.map((id: string) => currentDocument.getNode(id));
|
||||
currentSelection.onSelectionChange(() => {
|
||||
// const nodes = currentSelection.getNodes();
|
||||
// console.log(nodes);
|
||||
});
|
||||
} else {
|
||||
console.log('waiting ...');
|
||||
// console.log('waiting ...');
|
||||
requestAnimationFrame(getSelection);
|
||||
}
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user