GrapesJS / grapesjs

Free and Open source Web Builder Framework. Next generation tool for building templates without coding
https://grapesjs.com
BSD 3-Clause "New" or "Revised" License
22.36k stars 4.05k forks source link

BUG: Content loading issues from remote database #3215

Closed san-123 closed 3 years ago

san-123 commented 3 years ago

Hi, I created Grapejs Pagebuilder. I have two links one for pagebuilder1 and another for PAgeBuilder2. Both are redirected to grpaejs editor and loading content from database based on id.

When I clicking by PageBuilder1 goes to index.html?id=1 (load saved content from database)

When I clicking by PageBuilder2 goes to index.html?id=2 (load saved content from database)

My issues is same content loading all pagebuilder.

My code:

grapesjs.init({ showOffsets: 1, noticeOnUnload: 0, container: '#gjs', height: '100%', fromElement: true, storageManager: { autoload: true, autosave: false, }, autoBeautify: true, // clearOnRender: true, allowScripts: 1, styleManager: { sectors: [{}] });

Here Loading content from database,

success: function (data) {

            if (data.length > 0) {
                $.each(data, function (key, data) {
                    var html = data.content;
                  $('#gjs').append(html);
                    SiteBuilderThis.InitPageBuilder();
                });
            }

When I loading first content, all grapejs editors, showed here,

artf commented 3 years ago

Follow this guide https://grapesjs.com/docs/modules/Storage.html#setup-remote-storage