Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify javascript formatting to support IE. Move imports to new file #20

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions juicy-jsoneditor-imports.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<script src="../jsoneditor/dist/jsoneditor.min.js"></script>
<!-- <script src="../jsoneditor/dist/jsoneditor-minimalist.min.js"></script> -->
<script src="../fast-json-patch/src/json-patch-duplex.js"></script>
<!-- This is webpacked into ../jsoneditor/dist/jsoneditor.js,
but is executed async, and we need it before to prevent FOUC -->
<script src="../jsoneditor/src/js/ace/theme-jsoneditor.js"></script>
18 changes: 6 additions & 12 deletions juicy-jsoneditor.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@
-->

<link rel="import" href="../polymer/polymer.html">
<script src="../jsoneditor/dist/jsoneditor.min.js"></script>
<!-- <script src="../jsoneditor/dist/jsoneditor-minimalist.min.js"></script> -->
<script src="../fast-json-patch/src/json-patch-duplex.js"></script>
<!-- This is webpacked into ../jsoneditor/dist/jsoneditor.js,
but is executed async, and we need it before to prevent FOUC -->
<script src="../jsoneditor/src/js/ace/theme-jsoneditor.js"></script>
<link rel="import" href="juicy-jsoneditor-imports.html">

<!-- Define your custom element -->
<dom-module id="juicy-jsoneditor">
Expand Down Expand Up @@ -41,10 +36,9 @@
name: { type: String, observer: "nameChanged" },
search: { type: Boolean, observer: "searchChanged", value: true },
indentation: { type: String },
history: { type: Boolean, value: false }
history: { type: Boolean, value: false },
editor: {type: Object},
},
editor: null,
observer: null,
Copy link
Member

@tomalec tomalec Jan 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still use the observer, I'd keep it in the prototype, to make the API known beforehand.

Do we need to move editor to properties? What does it change? I think it may only cost us the performance of Polymer magic on top of that.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a reference to editor being undefined, and the move to polymer properties resolved that. The removal of observer was a misstep. I'll re-add and recheck. Thanks for the feedback!

created: function () {
//force context for observers
this.refresh = this.refresh.bind(this);
Expand All @@ -63,9 +57,9 @@
this.injectTheme('#ace_editor\\.css');
this.injectTheme('#ace-tm');
this.injectTheme('#ace_searchbox');
ace.config.loadModule(['theme', 'ace/theme/jsoneditor'], ()=>{
ace.config.loadModule(['theme', 'ace/theme/jsoneditor'], function(){
this.injectTheme('#ace-jsoneditor');
});
}.bind(this));
}
},
attached: function () {
Expand Down Expand Up @@ -212,7 +206,7 @@
}
}
},
injectTheme(themeId){
injectTheme: function(themeId){
var n = document.querySelector(themeId);
this.shadowRoot.appendChild(cloneStyle(n));
}
Expand Down