From f8bebd15f90beb0f682dcc713877fed60221bc1d Mon Sep 17 00:00:00 2001 From: hobbes6-2 Date: Mon, 22 Jun 2026 18:53:03 +0530 Subject: [PATCH] Add Baron's toast changes (no text size and padding stuff) and prevent toasts from displaying if toast message is already being displayed, change defaultOptions autoClose to 2000 and show progress bar --- src/Editor/Editor.jsx | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/Editor/Editor.jsx b/src/Editor/Editor.jsx index 2977c8234..9faf85542 100644 --- a/src/Editor/Editor.jsx +++ b/src/Editor/Editor.jsx @@ -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; @@ -851,17 +853,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: