jedison 1.22.1 → 1.22.3

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.
@@ -2079,7 +2079,11 @@ class Instance extends EventEmitter {
2079
2079
  * @returns {*} The final value after constraint enforcement
2080
2080
  */
2081
2081
  setValue(newValue, notifyParent = true, initiator = "api") {
2082
- if (this.value === newValue) {
2082
+ const wasInactive = !this.isActive;
2083
+ if (wasInactive) {
2084
+ this.isActive = true;
2085
+ }
2086
+ if (this.value === newValue && !wasInactive) {
2083
2087
  return this.value;
2084
2088
  }
2085
2089
  const purifiedValue = this.purify(newValue);
@@ -2092,7 +2096,7 @@ class Instance extends EventEmitter {
2092
2096
  newValue = schemaConst;
2093
2097
  }
2094
2098
  }
2095
- if (!wasPurified && !different(this.value, newValue)) {
2099
+ if (!wasPurified && !different(this.value, newValue) && !wasInactive) {
2096
2100
  return this.value;
2097
2101
  }
2098
2102
  this.value = newValue;
@@ -2258,7 +2262,11 @@ class Editor {
2258
2262
  */
2259
2263
  init() {
2260
2264
  this.theme = this.instance.jedison.theme;
2261
- this.markdownEnabled = getSchemaXOption(this.instance.schema, "parseMarkdown") ?? this.instance.jedison.getOption("parseMarkdown");
2265
+ const parseMarkdownOption = getSchemaXOption(this.instance.schema, "parseMarkdown") ?? this.instance.jedison.getOption("parseMarkdown");
2266
+ this.markdownEnabled = Boolean(parseMarkdownOption) && typeof window !== "undefined" && Boolean(window.marked);
2267
+ if (parseMarkdownOption && !this.markdownEnabled && typeof window !== "undefined") {
2268
+ console.warn("Jedison: parseMarkdown is enabled but window.marked was not found. Markdown will not be parsed.");
2269
+ }
2262
2270
  this.purifyEnabled = getSchemaXOption(this.instance.schema, "purifyHtml") ?? this.instance.jedison.getOption("purifyHtml");
2263
2271
  this.markdownCache = /* @__PURE__ */ new Map();
2264
2272
  this.purifyCache = /* @__PURE__ */ new Map();
@@ -2922,6 +2930,15 @@ class InstanceIfThenElse extends Instance {
2922
2930
  }
2923
2931
  }
2924
2932
  class InstanceMultiple extends Instance {
2933
+ // A Multiple's real value always comes from resolving the active branch
2934
+ // (see switchInstance()) - never from its own wrapper schema. The base
2935
+ // class's type-based placeholder (e.g. {} when the wrapper also declares
2936
+ // "type": "object" alongside oneOf, a common x-discriminator pattern) is
2937
+ // not real data, but prepare()/switchInstance() below can't tell it apart
2938
+ // from one - propagating it stomps the freshly built branch's own
2939
+ // x-defaultProperties-activated children right after creation.
2940
+ setInitialValue() {
2941
+ }
2925
2942
  prepare() {
2926
2943
  this.instances = [];
2927
2944
  this.activeInstance = null;
@@ -7498,7 +7515,7 @@ class JsonWalker {
7498
7515
  }
7499
7516
  }
7500
7517
  }
7501
- const version = "1.22.1";
7518
+ const version = "1.22.3";
7502
7519
  class Jedison extends EventEmitter {
7503
7520
  /**
7504
7521
  * Creates a Jedison instance.