@blokkli/editor 2.0.0-alpha.44 → 2.0.0-alpha.45
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 +1 -1
- package/dist/module.mjs +1 -1
- package/dist/modules/drupal/graphql/mutations/add_file.graphql +2 -0
- package/dist/modules/drupal/graphql/mutations/add_image.graphql +2 -0
- package/dist/modules/drupal/graphql/mutations/add_video_remote.graphql +2 -0
- package/dist/modules/drupal/runtime/adapter/index.js +6 -3
- package/dist/runtime/editor/features/clipboard/index.vue +4 -27
- package/dist/runtime/editor/features/clipboard/types.d.ts +6 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -8,6 +8,7 @@ mutation pbAddFile(
|
|
|
8
8
|
$hostUuid: String!
|
|
9
9
|
$hostFieldName: String!
|
|
10
10
|
$afterUuid: String
|
|
11
|
+
$paragraphBundle: String!
|
|
11
12
|
) {
|
|
12
13
|
state: paragraphsEditMutationState(
|
|
13
14
|
entityType: $entityType
|
|
@@ -20,6 +21,7 @@ mutation pbAddFile(
|
|
|
20
21
|
hostType: $hostType
|
|
21
22
|
hostUuid: $hostUuid
|
|
22
23
|
hostFieldName: $hostFieldName
|
|
24
|
+
paragraphBundle: $paragraphBundle
|
|
23
25
|
) {
|
|
24
26
|
...paragraphsBlokkliMutationResult
|
|
25
27
|
}
|
|
@@ -8,6 +8,7 @@ mutation pbAddImage(
|
|
|
8
8
|
$hostUuid: String!
|
|
9
9
|
$hostFieldName: String!
|
|
10
10
|
$afterUuid: String
|
|
11
|
+
$paragraphBundle: String!
|
|
11
12
|
) {
|
|
12
13
|
state: paragraphsEditMutationState(
|
|
13
14
|
entityType: $entityType
|
|
@@ -20,6 +21,7 @@ mutation pbAddImage(
|
|
|
20
21
|
hostType: $hostType
|
|
21
22
|
hostUuid: $hostUuid
|
|
22
23
|
hostFieldName: $hostFieldName
|
|
24
|
+
paragraphBundle: $paragraphBundle
|
|
23
25
|
) {
|
|
24
26
|
...paragraphsBlokkliMutationResult
|
|
25
27
|
}
|
|
@@ -7,6 +7,7 @@ mutation pbAddVideoRemote(
|
|
|
7
7
|
$hostUuid: String!
|
|
8
8
|
$hostFieldName: String!
|
|
9
9
|
$afterUuid: String
|
|
10
|
+
$paragraphBundle: String!
|
|
10
11
|
) {
|
|
11
12
|
state: paragraphsEditMutationState(
|
|
12
13
|
entityType: $entityType
|
|
@@ -18,6 +19,7 @@ mutation pbAddVideoRemote(
|
|
|
18
19
|
hostType: $hostType
|
|
19
20
|
hostUuid: $hostUuid
|
|
20
21
|
hostFieldName: $hostFieldName
|
|
22
|
+
paragraphBundle: $paragraphBundle
|
|
21
23
|
) {
|
|
22
24
|
...paragraphsBlokkliMutationResult
|
|
23
25
|
}
|
|
@@ -887,7 +887,8 @@ export default defineBlokkliEditAdapter(
|
|
|
887
887
|
hostType: e.host.type,
|
|
888
888
|
hostUuid: e.host.uuid,
|
|
889
889
|
hostFieldName: e.host.fieldName,
|
|
890
|
-
afterUuid: e.afterUuid
|
|
890
|
+
afterUuid: e.afterUuid,
|
|
891
|
+
paragraphBundle: e.blockBundle
|
|
891
892
|
}).then(mapMutation);
|
|
892
893
|
} else if (e.item.type === "file" && hasMutation("pbAddFile")) {
|
|
893
894
|
return useGraphqlMutation("pbAddFile", {
|
|
@@ -897,7 +898,8 @@ export default defineBlokkliEditAdapter(
|
|
|
897
898
|
hostType: e.host.type,
|
|
898
899
|
hostUuid: e.host.uuid,
|
|
899
900
|
hostFieldName: e.host.fieldName,
|
|
900
|
-
afterUuid: e.afterUuid
|
|
901
|
+
afterUuid: e.afterUuid,
|
|
902
|
+
paragraphBundle: e.blockBundle
|
|
901
903
|
}).then(mapMutation);
|
|
902
904
|
} else if (e.item.type === "video" && hasMutation("pbAddVideoRemote")) {
|
|
903
905
|
return useGraphqlMutation("pbAddVideoRemote", {
|
|
@@ -906,7 +908,8 @@ export default defineBlokkliEditAdapter(
|
|
|
906
908
|
hostType: e.host.type,
|
|
907
909
|
hostUuid: e.host.uuid,
|
|
908
910
|
hostFieldName: e.host.fieldName,
|
|
909
|
-
afterUuid: e.afterUuid
|
|
911
|
+
afterUuid: e.afterUuid,
|
|
912
|
+
paragraphBundle: e.blockBundle
|
|
910
913
|
}).then(mapMutation);
|
|
911
914
|
}
|
|
912
915
|
};
|
|
@@ -574,12 +574,12 @@ defineDropHandler("native_drop", {
|
|
|
574
574
|
}
|
|
575
575
|
const dt = item.dataTransfer;
|
|
576
576
|
if (dt.files.length > 0) {
|
|
577
|
+
item.files = [...dt.files];
|
|
577
578
|
if (!adapter.clipboardMapBundle) {
|
|
578
579
|
return field.allowedBundles.filter((b) => item.itemBundles.includes(b));
|
|
579
580
|
}
|
|
580
|
-
const files = [...dt.files];
|
|
581
581
|
let possibleBundles = null;
|
|
582
|
-
for (const file of files) {
|
|
582
|
+
for (const file of item.files) {
|
|
583
583
|
const type = file.type.startsWith("image/") ? "image" : "file";
|
|
584
584
|
const mapped = normalizeBundles(
|
|
585
585
|
adapter.clipboardMapBundle({
|
|
@@ -691,12 +691,8 @@ defineDropHandler("native_drop", {
|
|
|
691
691
|
});
|
|
692
692
|
return;
|
|
693
693
|
}
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
}
|
|
697
|
-
const dt = item.dataTransfer;
|
|
698
|
-
if (dt.files.length > 0) {
|
|
699
|
-
const files = [...dt.files];
|
|
694
|
+
const files = item.files;
|
|
695
|
+
if (files?.length) {
|
|
700
696
|
if (adapter.clipboardMapBundle) {
|
|
701
697
|
for (const file of files) {
|
|
702
698
|
const type = file.type.startsWith("image/") ? "image" : "file";
|
|
@@ -742,25 +738,6 @@ defineDropHandler("native_drop", {
|
|
|
742
738
|
}
|
|
743
739
|
return lastResult;
|
|
744
740
|
});
|
|
745
|
-
} else {
|
|
746
|
-
const text = dt.getData("text/html") || dt.getData("text/plain") || dt.getData("text");
|
|
747
|
-
if (!text) {
|
|
748
|
-
return;
|
|
749
|
-
}
|
|
750
|
-
const clipboardItem = {
|
|
751
|
-
type: "text",
|
|
752
|
-
id: generateUUID(),
|
|
753
|
-
itemBundle: bundle,
|
|
754
|
-
data: text
|
|
755
|
-
};
|
|
756
|
-
await state.mutateWithLoadingState(
|
|
757
|
-
() => adapter.addBlockFromClipboardItem({
|
|
758
|
-
item: clipboardItem,
|
|
759
|
-
blockBundle: bundle,
|
|
760
|
-
host,
|
|
761
|
-
afterUuid
|
|
762
|
-
})
|
|
763
|
-
);
|
|
764
741
|
}
|
|
765
742
|
}
|
|
766
743
|
});
|
|
@@ -85,6 +85,12 @@ export interface DraggableNativeDropItem {
|
|
|
85
85
|
itemBundles: string[];
|
|
86
86
|
dataTransfer: DataTransfer | null;
|
|
87
87
|
clipboardItems?: BlokkliClipboardItem[];
|
|
88
|
+
/**
|
|
89
|
+
* Eagerly extracted from DataTransfer in resolveBundles, because the
|
|
90
|
+
* DataTransfer object becomes stale after the synchronous event handler
|
|
91
|
+
* returns (e.g. while the bundle selector is shown).
|
|
92
|
+
*/
|
|
93
|
+
files?: File[];
|
|
88
94
|
}
|
|
89
95
|
declare module '#blokkli/editor/adapter' {
|
|
90
96
|
interface BlokkliAdapter<T> {
|