grapesjs icon indicating copy to clipboard operation
grapesjs copied to clipboard

[Need help]: After using urlLoad from storage manager impossible to change component with Traits

Open v8jupiter opened this issue 8 years ago • 6 comments

Hello, I am save template to db and after loading from db impossible to change component with Traits. Video example on countdown: https://youtu.be/0QPKswfhzlU version: "0.13.8"

  let editor = grapesjs.init({
    height: '100%',
    fromElement: 1,
    showOffsets: 1,
    container: '#gjs',
    plugins: ['gjs-blocks-basic', 'gjs-component-countdown', 'gjs-navbar', 'evp-video','gjs-blocks-flexbox', 'gjs-preset-webpage', 'add-popup'],
    storageManager: {
      autosave: false,
      setStepsBeforeSave: 1,
      type: 'remote',
      urlStore: '/7min-admin-panel/pb_page.php?id=' + id + '&action=save',
      urlLoad: loadUrl,
      contentTypeJson: true
    },
    canvas: {
    }
  });
  editor.Panels.addButton
  ('options',
    [{
      id: 'go-back',
      className: 'fa fa-reply',
      command: 'go-back',
      attributes: {title: 'Go back'}
    }]
  );
  editor.Panels.addButton
  ('options',
    [{
      id: 'save-db',
      className: 'fa fa-floppy-o',
      command: 'save-db',
      attributes: {title: 'Save DB'}
    }]
  );
  // Add the command
  editor.Commands.add
  ('save-db',
    {
      run: function (editor, sender) {
        sender && sender.set('active'); // turn off the button
        editor.store();
        editor.on('storage:end', function (e) {
          alert('Success saved');
          window.location.href = '/7min-admin-panel/pb_list.php';
        });
      }
    });

v8jupiter avatar Feb 15 '18 16:02 v8jupiter

I updated to "0.14.5" and still have issue. I am trying to debug and found next, traits always return old value which was selected before saving .

v8jupiter avatar Feb 15 '18 19:02 v8jupiter

Can someone help me on what place start to investigation issue?

v8jupiter avatar Feb 16 '18 13:02 v8jupiter

Thanks for the catch @v8jupiter it was actually an issue with the component javascript loading. I'll publish the fix with the next release

artf avatar Feb 27 '18 00:02 artf

Ok. Thank you. Will wait update

v8jupiter avatar Feb 28 '18 09:02 v8jupiter

Still some part of bug present. It seems inside of script: function () traits will have old value.

v8jupiter avatar Mar 23 '18 16:03 v8jupiter

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.

lock[bot] avatar Sep 17 '19 20:09 lock[bot]