mce 0.15.5 → 0.15.6
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 +37 -27
- 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
|
@@ -4274,7 +4274,7 @@ const defaultDoubleclickStrategy = (context) => {
|
|
|
4274
4274
|
const { editor } = context;
|
|
4275
4275
|
const { elementSelection } = editor;
|
|
4276
4276
|
const element = elementSelection.value[0];
|
|
4277
|
-
if (element) {
|
|
4277
|
+
if (element && !element.meta.lock) {
|
|
4278
4278
|
return element.foreground.isValid() ? void 0 : "typing";
|
|
4279
4279
|
}
|
|
4280
4280
|
return void 0;
|
|
@@ -5049,7 +5049,6 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
5049
5049
|
const _hoisted_1$l = ["data-id"];
|
|
5050
5050
|
const _hoisted_2$c = { class: "mce-layer__content" };
|
|
5051
5051
|
const _hoisted_3$b = { class: "mce-layer__prepend" };
|
|
5052
|
-
const _hoisted_4$5 = { class: "mce-layer__action" };
|
|
5053
5052
|
const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
5054
5053
|
...{
|
|
5055
5054
|
name: "MceLayer",
|
|
@@ -5114,6 +5113,8 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
5114
5113
|
return false;
|
|
5115
5114
|
});
|
|
5116
5115
|
const isActive = computed(() => selection.value.some((v) => v.equal(props.node)));
|
|
5116
|
+
const children = computed(() => props.node.children);
|
|
5117
|
+
const childrenLength = computed(() => children.value.length);
|
|
5117
5118
|
const inputDom = ref();
|
|
5118
5119
|
const isHoverElement = computed(() => props.node?.equal(hoverElement.value));
|
|
5119
5120
|
const hovering = ref(false);
|
|
@@ -5135,6 +5136,18 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
5135
5136
|
}
|
|
5136
5137
|
return "$shape";
|
|
5137
5138
|
});
|
|
5139
|
+
const thumbnailName = computed(() => {
|
|
5140
|
+
const node = props.node;
|
|
5141
|
+
let value = node.name;
|
|
5142
|
+
if (!value) {
|
|
5143
|
+
if (isElement(node)) {
|
|
5144
|
+
if (node.text.isValid()) {
|
|
5145
|
+
value = node.text.getStringContent();
|
|
5146
|
+
}
|
|
5147
|
+
}
|
|
5148
|
+
}
|
|
5149
|
+
return value || node.id;
|
|
5150
|
+
});
|
|
5138
5151
|
function onClickExpand() {
|
|
5139
5152
|
opened.value = !opened.value;
|
|
5140
5153
|
}
|
|
@@ -5195,11 +5208,11 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
5195
5208
|
}
|
|
5196
5209
|
function onDblclickName() {
|
|
5197
5210
|
editing.value = true;
|
|
5198
|
-
editValue.value =
|
|
5211
|
+
editValue.value = thumbnailName.value;
|
|
5199
5212
|
nextTick().then(() => {
|
|
5200
5213
|
const dom2 = inputDom.value;
|
|
5201
5214
|
if (dom2) {
|
|
5202
|
-
dom2.focus();
|
|
5215
|
+
dom2.focus({ preventScroll: true });
|
|
5203
5216
|
dom2.select();
|
|
5204
5217
|
}
|
|
5205
5218
|
});
|
|
@@ -5222,10 +5235,8 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
5222
5235
|
}
|
|
5223
5236
|
function onInputBlur() {
|
|
5224
5237
|
editing.value = false;
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
editValue.value = void 0;
|
|
5228
|
-
}
|
|
5238
|
+
props.node.name = editValue.value;
|
|
5239
|
+
editValue.value = "";
|
|
5229
5240
|
}
|
|
5230
5241
|
return (_ctx, _cache) => {
|
|
5231
5242
|
const _component_MceLayer = resolveComponent("MceLayer");
|
|
@@ -5255,7 +5266,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
5255
5266
|
_cache[6] || (_cache[6] = createElementVNode("span", { class: "mce-layer__overlay" }, null, -1)),
|
|
5256
5267
|
createElementVNode("div", _hoisted_2$c, [
|
|
5257
5268
|
createElementVNode("div", _hoisted_3$b, [
|
|
5258
|
-
|
|
5269
|
+
childrenLength.value ? (openBlock(), createBlock(unref(_sfc_main$C), {
|
|
5259
5270
|
key: 0,
|
|
5260
5271
|
icon: "$arrowRight",
|
|
5261
5272
|
onClick: onClickExpand,
|
|
@@ -5287,15 +5298,17 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
5287
5298
|
]),
|
|
5288
5299
|
createElementVNode("div", {
|
|
5289
5300
|
style: normalizeStyle({ visibility: editing.value ? "hidden" : void 0 })
|
|
5290
|
-
}, toDisplayString(editValue.value ||
|
|
5301
|
+
}, toDisplayString(editValue.value || thumbnailName.value), 5)
|
|
5291
5302
|
], 32),
|
|
5292
|
-
createElementVNode("div",
|
|
5303
|
+
createElementVNode("div", {
|
|
5304
|
+
class: normalizeClass(["mce-layer__action", {
|
|
5305
|
+
"mce-layer__action--hide": !hovering.value && !unref(isLock)(props.node) && unref(isVisible)(props.node)
|
|
5306
|
+
}])
|
|
5307
|
+
}, [
|
|
5293
5308
|
props.root ? (openBlock(), createBlock(_sfc_main$y, {
|
|
5294
5309
|
key: 0,
|
|
5295
5310
|
icon: "",
|
|
5296
|
-
class:
|
|
5297
|
-
"mce-layer__btn--hide": !hovering.value && !unref(isLock)(props.node)
|
|
5298
|
-
}]),
|
|
5311
|
+
class: "mce-layer__btn",
|
|
5299
5312
|
onClick: _cache[2] || (_cache[2] = ($event) => unref(setLock)(props.node, !unref(isLock)(props.node)))
|
|
5300
5313
|
}, {
|
|
5301
5314
|
default: withCtx(() => [
|
|
@@ -5304,12 +5317,10 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
5304
5317
|
}, null, 8, ["icon"])
|
|
5305
5318
|
]),
|
|
5306
5319
|
_: 1
|
|
5307
|
-
}
|
|
5320
|
+
})) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
5308
5321
|
createVNode(_sfc_main$y, {
|
|
5309
5322
|
icon: "",
|
|
5310
|
-
class:
|
|
5311
|
-
"mce-layer__btn--hide": !hovering.value && !unref(isLock)(props.node)
|
|
5312
|
-
}]),
|
|
5323
|
+
class: "mce-layer__btn",
|
|
5313
5324
|
onClick: _cache[3] || (_cache[3] = withModifiers(($event) => unref(setLock)(props.node, !unref(isLock)(props.node)), ["prevent", "stop"]))
|
|
5314
5325
|
}, {
|
|
5315
5326
|
default: withCtx(() => [
|
|
@@ -5318,12 +5329,10 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
5318
5329
|
}, null, 8, ["icon"])
|
|
5319
5330
|
]),
|
|
5320
5331
|
_: 1
|
|
5321
|
-
}
|
|
5332
|
+
}),
|
|
5322
5333
|
createVNode(_sfc_main$y, {
|
|
5323
5334
|
icon: "",
|
|
5324
|
-
class:
|
|
5325
|
-
"mce-layer__btn--hide": !hovering.value && unref(isVisible)(props.node)
|
|
5326
|
-
}]),
|
|
5335
|
+
class: "mce-layer__btn",
|
|
5327
5336
|
onClick: _cache[4] || (_cache[4] = withModifiers(($event) => unref(setVisible)(props.node, !unref(isVisible)(props.node)), ["prevent", "stop"]))
|
|
5328
5337
|
}, {
|
|
5329
5338
|
default: withCtx(() => [
|
|
@@ -5332,15 +5341,15 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
5332
5341
|
}, null, 8, ["icon"])
|
|
5333
5342
|
]),
|
|
5334
5343
|
_: 1
|
|
5335
|
-
}
|
|
5344
|
+
})
|
|
5336
5345
|
], 64))
|
|
5337
|
-
])
|
|
5346
|
+
], 2)
|
|
5338
5347
|
])
|
|
5339
5348
|
], 46, _hoisted_1$l),
|
|
5340
|
-
opened.value ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(
|
|
5349
|
+
opened.value ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(childrenLength.value, (i) => {
|
|
5341
5350
|
return openBlock(), createBlock(_component_MceLayer, {
|
|
5342
|
-
key,
|
|
5343
|
-
node:
|
|
5351
|
+
key: i,
|
|
5352
|
+
node: children.value[childrenLength.value - i],
|
|
5344
5353
|
indent: __props.root ? props.indent : props.indent + 1,
|
|
5345
5354
|
active: __props.active || isActive.value
|
|
5346
5355
|
}, null, 8, ["node", "indent", "active"]);
|
|
@@ -5394,6 +5403,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
5394
5403
|
if (last) {
|
|
5395
5404
|
nextTick().then(() => {
|
|
5396
5405
|
domItems.get(getIdByNode(last) ?? "")?.value?.scrollIntoView({
|
|
5406
|
+
inline: "nearest",
|
|
5397
5407
|
block: "center"
|
|
5398
5408
|
});
|
|
5399
5409
|
});
|
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.6",
|
|
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",
|