You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by dk...@apache.org on 2020/01/16 06:31:43 UTC

[sling-org-apache-sling-app-cms] branch master updated: Fixing SLING-9000 - Fixing undefined JavaScript variable

This is an automated email from the ASF dual-hosted git repository.

dklco pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git


The following commit(s) were added to refs/heads/master by this push:
     new 772c6da  Fixing SLING-9000 - Fixing undefined JavaScript variable
772c6da is described below

commit 772c6da06356891376ab96e12c6b2e5f8632601e
Author: Dan Klco <dk...@apache.org>
AuthorDate: Thu Jan 16 00:31:31 2020 -0600

    Fixing SLING-9000 - Fixing undefined JavaScript variable
---
 ui/src/main/frontend/js/editor.js | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ui/src/main/frontend/js/editor.js b/ui/src/main/frontend/js/editor.js
index ee22dc0..66cf07d 100644
--- a/ui/src/main/frontend/js/editor.js
+++ b/ui/src/main/frontend/js/editor.js
@@ -87,7 +87,7 @@ if (!window.CMSEditor) {
         let component = document.querySelector(
           `.sling-cms-component[data-sling-cms-resource-path="${path}"]`,
         );
-        let reloadPage = component.dataset.reload === 'true';
+        let forceReload = component && component.dataset.reload === 'true';
         while (!component && path.length > 1) {
           const pathArr = path.split('/');
           pathArr.pop();
@@ -95,11 +95,11 @@ if (!window.CMSEditor) {
           component = document.querySelector(
             `.sling-cms-component[data-sling-cms-resource-path="${path}"]`,
           );
-          if (component.dataset.reload === 'true') {
-            reloadPage = true;
+          if (component && component.dataset.reload === 'true') {
+            forceReload = true;
           }
         }
-        if (!component || reloadPage) {
+        if (!component || forceReload) {
           CMSEditor.ui.hideModal();
           window.top.location.reload();
         }