diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditors.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditors.directive.js index c852228205..ac9b20fd66 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditors.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditors.directive.js @@ -203,11 +203,14 @@ })); evts.push(eventsService.on("appState.editors.close", function (name, args) { - removeEditor(args.editor); - })); - - evts.push(eventsService.on("appState.editors.closeAll", function (name, args) { - scope.editors = []; + // remove the closed editor + if(args && args.editor) { + removeEditor(args.editor); + } + // close all editors + if(args && args.editors.length === 0) { + scope.editors = []; + } })); //ensure to unregister from all events! diff --git a/src/Umbraco.Web.UI.Client/src/common/services/editor.service.js b/src/Umbraco.Web.UI.Client/src/common/services/editor.service.js index 449470f54c..650a210784 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/editor.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/editor.service.js @@ -98,7 +98,7 @@ editor: null }; - eventsService.emit("appState.editors.closeAll", args); + eventsService.emit("appState.editors.close", args); } /**