@uniformdev/uniform-nuxt 19.198.2-alpha.0 → 19.198.3-alpha.5

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,5 +1,5 @@
1
1
  {
2
2
  "name": "nuxt-uniform",
3
3
  "configKey": "uniform",
4
- "version": "19.198.2-alpha.0+784b685d85"
4
+ "version": "19.198.3-alpha.5+c37bbd4ef2"
5
5
  }
@@ -1,19 +1,26 @@
1
1
  import {
2
2
  CANVAS_DRAFT_STATE,
3
- CANVAS_PUBLISHED_STATE
3
+ CANVAS_PUBLISHED_STATE,
4
+ EMPTY_COMPOSITION
4
5
  } from "@uniformdev/canvas";
5
6
  import { globalCompositionEnhancerInjectionKey } from "@uniformdev/canvas-vue";
6
7
  import { provide } from "vue-demi";
7
8
  import { useAsyncData, useNuxtApp } from "#app";
8
9
  export const useUniformComposition = async (options) => {
9
10
  const { enhance = (c) => c, ...parameters } = options;
10
- const { $uniformCanvasClient, $preview: preview } = useNuxtApp();
11
+ const { $uniformCanvasClient, $preview } = useNuxtApp();
12
+ const previewState = $preview;
11
13
  const canvasClient = $uniformCanvasClient;
12
14
  provide(globalCompositionEnhancerInjectionKey, enhance);
13
15
  const { data, pending, error } = await useAsyncData(
14
16
  `composition-${JSON.stringify(parameters)}`,
15
17
  async () => {
16
- const state = preview ? CANVAS_DRAFT_STATE : CANVAS_PUBLISHED_STATE;
18
+ if (previewState?.isContextualEditing) {
19
+ return {
20
+ composition: EMPTY_COMPOSITION
21
+ };
22
+ }
23
+ const state = previewState ? CANVAS_DRAFT_STATE : CANVAS_PUBLISHED_STATE;
17
24
  let response = void 0;
18
25
  if ("slug" in parameters) {
19
26
  response = await canvasClient.getCompositionBySlug({
@@ -1,2 +1,9 @@
1
+ export type PreviewState = {
2
+ slug: string | undefined;
3
+ compositionId: string | undefined;
4
+ path: string | undefined;
5
+ locale: string | undefined;
6
+ isContextualEditing: boolean;
7
+ };
1
8
  declare const _default: any;
2
9
  export default _default;
@@ -129,7 +129,8 @@ function setupPreview(nuxtApp) {
129
129
  slug: route.query.slug,
130
130
  compositionId: route.query.id,
131
131
  path: route.query.path,
132
- locale: route.query.locale
132
+ locale: route.query.locale,
133
+ isContextualEditing: route.query[IN_CONTEXT_EDITOR_QUERY_STRING_PARAM] === "true"
133
134
  };
134
135
  }
135
136
  nuxtApp.hook("app:beforeMount", () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/uniform-nuxt",
3
- "version": "19.198.2-alpha.0+784b685d85",
3
+ "version": "19.198.3-alpha.5+c37bbd4ef2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -24,11 +24,11 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@nuxt/kit": "3.9.3",
27
- "@uniformdev/canvas": "19.198.2-alpha.0+784b685d85",
28
- "@uniformdev/canvas-vue": "19.198.2-alpha.0+784b685d85",
29
- "@uniformdev/context": "19.198.2-alpha.0+784b685d85",
30
- "@uniformdev/context-vue": "19.198.2-alpha.0+784b685d85",
31
- "@uniformdev/richtext": "19.198.2-alpha.0+784b685d85",
27
+ "@uniformdev/canvas": "19.198.3-alpha.5+c37bbd4ef2",
28
+ "@uniformdev/canvas-vue": "19.198.3-alpha.5+c37bbd4ef2",
29
+ "@uniformdev/context": "19.198.3-alpha.5+c37bbd4ef2",
30
+ "@uniformdev/context-vue": "19.198.3-alpha.5+c37bbd4ef2",
31
+ "@uniformdev/richtext": "19.198.3-alpha.5+c37bbd4ef2",
32
32
  "vue-demi": "^0.14.6"
33
33
  },
34
34
  "devDependencies": {
@@ -44,5 +44,5 @@
44
44
  "publishConfig": {
45
45
  "access": "public"
46
46
  },
47
- "gitHead": "784b685d8510a8c185bc4d57e5aeaf2ced9719c9"
47
+ "gitHead": "c37bbd4ef2353582b4125b9dd21599634ecd5165"
48
48
  }