Addepar/ember-json-viewer

@ or this is not used for named arguments or own properties

juliolegrec opened this issue ยท 1 comments

Hi! ๐Ÿ‘‹

Firstly, thanks for your work on this project! ๐Ÿ™‚

Today I used patch-package to patch ember-json-viewer@0.7.0 for the project I'm working on.

The issue is that @ or this is not used for named arguments or own properties.

Here is the diff that solved my problem:

diff --git a/node_modules/ember-json-viewer/addon/templates/components/entry-viewer.hbs b/node_modules/ember-json-viewer/addon/templates/components/entry-viewer.hbs
index b799bea..e848d06 100644
--- a/node_modules/ember-json-viewer/addon/templates/components/entry-viewer.hbs
+++ b/node_modules/ember-json-viewer/addon/templates/components/entry-viewer.hbs
@@ -12,7 +12,7 @@
         {{! In order for copy/paste to work, the quoted key (e.g. '"foo": ')
           must be a single text node
         }}
-        {{quotedKey}}
+        {{this.quotedKey}}
       </span>
     </span>
   {{else}}
@@ -20,7 +20,7 @@
       {{! In order for copy/paste to work, the quoted key (e.g. '"foo": ')
         must be a single text node
       }}
-      {{quotedKey}}
+      {{this.quotedKey}}
     </span>
   {{/if}}
   {{value-viewer
diff --git a/node_modules/ember-json-viewer/addon/templates/components/value-viewer.hbs b/node_modules/ember-json-viewer/addon/templates/components/value-viewer.hbs
index 4ff1666..adefb9d 100644
--- a/node_modules/ember-json-viewer/addon/templates/components/value-viewer.hbs
+++ b/node_modules/ember-json-viewer/addon/templates/components/value-viewer.hbs
@@ -12,20 +12,20 @@
       {{this.valueSummary}}
     </span>
   {{else}}
-    <ul class="entries depth-{{depth}}">
+    <ul class="entries depth-{{this.depth}}">
       {{#if this.isObj}}
-        {{#each-in value as |key innerValue|}}
+        {{#each-in this.value as |key innerValue|}}
           {{entry-viewer
             key=key
             value=innerValue
             depth=this.depth
             path=(concat this.path "." key)
             displayOptions=this.displayOptions
-            isLast=(is-last value key)
+            isLast=(is-last this.value key)
           }}
         {{/each-in}}
       {{else}}
-        {{#each value as |innerValue index|}}
+        {{#each this.value as |innerValue index|}}
           <li class="entry">
             {{value-viewer
               value=innerValue
@@ -33,7 +33,7 @@
               path=(concat this.path "[" index "]")
               displayOptions=this.displayOptions
             }}
-            {{#unless (is-last value index)}}
+            {{#unless (is-last this.value index)}}
               {{! In order for copy/paste to work, there cannot be extra whitespace around the delimiter }}
               <span class="entry-delimiter" data-path={{concat this.path "[" index "]" "@" ","}}>,</span>
             {{/unless}}

This issue body was partially generated by patch-package.

bantic commented

@juliolegrec Thanks for reporting! We'll take a look at fixing this.