@blokkli/editor 2.0.0-alpha.2 → 2.0.0-alpha.3

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "blokkli",
3
3
  "configKey": "blokkli",
4
- "version": "2.0.0-alpha.2",
4
+ "version": "2.0.0-alpha.3",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.15.0"
7
7
  },
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.2";
16
+ const version = "2.0.0-alpha.3";
17
17
 
18
18
  function sortObjectKeys(obj) {
19
19
  if (Array.isArray(obj)) {
@@ -0,0 +1,8 @@
1
+ fragment blokkliProps on ParagraphsBlokkliProps {
2
+ entityUuid
3
+ entityType
4
+ entityBundle
5
+ canEdit
6
+ editLabel
7
+ language
8
+ }
@@ -0,0 +1,6 @@
1
+ fragment paragraphsFieldItem on Paragraph {
2
+ uuid
3
+ bundle: entityBundle
4
+ isNew
5
+ options: paragraphsBlokkliOptions
6
+ }
@@ -84,6 +84,8 @@ const index = defineBlokkliModule({
84
84
  "fragment.paragraphsBlokkliMutationItem.graphql",
85
85
  "fragment.paragraphsBlokkliMutationResult.graphql",
86
86
  "fragment.paragraphsBlokkliViolation.graphql",
87
+ "fragment.blokkliProps.graphql",
88
+ "fragment.paragraphsFieldItem.graphql",
87
89
  "query.pbConfig.graphql",
88
90
  "query.pbEditState.graphql"
89
91
  ];
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blokkli/editor",
3
- "version": "2.0.0-alpha.2",
3
+ "version": "2.0.0-alpha.3",
4
4
  "description": "Interactive page building experience for Nuxt",
5
5
  "repository": "blokkli/editor",
6
6
  "type": "module",