jedison 1.22.0 → 1.22.1
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 +5 -0
- package/dist/cjs/jedison.cjs +1 -1
- package/dist/cjs/jedison.cjs.map +1 -1
- package/dist/esm/jedison.js +33 -8
- 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
|
@@ -2213,6 +2213,7 @@ class Editor {
|
|
|
2213
2213
|
this.title = null;
|
|
2214
2214
|
this.description = null;
|
|
2215
2215
|
this.storedEventListeners = [];
|
|
2216
|
+
this.schemaButtonListeners = [];
|
|
2216
2217
|
this.init();
|
|
2217
2218
|
this.build();
|
|
2218
2219
|
this.setAttributes();
|
|
@@ -2314,8 +2315,9 @@ class Editor {
|
|
|
2314
2315
|
* `jedison.on('jedison:<name>', ({ jedison, editor, path }) => ...)`. The
|
|
2315
2316
|
* listener map is private to the instance, so the payload is not exposed to
|
|
2316
2317
|
* unrelated scripts on the page (F3 contained).
|
|
2317
|
-
* - Click listeners are registered through
|
|
2318
|
-
* cleans them up
|
|
2318
|
+
* - Click listeners are registered through schemaButtonListeners so
|
|
2319
|
+
* destroy() cleans them up, without being cleared by an editor's
|
|
2320
|
+
* refreshUI() in the meantime (issue #79).
|
|
2319
2321
|
*/
|
|
2320
2322
|
appendSchemaButtons() {
|
|
2321
2323
|
const buttons = getSchemaXOption(this.instance.schema, "buttons");
|
|
@@ -2345,7 +2347,7 @@ class Editor {
|
|
|
2345
2347
|
});
|
|
2346
2348
|
};
|
|
2347
2349
|
button.addEventListener("click", handler);
|
|
2348
|
-
this.
|
|
2350
|
+
this.schemaButtonListeners.push({
|
|
2349
2351
|
element: button,
|
|
2350
2352
|
eventType: "click",
|
|
2351
2353
|
handler
|
|
@@ -2426,6 +2428,22 @@ class Editor {
|
|
|
2426
2428
|
}
|
|
2427
2429
|
this.storedEventListeners = [];
|
|
2428
2430
|
}
|
|
2431
|
+
/**
|
|
2432
|
+
* Clears the click listeners registered by appendSchemaButtons(). Separate
|
|
2433
|
+
* from clearStoredEventListeners() so editors that clear the latter on
|
|
2434
|
+
* every refreshUI() (e.g. EditorArrayNav) don't also detach the schema
|
|
2435
|
+
* buttons, which are only ever appended once and never rebuilt (issue #79).
|
|
2436
|
+
*/
|
|
2437
|
+
clearSchemaButtonListeners() {
|
|
2438
|
+
if (this.schemaButtonListeners) {
|
|
2439
|
+
this.schemaButtonListeners.forEach((listener) => {
|
|
2440
|
+
if (listener.element && listener.handler) {
|
|
2441
|
+
listener.element.removeEventListener(listener.eventType || "click", listener.handler);
|
|
2442
|
+
}
|
|
2443
|
+
});
|
|
2444
|
+
}
|
|
2445
|
+
this.schemaButtonListeners = [];
|
|
2446
|
+
}
|
|
2429
2447
|
/**
|
|
2430
2448
|
* Shows validation error messages in the editor container.
|
|
2431
2449
|
*/
|
|
@@ -2671,6 +2689,7 @@ class Editor {
|
|
|
2671
2689
|
*/
|
|
2672
2690
|
destroy() {
|
|
2673
2691
|
this.clearStoredEventListeners();
|
|
2692
|
+
this.clearSchemaButtonListeners();
|
|
2674
2693
|
if (this.control.container && this.control.container.parentNode) {
|
|
2675
2694
|
this.control.container.parentNode.removeChild(this.control.container);
|
|
2676
2695
|
}
|
|
@@ -3477,6 +3496,7 @@ const glyphicons = {
|
|
|
3477
3496
|
properties: "glyphicon glyphicon-list",
|
|
3478
3497
|
delete: "glyphicon glyphicon-trash",
|
|
3479
3498
|
add: "glyphicon glyphicon-plus",
|
|
3499
|
+
addProperty: "glyphicon glyphicon-plus-sign",
|
|
3480
3500
|
moveUp: "glyphicon glyphicon-arrow-up",
|
|
3481
3501
|
moveDown: "glyphicon glyphicon-arrow-down",
|
|
3482
3502
|
collapse: "glyphicon glyphicon-chevron-down",
|
|
@@ -3494,6 +3514,7 @@ const bootstrapIcons = {
|
|
|
3494
3514
|
properties: "bi bi-card-list",
|
|
3495
3515
|
delete: "bi bi-trash2",
|
|
3496
3516
|
add: "bi bi-plus",
|
|
3517
|
+
addProperty: "bi bi-plus-circle",
|
|
3497
3518
|
moveUp: "bi bi-arrow-up",
|
|
3498
3519
|
moveDown: "bi bi-arrow-down",
|
|
3499
3520
|
collapse: "bi bi-chevron-down",
|
|
@@ -3510,6 +3531,7 @@ const fontAwesome3 = {
|
|
|
3510
3531
|
properties: "icon-list",
|
|
3511
3532
|
delete: "icon-trash",
|
|
3512
3533
|
add: "icon-plus",
|
|
3534
|
+
addProperty: "icon-plus-sign",
|
|
3513
3535
|
moveUp: "icon-arrow-up",
|
|
3514
3536
|
moveDown: "icon-arrow-down",
|
|
3515
3537
|
collapse: "icon-chevron-down",
|
|
@@ -3526,6 +3548,7 @@ const fontAwesome4 = {
|
|
|
3526
3548
|
properties: "fa fa-list",
|
|
3527
3549
|
delete: "fa fa-trash-o",
|
|
3528
3550
|
add: "fa fa-plus",
|
|
3551
|
+
addProperty: "fa fa-plus-circle",
|
|
3529
3552
|
moveUp: "fa fa-arrow-up",
|
|
3530
3553
|
moveDown: "fa fa-arrow-down",
|
|
3531
3554
|
collapse: "fa fa-chevron-down",
|
|
@@ -3542,6 +3565,7 @@ const fontAwesome5 = {
|
|
|
3542
3565
|
properties: "fas fa-list",
|
|
3543
3566
|
delete: "fas fa-trash",
|
|
3544
3567
|
add: "fas fa-plus",
|
|
3568
|
+
addProperty: "fas fa-plus-circle",
|
|
3545
3569
|
moveUp: "fas fa-arrow-up",
|
|
3546
3570
|
moveDown: "fas fa-arrow-down",
|
|
3547
3571
|
collapse: "fas fa-chevron-down",
|
|
@@ -3558,6 +3582,7 @@ const fontAwesome6 = {
|
|
|
3558
3582
|
properties: "fa-solid fa-list",
|
|
3559
3583
|
delete: "fa-solid fa-trash",
|
|
3560
3584
|
add: "fa-solid fa-plus",
|
|
3585
|
+
addProperty: "fa-solid fa-circle-plus",
|
|
3561
3586
|
moveUp: "fa-solid fa-arrow-up",
|
|
3562
3587
|
moveDown: "fa-solid fa-arrow-down",
|
|
3563
3588
|
collapse: "fa-solid fa-chevron-down",
|
|
@@ -7473,7 +7498,7 @@ class JsonWalker {
|
|
|
7473
7498
|
}
|
|
7474
7499
|
}
|
|
7475
7500
|
}
|
|
7476
|
-
const version = "1.22.
|
|
7501
|
+
const version = "1.22.1";
|
|
7477
7502
|
class Jedison extends EventEmitter {
|
|
7478
7503
|
/**
|
|
7479
7504
|
* Creates a Jedison instance.
|
|
@@ -9018,11 +9043,11 @@ class Theme {
|
|
|
9018
9043
|
});
|
|
9019
9044
|
const quickAddPropertyBtn = this.getAddPropertyButton({
|
|
9020
9045
|
content: config.addPropertyContent,
|
|
9021
|
-
icon: "
|
|
9046
|
+
icon: "addProperty"
|
|
9022
9047
|
});
|
|
9023
9048
|
const quickAddPropertyToggle = this.getQuickAddPropertyToggle({
|
|
9024
9049
|
content: config.addPropertyContent,
|
|
9025
|
-
icon: "
|
|
9050
|
+
icon: "addProperty",
|
|
9026
9051
|
propertiesContainer: quickAddPropertyContainer
|
|
9027
9052
|
});
|
|
9028
9053
|
const fieldset = this.getFieldset();
|
|
@@ -9135,10 +9160,10 @@ class Theme {
|
|
|
9135
9160
|
id: "jedi-quick-add-property-input-" + config.id,
|
|
9136
9161
|
title: config.addPropertyContent
|
|
9137
9162
|
});
|
|
9138
|
-
const quickAddPropertyBtn = this.getAddPropertyButton({ content: config.addPropertyContent, icon: "
|
|
9163
|
+
const quickAddPropertyBtn = this.getAddPropertyButton({ content: config.addPropertyContent, icon: "addProperty" });
|
|
9139
9164
|
const quickAddPropertyToggle = this.getQuickAddPropertyToggle({
|
|
9140
9165
|
content: config.addPropertyContent,
|
|
9141
|
-
icon: "
|
|
9166
|
+
icon: "addProperty",
|
|
9142
9167
|
propertiesContainer: quickAddPropertyContainer
|
|
9143
9168
|
});
|
|
9144
9169
|
const collapse = document.createElement("div");
|