@tmagic/editor 1.0.0-beta.5 → 1.0.0-beta.8
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/LICENSE +5432 -0
- package/dist/style.css +10 -0
- package/dist/tmagic-editor.es.js +9 -3
- package/dist/tmagic-editor.es.js.map +1 -1
- package/dist/tmagic-editor.umd.js +9 -3
- package/dist/tmagic-editor.umd.js.map +1 -1
- package/package.json +9 -8
- package/src/layouts/PropsPanel.vue +1 -0
- package/src/services/editor.ts +7 -1
- package/src/theme/props-panel.scss +14 -0
- package/src/utils/scroll-viewer.ts +5 -3
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.0.0-beta.
|
|
2
|
+
"version": "1.0.0-beta.8",
|
|
3
3
|
"name": "@tmagic/editor",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"main": "dist/tmagic-editor.umd.js",
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@element-plus/icons": "0.0.11",
|
|
31
|
-
"@tmagic/core": "^1.0.0-beta.
|
|
32
|
-
"@tmagic/form": "^1.0.0-beta.
|
|
33
|
-
"@tmagic/schema": "^1.0.0-beta.
|
|
34
|
-
"@tmagic/stage": "^1.0.0-beta.
|
|
35
|
-
"@tmagic/utils": "^1.0.0-beta.
|
|
31
|
+
"@tmagic/core": "^1.0.0-beta.8",
|
|
32
|
+
"@tmagic/form": "^1.0.0-beta.8",
|
|
33
|
+
"@tmagic/schema": "^1.0.0-beta.8",
|
|
34
|
+
"@tmagic/stage": "^1.0.0-beta.8",
|
|
35
|
+
"@tmagic/utils": "^1.0.0-beta.8",
|
|
36
36
|
"color": "^3.1.3",
|
|
37
|
-
"element-plus": "^2.
|
|
37
|
+
"element-plus": "^2.1.7",
|
|
38
38
|
"events": "^3.3.0",
|
|
39
39
|
"lodash-es": "^4.17.21",
|
|
40
40
|
"monaco-editor": "^0.32.1",
|
|
@@ -55,5 +55,6 @@
|
|
|
55
55
|
"vite": "^2.3.7",
|
|
56
56
|
"vite-plugin-dts": "^0.9.6",
|
|
57
57
|
"vue-tsc": "^0.0.24"
|
|
58
|
-
}
|
|
58
|
+
},
|
|
59
|
+
"gitHead": "ff8e32901775ecc145a82f906d6af6119652d61e"
|
|
59
60
|
}
|
package/src/services/editor.ts
CHANGED
|
@@ -184,6 +184,10 @@ class Editor extends BaseService {
|
|
|
184
184
|
const { node, parent, page } = this.getNodeInfo(id);
|
|
185
185
|
if (!node) throw new Error('获取不到组件信息');
|
|
186
186
|
|
|
187
|
+
if (node.id === this.state.root?.id) {
|
|
188
|
+
throw new Error('不能选根节点');
|
|
189
|
+
}
|
|
190
|
+
|
|
187
191
|
this.set('node', node);
|
|
188
192
|
this.set('page', page || null);
|
|
189
193
|
this.set('parent', parent || null);
|
|
@@ -291,7 +295,7 @@ class Editor extends BaseService {
|
|
|
291
295
|
|
|
292
296
|
let newConfig = await this.toggleFixedPosition(toRaw(config), node, this.get<MApp>('root'));
|
|
293
297
|
|
|
294
|
-
newConfig = mergeWith(node, newConfig, (objValue, srcValue) => {
|
|
298
|
+
newConfig = mergeWith(cloneDeep(node), newConfig, (objValue, srcValue) => {
|
|
295
299
|
if (Array.isArray(srcValue)) {
|
|
296
300
|
return srcValue;
|
|
297
301
|
}
|
|
@@ -355,6 +359,8 @@ class Editor extends BaseService {
|
|
|
355
359
|
await this.update(parent);
|
|
356
360
|
await this.select(node);
|
|
357
361
|
|
|
362
|
+
this.get<StageCore>('stage')?.update({ config: cloneDeep(node), root: this.get('root') });
|
|
363
|
+
|
|
358
364
|
this.addModifiedNodeId(parent.id);
|
|
359
365
|
this.pushHistoryState();
|
|
360
366
|
}
|
|
@@ -155,11 +155,13 @@ export class ScrollViewer {
|
|
|
155
155
|
event.preventDefault();
|
|
156
156
|
event.stopImmediatePropagation();
|
|
157
157
|
event.stopPropagation();
|
|
158
|
-
}
|
|
158
|
+
}
|
|
159
159
|
|
|
160
|
-
this.keydown
|
|
160
|
+
if (event.code !== Keys.ESCAPE || !this.enter || this.keydown) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
161
163
|
|
|
162
|
-
|
|
164
|
+
this.keydown = true;
|
|
163
165
|
|
|
164
166
|
this.target.style.cursor = 'grab';
|
|
165
167
|
this.container.addEventListener('mousedown', this.mousedownHandler);
|