Meet us at Drupa 24. Dusseldorf/Germany. May. 28 - Jun 7.
Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
gravitypad  
#1 Posted : Monday, May 29, 2017 7:21:28 PM(UTC)
gravitypad

Rank: Member

Groups: Member
Joined: 5/18/2016(UTC)
Posts: 11

I am having trouble loading a blank design. I have a New button on my page. When the user clicks this, the following code is executed:

function newDesign() {
if (editor != null) {
editor.dispose();
editor = null;
}
var iframe = document.getElementById("editorFrame");
CustomersCanvas.IframeApi.loadEditor(iframe,
{ // Specify the empty product size.
surfaces: [{ width: 800, height: 600 }]
},
{
userId: 'masteruser',
initialMode: "Advanced",
widgets: {
LeftToolbar: {
linearBarcodeButtonEnabled: false,
qrCodeButtonEnabled: false
}
}
})
//If the editor has been successfully loaded.
.then(function (e) {
editor = e;
});
};

This works the first time. But if the user makes adds anything to the design, when a new design is loaded, the last edited design is still present. For example:

1. Click the new button. We get a blank design surface.
2. Add a rectangle to the design surface.
3. Click the new button. We see the rectangle added in step #2.

This is even true if we reload the page, so I think CC is holding onto the state somewhere. Can you help?

Thanks,
Paul
Julia Khoptyan  
#2 Posted : Monday, May 29, 2017 10:59:29 PM(UTC)
Julia Khoptyan

Rank: Advanced Member

Groups: Member
Joined: 8/19/2016(UTC)
Posts: 33

Was thanked: 1 time(s) in 1 post(s)
Hey Gravitypad,

Did you consider using the addSurface function allowing you to add new surfaces out of the box?

Does that seem appropriate?

Kind regards,
Julia
gravitypad  
#3 Posted : Tuesday, May 30, 2017 4:47:50 AM(UTC)
gravitypad

Rank: Member

Groups: Member
Joined: 5/18/2016(UTC)
Posts: 11

I am trying to give the user the ability to start a new design, so addSurface doesn't seem appropriate.

I am seeing similar behavior when I load a saved state file. It always displays the last design for the user instead of loading the design from the state file.

I'm really stuck. Any help is appreciated.
gravitypad  
#4 Posted : Tuesday, May 30, 2017 11:05:40 AM(UTC)
gravitypad

Rank: Member

Groups: Member
Joined: 5/18/2016(UTC)
Posts: 11

Here are two videos that show the issue I am experiencing.

1. This video shows that, when clicking the New button is clicked (which runs the code in my first post above), the design surface still contains existing objects. If I delete everything from the FileCache folder, then I can get a new design surface.

2. This video shows that when I load a design from a stateId, the design is not loaded into the editor. The previous design is retained.

Any help you can provide is greatly appreciated.

Thanks,
pk

Edited by user Tuesday, May 30, 2017 12:02:58 PM(UTC)  | Reason: Not specified

Julia Khoptyan  
#5 Posted : Wednesday, May 31, 2017 8:12:59 PM(UTC)
Julia Khoptyan

Rank: Advanced Member

Groups: Member
Joined: 8/19/2016(UTC)
Posts: 33

Was thanked: 1 time(s) in 1 post(s)
Hi Gravitypad,

Thank you for the detailed explanations. I see the problem.

Use the restoreProductOnReloadEnabled parameter with "false" value. You can apply it to the entire application in the clientConfig.json or pass it down through the iConfiguration when loading the editor:
Code:
configuration = { restoreProductOnReloadEnabled: "false"};

CustomersCanvas.IframeApi.loadEditor(iframe, productDefinition, configuration).then(function(e) {editor = e});
However, I should inform you that all current changes will be lost after reloading the page.

Regarding the state file, we confirm the problem (Customer's Canvas Bug #23367). I will get back to you with the estimation of the issue later this week.

Best regards,
Julia

Edited by user Tuesday, June 6, 2017 4:07:12 AM(UTC)  | Reason: Not specified

Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.