Skip to content

Commit

Permalink
Add ability to drag multiple selected components (#6155)
Browse files Browse the repository at this point in the history
* Add ability to drag multiple selected components

* Use em instead of editor api

* Format
  • Loading branch information
mohamedsalem401 committed Sep 20, 2024
1 parent 8d4c850 commit d48e1e3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export default class CommandsModule extends Module<CommandsConfig & { pStylePref
const em = ed.getModel();
const { event } = opts;
const trg = opts.target as Component | undefined;
const trgs = trg ? [trg] : [...ed.getSelectedAll()];
const trgs = Array.isArray(trg) ? trg : trg ? [trg] : [...ed.getSelectedAll()];
const targets = trgs.map((trg) => trg.delegate?.move?.(trg) || trg).filter(Boolean);
const target = targets[targets.length - 1] as Component | undefined;
const nativeDrag = event?.type === 'dragstart';
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/dom_components/view/ComponentView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ TComp> {
event.stopPropagation();
event.preventDefault();
this.em.Commands.run('tlb-move', {
target: this.model,
target: [...this.em.getSelectedAll()],
event,
});
}
Expand Down

0 comments on commit d48e1e3

Please sign in to comment.