Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions src/Editor/Editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ class Editor extends EditorCore {
// Set path for engine dependencies
window.Wick.resourcepath = 'corelibs/wick-engine/';

this.openToasts = []

// "Live" editor states
this.project = null;
this.paper = null;
Expand Down Expand Up @@ -878,17 +880,27 @@ class Editor extends EditorCore {
// If no options are given, set the options param to an empty object so only the default options are used.
if (!options) options = {};

//Check if this has already been toasted
if(this.openToasts.includes(message)){
return;
}

this.openToasts.push(message);

// Default options for the toast:
let defaultOptions = {
position: "top-right",
autoClose: 3000,
hideProgressBar: true,
position: "bottom-right",
autoClose: 2000,
hideProgressBar: false,
closeOnClick: true,
pauseOnHover: true,
draggable: true,
draggable: false,
className: (type + '-toast-background'),
bodyClassName: (type + '-toast-body'),
progressClassName: (type + '-toast-progress'),
onClose: () => {
this.openToasts.splice(this.openToasts.indexOf(message) , 1);
}
};

// Mix default options and options param:
Expand Down