@blokkli/editor 2.0.0-alpha.10 → 2.0.0-alpha.11
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/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import { BK_VISIBLE_LANGUAGES, BK_HIDDEN_GLOBALLY } from '../dist/runtime/helper
|
|
|
13
13
|
import fs from 'node:fs';
|
|
14
14
|
import { defu, createDefu } from 'defu';
|
|
15
15
|
|
|
16
|
-
const version = "2.0.0-alpha.
|
|
16
|
+
const version = "2.0.0-alpha.11";
|
|
17
17
|
|
|
18
18
|
function sortObjectKeys(obj) {
|
|
19
19
|
if (Array.isArray(obj)) {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
INJECT_EDIT_CONTEXT,
|
|
3
|
+
INJECT_MUTATED_FIELDS_MAP,
|
|
3
4
|
INJECT_PROVIDER_BLOCKS
|
|
4
5
|
} from "#blokkli/helpers/symbols";
|
|
5
6
|
import { inject, computed, watch, ref } from "#imports";
|
|
6
7
|
import { FIELD_MAPPING } from "#blokkli-build/runtime-options";
|
|
7
8
|
import { getActualBlock } from "#blokkli/helpers/runtimeHelpers";
|
|
8
|
-
function walkBlocks(matches, callback, mutatedOptions, list) {
|
|
9
|
+
function walkBlocks(matches, callback, mutatedOptions, mutatedFieldsMap, list) {
|
|
9
10
|
if (!list) return;
|
|
10
11
|
for (let i = 0; i < list.length; i++) {
|
|
11
12
|
const item = list[i];
|
|
@@ -31,10 +32,18 @@ function walkBlocks(matches, callback, mutatedOptions, list) {
|
|
|
31
32
|
if (!mappedItem.props) continue;
|
|
32
33
|
const propNames = Object.keys(nestedFieldMapping);
|
|
33
34
|
for (const propName of propNames) {
|
|
34
|
-
const
|
|
35
|
+
const fieldName = nestedFieldMapping[propName];
|
|
36
|
+
const key = mappedItem.uuid + ":" + fieldName;
|
|
37
|
+
const value = mutatedFieldsMap ? mutatedFieldsMap[key]?.list : mappedItem.props?.[propName];
|
|
35
38
|
if (!value) continue;
|
|
36
39
|
const valueAsArray = Array.isArray(value) ? value : [value];
|
|
37
|
-
walkBlocks(
|
|
40
|
+
walkBlocks(
|
|
41
|
+
matches,
|
|
42
|
+
callback,
|
|
43
|
+
mutatedOptions,
|
|
44
|
+
mutatedFieldsMap,
|
|
45
|
+
valueAsArray
|
|
46
|
+
);
|
|
38
47
|
}
|
|
39
48
|
}
|
|
40
49
|
}
|
|
@@ -45,6 +54,10 @@ export function useBlokkliHelper() {
|
|
|
45
54
|
);
|
|
46
55
|
const editContext = inject(INJECT_EDIT_CONTEXT, null);
|
|
47
56
|
const mutatedOptions = ref({});
|
|
57
|
+
const mutatedFields = inject(
|
|
58
|
+
INJECT_MUTATED_FIELDS_MAP,
|
|
59
|
+
null
|
|
60
|
+
);
|
|
48
61
|
if (editContext?.mutatedOptions) {
|
|
49
62
|
watch(editContext.mutatedOptions, (options) => {
|
|
50
63
|
mutatedOptions.value = options;
|
|
@@ -72,7 +85,7 @@ export function useBlokkliHelper() {
|
|
|
72
85
|
);
|
|
73
86
|
return [];
|
|
74
87
|
}
|
|
75
|
-
walkBlocks(matches, callback, mutatedOptions.value, list);
|
|
88
|
+
walkBlocks(matches, callback, mutatedOptions.value, mutatedFields, list);
|
|
76
89
|
return matches;
|
|
77
90
|
});
|
|
78
91
|
}
|