Issue #2464Opened December 21, 2019by alemenciones0 reactions

Problem replacing component in absolute dragMode

Question

I have a problem to replace a componente in the same position (top/left), the new component is always added in the positions top: 0px / left: 0px;

I'm triyng something like this:

const selectedComponent = editor.getSelected();
const coll = selectedComponent.collection;
const at = coll.indexOf(selectedComponent);

var styles = selectedComponent.getStyle() || {};   

coll.remove(selectedComponent);

let newComponent = coll.add(component, {
   fromAddNewComponent: true,
   at: at,
});

newComponent .setStyle(styles);

But setStyle() is not working this time...

Answers (1)

artfDecember 25, 20190 reactions

The code, more or less, seems ok, be sure to check styles contains the position properties (and the component has also the absolute position). If it's not working yet try to create a reproducible demo, please

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.