@digipair/skill-web-jsoneditor 0.8.12 → 0.8.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -41077,7 +41077,7 @@ function findNextOccurrence(state, query) {
41077
41077
  var _loop = function(cycled1, cursor1) {
41078
41078
  cursor1.next();
41079
41079
  if (cursor1.done) {
41080
- if (cycled1) return cycled = cycled1, cursor = cursor1, {
41080
+ if (cycled1) return cursor = cursor1, cycled = cycled1, {
41081
41081
  v: null
41082
41082
  };
41083
41083
  cursor1 = new SearchCursor(state.doc, query, 0, Math.max(0, ranges[ranges.length - 1].from - 1));
@@ -41085,16 +41085,16 @@ function findNextOccurrence(state, query) {
41085
41085
  } else {
41086
41086
  if (cycled1 && ranges.some(function(r) {
41087
41087
  return r.from == cursor1.value.from;
41088
- })) return cycled = cycled1, cursor = cursor1, "continue";
41088
+ })) return cursor = cursor1, cycled = cycled1, "continue";
41089
41089
  if (fullWord) {
41090
41090
  var word = state.wordAt(cursor1.value.from);
41091
- if (!word || word.from != cursor1.value.from || word.to != cursor1.value.to) return cycled = cycled1, cursor = cursor1, "continue";
41091
+ if (!word || word.from != cursor1.value.from || word.to != cursor1.value.to) return cursor = cursor1, cycled = cycled1, "continue";
41092
41092
  }
41093
- return cycled = cycled1, cursor = cursor1, {
41093
+ return cursor = cursor1, cycled = cycled1, {
41094
41094
  v: cursor1.value
41095
41095
  };
41096
41096
  }
41097
- cycled = cycled1, cursor = cursor1;
41097
+ cursor = cursor1, cycled = cycled1;
41098
41098
  };
41099
41099
  var _state_selection = state.selection, main = _state_selection.main, ranges = _state_selection.ranges;
41100
41100
  var word = state.wordAt(main.head), fullWord = word && word.from == main.from && word.to == main.to;
@@ -84576,9 +84576,22 @@ class JsonEditorElement extends s$1 {
84576
84576
  window.__TMP_JSON_EDITOR__ = new Hy({
84577
84577
  target,
84578
84578
  props: {
84579
- content: this.content,
84579
+ content: {
84580
+ json: this.json
84581
+ },
84580
84582
  onChange: (updatedContent, previousContent, { contentErrors, patchResult })=>{
84581
- this.content = updatedContent;
84583
+ let json = updatedContent.json;
84584
+ if (updatedContent.text) {
84585
+ try {
84586
+ json = JSON.parse(updatedContent.text);
84587
+ } catch (e) {
84588
+ // nothing
84589
+ }
84590
+ }
84591
+ if (!json) {
84592
+ return;
84593
+ }
84594
+ this.json = json;
84582
84595
  this.dispatchEvent(new CustomEvent('change', {
84583
84596
  detail: {
84584
84597
  updatedContent,
@@ -84592,17 +84605,21 @@ class JsonEditorElement extends s$1 {
84592
84605
  });
84593
84606
  }
84594
84607
  }, 1);
84595
- return x$1` <section></section> `;
84608
+ return x$1` <section style=${this.contentStyle}></section> `;
84596
84609
  }
84597
84610
  constructor(...args){
84598
84611
  super(...args);
84599
- this.content = {};
84612
+ this.json = {};
84613
+ this.contentStyle = '';
84600
84614
  }
84601
84615
  }
84602
84616
  __decorate([
84603
84617
  n$1(),
84604
84618
  __metadata("design:type", Object)
84605
- ], JsonEditorElement.prototype, "content", void 0);
84619
+ ], JsonEditorElement.prototype, "json", void 0);
84620
+ __decorate([
84621
+ n$1()
84622
+ ], JsonEditorElement.prototype, "contentStyle", void 0);
84606
84623
  JsonEditorElement = __decorate([
84607
84624
  t$2('digipair-jsoneditor')
84608
84625
  ], JsonEditorElement);