@vonaffenfels/contentful-slate-editor 1.0.81 → 1.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vonaffenfels/contentful-slate-editor",
3
- "version": "1.0.81",
3
+ "version": "1.1.3",
4
4
  "scripts": {
5
5
  "prepublish": "yarn run build",
6
6
  "dev": "yarn run start",
@@ -91,10 +91,10 @@
91
91
  "webpack-watch-files-plugin": "^1.2.1"
92
92
  },
93
93
  "dependencies": {
94
- "@vonaffenfels/slate-editor": "^1.0.81",
94
+ "@vonaffenfels/slate-editor": "^1.1.3",
95
95
  "webpack": "5.88.2"
96
96
  },
97
- "gitHead": "a8759bb4528cbe15162eea2db425d570110eaaf7",
97
+ "gitHead": "9bb577c35e6bd63588821abb46c9a3d4d400bda2",
98
98
  "publishConfig": {
99
99
  "access": "public"
100
100
  }
@@ -99,7 +99,6 @@ const EditorField = ({
99
99
  setIsLoadingCount(++isLoadingCountGlobal);
100
100
 
101
101
  try {
102
- console.log("KIENZ_DEBUG: :101 / executeLoader", sdk, sdk?.entry?.sys?.id);
103
102
  const loaderResult = await fetch(`/api/loader/?portal=${portal}&block=${block}`, {
104
103
  method: "POST",
105
104
  body: JSON.stringify({
package/src/index.js CHANGED
@@ -18,7 +18,8 @@ import Dialog from "./components/Dialog";
18
18
  export const BaseContentfulApp = (props) => {
19
19
  init(async (sdk) => {
20
20
  const rootContainer = document.getElementById('root');
21
- const RendererWrapperComponent = props?.RendererWrapperComponent || (({children}) => <div className="h-full">{children}</div>);
21
+ const RendererWrapperComponent = props?.RendererWrapperComponent || (({children}) => <div
22
+ className="h-full">{children}</div>);
22
23
  const wrapperProps = {
23
24
  sdk,
24
25
  value: sdk.parameters?.invocation?.value || sdk?.field?.getValue(),
@@ -29,11 +30,15 @@ export const BaseContentfulApp = (props) => {
29
30
 
30
31
  let config = {};
31
32
 
32
- if (wrapperProps.portal) {
33
- config = await props.getByPortal(wrapperProps.portal);
33
+ if (wrapperProps.portal && props.getByPortal) {
34
+ try {
35
+ config = await props.getByPortal(wrapperProps.portal);
34
36
 
35
- if (props.getDomain) {
36
- config.domain = props.getDomain(wrapperProps.portal);
37
+ if (props.getDomain) {
38
+ config.domain = props.getDomain(wrapperProps.portal);
39
+ }
40
+ } catch (e) {
41
+ console.error(`Error in getting config for portal ${wrapperProps.portal}`, e);
37
42
  }
38
43
  }
39
44
 
@@ -44,7 +49,9 @@ export const BaseContentfulApp = (props) => {
44
49
  },
45
50
  {
46
51
  location: locations.LOCATION_ENTRY_FIELD,
47
- component: <RendererWrapperComponent {...wrapperProps}><Field sdk={sdk} elementPropsMap={elementPropsMap}/></RendererWrapperComponent>,
52
+ component: <RendererWrapperComponent {...wrapperProps}><Field
53
+ sdk={sdk}
54
+ elementPropsMap={elementPropsMap}/></RendererWrapperComponent>,
48
55
  },
49
56
  {
50
57
  location: locations.LOCATION_ENTRY_EDITOR,
@@ -60,7 +67,7 @@ export const BaseContentfulApp = (props) => {
60
67
  },
61
68
  {
62
69
  location: locations.LOCATION_DIALOG,
63
- component: <Dialog sdk={sdk} elementPropsMap={elementPropsMap} activeConfig={config} />,
70
+ component: <Dialog sdk={sdk} elementPropsMap={elementPropsMap} activeConfig={config}/>,
64
71
  },
65
72
  ];
66
73