From c15fea357f7a6ffb76bef3a29677e063ee5da71d Mon Sep 17 00:00:00 2001 From: Norbert Nemeth Date: Fri, 7 Aug 2020 13:02:02 +0200 Subject: [PATCH 1/2] LPS-118717 create a deep copy of icon in case it already exists --- .../META-INF/resources/js/alloyeditor_source.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/apps/frontend-editor/frontend-editor-alloyeditor-web/src/main/resources/META-INF/resources/js/alloyeditor_source.js b/modules/apps/frontend-editor/frontend-editor-alloyeditor-web/src/main/resources/META-INF/resources/js/alloyeditor_source.js index 47c8987157527e..a366b35db9a5cf 100644 --- a/modules/apps/frontend-editor/frontend-editor-alloyeditor-web/src/main/resources/META-INF/resources/js/alloyeditor_source.js +++ b/modules/apps/frontend-editor/frontend-editor-alloyeditor-web/src/main/resources/META-INF/resources/js/alloyeditor_source.js @@ -87,17 +87,20 @@ AUI.add( _getEditorStateLexiconIcon() { var instance = this; - var currentState = MAP_TOGGLE_STATE[instance._isVisible]; + var icon; - var icon = currentState.icon; + var currentState = MAP_TOGGLE_STATE[instance._isVisible]; - if (!icon) { + if (!currentState.icon) { icon = Liferay.Util.getLexiconIcon( currentState.iconCssClass ); currentState.icon = icon; } + else { + icon = currentState.icon.cloneNode(true); + } return icon; }, From 81826e105bbebe9ee4517a35747cdfc5e3eb7998 Mon Sep 17 00:00:00 2001 From: Norbert Nemeth Date: Tue, 11 Aug 2020 11:56:07 +0200 Subject: [PATCH 2/2] LPS-118717 avoid negation for readability --- .../resources/META-INF/resources/js/alloyeditor_source.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/apps/frontend-editor/frontend-editor-alloyeditor-web/src/main/resources/META-INF/resources/js/alloyeditor_source.js b/modules/apps/frontend-editor/frontend-editor-alloyeditor-web/src/main/resources/META-INF/resources/js/alloyeditor_source.js index a366b35db9a5cf..9464f9981e393f 100644 --- a/modules/apps/frontend-editor/frontend-editor-alloyeditor-web/src/main/resources/META-INF/resources/js/alloyeditor_source.js +++ b/modules/apps/frontend-editor/frontend-editor-alloyeditor-web/src/main/resources/META-INF/resources/js/alloyeditor_source.js @@ -91,16 +91,16 @@ AUI.add( var currentState = MAP_TOGGLE_STATE[instance._isVisible]; - if (!currentState.icon) { + if (currentState.icon) { + icon = currentState.icon.cloneNode(true); + } + else { icon = Liferay.Util.getLexiconIcon( currentState.iconCssClass ); currentState.icon = icon; } - else { - icon = currentState.icon.cloneNode(true); - } return icon; },