moveable icon indicating copy to clipboard operation
moveable copied to clipboard

What is the best possible way to save edited elements?

Open l1lgadil1 opened this issue 1 year ago • 1 comments

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 avatar Oct 17 '23 03:10 l1lgadil1

@l1lgadil1

Such information is not provided by moveable.

It would be better to check directly with getComputedStyle, el.style.cssText, etc.

daybrush avatar Nov 19 '23 03:11 daybrush