@tmagic/editor 1.7.14-beta.1 → 1.7.14-beta.2
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/es/components/ToolButton.vue_vue_type_script_setup_true_lang.js +6 -2
- package/dist/es/layouts/CodeEditor.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/es/layouts/NavMenu.vue_vue_type_script_setup_true_lang.js +11 -11
- package/dist/es/layouts/NavMenuColumn.js +5 -0
- package/dist/es/layouts/NavMenuColumn.vue_vue_type_script_setup_true_lang.js +201 -0
- package/dist/es/services/storage.js +5 -5
- package/dist/es/style.css +51 -0
- package/dist/es/utils/keybinding-config.js +19 -19
- package/dist/style.css +51 -0
- package/dist/tmagic-editor.umd.cjs +265 -62
- package/package.json +8 -8
- package/src/components/ToolButton.vue +7 -1
- package/src/layouts/CodeEditor.vue +18 -10
- package/src/layouts/NavMenu.vue +9 -4
- package/src/layouts/NavMenuColumn.vue +252 -0
- package/src/theme/nav-menu.scss +61 -0
- package/src/type.ts +42 -0
- package/src/utils/undo-redo.ts +2 -0
- package/types/index.d.ts +420 -425
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useServices } from "../hooks/use-services.js";
|
|
2
2
|
import Icon_default from "./Icon.js";
|
|
3
3
|
import { TMagicButton, TMagicDivider, TMagicDropdown, TMagicDropdownItem, TMagicDropdownMenu, TMagicIcon, TMagicTooltip } from "@tmagic/design";
|
|
4
|
-
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, mergeProps, normalizeClass, openBlock, renderList, resolveDynamicComponent, toDisplayString, toHandlers, unref, withCtx } from "vue";
|
|
4
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, mergeProps, normalizeClass, openBlock, renderList, resolveDynamicComponent, toDisplayString, toHandlers, unref, useTemplateRef, withCtx } from "vue";
|
|
5
5
|
import { ArrowDown } from "@element-plus/icons-vue";
|
|
6
6
|
//#region packages/editor/src/components/ToolButton.vue?vue&type=script&setup=true&lang.ts
|
|
7
7
|
var _hoisted_1 = {
|
|
@@ -19,9 +19,11 @@ var ToolButton_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
19
19
|
}) },
|
|
20
20
|
eventType: { default: "click" }
|
|
21
21
|
},
|
|
22
|
-
setup(__props) {
|
|
22
|
+
setup(__props, { expose: __expose }) {
|
|
23
23
|
const props = __props;
|
|
24
24
|
const services = useServices();
|
|
25
|
+
const rootElRef = useTemplateRef("rootEl");
|
|
26
|
+
const getElRef = () => rootElRef;
|
|
25
27
|
const disabled = computed(() => {
|
|
26
28
|
if (typeof props.data === "string") return false;
|
|
27
29
|
if (props.data.type === "component") return false;
|
|
@@ -53,9 +55,11 @@ var ToolButton_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
53
55
|
if (props.eventType !== "mouseup") return;
|
|
54
56
|
if (item.type === "button" && event.button === 0) buttonHandler(item, event);
|
|
55
57
|
};
|
|
58
|
+
__expose({ getElRef });
|
|
56
59
|
return (_ctx, _cache) => {
|
|
57
60
|
return display.value ? (openBlock(), createElementBlock("div", {
|
|
58
61
|
key: 0,
|
|
62
|
+
ref: "rootEl",
|
|
59
63
|
class: normalizeClass(["menu-item", `${__props.data.type} ${__props.data.className || ""}`]),
|
|
60
64
|
onClick: _cache[0] || (_cache[0] = ($event) => clickHandler(__props.data, $event)),
|
|
61
65
|
onMousedown: _cache[1] || (_cache[1] = ($event) => mousedownHandler(__props.data, $event)),
|
|
@@ -124,23 +124,23 @@ var CodeEditor_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
124
124
|
if (props.type === "diff") {
|
|
125
125
|
const originalModel = monaco.editor.createModel(values.value, "text/javascript");
|
|
126
126
|
const modifiedModel = monaco.editor.createModel(toString(m, props.language), "text/javascript");
|
|
127
|
-
const
|
|
127
|
+
const viewState = vsDiffEditor?.saveViewState();
|
|
128
128
|
const result = vsDiffEditor?.setModel({
|
|
129
129
|
original: originalModel,
|
|
130
130
|
modified: modifiedModel
|
|
131
131
|
});
|
|
132
|
-
if (
|
|
133
|
-
vsDiffEditor?.
|
|
132
|
+
if (viewState) nextTick(() => {
|
|
133
|
+
vsDiffEditor?.restoreViewState(viewState);
|
|
134
134
|
vsDiffEditor?.focus();
|
|
135
|
-
}
|
|
135
|
+
});
|
|
136
136
|
return result;
|
|
137
137
|
}
|
|
138
|
-
const
|
|
138
|
+
const viewState = vsEditor?.saveViewState();
|
|
139
139
|
const result = vsEditor?.setValue(values.value);
|
|
140
|
-
if (
|
|
141
|
-
vsEditor?.
|
|
140
|
+
if (viewState) nextTick(() => {
|
|
141
|
+
vsEditor?.restoreViewState(viewState);
|
|
142
142
|
vsEditor?.focus();
|
|
143
|
-
}
|
|
143
|
+
});
|
|
144
144
|
return result;
|
|
145
145
|
};
|
|
146
146
|
const getEditorValue = () => (props.type === "diff" ? vsDiffEditor?.getModifiedEditor().getValue() : vsEditor?.getValue()) || "";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ColumnLayout } from "../type.js";
|
|
2
2
|
import { useServices } from "../hooks/use-services.js";
|
|
3
|
-
import
|
|
3
|
+
import NavMenuColumn_default from "./NavMenuColumn.js";
|
|
4
4
|
import { NodeType } from "@tmagic/core";
|
|
5
|
-
import { Fragment, computed, createBlock, createElementBlock, defineComponent, markRaw,
|
|
5
|
+
import { Fragment, computed, createBlock, createElementBlock, defineComponent, markRaw, normalizeStyle, onBeforeUnmount, onMounted, openBlock, renderList, unref, useTemplateRef } from "vue";
|
|
6
6
|
import { Back, Delete, FullScreen, Grid, Memo, Right, ScaleToOriginal, ZoomIn, ZoomOut } from "@element-plus/icons-vue";
|
|
7
7
|
//#region packages/editor/src/layouts/NavMenu.vue?vue&type=script&setup=true&lang.ts
|
|
8
8
|
var NavMenu_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
@@ -165,16 +165,16 @@ var NavMenu_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
|
|
|
165
165
|
style: normalizeStyle({ height: `${__props.height}px` }),
|
|
166
166
|
ref: "navMenu"
|
|
167
167
|
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(keys), (key) => {
|
|
168
|
-
return openBlock(),
|
|
169
|
-
class: normalizeClass(`menu-${key}`),
|
|
168
|
+
return openBlock(), createBlock(NavMenuColumn_default, {
|
|
170
169
|
key,
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
170
|
+
"column-key": key,
|
|
171
|
+
items: buttons.value[key],
|
|
172
|
+
width: columnWidth.value?.[key]
|
|
173
|
+
}, null, 8, [
|
|
174
|
+
"column-key",
|
|
175
|
+
"items",
|
|
176
|
+
"width"
|
|
177
|
+
]);
|
|
178
178
|
}), 128))], 4);
|
|
179
179
|
};
|
|
180
180
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import NavMenuColumn_vue_vue_type_script_setup_true_lang_default from "./NavMenuColumn.vue_vue_type_script_setup_true_lang.js";
|
|
2
|
+
//#region packages/editor/src/layouts/NavMenuColumn.vue
|
|
3
|
+
var NavMenuColumn_default = NavMenuColumn_vue_vue_type_script_setup_true_lang_default;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { NavMenuColumn_default as default };
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import ToolButton_default from "../components/ToolButton.js";
|
|
2
|
+
import { TMagicButton, TMagicPopover } from "@tmagic/design";
|
|
3
|
+
import { Fragment, computed, createBlock, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, openBlock, ref, renderList, unref, useTemplateRef, watch, withCtx } from "vue";
|
|
4
|
+
import { ArrowDown, ArrowUp } from "@element-plus/icons-vue";
|
|
5
|
+
//#region packages/editor/src/layouts/NavMenuColumn.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
+
var _hoisted_1 = { class: "m-editor-nav-menu-overflow-list" };
|
|
7
|
+
var NavMenuColumn_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
8
|
+
name: "MEditorNavMenuColumn",
|
|
9
|
+
__name: "NavMenuColumn",
|
|
10
|
+
props: {
|
|
11
|
+
columnKey: {},
|
|
12
|
+
items: { default: () => [] },
|
|
13
|
+
width: {},
|
|
14
|
+
gap: { default: 3 },
|
|
15
|
+
popoverWidth: { default: 180 }
|
|
16
|
+
},
|
|
17
|
+
setup(__props) {
|
|
18
|
+
const props = __props;
|
|
19
|
+
const columnEl = useTemplateRef("columnEl");
|
|
20
|
+
const moreWrapperEl = useTemplateRef("moreWrapperEl");
|
|
21
|
+
const popoverVisible = ref(false);
|
|
22
|
+
const togglePopover = () => {
|
|
23
|
+
popoverVisible.value = !popoverVisible.value;
|
|
24
|
+
};
|
|
25
|
+
const itemInstances = ref([]);
|
|
26
|
+
let slotsRO;
|
|
27
|
+
const observedEls = /* @__PURE__ */ new Set();
|
|
28
|
+
const setItemRef = (inst, index) => {
|
|
29
|
+
itemInstances.value[index] = inst ?? null;
|
|
30
|
+
};
|
|
31
|
+
const itemEls = computed(() => itemInstances.value.map((inst) => inst?.getElRef?.().value ?? null));
|
|
32
|
+
const reobserveSlots = () => {
|
|
33
|
+
if (!slotsRO) return;
|
|
34
|
+
for (const el of observedEls) slotsRO.unobserve(el);
|
|
35
|
+
observedEls.clear();
|
|
36
|
+
for (const el of itemEls.value) if (el) {
|
|
37
|
+
slotsRO.observe(el);
|
|
38
|
+
observedEls.add(el);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const cachedWidths = ref(/* @__PURE__ */ new Map());
|
|
42
|
+
const moreWidth = ref(0);
|
|
43
|
+
const containerWidth = ref(0);
|
|
44
|
+
const hiddenIndexSet = ref(/* @__PURE__ */ new Set());
|
|
45
|
+
const hasOverflow = computed(() => hiddenIndexSet.value.size > 0);
|
|
46
|
+
const overflowItems = computed(() => props.items.filter((_, index) => hiddenIndexSet.value.has(index)));
|
|
47
|
+
const measureAndCompute = () => {
|
|
48
|
+
if (!columnEl.value) return;
|
|
49
|
+
containerWidth.value = columnEl.value.clientWidth;
|
|
50
|
+
const els = itemEls.value;
|
|
51
|
+
for (let i = 0; i < props.items.length; i++) {
|
|
52
|
+
const el = els[i];
|
|
53
|
+
if (!el) {
|
|
54
|
+
cachedWidths.value.delete(i);
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const w = el.getBoundingClientRect().width;
|
|
58
|
+
if (w > 0) cachedWidths.value.set(i, w);
|
|
59
|
+
else cachedWidths.value.delete(i);
|
|
60
|
+
}
|
|
61
|
+
if (moreWrapperEl.value) {
|
|
62
|
+
const w = moreWrapperEl.value.getBoundingClientRect().width;
|
|
63
|
+
if (w > 0) moreWidth.value = w;
|
|
64
|
+
}
|
|
65
|
+
const total = props.items.length;
|
|
66
|
+
if (total === 0 || containerWidth.value <= 0) {
|
|
67
|
+
if (hiddenIndexSet.value.size > 0) hiddenIndexSet.value = /* @__PURE__ */ new Set();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
let fullSum = 0;
|
|
71
|
+
let positive = 0;
|
|
72
|
+
for (let i = 0; i < total; i++) {
|
|
73
|
+
const w = cachedWidths.value.get(i) ?? 0;
|
|
74
|
+
if (w > 0) {
|
|
75
|
+
fullSum += w;
|
|
76
|
+
positive += 1;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
fullSum += props.gap * Math.max(0, positive - 1);
|
|
80
|
+
const effectiveMoreWidth = moreWidth.value > 0 ? moreWidth.value : 32;
|
|
81
|
+
const reservedMore = effectiveMoreWidth + (positive > 0 ? props.gap : 0);
|
|
82
|
+
let nextHidden = null;
|
|
83
|
+
if (fullSum + reservedMore <= containerWidth.value + .5) {
|
|
84
|
+
if (hiddenIndexSet.value.size > 0) nextHidden = /* @__PURE__ */ new Set();
|
|
85
|
+
} else {
|
|
86
|
+
const newHidden = /* @__PURE__ */ new Set();
|
|
87
|
+
let used = effectiveMoreWidth;
|
|
88
|
+
let cutoff = -1;
|
|
89
|
+
for (let i = 0; i < total; i++) {
|
|
90
|
+
const w = cachedWidths.value.get(i) ?? 0;
|
|
91
|
+
if (w === 0) continue;
|
|
92
|
+
const need = props.gap + w;
|
|
93
|
+
if (used + need > containerWidth.value) {
|
|
94
|
+
cutoff = i;
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
used += need;
|
|
98
|
+
}
|
|
99
|
+
if (cutoff >= 0) for (let j = cutoff; j < total; j++) newHidden.add(j);
|
|
100
|
+
nextHidden = newHidden;
|
|
101
|
+
}
|
|
102
|
+
if (nextHidden) {
|
|
103
|
+
if (!(nextHidden.size === hiddenIndexSet.value.size && [...nextHidden].every((v) => hiddenIndexSet.value.has(v)))) hiddenIndexSet.value = nextHidden;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
let raf = 0;
|
|
107
|
+
const scheduleMeasure = () => {
|
|
108
|
+
if (raf) cancelAnimationFrame(raf);
|
|
109
|
+
raf = requestAnimationFrame(() => {
|
|
110
|
+
raf = 0;
|
|
111
|
+
measureAndCompute();
|
|
112
|
+
if (hasOverflow.value && moreWidth.value === 0) raf = requestAnimationFrame(() => {
|
|
113
|
+
raf = 0;
|
|
114
|
+
measureAndCompute();
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
watch(hasOverflow, (value) => {
|
|
119
|
+
if (!value) popoverVisible.value = false;
|
|
120
|
+
});
|
|
121
|
+
watch(() => props.items, () => {
|
|
122
|
+
cachedWidths.value = /* @__PURE__ */ new Map();
|
|
123
|
+
hiddenIndexSet.value = /* @__PURE__ */ new Set();
|
|
124
|
+
}, { deep: true });
|
|
125
|
+
watch(itemEls, () => {
|
|
126
|
+
cachedWidths.value = /* @__PURE__ */ new Map();
|
|
127
|
+
reobserveSlots();
|
|
128
|
+
scheduleMeasure();
|
|
129
|
+
});
|
|
130
|
+
watch(() => props.width, () => scheduleMeasure());
|
|
131
|
+
let ro;
|
|
132
|
+
onMounted(() => {
|
|
133
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
134
|
+
if (columnEl.value) {
|
|
135
|
+
ro = new ResizeObserver(() => scheduleMeasure());
|
|
136
|
+
ro.observe(columnEl.value);
|
|
137
|
+
}
|
|
138
|
+
slotsRO = new ResizeObserver(() => scheduleMeasure());
|
|
139
|
+
reobserveSlots();
|
|
140
|
+
}
|
|
141
|
+
scheduleMeasure();
|
|
142
|
+
});
|
|
143
|
+
onBeforeUnmount(() => {
|
|
144
|
+
if (raf) cancelAnimationFrame(raf);
|
|
145
|
+
ro?.disconnect();
|
|
146
|
+
slotsRO?.disconnect();
|
|
147
|
+
slotsRO = void 0;
|
|
148
|
+
observedEls.clear();
|
|
149
|
+
});
|
|
150
|
+
return (_ctx, _cache) => {
|
|
151
|
+
return openBlock(), createElementBlock("div", {
|
|
152
|
+
class: normalizeClass(`menu-${__props.columnKey} m-editor-nav-menu-column`),
|
|
153
|
+
style: normalizeStyle(__props.width != null ? `width: ${__props.width}px` : ""),
|
|
154
|
+
ref_key: "columnEl",
|
|
155
|
+
ref: columnEl
|
|
156
|
+
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item, index) => {
|
|
157
|
+
return openBlock(), createBlock(ToolButton_default, {
|
|
158
|
+
data: item,
|
|
159
|
+
key: `item-${index}`,
|
|
160
|
+
class: normalizeClass({ "m-editor-nav-menu-slot-hidden": hiddenIndexSet.value.has(index) }),
|
|
161
|
+
ref_for: true,
|
|
162
|
+
ref: (comp) => setItemRef(comp, index)
|
|
163
|
+
}, null, 8, ["data", "class"]);
|
|
164
|
+
}), 128)), createElementVNode("div", {
|
|
165
|
+
class: normalizeClass(["m-editor-nav-menu-more-wrapper", { "m-editor-nav-menu-more-wrapper-hidden": !hasOverflow.value }]),
|
|
166
|
+
ref_key: "moreWrapperEl",
|
|
167
|
+
ref: moreWrapperEl
|
|
168
|
+
}, [createVNode(unref(TMagicPopover), {
|
|
169
|
+
placement: "bottom-end",
|
|
170
|
+
"popper-class": "m-editor-nav-menu-popover",
|
|
171
|
+
width: __props.popoverWidth,
|
|
172
|
+
visible: popoverVisible.value
|
|
173
|
+
}, {
|
|
174
|
+
reference: withCtx(() => [createElementVNode("div", {
|
|
175
|
+
class: "menu-item button m-editor-nav-menu-more",
|
|
176
|
+
ref: "referenceEl",
|
|
177
|
+
onClick: togglePopover
|
|
178
|
+
}, [createVNode(unref(TMagicButton), {
|
|
179
|
+
size: "small",
|
|
180
|
+
text: "",
|
|
181
|
+
icon: popoverVisible.value ? unref(ArrowUp) : unref(ArrowDown),
|
|
182
|
+
bg: popoverVisible.value,
|
|
183
|
+
type: popoverVisible.value ? "primary" : ""
|
|
184
|
+
}, null, 8, [
|
|
185
|
+
"icon",
|
|
186
|
+
"bg",
|
|
187
|
+
"type"
|
|
188
|
+
])], 512)]),
|
|
189
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_1, [(openBlock(true), createElementBlock(Fragment, null, renderList(overflowItems.value, (item, index) => {
|
|
190
|
+
return openBlock(), createBlock(ToolButton_default, {
|
|
191
|
+
data: item,
|
|
192
|
+
key: `o-${index}`
|
|
193
|
+
}, null, 8, ["data"]);
|
|
194
|
+
}), 128))])]),
|
|
195
|
+
_: 1
|
|
196
|
+
}, 8, ["width", "visible"])], 2)], 6);
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
//#endregion
|
|
201
|
+
export { NavMenuColumn_vue_vue_type_script_setup_true_lang_default as default };
|
|
@@ -64,10 +64,10 @@ var WebStorage = class extends BaseService_default {
|
|
|
64
64
|
const { protocol = options.protocol, item } = this.getValueAndProtocol(storage.getItem(`${options.namespace || namespace}:${key}`));
|
|
65
65
|
if (item === null) return null;
|
|
66
66
|
switch (protocol) {
|
|
67
|
-
case
|
|
68
|
-
case
|
|
69
|
-
case
|
|
70
|
-
case
|
|
67
|
+
case "object": return getEditorConfig("parseDSL")(`(${item})`);
|
|
68
|
+
case "json": return JSON.parse(item);
|
|
69
|
+
case "number": return Number(item);
|
|
70
|
+
case "boolean":
|
|
71
71
|
if (item === "true") return true;
|
|
72
72
|
if (item === "false") return false;
|
|
73
73
|
default: return item;
|
|
@@ -95,7 +95,7 @@ var WebStorage = class extends BaseService_default {
|
|
|
95
95
|
const namespace = this.getNamespace();
|
|
96
96
|
let item = value;
|
|
97
97
|
const protocol = options.protocol ? `${options.protocol}:` : "";
|
|
98
|
-
if (typeof value ===
|
|
98
|
+
if (typeof value === "string" || typeof value === "number") item = `${protocol}${value}`;
|
|
99
99
|
else item = `${protocol}${serialize(value)}`;
|
|
100
100
|
storage.setItem(`${options.namespace || namespace}:${key}`, item);
|
|
101
101
|
}
|
package/dist/es/style.css
CHANGED
|
@@ -477,6 +477,10 @@ fieldset.m-fieldset .m-form-tip {
|
|
|
477
477
|
height: 100%;
|
|
478
478
|
z-index: 1;
|
|
479
479
|
align-items: center;
|
|
480
|
+
flex-wrap: nowrap;
|
|
481
|
+
overflow: hidden;
|
|
482
|
+
position: relative;
|
|
483
|
+
min-width: 0;
|
|
480
484
|
}
|
|
481
485
|
.m-editor-nav-menu .menu-center {
|
|
482
486
|
justify-content: center;
|
|
@@ -484,8 +488,29 @@ fieldset.m-fieldset .m-form-tip {
|
|
|
484
488
|
.m-editor-nav-menu .menu-right {
|
|
485
489
|
justify-content: flex-end;
|
|
486
490
|
}
|
|
491
|
+
.m-editor-nav-menu .m-editor-nav-menu-slot-hidden {
|
|
492
|
+
position: absolute;
|
|
493
|
+
left: -99999px;
|
|
494
|
+
top: 0;
|
|
495
|
+
visibility: hidden;
|
|
496
|
+
pointer-events: none;
|
|
497
|
+
}
|
|
498
|
+
.m-editor-nav-menu .m-editor-nav-menu-more-wrapper {
|
|
499
|
+
flex: 0 0 auto;
|
|
500
|
+
display: flex;
|
|
501
|
+
align-items: center;
|
|
502
|
+
height: 100%;
|
|
503
|
+
}
|
|
504
|
+
.m-editor-nav-menu .m-editor-nav-menu-more-wrapper.m-editor-nav-menu-more-wrapper-hidden {
|
|
505
|
+
visibility: hidden;
|
|
506
|
+
pointer-events: none;
|
|
507
|
+
}
|
|
508
|
+
.m-editor-nav-menu .m-editor-nav-menu-more {
|
|
509
|
+
flex: 0 0 auto;
|
|
510
|
+
}
|
|
487
511
|
.m-editor-nav-menu .menu-item {
|
|
488
512
|
flex-direction: row;
|
|
513
|
+
flex: 0 0 auto;
|
|
489
514
|
-webkit-box-align: center;
|
|
490
515
|
align-items: center;
|
|
491
516
|
vertical-align: middle;
|
|
@@ -499,6 +524,7 @@ fieldset.m-fieldset .m-form-tip {
|
|
|
499
524
|
transition: all 0.3s ease 0s;
|
|
500
525
|
border-bottom: 2px solid transparent;
|
|
501
526
|
margin: 0;
|
|
527
|
+
white-space: nowrap;
|
|
502
528
|
}
|
|
503
529
|
.m-editor-nav-menu .menu-item .is-disabled {
|
|
504
530
|
opacity: 0.5;
|
|
@@ -518,6 +544,7 @@ fieldset.m-fieldset .m-form-tip {
|
|
|
518
544
|
}
|
|
519
545
|
.m-editor-nav-menu .menu-item .menu-item-text {
|
|
520
546
|
color: #313a40;
|
|
547
|
+
white-space: nowrap;
|
|
521
548
|
}
|
|
522
549
|
.m-editor-nav-menu .menu-item.rule .el-icon {
|
|
523
550
|
transform: rotate(-90deg);
|
|
@@ -527,6 +554,30 @@ fieldset.m-fieldset .m-form-tip {
|
|
|
527
554
|
padding-right: 1px;
|
|
528
555
|
}
|
|
529
556
|
|
|
557
|
+
.m-editor-nav-menu-popover .m-editor-nav-menu-overflow-list {
|
|
558
|
+
display: flex;
|
|
559
|
+
flex-direction: column;
|
|
560
|
+
gap: 4px;
|
|
561
|
+
padding: 4px 0;
|
|
562
|
+
}
|
|
563
|
+
.m-editor-nav-menu-popover .m-editor-nav-menu-overflow-list .menu-item {
|
|
564
|
+
display: flex;
|
|
565
|
+
align-items: center;
|
|
566
|
+
padding: 4px 8px;
|
|
567
|
+
cursor: pointer;
|
|
568
|
+
border-radius: 4px;
|
|
569
|
+
}
|
|
570
|
+
.m-editor-nav-menu-popover .m-editor-nav-menu-overflow-list .menu-item:hover {
|
|
571
|
+
background-color: rgba(0, 0, 0, 0.05);
|
|
572
|
+
}
|
|
573
|
+
.m-editor-nav-menu-popover .m-editor-nav-menu-overflow-list .menu-item.divider {
|
|
574
|
+
padding: 0;
|
|
575
|
+
cursor: default;
|
|
576
|
+
}
|
|
577
|
+
.m-editor-nav-menu-popover .m-editor-nav-menu-overflow-list .menu-item.divider:hover {
|
|
578
|
+
background-color: transparent;
|
|
579
|
+
}
|
|
580
|
+
|
|
530
581
|
.m-editor {
|
|
531
582
|
display: flex;
|
|
532
583
|
flex-direction: column;
|
|
@@ -9,97 +9,97 @@ var keybinding_config_default = [
|
|
|
9
9
|
{
|
|
10
10
|
command: KeyBindingCommand.DELETE_NODE,
|
|
11
11
|
keybinding: ["delete", "backspace"],
|
|
12
|
-
when: [[
|
|
12
|
+
when: [["stage", "keyup"], ["layer-panel", "keydown"]]
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
command: KeyBindingCommand.COPY_NODE,
|
|
16
16
|
keybinding: "ctrl+c",
|
|
17
|
-
when: [[
|
|
17
|
+
when: [["stage", "keydown"], ["layer-panel", "keydown"]]
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
20
|
command: KeyBindingCommand.PASTE_NODE,
|
|
21
21
|
keybinding: "ctrl+v",
|
|
22
|
-
when: [[
|
|
22
|
+
when: [["stage", "keydown"], ["layer-panel", "keydown"]]
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
command: KeyBindingCommand.CUT_NODE,
|
|
26
26
|
keybinding: "ctrl+x",
|
|
27
|
-
when: [[
|
|
27
|
+
when: [["stage", "keydown"], ["layer-panel", "keydown"]]
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
command: KeyBindingCommand.UNDO,
|
|
31
31
|
keybinding: "ctrl+z",
|
|
32
|
-
when: [[
|
|
32
|
+
when: [["stage", "keydown"], ["layer-panel", "keydown"]]
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
command: KeyBindingCommand.REDO,
|
|
36
36
|
keybinding: "ctrl+shift+z",
|
|
37
|
-
when: [[
|
|
37
|
+
when: [["stage", "keydown"], ["layer-panel", "keydown"]]
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
40
|
command: KeyBindingCommand.MOVE_UP_1,
|
|
41
41
|
keybinding: "up",
|
|
42
|
-
when: [[
|
|
42
|
+
when: [["stage", "keydown"]]
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
command: KeyBindingCommand.MOVE_DOWN_1,
|
|
46
46
|
keybinding: "down",
|
|
47
|
-
when: [[
|
|
47
|
+
when: [["stage", "keydown"]]
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
50
|
command: KeyBindingCommand.MOVE_LEFT_1,
|
|
51
51
|
keybinding: "left",
|
|
52
|
-
when: [[
|
|
52
|
+
when: [["stage", "keydown"]]
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
command: KeyBindingCommand.MOVE_RIGHT_1,
|
|
56
56
|
keybinding: "right",
|
|
57
|
-
when: [[
|
|
57
|
+
when: [["stage", "keydown"]]
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
command: KeyBindingCommand.MOVE_UP_10,
|
|
61
61
|
keybinding: "ctrl+up",
|
|
62
|
-
when: [[
|
|
62
|
+
when: [["stage", "keydown"]]
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
65
|
command: KeyBindingCommand.MOVE_DOWN_10,
|
|
66
66
|
keybinding: "ctrl+down",
|
|
67
|
-
when: [[
|
|
67
|
+
when: [["stage", "keydown"]]
|
|
68
68
|
},
|
|
69
69
|
{
|
|
70
70
|
command: KeyBindingCommand.MOVE_LEFT_10,
|
|
71
71
|
keybinding: "ctrl+left",
|
|
72
|
-
when: [[
|
|
72
|
+
when: [["stage", "keydown"]]
|
|
73
73
|
},
|
|
74
74
|
{
|
|
75
75
|
command: KeyBindingCommand.MOVE_RIGHT_10,
|
|
76
76
|
keybinding: "ctrl+right",
|
|
77
|
-
when: [[
|
|
77
|
+
when: [["stage", "keydown"]]
|
|
78
78
|
},
|
|
79
79
|
{
|
|
80
80
|
command: KeyBindingCommand.SWITCH_NODE,
|
|
81
81
|
keybinding: "tab",
|
|
82
|
-
when: [[
|
|
82
|
+
when: [["stage", "keydown"], ["layer-panel", "keydown"]]
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
85
|
command: KeyBindingCommand.ZOOM_IN,
|
|
86
86
|
keybinding: ["ctrl+=", "ctrl+numpadplus"],
|
|
87
|
-
when: [[
|
|
87
|
+
when: [["stage", "keydown"]]
|
|
88
88
|
},
|
|
89
89
|
{
|
|
90
90
|
command: KeyBindingCommand.ZOOM_OUT,
|
|
91
91
|
keybinding: ["ctrl+-", "ctrl+numpad-"],
|
|
92
|
-
when: [[
|
|
92
|
+
when: [["stage", "keydown"]]
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
95
|
command: KeyBindingCommand.ZOOM_FIT,
|
|
96
96
|
keybinding: "ctrl+0",
|
|
97
|
-
when: [[
|
|
97
|
+
when: [["stage", "keydown"]]
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
100
|
command: KeyBindingCommand.ZOOM_RESET,
|
|
101
101
|
keybinding: "ctrl+1",
|
|
102
|
-
when: [[
|
|
102
|
+
when: [["stage", "keydown"]]
|
|
103
103
|
}
|
|
104
104
|
];
|
|
105
105
|
//#endregion
|
package/dist/style.css
CHANGED
|
@@ -477,6 +477,10 @@ fieldset.m-fieldset .m-form-tip {
|
|
|
477
477
|
height: 100%;
|
|
478
478
|
z-index: 1;
|
|
479
479
|
align-items: center;
|
|
480
|
+
flex-wrap: nowrap;
|
|
481
|
+
overflow: hidden;
|
|
482
|
+
position: relative;
|
|
483
|
+
min-width: 0;
|
|
480
484
|
}
|
|
481
485
|
.m-editor-nav-menu .menu-center {
|
|
482
486
|
justify-content: center;
|
|
@@ -484,8 +488,29 @@ fieldset.m-fieldset .m-form-tip {
|
|
|
484
488
|
.m-editor-nav-menu .menu-right {
|
|
485
489
|
justify-content: flex-end;
|
|
486
490
|
}
|
|
491
|
+
.m-editor-nav-menu .m-editor-nav-menu-slot-hidden {
|
|
492
|
+
position: absolute;
|
|
493
|
+
left: -99999px;
|
|
494
|
+
top: 0;
|
|
495
|
+
visibility: hidden;
|
|
496
|
+
pointer-events: none;
|
|
497
|
+
}
|
|
498
|
+
.m-editor-nav-menu .m-editor-nav-menu-more-wrapper {
|
|
499
|
+
flex: 0 0 auto;
|
|
500
|
+
display: flex;
|
|
501
|
+
align-items: center;
|
|
502
|
+
height: 100%;
|
|
503
|
+
}
|
|
504
|
+
.m-editor-nav-menu .m-editor-nav-menu-more-wrapper.m-editor-nav-menu-more-wrapper-hidden {
|
|
505
|
+
visibility: hidden;
|
|
506
|
+
pointer-events: none;
|
|
507
|
+
}
|
|
508
|
+
.m-editor-nav-menu .m-editor-nav-menu-more {
|
|
509
|
+
flex: 0 0 auto;
|
|
510
|
+
}
|
|
487
511
|
.m-editor-nav-menu .menu-item {
|
|
488
512
|
flex-direction: row;
|
|
513
|
+
flex: 0 0 auto;
|
|
489
514
|
-webkit-box-align: center;
|
|
490
515
|
align-items: center;
|
|
491
516
|
vertical-align: middle;
|
|
@@ -499,6 +524,7 @@ fieldset.m-fieldset .m-form-tip {
|
|
|
499
524
|
transition: all 0.3s ease 0s;
|
|
500
525
|
border-bottom: 2px solid transparent;
|
|
501
526
|
margin: 0;
|
|
527
|
+
white-space: nowrap;
|
|
502
528
|
}
|
|
503
529
|
.m-editor-nav-menu .menu-item .is-disabled {
|
|
504
530
|
opacity: 0.5;
|
|
@@ -518,6 +544,7 @@ fieldset.m-fieldset .m-form-tip {
|
|
|
518
544
|
}
|
|
519
545
|
.m-editor-nav-menu .menu-item .menu-item-text {
|
|
520
546
|
color: #313a40;
|
|
547
|
+
white-space: nowrap;
|
|
521
548
|
}
|
|
522
549
|
.m-editor-nav-menu .menu-item.rule .el-icon {
|
|
523
550
|
transform: rotate(-90deg);
|
|
@@ -527,6 +554,30 @@ fieldset.m-fieldset .m-form-tip {
|
|
|
527
554
|
padding-right: 1px;
|
|
528
555
|
}
|
|
529
556
|
|
|
557
|
+
.m-editor-nav-menu-popover .m-editor-nav-menu-overflow-list {
|
|
558
|
+
display: flex;
|
|
559
|
+
flex-direction: column;
|
|
560
|
+
gap: 4px;
|
|
561
|
+
padding: 4px 0;
|
|
562
|
+
}
|
|
563
|
+
.m-editor-nav-menu-popover .m-editor-nav-menu-overflow-list .menu-item {
|
|
564
|
+
display: flex;
|
|
565
|
+
align-items: center;
|
|
566
|
+
padding: 4px 8px;
|
|
567
|
+
cursor: pointer;
|
|
568
|
+
border-radius: 4px;
|
|
569
|
+
}
|
|
570
|
+
.m-editor-nav-menu-popover .m-editor-nav-menu-overflow-list .menu-item:hover {
|
|
571
|
+
background-color: rgba(0, 0, 0, 0.05);
|
|
572
|
+
}
|
|
573
|
+
.m-editor-nav-menu-popover .m-editor-nav-menu-overflow-list .menu-item.divider {
|
|
574
|
+
padding: 0;
|
|
575
|
+
cursor: default;
|
|
576
|
+
}
|
|
577
|
+
.m-editor-nav-menu-popover .m-editor-nav-menu-overflow-list .menu-item.divider:hover {
|
|
578
|
+
background-color: transparent;
|
|
579
|
+
}
|
|
580
|
+
|
|
530
581
|
.m-editor {
|
|
531
582
|
display: flex;
|
|
532
583
|
flex-direction: column;
|