Issue #1971Opened April 22, 2019by sakshigarg91 reactions

event triggers previous state attributes to remote storage

Question

I'm trying to extract the change in src of an image and store it in the remote storage using Storage Manager, by using the following code

editor.on('stop:open-assets', model => {
    editor.StorageManager.get('remote').set({ 
      params: {
        metakey: 'logo-src',
        val:  editor.getSelected().attributes.src
        },
      },console.log("storage assets",editor.getSelected().attributes.src))
  })

The issue I'm facing is that when I change the image for the first time, it gives me the desired output in the console-> storage assets image2.jpg but the params are not affected, in fact no trigger it made to the params

The second time I change the image to to image1.jpg, i get the desired output in the console-> storage assets image1.jpg but the params affected contain values of the previous state and return image2.jpg

hence on, every time i change to a new image the params return the previous state. This behaviour is unusual. I didn't face an issue like these while dealing with other events

Answers (2)

sakshigarg9April 24, 20191 reactions

had to initialize autosave to false and autoload to true and call editor.store at the end of the event. issue resolved

lock[bot]April 25, 20200 reactions

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

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.