moveable
moveable copied to clipboard
What is the best possible way to save edited elements?
I have customize editor, just like in here, and I'm a bit confused with saving full container with its elements position, colors, width,height and etc saved.
Previously, I extracted elements like this:
const div = document.querySelector(`.${className}`);
console.log(div)
if(div){
const contentHTML= div.innerHTML;
const styles = Array.from(div.querySelectorAll('style'))
.map((style) => style.innerHTML)
.join('\n');
const scripts = Array.from(div.querySelectorAll('script'))
.map((script) => script.innerHTML)
.join('\n');
return { contentHTML, styles, scripts };
}
But I feel that I'm doing something wrong. I need elements to be sent on backend, in order to save it, and extract it afterwards.Any help is appreciated
@l1lgadil1
Such information is not provided by moveable.
It would be better to check directly with getComputedStyle, el.style.cssText, etc.