@craftile/editor 1.2.0 → 1.2.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/dist/index.js +9 -25
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -344,17 +344,14 @@ class Jr {
|
|
|
344
344
|
const o = this.blocksManager.get(this.blockType);
|
|
345
345
|
if (this.presetData)
|
|
346
346
|
this.insertedBlock = {
|
|
347
|
+
...structuredClone(this.presetData),
|
|
347
348
|
type: this.blockType,
|
|
348
349
|
id: this.blockId,
|
|
349
350
|
name: this.presetData.name || o?.meta?.name || this.blockType,
|
|
350
351
|
semanticId: this.presetData.semanticId || this.presetData.id,
|
|
351
352
|
properties: this.properties,
|
|
352
353
|
children: [],
|
|
353
|
-
parentId: void 0
|
|
354
|
-
static: this.presetData.static,
|
|
355
|
-
disabled: this.presetData.disabled,
|
|
356
|
-
repeated: this.presetData.repeated,
|
|
357
|
-
ghost: this.presetData.ghost
|
|
354
|
+
parentId: void 0
|
|
358
355
|
}, this.page.blocks[this.blockId] = this.insertedBlock, this.createdBlockIds.push(this.blockId), this.presetData.children && this.presetData.children.length > 0 && (this.insertedBlock.children = this.createChildrenFromPreset(this.presetData.children, this.blockId));
|
|
359
356
|
else if (this.presetIndex !== void 0) {
|
|
360
357
|
const n = o?.presets?.[this.presetIndex];
|
|
@@ -413,17 +410,14 @@ class Jr {
|
|
|
413
410
|
continue;
|
|
414
411
|
}
|
|
415
412
|
const c = this.buildProperties(i, r.properties), l = {
|
|
413
|
+
...structuredClone(r),
|
|
416
414
|
type: r.type,
|
|
417
415
|
id: s,
|
|
418
416
|
name: r.name || i.meta?.name || r.type,
|
|
419
417
|
semanticId: r.semanticId || r.id,
|
|
420
418
|
properties: c,
|
|
421
419
|
children: [],
|
|
422
|
-
parentId: o
|
|
423
|
-
static: r.static,
|
|
424
|
-
disabled: r.disabled,
|
|
425
|
-
repeated: r.repeated,
|
|
426
|
-
ghost: r.ghost
|
|
420
|
+
parentId: o
|
|
427
421
|
};
|
|
428
422
|
this.page.blocks[s] = l, this.createdBlockIds.push(s), r.children && r.children.length > 0 && (l.children = this.createChildrenFromPreset(r.children, s)), n.push(s);
|
|
429
423
|
}
|
|
@@ -897,17 +891,14 @@ class sl {
|
|
|
897
891
|
if (!r)
|
|
898
892
|
throw new Error(`Block type '${t.type}' is not registered`);
|
|
899
893
|
const s = lo(), i = {
|
|
894
|
+
...structuredClone(t),
|
|
900
895
|
type: t.type,
|
|
901
896
|
id: s,
|
|
902
897
|
name: t.name || r.meta?.name || t.type,
|
|
903
898
|
semanticId: t.semanticId || t.id,
|
|
904
899
|
properties: this.buildProperties(r, t.properties),
|
|
905
900
|
children: [],
|
|
906
|
-
parentId: o
|
|
907
|
-
static: t.static,
|
|
908
|
-
disabled: t.disabled,
|
|
909
|
-
repeated: t.repeated,
|
|
910
|
-
ghost: t.ghost
|
|
901
|
+
parentId: o
|
|
911
902
|
};
|
|
912
903
|
return n[s] = i, i.children = (t.children ?? []).map((c) => this.createBlockFromStructure(c, s, n)), s;
|
|
913
904
|
}
|
|
@@ -1125,18 +1116,11 @@ class lr extends ti {
|
|
|
1125
1116
|
const o = this.page.blocks[t];
|
|
1126
1117
|
if (!o)
|
|
1127
1118
|
throw new Error(`Block not found: ${t}`);
|
|
1128
|
-
const n = {
|
|
1129
|
-
|
|
1130
|
-
id: o.id,
|
|
1131
|
-
semanticId: o.semanticId,
|
|
1132
|
-
properties: structuredClone(o.properties),
|
|
1133
|
-
name: o.name,
|
|
1134
|
-
static: o.static,
|
|
1135
|
-
disabled: o.disabled,
|
|
1136
|
-
repeated: o.repeated,
|
|
1119
|
+
const { parentId: n, children: r, ...s } = structuredClone(o), i = {
|
|
1120
|
+
...s,
|
|
1137
1121
|
children: []
|
|
1138
1122
|
};
|
|
1139
|
-
return o.children && o.children.length > 0 && (
|
|
1123
|
+
return o.children && o.children.length > 0 && (i.children = o.children.map((c) => this.exportBlockAsNestedStructure(c))), i;
|
|
1140
1124
|
}
|
|
1141
1125
|
/**
|
|
1142
1126
|
* Paste a block from a nested structure
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@craftile/editor",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Vue.js-based editor UI components for craftile blocks engine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"craftile",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"vue": "^3.5.17",
|
|
40
40
|
"vue-draggable-plus": "^0.6.0",
|
|
41
|
-
"@craftile/core": "1.2.
|
|
42
|
-
"@craftile/event-bus": "1.2.
|
|
43
|
-
"@craftile/messenger": "1.2.
|
|
44
|
-
"@craftile/types": "1.2.
|
|
41
|
+
"@craftile/core": "1.2.1",
|
|
42
|
+
"@craftile/event-bus": "1.2.1",
|
|
43
|
+
"@craftile/messenger": "1.2.1",
|
|
44
|
+
"@craftile/types": "1.2.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@ark-ui/vue": "^5.24.1",
|