@leafer-editor/worker 1.5.2 → 1.5.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.
- package/dist/worker.js +20 -12
- package/dist/worker.js.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +20 -12
- package/dist/worker.module.js.map +1 -1
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +15 -15
package/dist/worker.module.js
CHANGED
|
@@ -6071,7 +6071,7 @@ class LeafLevelList {
|
|
|
6071
6071
|
}
|
|
6072
6072
|
}
|
|
6073
6073
|
|
|
6074
|
-
const version = "1.5.
|
|
6074
|
+
const version = "1.5.3";
|
|
6075
6075
|
|
|
6076
6076
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6077
6077
|
get allowBackgroundColor() { return true; }
|
|
@@ -11706,9 +11706,24 @@ function targetAttr(fn) {
|
|
|
11706
11706
|
set(value) {
|
|
11707
11707
|
const old = this[privateKey];
|
|
11708
11708
|
if (old !== value) {
|
|
11709
|
-
|
|
11710
|
-
|
|
11711
|
-
|
|
11709
|
+
if (this.config) {
|
|
11710
|
+
const isSelect = key === 'target';
|
|
11711
|
+
if (isSelect) {
|
|
11712
|
+
if (value instanceof Array && value.length > 1 && value[0].locked)
|
|
11713
|
+
value.splice(0, 1);
|
|
11714
|
+
const { beforeSelect } = this.config;
|
|
11715
|
+
if (beforeSelect) {
|
|
11716
|
+
const check = beforeSelect({ target: value });
|
|
11717
|
+
if (typeof check === 'object')
|
|
11718
|
+
value = check;
|
|
11719
|
+
else if (check === false)
|
|
11720
|
+
return;
|
|
11721
|
+
}
|
|
11722
|
+
}
|
|
11723
|
+
const type = isSelect ? EditorEvent.BEFORE_SELECT : EditorEvent.BEFORE_HOVER;
|
|
11724
|
+
if (this.hasEvent(type))
|
|
11725
|
+
this.emitEvent(new EditorEvent(type, { editor: this, value: value, oldValue: old }));
|
|
11726
|
+
}
|
|
11712
11727
|
this[privateKey] = value, fn(this, old);
|
|
11713
11728
|
}
|
|
11714
11729
|
}
|
|
@@ -12743,11 +12758,7 @@ function simulate(editor) {
|
|
|
12743
12758
|
function onTarget(editor, oldValue) {
|
|
12744
12759
|
const { target } = editor;
|
|
12745
12760
|
if (target) {
|
|
12746
|
-
|
|
12747
|
-
if (!list.every(checkEditable)) {
|
|
12748
|
-
editor.target = list.filter(checkEditable);
|
|
12749
|
-
return;
|
|
12750
|
-
}
|
|
12761
|
+
editor.leafList = target instanceof LeafList ? target : new LeafList(target);
|
|
12751
12762
|
if (editor.multiple)
|
|
12752
12763
|
simulate(editor);
|
|
12753
12764
|
}
|
|
@@ -12774,9 +12785,6 @@ function onTarget(editor, oldValue) {
|
|
|
12774
12785
|
function onHover(editor, oldValue) {
|
|
12775
12786
|
editor.emitEvent(new EditorEvent(EditorEvent.HOVER, { editor, value: editor.hoverTarget, oldValue }));
|
|
12776
12787
|
}
|
|
12777
|
-
function checkEditable(item) {
|
|
12778
|
-
return item.editable && !item.locked;
|
|
12779
|
-
}
|
|
12780
12788
|
|
|
12781
12789
|
const order = (a, b) => a.parent.children.indexOf(a) - b.parent.children.indexOf(b);
|
|
12782
12790
|
const reverseOrder = (a, b) => b.parent.children.indexOf(b) - a.parent.children.indexOf(a);
|