@tmagic/editor 1.1.0 → 1.1.1
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/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.1.
|
|
2
|
+
"version": "1.1.1",
|
|
3
3
|
"name": "@tmagic/editor",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"dist/*",
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@babel/core": "^7.18.0",
|
|
47
47
|
"@element-plus/icons-vue": "^2.0.9",
|
|
48
|
-
"@tmagic/core": "1.1.
|
|
49
|
-
"@tmagic/form": "1.1.
|
|
50
|
-
"@tmagic/schema": "1.1.
|
|
51
|
-
"@tmagic/stage": "1.1.
|
|
52
|
-
"@tmagic/utils": "1.1.
|
|
48
|
+
"@tmagic/core": "1.1.1",
|
|
49
|
+
"@tmagic/form": "1.1.1",
|
|
50
|
+
"@tmagic/schema": "1.1.1",
|
|
51
|
+
"@tmagic/stage": "1.1.1",
|
|
52
|
+
"@tmagic/utils": "1.1.1",
|
|
53
53
|
"buffer": "^6.0.3",
|
|
54
54
|
"color": "^3.1.3",
|
|
55
55
|
"element-plus": "^2.2.6",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"vue": "^3.2.37"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"@tmagic/form": "1.1.
|
|
65
|
+
"@tmagic/form": "1.1.1",
|
|
66
66
|
"element-plus": "^2.2.6",
|
|
67
67
|
"monaco-editor": "^0.34.0",
|
|
68
68
|
"vue": "^3.2.37"
|
package/src/Editor.vue
CHANGED
|
@@ -193,9 +193,15 @@ export default defineComponent({
|
|
|
193
193
|
emits: ['props-panel-mounted', 'update:modelValue'],
|
|
194
194
|
|
|
195
195
|
setup(props, { emit }) {
|
|
196
|
-
editorService.on('root-change', () => {
|
|
197
|
-
const node = editorService.get<MNode | null>('node')
|
|
198
|
-
node
|
|
196
|
+
editorService.on('root-change', (value) => {
|
|
197
|
+
const node = editorService.get<MNode | null>('node');
|
|
198
|
+
const nodeId = node?.id || props.defaultSelected;
|
|
199
|
+
if (nodeId && node !== value) {
|
|
200
|
+
editorService.select(nodeId);
|
|
201
|
+
} else {
|
|
202
|
+
editorService.set('nodes', [value]);
|
|
203
|
+
}
|
|
204
|
+
|
|
199
205
|
emit('update:modelValue', toRaw(editorService.get('root')));
|
|
200
206
|
});
|
|
201
207
|
|
package/src/services/editor.ts
CHANGED
|
@@ -400,7 +400,7 @@ class Editor extends BaseService {
|
|
|
400
400
|
await this.select(root.items[0]);
|
|
401
401
|
stage?.select(root.items[0].id);
|
|
402
402
|
} else {
|
|
403
|
-
this.set('
|
|
403
|
+
this.set('nodes', [root]);
|
|
404
404
|
this.set('parent', null);
|
|
405
405
|
this.set('page', null);
|
|
406
406
|
this.set('stage', null);
|