jedison 1.22.2 → 1.23.0
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/CHANGELOG.md +10 -0
- package/dist/cjs/jedison.cjs +1 -1
- package/dist/cjs/jedison.cjs.map +1 -1
- package/dist/esm/jedison.js +25 -6
- package/dist/esm/jedison.js.map +1 -1
- package/dist/umd/jedison.umd.js +1 -1
- package/dist/umd/jedison.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/esm/jedison.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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();
|
|
@@ -3118,7 +3126,11 @@ class InstanceObject extends Instance {
|
|
|
3118
3126
|
const initialValue = clone(this.value);
|
|
3119
3127
|
if (isSet(schemaProperties)) {
|
|
3120
3128
|
Object.keys(schemaProperties).forEach((key) => {
|
|
3121
|
-
|
|
3129
|
+
let schema = schemaProperties[key];
|
|
3130
|
+
if (isObject$1(schema) && this.jedison.refParser && this.jedison.refParser.hasRef(schema) && !schema["x-recursive"]) {
|
|
3131
|
+
schema = this.jedison.refParser.expand(schema);
|
|
3132
|
+
schemaProperties[key] = schema;
|
|
3133
|
+
}
|
|
3122
3134
|
this.properties[key] = { schema };
|
|
3123
3135
|
let musstCreateChild = true;
|
|
3124
3136
|
const isRecursive = isSet(schema["x-recursive"]);
|
|
@@ -3356,10 +3368,15 @@ class InstanceObject extends Instance {
|
|
|
3356
3368
|
this.createChild(schema, propertyName, value[propertyName], true);
|
|
3357
3369
|
}
|
|
3358
3370
|
});
|
|
3371
|
+
const keepMissingSchemaFields = this.jedison.getOption("keepMissingSchemaFields");
|
|
3359
3372
|
for (let i = this.children.length - 1; i >= 0; i--) {
|
|
3360
3373
|
const instance = this.children[i];
|
|
3361
3374
|
const propertyName = instance.getKey();
|
|
3362
3375
|
if (notSet(value[propertyName])) {
|
|
3376
|
+
const isSchemaProperty = hasOwn(this.properties, propertyName);
|
|
3377
|
+
if (isSchemaProperty && keepMissingSchemaFields) {
|
|
3378
|
+
continue;
|
|
3379
|
+
}
|
|
3363
3380
|
if (childMap.has(propertyName)) {
|
|
3364
3381
|
instance.deactivate();
|
|
3365
3382
|
} else {
|
|
@@ -7507,7 +7524,7 @@ class JsonWalker {
|
|
|
7507
7524
|
}
|
|
7508
7525
|
}
|
|
7509
7526
|
}
|
|
7510
|
-
const version = "1.
|
|
7527
|
+
const version = "1.23.0";
|
|
7511
7528
|
class Jedison extends EventEmitter {
|
|
7512
7529
|
/**
|
|
7513
7530
|
* Creates a Jedison instance.
|
|
@@ -7570,7 +7587,9 @@ class Jedison extends EventEmitter {
|
|
|
7570
7587
|
subErrors: false,
|
|
7571
7588
|
debug: false,
|
|
7572
7589
|
audacity: true,
|
|
7573
|
-
switcherTypeLabels: {}
|
|
7590
|
+
switcherTypeLabels: {},
|
|
7591
|
+
keepMissingSchemaFields: false
|
|
7592
|
+
// for backwards compatibility
|
|
7574
7593
|
}, options);
|
|
7575
7594
|
this.rootName = "#";
|
|
7576
7595
|
this.pathSeparator = "/";
|