@blokkli/editor 2.0.0-alpha.10 → 2.0.0-alpha.12
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.12";
|
|
17
17
|
|
|
18
18
|
function sortObjectKeys(obj) {
|
|
19
19
|
if (Array.isArray(obj)) {
|
|
@@ -664,7 +664,7 @@ export default defineBlokkliEditAdapter(
|
|
|
664
664
|
}).then(mapMutation);
|
|
665
665
|
};
|
|
666
666
|
}
|
|
667
|
-
if (availableFeatureIds.has("
|
|
667
|
+
if (availableFeatureIds.has("clipboard")) {
|
|
668
668
|
adapter.clipboardMapBundle = (e) => {
|
|
669
669
|
if (e.type === "video") {
|
|
670
670
|
return config.clipboard.find((v) => {
|
|
@@ -291,27 +291,26 @@ function onPaste(e, fromInput) {
|
|
|
291
291
|
return;
|
|
292
292
|
}
|
|
293
293
|
const clipboardData = e.clipboardData;
|
|
294
|
-
if (clipboardData
|
|
295
|
-
return handleFiles(clipboardData);
|
|
296
|
-
}
|
|
297
|
-
let pastedData = clipboardData?.getData("text/html");
|
|
298
|
-
if (!pastedData) {
|
|
299
|
-
pastedData = clipboardData?.getData("text");
|
|
300
|
-
}
|
|
301
|
-
if (!pastedData) {
|
|
294
|
+
if (!clipboardData) {
|
|
302
295
|
return;
|
|
303
296
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
const
|
|
309
|
-
|
|
297
|
+
const pastedData = clipboardData.getData("text/html") || clipboardData.getData("text/plain") || clipboardData.getData("text");
|
|
298
|
+
if (pastedData) {
|
|
299
|
+
if (pastedData.startsWith("{")) {
|
|
300
|
+
try {
|
|
301
|
+
const data = JSON.parse(pastedData);
|
|
302
|
+
if (typeof data === "object" && data.type && data.type === "selection") {
|
|
303
|
+
const uuids = data.uuids;
|
|
304
|
+
return handleSelectionPaste(uuids);
|
|
305
|
+
}
|
|
306
|
+
} catch (_e) {
|
|
310
307
|
}
|
|
311
|
-
} catch (_e) {
|
|
312
308
|
}
|
|
309
|
+
handlePastedText(pastedData);
|
|
310
|
+
}
|
|
311
|
+
if (clipboardData.files.length) {
|
|
312
|
+
return handleFiles(clipboardData);
|
|
313
313
|
}
|
|
314
|
-
handlePastedText(pastedData);
|
|
315
314
|
}
|
|
316
315
|
const handlePastedText = (text) => {
|
|
317
316
|
if (!adapter.clipboardMapBundle) {
|
|
@@ -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
|
}
|