From 2b5c4b82b8e7c884965444ef50f13fa0967495c7 Mon Sep 17 00:00:00 2001 From: Joel Mitchell <2780344+HeyJoel@users.noreply.github.com> Date: Sat, 21 Sep 2024 11:11:51 +0100 Subject: [PATCH] Fixes #549 - assinging window.onload to a new JS function causes the visual editor to silently stop working. --- .../Admin/Modules/VisualEditor/Content/js/contentpage.js | 6 +++--- .../Modules/VisualEditor/Content/js/contentpage_min.js | 2 +- .../Modules/VisualEditor/Js/ContentPage/GuiController.js | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Cofoundry.Web.Admin/Admin/Modules/VisualEditor/Content/js/contentpage.js b/src/Cofoundry.Web.Admin/Admin/Modules/VisualEditor/Content/js/contentpage.js index 1e50aa6d6..e36842471 100644 --- a/src/Cofoundry.Web.Admin/Admin/Modules/VisualEditor/Content/js/contentpage.js +++ b/src/Cofoundry.Web.Admin/Admin/Modules/VisualEditor/Content/js/contentpage.js @@ -634,7 +634,7 @@ Cofoundry.visualEditor = (function () { } } - window.onload = function () { + window.addEventListener('load', function () { // pageResponseData object is a serialized object inserted into the page _internal.model = Cofoundry.PageResponseData; @@ -643,11 +643,11 @@ Cofoundry.visualEditor = (function () { _internal.bindGui(); _internal.bindToolbar(); } - } + }); // Return public API return { toolBar: _toolBar } -})(); \ No newline at end of file +})(); diff --git a/src/Cofoundry.Web.Admin/Admin/Modules/VisualEditor/Content/js/contentpage_min.js b/src/Cofoundry.Web.Admin/Admin/Modules/VisualEditor/Content/js/contentpage_min.js index 278103ec1..079c30149 100644 --- a/src/Cofoundry.Web.Admin/Admin/Modules/VisualEditor/Content/js/contentpage_min.js +++ b/src/Cofoundry.Web.Admin/Admin/Modules/VisualEditor/Content/js/contentpage_min.js @@ -1,3 +1,3 @@ var Cofoundry=Cofoundry||{}; Cofoundry.events={on:function(s,t){this._callbacks||(this._callbacks={});(this._callbacks[s]||(this._callbacks[s]=[])).push(t)},off:function(s,t){for(var l=0,c=this._callbacks[s].length;ldraft",type:"primary",classNames:"publish popup",click:D.copyToDraft}),("Preview"===o||"Edit"===o||"Unpublished"==n.publishStatus&&t.pageVersion.isLatestPublishedVersion&&!t.hasDraftVersion)&&t.hasEntityPublishPermission?l.addButton({icon:"fa-cloud-upload",title:"Publish",type:"primary",classNames:"publish popup",click:D.publish}):"Live"===o&&t.hasEntityPublishPermission&&l.addButton({icon:"fa-cloud-download",title:"Unpublish",type:"primary",classNames:"publish popup",click:D.unpublish})},bindGui:function(){var e,t,o,n,i,s,l,f=document.getElementById("cofoundry-sv__btn-add-block"),d=document.getElementById("cofoundry-sv__block-popover-container"),k=document.getElementsByTagName("body")[0];function c(y){var g=D.model.isCustomEntityRoute?"custom-entity":"page";function e(e,t,o,n){for(var i,s="data-cms-"+g+"-"+e,l=!1,d=y.hasAttribute&&y.hasAttribute(s)?[y]:y.querySelectorAll("["+s+"]"),c=d.length,a=0;adraft",type:"primary",classNames:"publish popup",click:D.copyToDraft}),("Preview"===o||"Edit"===o||"Unpublished"==n.publishStatus&&t.pageVersion.isLatestPublishedVersion&&!t.hasDraftVersion)&&t.hasEntityPublishPermission?l.addButton({icon:"fa-cloud-upload",title:"Publish",type:"primary",classNames:"publish popup",click:D.publish}):"Live"===o&&t.hasEntityPublishPermission&&l.addButton({icon:"fa-cloud-download",title:"Unpublish",type:"primary",classNames:"publish popup",click:D.unpublish})},bindGui:function(){var e,t,o,n,i,s,l,f=document.getElementById("cofoundry-sv__btn-add-block"),d=document.getElementById("cofoundry-sv__block-popover-container"),k=document.getElementsByTagName("body")[0];function c(y){var g=D.model.isCustomEntityRoute?"custom-entity":"page";function e(e,t,o,n){for(var i,s="data-cms-"+g+"-"+e,l=!1,d=y.hasAttribute&&y.hasAttribute(s)?[y]:y.querySelectorAll("["+s+"]"),c=d.length,a=0;a