@tmagic/editor 1.1.0-beta.2 → 1.1.0-beta.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/tmagic-editor.es.js +23 -38
- package/dist/tmagic-editor.es.js.map +1 -1
- package/dist/tmagic-editor.umd.js +21 -36
- package/dist/tmagic-editor.umd.js.map +1 -1
- package/package.json +7 -7
- package/src/layouts/sidebar/ComponentListPanel.vue +4 -15
- package/src/services/BaseService.ts +4 -9
- package/src/services/editor.ts +1 -3
- package/src/utils/editor.ts +2 -1
|
@@ -479,17 +479,12 @@
|
|
|
479
479
|
try {
|
|
480
480
|
let beforeArgs = args;
|
|
481
481
|
for (const beforeMethod of scope.pluginOptionsList[beforeMethodName]) {
|
|
482
|
-
|
|
483
|
-
if (isError(
|
|
484
|
-
throw
|
|
485
|
-
if (!Array.isArray(
|
|
486
|
-
|
|
482
|
+
beforeArgs = await beforeMethod(...beforeArgs) || [];
|
|
483
|
+
if (isError(beforeArgs))
|
|
484
|
+
throw beforeArgs;
|
|
485
|
+
if (!Array.isArray(beforeArgs)) {
|
|
486
|
+
beforeArgs = [beforeArgs];
|
|
487
487
|
}
|
|
488
|
-
beforeArgs = beforeArgs.map((v, index) => {
|
|
489
|
-
if (typeof beforeReturnValue[index] === "undefined")
|
|
490
|
-
return v;
|
|
491
|
-
return beforeReturnValue[index];
|
|
492
|
-
});
|
|
493
488
|
}
|
|
494
489
|
let returnValue = await fn(beforeArgs, sourceMethod.bind(scope));
|
|
495
490
|
for (const afterMethod of scope.pluginOptionsList[afterMethodName]) {
|
|
@@ -879,23 +874,13 @@
|
|
|
879
874
|
return config.style?.left;
|
|
880
875
|
const el = doc.getElementById(`${config.id}`);
|
|
881
876
|
const parentEl = doc.getElementById(`${parent.id}`);
|
|
882
|
-
|
|
877
|
+
const left = Number(config.style?.left) || 0;
|
|
878
|
+
if (el && parentEl && el.offsetWidth + left > parentEl.offsetWidth) {
|
|
883
879
|
return parentEl.offsetWidth - el.offsetWidth;
|
|
884
880
|
}
|
|
885
881
|
return config.style.left;
|
|
886
882
|
};
|
|
887
883
|
|
|
888
|
-
const log = (...args) => {
|
|
889
|
-
};
|
|
890
|
-
const info = (...args) => {
|
|
891
|
-
};
|
|
892
|
-
const warn = (...args) => {
|
|
893
|
-
};
|
|
894
|
-
const debug = (...args) => {
|
|
895
|
-
};
|
|
896
|
-
const error = (...args) => {
|
|
897
|
-
};
|
|
898
|
-
|
|
899
884
|
class Editor$1 extends BaseService {
|
|
900
885
|
constructor() {
|
|
901
886
|
super([
|
|
@@ -1057,7 +1042,7 @@
|
|
|
1057
1042
|
parentNode?.items?.push(newNode);
|
|
1058
1043
|
const stage = this.get("stage");
|
|
1059
1044
|
const root = this.get("root");
|
|
1060
|
-
await stage?.add({ config: lodashEs.cloneDeep(newNode), root: lodashEs.cloneDeep(root) });
|
|
1045
|
+
await stage?.add({ config: lodashEs.cloneDeep(newNode), parent: lodashEs.cloneDeep(parentNode), root: lodashEs.cloneDeep(root) });
|
|
1061
1046
|
if (layout === Layout.ABSOLUTE) {
|
|
1062
1047
|
const fixedLeft = fixNodeLeft(newNode, parentNode, stage?.renderer.contentWindow?.document);
|
|
1063
1048
|
if (typeof fixedLeft !== "undefined") {
|
|
@@ -1642,6 +1627,17 @@
|
|
|
1642
1627
|
name: type
|
|
1643
1628
|
};
|
|
1644
1629
|
|
|
1630
|
+
const log = (...args) => {
|
|
1631
|
+
};
|
|
1632
|
+
const info = (...args) => {
|
|
1633
|
+
};
|
|
1634
|
+
const warn = (...args) => {
|
|
1635
|
+
};
|
|
1636
|
+
const debug = (...args) => {
|
|
1637
|
+
};
|
|
1638
|
+
const error = (...args) => {
|
|
1639
|
+
};
|
|
1640
|
+
|
|
1645
1641
|
const _sfc_main$i = vue.defineComponent({
|
|
1646
1642
|
components: { Plus: iconsVue.Plus },
|
|
1647
1643
|
setup() {
|
|
@@ -2307,20 +2303,9 @@
|
|
|
2307
2303
|
}
|
|
2308
2304
|
return;
|
|
2309
2305
|
}
|
|
2310
|
-
if (timeout)
|
|
2306
|
+
if (timeout || !stage.value)
|
|
2311
2307
|
return;
|
|
2312
|
-
timeout =
|
|
2313
|
-
if (!stageOptions || !stage.value)
|
|
2314
|
-
return;
|
|
2315
|
-
const doc = stage.value.renderer.contentWindow?.document;
|
|
2316
|
-
const els = stage.value.getElementsFromPoint(e);
|
|
2317
|
-
for (const el of els) {
|
|
2318
|
-
if (doc && !el.id.startsWith(StageCore.GHOST_EL_ID_PREFIX) && await stageOptions.isContainer(el)) {
|
|
2319
|
-
utils.addClassName(el, doc, stageOptions?.containerHighlightClassName);
|
|
2320
|
-
break;
|
|
2321
|
-
}
|
|
2322
|
-
}
|
|
2323
|
-
}, stageOptions?.containerHighlightDuration);
|
|
2308
|
+
timeout = stage.value.getAddContainerHighlightClassNameTimeout(e);
|
|
2324
2309
|
}
|
|
2325
2310
|
};
|
|
2326
2311
|
}
|