Issue #3211Opened December 29, 2020by alemenciones3 reactions

how to move components

Question

Hello dear:

I want move a component to first/end in the wrapper programmatically, i think something like editor.getWrapper().add(editor.selectedComponent(), {at: 0});, but this's adding a new clone from selectedComponent,

maybe with trigger "sorter:drag:end" at position??

can you help me?

sorry for my poor english :')

Answers (1)

artfDecember 31, 20203 reactions

Probably it makes sense to add a new component.move(desComponent, opts) method to cover such a case, but for now you can achieve it in this way:

const selected = editor.getSelected();
selected.remove({ temporary: true }); // temporary option will avoid removing component related styles
editor.getWrapper().append(selected, { at: 0 });

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.