mce 0.15.5 → 0.15.7
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/index.css +11 -1
- package/dist/index.js +47 -27
- package/dist/locale/en.d.ts +1 -0
- package/dist/locale/zh-Hans.d.ts +1 -0
- package/package.json +6 -6
package/dist/index.css
CHANGED
|
@@ -204,6 +204,7 @@
|
|
|
204
204
|
.mce-layer__name {
|
|
205
205
|
position: relative;
|
|
206
206
|
flex: 1;
|
|
207
|
+
overscroll-behavior: none;
|
|
207
208
|
}
|
|
208
209
|
.mce-layer__input {
|
|
209
210
|
position: absolute;
|
|
@@ -219,11 +220,20 @@
|
|
|
219
220
|
border-radius: 2px;
|
|
220
221
|
}
|
|
221
222
|
.mce-layer__action {
|
|
223
|
+
position: sticky;
|
|
224
|
+
right: 0;
|
|
222
225
|
flex: none;
|
|
223
226
|
display: flex;
|
|
224
227
|
align-items: center;
|
|
228
|
+
background-color: var(--overlay-color, transparent);
|
|
229
|
+
backdrop-filter: blur(8px);
|
|
230
|
+
border-radius: 4px;
|
|
231
|
+
}
|
|
232
|
+
.mce-layer__action--hide {
|
|
233
|
+
background-color: transparent;
|
|
234
|
+
backdrop-filter: none;
|
|
225
235
|
}
|
|
226
|
-
.mce-
|
|
236
|
+
.mce-layer__action--hide .mce-layer__btn {
|
|
227
237
|
opacity: 0;
|
|
228
238
|
}
|
|
229
239
|
.mce-layer__btn + .mce-layer__btn {
|
package/dist/index.js
CHANGED
|
@@ -1027,7 +1027,6 @@ const _0_font = defineMixin((editor, options) => {
|
|
|
1027
1027
|
const loading = ref(false);
|
|
1028
1028
|
async function loadFont(source, options2) {
|
|
1029
1029
|
const res = await fonts.load(source, options2);
|
|
1030
|
-
console.log("loadFont", res);
|
|
1031
1030
|
emit("loadFont", res);
|
|
1032
1031
|
return res;
|
|
1033
1032
|
}
|
|
@@ -1076,6 +1075,7 @@ const en = {
|
|
|
1076
1075
|
"move": "Move",
|
|
1077
1076
|
"hand": "Hand",
|
|
1078
1077
|
"frame": "Frame",
|
|
1078
|
+
"group": "Group",
|
|
1079
1079
|
"text": "Text",
|
|
1080
1080
|
"doubleClickEditText": "DoubleClickEditText",
|
|
1081
1081
|
"rectangle": "Rectangle",
|
|
@@ -1181,6 +1181,7 @@ const zhHans = {
|
|
|
1181
1181
|
"move": "移动",
|
|
1182
1182
|
"hand": "抓手",
|
|
1183
1183
|
"frame": "画板",
|
|
1184
|
+
"group": "组合",
|
|
1184
1185
|
"text": "文字",
|
|
1185
1186
|
"doubleClickEditText": "双击编辑文字",
|
|
1186
1187
|
"rectangle": "矩形",
|
|
@@ -4274,7 +4275,7 @@ const defaultDoubleclickStrategy = (context) => {
|
|
|
4274
4275
|
const { editor } = context;
|
|
4275
4276
|
const { elementSelection } = editor;
|
|
4276
4277
|
const element = elementSelection.value[0];
|
|
4277
|
-
if (element) {
|
|
4278
|
+
if (element && !element.meta.lock) {
|
|
4278
4279
|
return element.foreground.isValid() ? void 0 : "typing";
|
|
4279
4280
|
}
|
|
4280
4281
|
return void 0;
|
|
@@ -5049,7 +5050,6 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
5049
5050
|
const _hoisted_1$l = ["data-id"];
|
|
5050
5051
|
const _hoisted_2$c = { class: "mce-layer__content" };
|
|
5051
5052
|
const _hoisted_3$b = { class: "mce-layer__prepend" };
|
|
5052
|
-
const _hoisted_4$5 = { class: "mce-layer__action" };
|
|
5053
5053
|
const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
5054
5054
|
...{
|
|
5055
5055
|
name: "MceLayer",
|
|
@@ -5086,7 +5086,8 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
5086
5086
|
nodeIndexMap,
|
|
5087
5087
|
zoomTo,
|
|
5088
5088
|
hoverElement,
|
|
5089
|
-
exec
|
|
5089
|
+
exec,
|
|
5090
|
+
t
|
|
5090
5091
|
} = useEditor();
|
|
5091
5092
|
const opened = useModel(__props, "opened");
|
|
5092
5093
|
const dom = ref();
|
|
@@ -5114,6 +5115,8 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
5114
5115
|
return false;
|
|
5115
5116
|
});
|
|
5116
5117
|
const isActive = computed(() => selection.value.some((v) => v.equal(props.node)));
|
|
5118
|
+
const children = computed(() => props.node.children);
|
|
5119
|
+
const childrenLength = computed(() => children.value.length);
|
|
5117
5120
|
const inputDom = ref();
|
|
5118
5121
|
const isHoverElement = computed(() => props.node?.equal(hoverElement.value));
|
|
5119
5122
|
const hovering = ref(false);
|
|
@@ -5135,6 +5138,24 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
5135
5138
|
}
|
|
5136
5139
|
return "$shape";
|
|
5137
5140
|
});
|
|
5141
|
+
const thumbnailName = computed(() => {
|
|
5142
|
+
const node = props.node;
|
|
5143
|
+
let value = node.name;
|
|
5144
|
+
if (!value) {
|
|
5145
|
+
if (isFrame(node)) {
|
|
5146
|
+
return t("frame");
|
|
5147
|
+
} else if (node.children.length) {
|
|
5148
|
+
value = t("group");
|
|
5149
|
+
} else if (isElement(node)) {
|
|
5150
|
+
if (node.foreground.isValid() && node.foreground.image) {
|
|
5151
|
+
value = t("image");
|
|
5152
|
+
} else if (node.text.isValid()) {
|
|
5153
|
+
value = node.text.getStringContent();
|
|
5154
|
+
}
|
|
5155
|
+
}
|
|
5156
|
+
}
|
|
5157
|
+
return value || node.id;
|
|
5158
|
+
});
|
|
5138
5159
|
function onClickExpand() {
|
|
5139
5160
|
opened.value = !opened.value;
|
|
5140
5161
|
}
|
|
@@ -5195,11 +5216,11 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
5195
5216
|
}
|
|
5196
5217
|
function onDblclickName() {
|
|
5197
5218
|
editing.value = true;
|
|
5198
|
-
editValue.value =
|
|
5219
|
+
editValue.value = thumbnailName.value;
|
|
5199
5220
|
nextTick().then(() => {
|
|
5200
5221
|
const dom2 = inputDom.value;
|
|
5201
5222
|
if (dom2) {
|
|
5202
|
-
dom2.focus();
|
|
5223
|
+
dom2.focus({ preventScroll: true });
|
|
5203
5224
|
dom2.select();
|
|
5204
5225
|
}
|
|
5205
5226
|
});
|
|
@@ -5222,9 +5243,9 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
5222
5243
|
}
|
|
5223
5244
|
function onInputBlur() {
|
|
5224
5245
|
editing.value = false;
|
|
5225
|
-
if (editValue.value) {
|
|
5246
|
+
if (editValue.value !== thumbnailName.value) {
|
|
5226
5247
|
props.node.name = editValue.value;
|
|
5227
|
-
editValue.value =
|
|
5248
|
+
editValue.value = "";
|
|
5228
5249
|
}
|
|
5229
5250
|
}
|
|
5230
5251
|
return (_ctx, _cache) => {
|
|
@@ -5255,7 +5276,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
5255
5276
|
_cache[6] || (_cache[6] = createElementVNode("span", { class: "mce-layer__overlay" }, null, -1)),
|
|
5256
5277
|
createElementVNode("div", _hoisted_2$c, [
|
|
5257
5278
|
createElementVNode("div", _hoisted_3$b, [
|
|
5258
|
-
|
|
5279
|
+
childrenLength.value ? (openBlock(), createBlock(unref(_sfc_main$C), {
|
|
5259
5280
|
key: 0,
|
|
5260
5281
|
icon: "$arrowRight",
|
|
5261
5282
|
onClick: onClickExpand,
|
|
@@ -5287,15 +5308,17 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
5287
5308
|
]),
|
|
5288
5309
|
createElementVNode("div", {
|
|
5289
5310
|
style: normalizeStyle({ visibility: editing.value ? "hidden" : void 0 })
|
|
5290
|
-
}, toDisplayString(editValue.value ||
|
|
5311
|
+
}, toDisplayString(editValue.value || thumbnailName.value), 5)
|
|
5291
5312
|
], 32),
|
|
5292
|
-
createElementVNode("div",
|
|
5313
|
+
createElementVNode("div", {
|
|
5314
|
+
class: normalizeClass(["mce-layer__action", {
|
|
5315
|
+
"mce-layer__action--hide": !hovering.value && !unref(isLock)(props.node) && unref(isVisible)(props.node)
|
|
5316
|
+
}])
|
|
5317
|
+
}, [
|
|
5293
5318
|
props.root ? (openBlock(), createBlock(_sfc_main$y, {
|
|
5294
5319
|
key: 0,
|
|
5295
5320
|
icon: "",
|
|
5296
|
-
class:
|
|
5297
|
-
"mce-layer__btn--hide": !hovering.value && !unref(isLock)(props.node)
|
|
5298
|
-
}]),
|
|
5321
|
+
class: "mce-layer__btn",
|
|
5299
5322
|
onClick: _cache[2] || (_cache[2] = ($event) => unref(setLock)(props.node, !unref(isLock)(props.node)))
|
|
5300
5323
|
}, {
|
|
5301
5324
|
default: withCtx(() => [
|
|
@@ -5304,12 +5327,10 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
5304
5327
|
}, null, 8, ["icon"])
|
|
5305
5328
|
]),
|
|
5306
5329
|
_: 1
|
|
5307
|
-
}
|
|
5330
|
+
})) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
5308
5331
|
createVNode(_sfc_main$y, {
|
|
5309
5332
|
icon: "",
|
|
5310
|
-
class:
|
|
5311
|
-
"mce-layer__btn--hide": !hovering.value && !unref(isLock)(props.node)
|
|
5312
|
-
}]),
|
|
5333
|
+
class: "mce-layer__btn",
|
|
5313
5334
|
onClick: _cache[3] || (_cache[3] = withModifiers(($event) => unref(setLock)(props.node, !unref(isLock)(props.node)), ["prevent", "stop"]))
|
|
5314
5335
|
}, {
|
|
5315
5336
|
default: withCtx(() => [
|
|
@@ -5318,12 +5339,10 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
5318
5339
|
}, null, 8, ["icon"])
|
|
5319
5340
|
]),
|
|
5320
5341
|
_: 1
|
|
5321
|
-
}
|
|
5342
|
+
}),
|
|
5322
5343
|
createVNode(_sfc_main$y, {
|
|
5323
5344
|
icon: "",
|
|
5324
|
-
class:
|
|
5325
|
-
"mce-layer__btn--hide": !hovering.value && unref(isVisible)(props.node)
|
|
5326
|
-
}]),
|
|
5345
|
+
class: "mce-layer__btn",
|
|
5327
5346
|
onClick: _cache[4] || (_cache[4] = withModifiers(($event) => unref(setVisible)(props.node, !unref(isVisible)(props.node)), ["prevent", "stop"]))
|
|
5328
5347
|
}, {
|
|
5329
5348
|
default: withCtx(() => [
|
|
@@ -5332,15 +5351,15 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
5332
5351
|
}, null, 8, ["icon"])
|
|
5333
5352
|
]),
|
|
5334
5353
|
_: 1
|
|
5335
|
-
}
|
|
5354
|
+
})
|
|
5336
5355
|
], 64))
|
|
5337
|
-
])
|
|
5356
|
+
], 2)
|
|
5338
5357
|
])
|
|
5339
5358
|
], 46, _hoisted_1$l),
|
|
5340
|
-
opened.value ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(
|
|
5359
|
+
opened.value ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(childrenLength.value, (i) => {
|
|
5341
5360
|
return openBlock(), createBlock(_component_MceLayer, {
|
|
5342
|
-
key,
|
|
5343
|
-
node:
|
|
5361
|
+
key: i,
|
|
5362
|
+
node: children.value[childrenLength.value - i],
|
|
5344
5363
|
indent: __props.root ? props.indent : props.indent + 1,
|
|
5345
5364
|
active: __props.active || isActive.value
|
|
5346
5365
|
}, null, 8, ["node", "indent", "active"]);
|
|
@@ -5394,6 +5413,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
5394
5413
|
if (last) {
|
|
5395
5414
|
nextTick().then(() => {
|
|
5396
5415
|
domItems.get(getIdByNode(last) ?? "")?.value?.scrollIntoView({
|
|
5416
|
+
inline: "nearest",
|
|
5397
5417
|
block: "center"
|
|
5398
5418
|
});
|
|
5399
5419
|
});
|
package/dist/locale/en.d.ts
CHANGED
package/dist/locale/zh-Hans.d.ts
CHANGED
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.7",
|
|
5
5
|
"description": "The headless canvas editor framework. only the ESM.",
|
|
6
6
|
"author": "wxm",
|
|
7
7
|
"license": "MIT",
|
|
@@ -61,11 +61,11 @@
|
|
|
61
61
|
"diff": "^8.0.2",
|
|
62
62
|
"file-saver": "^2.0.5",
|
|
63
63
|
"lodash-es": "^4.17.22",
|
|
64
|
-
"modern-canvas": "^0.14.
|
|
64
|
+
"modern-canvas": "^0.14.22",
|
|
65
65
|
"modern-font": "^0.4.4",
|
|
66
|
-
"modern-idoc": "^0.10.
|
|
67
|
-
"modern-text": "^1.10.
|
|
68
|
-
"yjs": "^13.6.
|
|
66
|
+
"modern-idoc": "^0.10.8",
|
|
67
|
+
"modern-text": "^1.10.6",
|
|
68
|
+
"yjs": "^13.6.28"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"lottie-web": "^5",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"@vitejs/plugin-vue": "^6.0.3",
|
|
95
95
|
"jiti": "^2.6.1",
|
|
96
96
|
"modern-gif": "^2.0.4",
|
|
97
|
-
"sass-embedded": "^1.97.
|
|
97
|
+
"sass-embedded": "^1.97.1"
|
|
98
98
|
},
|
|
99
99
|
"scripts": {
|
|
100
100
|
"build:code": "vite build",
|