@blokkli/editor 2.0.0-alpha.2 → 2.0.0-alpha.4
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/base/fragment.blokkliProps.graphql +8 -0
- package/dist/modules/drupal/graphql/base/fragment.paragraphsFieldItem.graphql +6 -0
- package/dist/modules/drupal/index.mjs +10 -3
- package/dist/modules/drupal/runtime/adapter/index.d.ts +3 -0
- package/dist/modules/drupal/{adapter/index.mjs → runtime/adapter/index.js} +13 -10
- package/dist/runtime/components/Edit/Features/Publish/index.vue +20 -2
- package/package.json +1 -1
- package/dist/modules/drupal/adapter/index.d.mts +0 -6
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.4";
|
|
17
17
|
|
|
18
18
|
function sortObjectKeys(obj) {
|
|
19
19
|
if (Array.isArray(obj)) {
|
|
@@ -33,7 +33,7 @@ const index = defineBlokkliModule({
|
|
|
33
33
|
const resolver = createResolver(
|
|
34
34
|
fileURLToPath(new URL("./", import.meta.url))
|
|
35
35
|
);
|
|
36
|
-
const filePath = resolver.resolve("./adapter/index.
|
|
36
|
+
const filePath = resolver.resolve("./runtime/adapter/index.js");
|
|
37
37
|
options.editAdapterPath = filePath;
|
|
38
38
|
}
|
|
39
39
|
if (!options.getBundlePropsType) {
|
|
@@ -53,6 +53,11 @@ const index = defineBlokkliModule({
|
|
|
53
53
|
throw new Error("Failed to initialise bl\xF6kkli Drupal module.");
|
|
54
54
|
}
|
|
55
55
|
const graphql = useGraphqlModuleContext();
|
|
56
|
+
const blokkliModuleResolver = createResolver(
|
|
57
|
+
fileURLToPath(new URL("./", import.meta.url))
|
|
58
|
+
);
|
|
59
|
+
const filePath = blokkliModuleResolver.resolve("./runtime");
|
|
60
|
+
context.helper.addAlias("#blokkli/drupal", filePath);
|
|
56
61
|
function getTypeFields(typeName) {
|
|
57
62
|
const type = graphql.schemaGetType(typeName);
|
|
58
63
|
if (isObjectType(type) || isInterfaceType(type)) {
|
|
@@ -68,8 +73,8 @@ const index = defineBlokkliModule({
|
|
|
68
73
|
join(fileURLToPath(new URL("./", import.meta.url)), "graphql")
|
|
69
74
|
);
|
|
70
75
|
function addGraphqlDocument(fileName) {
|
|
71
|
-
const
|
|
72
|
-
graphql.addImportFile(
|
|
76
|
+
const filePath2 = resolver.resolve(fileName);
|
|
77
|
+
graphql.addImportFile(filePath2);
|
|
73
78
|
}
|
|
74
79
|
function addMutation(mutationName, feature) {
|
|
75
80
|
if (editMutationStateFields.has(mutationName)) {
|
|
@@ -84,6 +89,8 @@ const index = defineBlokkliModule({
|
|
|
84
89
|
"fragment.paragraphsBlokkliMutationItem.graphql",
|
|
85
90
|
"fragment.paragraphsBlokkliMutationResult.graphql",
|
|
86
91
|
"fragment.paragraphsBlokkliViolation.graphql",
|
|
92
|
+
"fragment.blokkliProps.graphql",
|
|
93
|
+
"fragment.paragraphsFieldItem.graphql",
|
|
87
94
|
"query.pbConfig.graphql",
|
|
88
95
|
"query.pbEditState.graphql"
|
|
89
96
|
];
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import { defineBlokkliEditAdapter } from
|
|
2
|
-
import { falsy } from
|
|
3
|
-
import { availableFeaturesAtBuild } from
|
|
4
|
-
import { operationSources } from
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { defineBlokkliEditAdapter } from "#blokkli/adapter";
|
|
2
|
+
import { falsy } from "#blokkli/helpers";
|
|
3
|
+
import { availableFeaturesAtBuild } from "#blokkli-build/features";
|
|
4
|
+
import { operationSources } from "#nuxt-graphql-middleware/sources";
|
|
5
|
+
import {
|
|
6
|
+
useGraphqlQuery,
|
|
7
|
+
useGraphqlMutation,
|
|
8
|
+
computed,
|
|
9
|
+
useRoute,
|
|
10
|
+
useRouter
|
|
11
|
+
} from "#imports";
|
|
12
|
+
import { ParagraphsBlokkliRemoteVideoProvider } from "#graphql-operations";
|
|
13
|
+
export default defineBlokkliEditAdapter(
|
|
9
14
|
async (providedContext) => {
|
|
10
15
|
const availableFeatureIds = new Set(availableFeaturesAtBuild);
|
|
11
16
|
const availableGraphqlOperations = new Set(Object.keys(operationSources));
|
|
@@ -758,5 +763,3 @@ const index = defineBlokkliEditAdapter(
|
|
|
758
763
|
return adapter;
|
|
759
764
|
}
|
|
760
765
|
);
|
|
761
|
-
|
|
762
|
-
export { index as default };
|
|
@@ -50,8 +50,8 @@ const { adapter, settings } = defineBlokkliFeature({
|
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
const route = useRoute();
|
|
53
|
-
const { state, $t, broadcast, context } = useBlokkli();
|
|
54
|
-
const { mutations, canEdit } = state;
|
|
53
|
+
const { state, $t, broadcast, context, eventBus } = useBlokkli();
|
|
54
|
+
const { mutations, canEdit, mutateWithLoadingState } = state;
|
|
55
55
|
const hasPublishOptions = !!adapter.getPublishOptions;
|
|
56
56
|
const isPublished = computed(() => !!state.entity.value.status);
|
|
57
57
|
const showDialog = ref(false);
|
|
@@ -82,6 +82,24 @@ const onMenuClick = async () => {
|
|
|
82
82
|
await publishCurrent();
|
|
83
83
|
};
|
|
84
84
|
async function publishCurrent() {
|
|
85
|
+
const success = await mutateWithLoadingState(
|
|
86
|
+
() => adapter.publish({
|
|
87
|
+
hostEntityType: context.value.entityType,
|
|
88
|
+
hostEntityUuid: context.value.entityUuid,
|
|
89
|
+
closeAfterPublish: settings.value.closeAfterPublish
|
|
90
|
+
}),
|
|
91
|
+
$t("publishError", "Changes could not be published."),
|
|
92
|
+
$t("publishSuccess", "Changes published successfully.")
|
|
93
|
+
);
|
|
94
|
+
if (!success) {
|
|
95
|
+
const validations = state.violations.value;
|
|
96
|
+
if (validations.length) {
|
|
97
|
+
eventBus.emit("publish:failed");
|
|
98
|
+
eventBus.emit("sidebar:open", "violations");
|
|
99
|
+
}
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
onSubmit();
|
|
85
103
|
}
|
|
86
104
|
function onSubmit() {
|
|
87
105
|
broadcast.emit("published", { uuid: context.value.entityUuid });
|
package/package.json
CHANGED