mce 0.15.26 → 0.15.28
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/components/Scrollbars.vue.d.ts +0 -2
- package/dist/index.js +233 -47
- package/dist/locale/en.d.ts +1 -0
- package/dist/locale/zh-Hans.d.ts +1 -0
- package/dist/mixins/0.context.d.ts +2 -0
- package/dist/mixins/http.d.ts +23 -0
- package/dist/plugin.d.ts +1 -0
- package/dist/plugins/slice.d.ts +2 -0
- package/dist/typed-plugins.d.ts +2 -0
- package/package.json +2 -2
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
|
-
infinite?: boolean;
|
|
3
2
|
offset?: number;
|
|
4
3
|
size?: number;
|
|
5
4
|
};
|
|
6
5
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
7
6
|
size: number;
|
|
8
7
|
offset: number;
|
|
9
|
-
infinite: boolean;
|
|
10
8
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
9
|
declare const _default: typeof __VLS_export;
|
|
12
10
|
export default _default;
|
package/dist/index.js
CHANGED
|
@@ -938,8 +938,11 @@ const _0_context = defineMixin((editor) => {
|
|
|
938
938
|
function isElement(value) {
|
|
939
939
|
return value instanceof Element2D;
|
|
940
940
|
}
|
|
941
|
+
function inEditorIs(value, inEditorIs2) {
|
|
942
|
+
return value.meta.inEditorIs === inEditorIs2;
|
|
943
|
+
}
|
|
941
944
|
function isFrame(value) {
|
|
942
|
-
return isElement(value) && value
|
|
945
|
+
return isElement(value) && inEditorIs(value, "Frame");
|
|
943
946
|
}
|
|
944
947
|
function isTopFrame(value) {
|
|
945
948
|
return isFrame(value) && Boolean(value.parent?.equal(root.value));
|
|
@@ -984,6 +987,7 @@ const _0_context = defineMixin((editor) => {
|
|
|
984
987
|
isNode,
|
|
985
988
|
isRoot,
|
|
986
989
|
isElement,
|
|
990
|
+
inEditorIs,
|
|
987
991
|
isFrame,
|
|
988
992
|
isTopFrame,
|
|
989
993
|
isVisible,
|
|
@@ -1079,6 +1083,7 @@ const en = {
|
|
|
1079
1083
|
"move": "Move",
|
|
1080
1084
|
"hand": "Hand",
|
|
1081
1085
|
"frame": "Frame",
|
|
1086
|
+
"slice": "Slice",
|
|
1082
1087
|
"group": "Group",
|
|
1083
1088
|
"text": "Text",
|
|
1084
1089
|
"doubleClickEditText": "DoubleClickEditText",
|
|
@@ -1191,6 +1196,7 @@ const zhHans = {
|
|
|
1191
1196
|
"move": "移动",
|
|
1192
1197
|
"hand": "抓手",
|
|
1193
1198
|
"frame": "画板",
|
|
1199
|
+
"slice": "切片",
|
|
1194
1200
|
"group": "组合",
|
|
1195
1201
|
"text": "文字",
|
|
1196
1202
|
"doubleClickEditText": "双击编辑文字",
|
|
@@ -3486,22 +3492,20 @@ const _4_2_frame = defineMixin((editor) => {
|
|
|
3486
3492
|
continue;
|
|
3487
3493
|
}
|
|
3488
3494
|
const aabb2 = frame2.getGlobalAabb();
|
|
3489
|
-
if (aabb2) {
|
|
3490
|
-
if (
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
index = options.index;
|
|
3495
|
-
}
|
|
3496
|
-
frame2.moveChild(element, index);
|
|
3497
|
-
element.style.left = aabb1.x - aabb2.x;
|
|
3498
|
-
element.style.top = aabb1.y - aabb2.y;
|
|
3499
|
-
element.updateGlobalTransform();
|
|
3500
|
-
exec("layerScrollIntoView");
|
|
3495
|
+
if (pointer ? aabb2.contains(pointer) : aabb1 && aabb1.getIntersectionRect(aabb2).getArea() > area1 * 0.5) {
|
|
3496
|
+
if (!frame2.equal(frame1)) {
|
|
3497
|
+
let index = frame2.children.length;
|
|
3498
|
+
if (frame2.equal(options?.parent)) {
|
|
3499
|
+
index = options.index;
|
|
3501
3500
|
}
|
|
3502
|
-
|
|
3503
|
-
|
|
3501
|
+
frame2.moveChild(element, index);
|
|
3502
|
+
element.style.left = aabb1.x - aabb2.x;
|
|
3503
|
+
element.style.top = aabb1.y - aabb2.y;
|
|
3504
|
+
element.updateGlobalTransform();
|
|
3505
|
+
exec("layerScrollIntoView");
|
|
3504
3506
|
}
|
|
3507
|
+
flag = false;
|
|
3508
|
+
break;
|
|
3505
3509
|
}
|
|
3506
3510
|
}
|
|
3507
3511
|
if (flag && frame1) {
|
|
@@ -3525,8 +3529,11 @@ const _4_2_frame = defineMixin((editor) => {
|
|
|
3525
3529
|
on,
|
|
3526
3530
|
getGlobalPointer
|
|
3527
3531
|
} = editor;
|
|
3528
|
-
|
|
3532
|
+
let startFrame;
|
|
3533
|
+
let startContext = {};
|
|
3529
3534
|
on("selectionTransformStart", ({ elements }) => {
|
|
3535
|
+
const pointer = getGlobalPointer();
|
|
3536
|
+
startFrame = frames.value.find((frame) => frame.getGlobalAabb().contains(pointer));
|
|
3530
3537
|
const ctx = {};
|
|
3531
3538
|
elements.forEach((el) => {
|
|
3532
3539
|
ctx[el.instanceId] = {
|
|
@@ -3534,16 +3541,19 @@ const _4_2_frame = defineMixin((editor) => {
|
|
|
3534
3541
|
index: el.getIndex()
|
|
3535
3542
|
};
|
|
3536
3543
|
});
|
|
3537
|
-
startContext
|
|
3544
|
+
startContext = ctx;
|
|
3538
3545
|
});
|
|
3539
3546
|
on("selectionTransforming", ({ handle, startEvent, elements }) => {
|
|
3540
3547
|
if (handle === "move" && !startEvent?.__FROM__) {
|
|
3541
3548
|
const idSet = /* @__PURE__ */ new Set();
|
|
3542
3549
|
elements.forEach((el) => {
|
|
3543
|
-
|
|
3544
|
-
|
|
3550
|
+
const frame = isTopFrame(el) ? el : el.findAncestor(isTopFrame);
|
|
3551
|
+
if (frame) {
|
|
3552
|
+
if (frame.equal(startFrame)) {
|
|
3553
|
+
idSet.add(frame.instanceId);
|
|
3554
|
+
}
|
|
3545
3555
|
} else {
|
|
3546
|
-
idSet.add(
|
|
3556
|
+
idSet.add(0);
|
|
3547
3557
|
}
|
|
3548
3558
|
});
|
|
3549
3559
|
if (idSet.size === 1) {
|
|
@@ -3551,7 +3561,7 @@ const _4_2_frame = defineMixin((editor) => {
|
|
|
3551
3561
|
handleDragOutReparent(
|
|
3552
3562
|
element,
|
|
3553
3563
|
{
|
|
3554
|
-
...startContext
|
|
3564
|
+
...startContext[element.instanceId],
|
|
3555
3565
|
pointer: getGlobalPointer()
|
|
3556
3566
|
}
|
|
3557
3567
|
);
|
|
@@ -3560,7 +3570,8 @@ const _4_2_frame = defineMixin((editor) => {
|
|
|
3560
3570
|
}
|
|
3561
3571
|
});
|
|
3562
3572
|
on("selectionTransformEnd", () => {
|
|
3563
|
-
startContext
|
|
3573
|
+
startContext = {};
|
|
3574
|
+
startFrame = void 0;
|
|
3564
3575
|
});
|
|
3565
3576
|
};
|
|
3566
3577
|
});
|
|
@@ -3936,6 +3947,72 @@ const _drawingTool$1 = defineMixin((editor) => {
|
|
|
3936
3947
|
});
|
|
3937
3948
|
};
|
|
3938
3949
|
});
|
|
3950
|
+
function createHttp() {
|
|
3951
|
+
async function request(config) {
|
|
3952
|
+
const {
|
|
3953
|
+
url,
|
|
3954
|
+
method = "GET",
|
|
3955
|
+
data,
|
|
3956
|
+
responseType
|
|
3957
|
+
} = config;
|
|
3958
|
+
const fetchConfig = {
|
|
3959
|
+
method: method.toUpperCase(),
|
|
3960
|
+
headers: new Headers()
|
|
3961
|
+
};
|
|
3962
|
+
if (data !== void 0) {
|
|
3963
|
+
if (data instanceof FormData || data instanceof URLSearchParams || data instanceof Blob) {
|
|
3964
|
+
fetchConfig.body = data;
|
|
3965
|
+
} else if (typeof data === "object") {
|
|
3966
|
+
fetchConfig.body = JSON.stringify(data);
|
|
3967
|
+
fetchConfig.headers.set("Content-Type", "application/json");
|
|
3968
|
+
} else {
|
|
3969
|
+
fetchConfig.body = String(data);
|
|
3970
|
+
}
|
|
3971
|
+
}
|
|
3972
|
+
const response = await fetch(url, fetchConfig);
|
|
3973
|
+
if (!response.ok) {
|
|
3974
|
+
const error = new Error(`HTTP Error: ${response.status} ${response.statusText}`);
|
|
3975
|
+
error.response = {
|
|
3976
|
+
status: response.status,
|
|
3977
|
+
statusText: response.statusText,
|
|
3978
|
+
headers: Object.fromEntries(response.headers.entries()),
|
|
3979
|
+
data: await response.text().catch(() => null)
|
|
3980
|
+
};
|
|
3981
|
+
throw error;
|
|
3982
|
+
}
|
|
3983
|
+
let _responseType = responseType;
|
|
3984
|
+
if (!_responseType) {
|
|
3985
|
+
const repContentType = response.headers.get("content-type");
|
|
3986
|
+
if (repContentType) {
|
|
3987
|
+
if (repContentType.includes("application/json")) {
|
|
3988
|
+
_responseType = "json";
|
|
3989
|
+
}
|
|
3990
|
+
}
|
|
3991
|
+
}
|
|
3992
|
+
switch (_responseType ?? "text") {
|
|
3993
|
+
case "arraybuffer":
|
|
3994
|
+
return await response.arrayBuffer();
|
|
3995
|
+
case "blob":
|
|
3996
|
+
return await response.blob();
|
|
3997
|
+
case "json":
|
|
3998
|
+
return await response.json();
|
|
3999
|
+
case "document":
|
|
4000
|
+
case "stream":
|
|
4001
|
+
case "formdata":
|
|
4002
|
+
case "text":
|
|
4003
|
+
default:
|
|
4004
|
+
return await response.text();
|
|
4005
|
+
}
|
|
4006
|
+
}
|
|
4007
|
+
return {
|
|
4008
|
+
request
|
|
4009
|
+
};
|
|
4010
|
+
}
|
|
4011
|
+
const _http = defineMixin((editor, options) => {
|
|
4012
|
+
Object.assign(editor, {
|
|
4013
|
+
http: options.http ?? createHttp()
|
|
4014
|
+
});
|
|
4015
|
+
});
|
|
3939
4016
|
const _scroll$1 = defineMixin((editor) => {
|
|
3940
4017
|
const {
|
|
3941
4018
|
camera,
|
|
@@ -4272,6 +4349,7 @@ const mixins = [
|
|
|
4272
4349
|
_4_3_element,
|
|
4273
4350
|
_4_4_doc,
|
|
4274
4351
|
_drawingTool$1,
|
|
4352
|
+
_http,
|
|
4275
4353
|
_scroll$1,
|
|
4276
4354
|
_snapshot,
|
|
4277
4355
|
_zoom$1
|
|
@@ -4847,6 +4925,7 @@ const aliases = {
|
|
|
4847
4925
|
check: "M21 7L9 19l-5.5-5.5l1.41-1.41L9 16.17L19.59 5.59z",
|
|
4848
4926
|
collapse: "m12 17.4l-3.9 3.9q-.275.275-.7.275t-.7-.275t-.275-.7t.275-.7l3.875-3.875q.575-.575 1.425-.575t1.425.575L17.3 19.9q.275.275.275.7t-.275.7t-.7.275t-.7-.275zm0-10.8l3.9-3.9q.275-.275.7-.275t.7.275t.275.7t-.275.7l-3.875 3.875Q12.85 8.55 12 8.55t-1.425-.575L6.7 4.1q-.275-.275-.275-.7t.275-.7t.7-.275t.7.275z",
|
|
4849
4927
|
frame: "M17 9v6H7V9zm2-6h-2v3h2zM7 3H5v3h2zm16 4h-3v2h3zm-4 0H5v10h14zM4 7H1v2h3zm19 8h-3v2h3zM4 15H1v2h3zm15 3h-2v3h2zM7 18H5v3h2z",
|
|
4928
|
+
slice: "M20.802 4.221a2.166 2.166 0 0 0-3.062 0L2.24 19.72l.001.001A.75.75 0 0 0 2.773 21h8.125a2.25 2.25 0 0 0 2.25-2.25v-3.812l7.654-7.654a2.166 2.166 0 0 0 0-3.063m-7.654 8.596v-1.883L18.8 5.282a.665.665 0 1 1 .941.941zM4.584 19.5l7.064-7.064v6.314a.75.75 0 0 1-.75.75z",
|
|
4850
4929
|
group: "M10 22q-.825 0-1.412-.587T8 20v-4H4q-.825 0-1.412-.587T2 14V4q0-.825.588-1.412T4 2h10q.825 0 1.413.588T16 4v4h4q.825 0 1.413.588T22 10v10q0 .825-.587 1.413T20 22zm0-2h10V10h-6V4H4v10h6zm2-8",
|
|
4851
4930
|
shape: "M8 17.95q.25.025.488.038T9 18t.513-.012t.487-.038V20h10V10h-2.05q.025-.25.038-.488T18 9t-.012-.513T17.95 8H20q.825 0 1.413.588T22 10v10q0 .825-.587 1.413T20 22H10q-.825 0-1.412-.587T8 20zM9 16q-2.925 0-4.962-2.037T2 9t2.038-4.962T9 2t4.963 2.038T16 9t-2.037 4.963T9 16m0-2q2.075 0 3.538-1.463T14 9t-1.463-3.537T9 4T5.463 5.463T4 9t1.463 3.538T9 14m0-5",
|
|
4852
4931
|
text: "m18.5 4l1.16 4.35l-.96.26c-.45-.87-.91-1.74-1.44-2.18C16.73 6 16.11 6 15.5 6H13v10.5c0 .5 0 1 .33 1.25c.34.25 1 .25 1.67.25v1H9v-1c.67 0 1.33 0 1.67-.25c.33-.25.33-.75.33-1.25V6H8.5c-.61 0-1.23 0-1.76.43c-.53.44-.99 1.31-1.44 2.18l-.96-.26L5.5 4z",
|
|
@@ -5525,9 +5604,6 @@ const _frame = definePlugin((editor) => {
|
|
|
5525
5604
|
} = editor;
|
|
5526
5605
|
return {
|
|
5527
5606
|
name: "mce:frame",
|
|
5528
|
-
components: [
|
|
5529
|
-
{ type: "overlay", component: _sfc_main$A }
|
|
5530
|
-
],
|
|
5531
5607
|
drawingTools: [
|
|
5532
5608
|
{
|
|
5533
5609
|
name: "frame",
|
|
@@ -5567,6 +5643,9 @@ const _frame = definePlugin((editor) => {
|
|
|
5567
5643
|
],
|
|
5568
5644
|
hotkeys: [
|
|
5569
5645
|
{ command: "setActiveDrawingTool:frame", key: "F" }
|
|
5646
|
+
],
|
|
5647
|
+
components: [
|
|
5648
|
+
{ type: "overlay", component: _sfc_main$A, order: "before" }
|
|
5570
5649
|
]
|
|
5571
5650
|
};
|
|
5572
5651
|
});
|
|
@@ -12128,7 +12207,6 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
12128
12207
|
},
|
|
12129
12208
|
__name: "Scrollbars",
|
|
12130
12209
|
props: {
|
|
12131
|
-
infinite: { type: Boolean, default: true },
|
|
12132
12210
|
offset: { default: 0 },
|
|
12133
12211
|
size: { default: 8 }
|
|
12134
12212
|
},
|
|
@@ -12460,6 +12538,102 @@ const _shape = definePlugin((editor) => {
|
|
|
12460
12538
|
]
|
|
12461
12539
|
};
|
|
12462
12540
|
});
|
|
12541
|
+
const _slice = definePlugin((editor) => {
|
|
12542
|
+
const {
|
|
12543
|
+
setActiveDrawingTool,
|
|
12544
|
+
addElement,
|
|
12545
|
+
t,
|
|
12546
|
+
elementSelection,
|
|
12547
|
+
inEditorIs,
|
|
12548
|
+
to,
|
|
12549
|
+
fonts,
|
|
12550
|
+
drawboardEffect
|
|
12551
|
+
} = editor;
|
|
12552
|
+
async function exportSlice(options) {
|
|
12553
|
+
const el = elementSelection.value[0];
|
|
12554
|
+
if (!el || !inEditorIs(el, "Slice")) {
|
|
12555
|
+
return;
|
|
12556
|
+
}
|
|
12557
|
+
const aabb = el.getGlobalAabb();
|
|
12558
|
+
const doc = to("json", {
|
|
12559
|
+
...options,
|
|
12560
|
+
selected: el.parent?.children.filter((node) => !node.equal(el)) ?? []
|
|
12561
|
+
});
|
|
12562
|
+
doc.children.unshift({
|
|
12563
|
+
position: {
|
|
12564
|
+
x: aabb.left,
|
|
12565
|
+
y: aabb.top
|
|
12566
|
+
},
|
|
12567
|
+
meta: {
|
|
12568
|
+
inCanvasIs: "Camera2D"
|
|
12569
|
+
}
|
|
12570
|
+
});
|
|
12571
|
+
return await render({
|
|
12572
|
+
data: doc,
|
|
12573
|
+
fonts,
|
|
12574
|
+
width: aabb.width,
|
|
12575
|
+
height: aabb.height,
|
|
12576
|
+
onBefore: (engine) => {
|
|
12577
|
+
engine.root.append(
|
|
12578
|
+
new DrawboardEffect({
|
|
12579
|
+
...drawboardEffect.value.getProperties(),
|
|
12580
|
+
internalMode: "back",
|
|
12581
|
+
effectMode: "before",
|
|
12582
|
+
checkerboard: false,
|
|
12583
|
+
pixelGrid: false
|
|
12584
|
+
})
|
|
12585
|
+
);
|
|
12586
|
+
}
|
|
12587
|
+
});
|
|
12588
|
+
}
|
|
12589
|
+
return {
|
|
12590
|
+
name: "mce:slice",
|
|
12591
|
+
drawingTools: [
|
|
12592
|
+
{
|
|
12593
|
+
name: "slice",
|
|
12594
|
+
handle: (start) => {
|
|
12595
|
+
const el = addElement({
|
|
12596
|
+
name: t("slice"),
|
|
12597
|
+
outline: {
|
|
12598
|
+
color: "#d9d9d9",
|
|
12599
|
+
width: 1,
|
|
12600
|
+
style: "dashed"
|
|
12601
|
+
},
|
|
12602
|
+
meta: {
|
|
12603
|
+
inPptIs: "Shape",
|
|
12604
|
+
inEditorIs: "Slice",
|
|
12605
|
+
inCanvasIs: "Element2D"
|
|
12606
|
+
}
|
|
12607
|
+
}, {
|
|
12608
|
+
position: start,
|
|
12609
|
+
active: true
|
|
12610
|
+
});
|
|
12611
|
+
return {
|
|
12612
|
+
move: (move) => {
|
|
12613
|
+
const minX = Math.min(move.x, start.x);
|
|
12614
|
+
const minY = Math.min(move.y, start.y);
|
|
12615
|
+
const maxX = Math.max(move.x, start.x);
|
|
12616
|
+
const maxY = Math.max(move.y, start.y);
|
|
12617
|
+
el.style.left = minX;
|
|
12618
|
+
el.style.top = minY;
|
|
12619
|
+
el.style.width = maxX - minX;
|
|
12620
|
+
el.style.height = maxY - minY;
|
|
12621
|
+
},
|
|
12622
|
+
end: () => {
|
|
12623
|
+
setActiveDrawingTool(void 0);
|
|
12624
|
+
}
|
|
12625
|
+
};
|
|
12626
|
+
}
|
|
12627
|
+
}
|
|
12628
|
+
],
|
|
12629
|
+
hotkeys: [
|
|
12630
|
+
{ command: "setActiveDrawingTool:slice", key: "S" }
|
|
12631
|
+
],
|
|
12632
|
+
commands: [
|
|
12633
|
+
{ command: "exportSlice", handle: exportSlice }
|
|
12634
|
+
]
|
|
12635
|
+
};
|
|
12636
|
+
});
|
|
12463
12637
|
const _hoisted_1$c = { class: "mce-smart-guides" };
|
|
12464
12638
|
const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
12465
12639
|
__name: "SmartGuides",
|
|
@@ -14448,9 +14622,13 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
14448
14622
|
]
|
|
14449
14623
|
},
|
|
14450
14624
|
{
|
|
14451
|
-
key: "frame",
|
|
14452
|
-
active: activeDrawingTool.value?.name
|
|
14453
|
-
handle: () => setActiveDrawingTool("frame")
|
|
14625
|
+
key: activeDrawingTool.value?.name === "slice" ? "slice" : "frame",
|
|
14626
|
+
active: ["frame", "slice"].includes(activeDrawingTool.value?.name),
|
|
14627
|
+
handle: () => setActiveDrawingTool("frame"),
|
|
14628
|
+
children: [
|
|
14629
|
+
{ key: "frame", handle: () => setActiveDrawingTool("frame") },
|
|
14630
|
+
{ key: "slice", handle: () => setActiveDrawingTool("slice") }
|
|
14631
|
+
]
|
|
14454
14632
|
},
|
|
14455
14633
|
{
|
|
14456
14634
|
...shapeItems.value.find((v) => v.checked) ?? shapeItems.value[activeShape.value],
|
|
@@ -14626,7 +14804,8 @@ const _ui = definePlugin((editor) => {
|
|
|
14626
14804
|
});
|
|
14627
14805
|
const _url = definePlugin((editor) => {
|
|
14628
14806
|
const {
|
|
14629
|
-
load
|
|
14807
|
+
load,
|
|
14808
|
+
http
|
|
14630
14809
|
} = editor;
|
|
14631
14810
|
return {
|
|
14632
14811
|
name: "mce:url",
|
|
@@ -14637,7 +14816,7 @@ const _url = definePlugin((editor) => {
|
|
|
14637
14816
|
return typeof source === "string";
|
|
14638
14817
|
},
|
|
14639
14818
|
load: async (url) => {
|
|
14640
|
-
const blob = await
|
|
14819
|
+
const blob = await http.request({ url, responseType: "blob" });
|
|
14641
14820
|
const file = new File([blob], url, { type: blob.type });
|
|
14642
14821
|
try {
|
|
14643
14822
|
return await load(file);
|
|
@@ -14772,6 +14951,7 @@ const plugins = [
|
|
|
14772
14951
|
_scroll,
|
|
14773
14952
|
_selection,
|
|
14774
14953
|
_shape,
|
|
14954
|
+
_slice,
|
|
14775
14955
|
_smartGuides,
|
|
14776
14956
|
_state,
|
|
14777
14957
|
_statusbar,
|
|
@@ -16763,6 +16943,24 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
16763
16943
|
}, ["prevent"]))
|
|
16764
16944
|
}, [
|
|
16765
16945
|
createElementVNode("canvas", _hoisted_2, null, 512),
|
|
16946
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(pluginsComponents).overlay.filter((v) => v.order === "before"), (p, key) => {
|
|
16947
|
+
return openBlock(), createBlock(resolveDynamicComponent(p.component), { key });
|
|
16948
|
+
}), 128)),
|
|
16949
|
+
createVNode(_sfc_main$7, {
|
|
16950
|
+
ref: "selectorTpl",
|
|
16951
|
+
"selected-area": selectedArea.value,
|
|
16952
|
+
"resize-strategy": resizeStrategy.value
|
|
16953
|
+
}, {
|
|
16954
|
+
transformable: withCtx(({ box }) => [
|
|
16955
|
+
renderSlot(_ctx.$slots, "transformer", mergeProps({ box }, slotProps))
|
|
16956
|
+
]),
|
|
16957
|
+
default: withCtx(({ box }) => [
|
|
16958
|
+
createVNode(_sfc_main$8),
|
|
16959
|
+
renderSlot(_ctx.$slots, "selector", mergeProps({ box }, slotProps))
|
|
16960
|
+
]),
|
|
16961
|
+
_: 3
|
|
16962
|
+
}, 8, ["selected-area", "resize-strategy"]),
|
|
16963
|
+
createVNode(_sfc_main$2, { ref: "textEditorTpl" }, null, 512),
|
|
16766
16964
|
slots.floatbar ? (openBlock(), createBlock(_sfc_main$b, {
|
|
16767
16965
|
key: 0,
|
|
16768
16966
|
location: "top-start",
|
|
@@ -16796,24 +16994,12 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
16796
16994
|
]),
|
|
16797
16995
|
_: 3
|
|
16798
16996
|
}, 8, ["target"])) : createCommentVNode("", true),
|
|
16799
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(pluginsComponents).overlay, (p, key) => {
|
|
16997
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(pluginsComponents).overlay.filter((v) => v.order !== "before" && v.order !== "after"), (p, key) => {
|
|
16998
|
+
return openBlock(), createBlock(resolveDynamicComponent(p.component), { key });
|
|
16999
|
+
}), 128)),
|
|
17000
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(pluginsComponents).overlay.filter((v) => v.order === "after"), (p, key) => {
|
|
16800
17001
|
return openBlock(), createBlock(resolveDynamicComponent(p.component), { key });
|
|
16801
17002
|
}), 128)),
|
|
16802
|
-
createVNode(_sfc_main$2, { ref: "textEditorTpl" }, null, 512),
|
|
16803
|
-
createVNode(_sfc_main$7, {
|
|
16804
|
-
ref: "selectorTpl",
|
|
16805
|
-
"selected-area": selectedArea.value,
|
|
16806
|
-
"resize-strategy": resizeStrategy.value
|
|
16807
|
-
}, {
|
|
16808
|
-
transformable: withCtx(({ box }) => [
|
|
16809
|
-
renderSlot(_ctx.$slots, "transformer", mergeProps({ box }, slotProps))
|
|
16810
|
-
]),
|
|
16811
|
-
default: withCtx(({ box }) => [
|
|
16812
|
-
createVNode(_sfc_main$8),
|
|
16813
|
-
renderSlot(_ctx.$slots, "selector", mergeProps({ box }, slotProps))
|
|
16814
|
-
]),
|
|
16815
|
-
_: 3
|
|
16816
|
-
}, 8, ["selected-area", "resize-strategy"]),
|
|
16817
17003
|
renderSlot(_ctx.$slots, "drawboard", normalizeProps(guardReactiveProps(slotProps)))
|
|
16818
17004
|
], 40, _hoisted_1)
|
|
16819
17005
|
]),
|
package/dist/locale/en.d.ts
CHANGED
package/dist/locale/zh-Hans.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ declare global {
|
|
|
20
20
|
align: Tblock | 'center';
|
|
21
21
|
};
|
|
22
22
|
type IndexCharacter = _IndexCharacter;
|
|
23
|
+
type EditorNodeType = 'Doc' | 'Frame' | 'Slice' | 'Element';
|
|
23
24
|
interface Editor {
|
|
24
25
|
fonts: Fonts;
|
|
25
26
|
renderEngine: Ref<Engine>;
|
|
@@ -45,6 +46,7 @@ declare global {
|
|
|
45
46
|
parseAnchor: (anchor: Anchor, isRtl?: boolean) => ParsedAnchor;
|
|
46
47
|
isNode: (value: any) => value is Node;
|
|
47
48
|
isRoot: (value: any) => value is Node;
|
|
49
|
+
inEditorIs: (value: Node, inEditorIs?: EditorNodeType) => boolean;
|
|
48
50
|
isElement: (value: any) => value is Element2D;
|
|
49
51
|
isFrame: (value: any) => value is Element2D;
|
|
50
52
|
isTopFrame: (value: any) => value is Element2D;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Mce {
|
|
3
|
+
type HttpMethod = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
4
|
+
type HttpResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream' | 'formdata';
|
|
5
|
+
interface HttpRequestConfig {
|
|
6
|
+
url: string;
|
|
7
|
+
method?: HttpMethod | string;
|
|
8
|
+
data?: any;
|
|
9
|
+
responseType?: HttpResponseType;
|
|
10
|
+
}
|
|
11
|
+
interface Http {
|
|
12
|
+
request: (config: HttpRequestConfig) => Promise<any>;
|
|
13
|
+
}
|
|
14
|
+
interface Options {
|
|
15
|
+
http?: Http;
|
|
16
|
+
}
|
|
17
|
+
interface Editor {
|
|
18
|
+
http: Http;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
declare const _default: import("..").Mixin;
|
|
23
|
+
export default _default;
|
package/dist/plugin.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export interface PanelPluginComponent extends BasePluginComponent {
|
|
|
13
13
|
}
|
|
14
14
|
export interface OverlayPluginComponent extends BasePluginComponent {
|
|
15
15
|
type: 'overlay';
|
|
16
|
+
order?: 'before' | 'after';
|
|
16
17
|
}
|
|
17
18
|
export type PluginComponent = OverlayPluginComponent | PanelPluginComponent;
|
|
18
19
|
export interface PluginObject {
|
package/dist/typed-plugins.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ import './mixins/4.2.frame'
|
|
|
23
23
|
import './mixins/4.3.element'
|
|
24
24
|
import './mixins/4.4.doc'
|
|
25
25
|
import './mixins/drawingTool'
|
|
26
|
+
import './mixins/http'
|
|
26
27
|
import './mixins/scroll'
|
|
27
28
|
import './mixins/snapshot'
|
|
28
29
|
import './mixins/zoom'
|
|
@@ -57,6 +58,7 @@ import './plugins/saveAs'
|
|
|
57
58
|
import './plugins/scroll'
|
|
58
59
|
import './plugins/selection'
|
|
59
60
|
import './plugins/shape'
|
|
61
|
+
import './plugins/slice'
|
|
60
62
|
import './plugins/smartGuides'
|
|
61
63
|
import './plugins/state'
|
|
62
64
|
import './plugins/statusbar'
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mce",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.15.
|
|
4
|
+
"version": "0.15.28",
|
|
5
5
|
"description": "The headless canvas editor framework. only the ESM.",
|
|
6
6
|
"author": "wxm",
|
|
7
7
|
"license": "MIT",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"diff": "^8.0.3",
|
|
62
62
|
"file-saver": "^2.0.5",
|
|
63
63
|
"lodash-es": "^4.17.22",
|
|
64
|
-
"modern-canvas": "^0.14.
|
|
64
|
+
"modern-canvas": "^0.14.39",
|
|
65
65
|
"modern-font": "^0.4.4",
|
|
66
66
|
"modern-idoc": "^0.10.9",
|
|
67
67
|
"modern-text": "^1.10.15",
|