@griddo/ax 11.0.4-rc.0 → 11.0.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@griddo/ax",
3
3
  "description": "Griddo Author Experience",
4
- "version": "11.0.4-rc.0",
4
+ "version": "11.0.4",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Carlos Torres <carlos.torres@secuoyas.com>",
@@ -229,5 +229,5 @@
229
229
  "publishConfig": {
230
230
  "access": "public"
231
231
  },
232
- "gitHead": "61a3d4db2dcca2a2e4ce4bc139fa59294e502a71"
232
+ "gitHead": "b97706dc29f2f8066e22ca49a9ee9c8959e8f820"
233
233
  }
@@ -327,11 +327,12 @@ function createStructuredDataContent(
327
327
  const {
328
328
  app: { lang },
329
329
  sites: { currentSiteInfo },
330
- structuredData: { schema },
331
- } = getState();
330
+ structuredData: { schema, currentStructuredData },
331
+ }: IRootState = getState();
332
332
 
333
+ const isCategory = currentStructuredData?.taxonomy === true;
333
334
  let dataContent = prepareStructuredDataContent(structuredDataContent);
334
- if (Array.isArray(schema.fields)) {
335
+ if (Array.isArray(schema.fields) && !isCategory) {
335
336
  dataContent = evalueDataComputedFields(structuredDataContent, schema.fields);
336
337
  }
337
338
 
@@ -363,11 +364,12 @@ function updateStructuredDataContent(
363
364
  return async (dispatch, getState) => {
364
365
  try {
365
366
  const {
366
- structuredData: { schema },
367
- } = getState();
367
+ structuredData: { schema, currentStructuredData },
368
+ }: IRootState = getState();
368
369
 
370
+ const isCategory = currentStructuredData?.taxonomy === true;
369
371
  let dataContent = prepareStructuredDataContent(structuredDataContent);
370
- if (Array.isArray(schema.fields)) {
372
+ if (Array.isArray(schema.fields) && !isCategory) {
371
373
  dataContent = evalueDataComputedFields(structuredDataContent, schema.fields);
372
374
  }
373
375
 
@@ -628,6 +630,7 @@ function resetCurrentData(): (dispatch: Dispatch) => Promise<void> {
628
630
  dispatch(setCurrentData(null));
629
631
  dispatch(setCurrentDataID(null));
630
632
  dispatch(setCurrentDataContent([]));
633
+ dispatch(setSchema({}));
631
634
  //dispatch(setCurrentSearch(""));
632
635
  } catch (e) {
633
636
  console.log("Error", e);
@@ -35,7 +35,7 @@ const filterStructuredDataByID = (data: any, id: string) => data.find((item: any
35
35
  const evalueDataComputedFields = (structuredData: any, fields: any[]) => {
36
36
  const updatedData = deepClone(structuredData);
37
37
  fields.forEach((field: ISchemaField) => {
38
- if (field.hasOwnProperty("computed")) {
38
+ if (Object.prototype.hasOwnProperty.call(field, "computed")) {
39
39
  const computedFunction = eval(`(${field.computed})`);
40
40
  updatedData.content[field.key] = computedFunction(structuredData.content);
41
41
  }
@@ -54,7 +54,7 @@ const FramePreview = (props: IProps) => {
54
54
 
55
55
  const selectHoverEditorID = (editorID: number, parentEditorID: number) => {
56
56
  const { parent } = findByEditorID(content, parentEditorID);
57
- if (parent.parentEditorID === 0) {
57
+ if (parent && parent.parentEditorID === 0) {
58
58
  window.parent.postMessage({ type: "module-scroll", message: editorID }, "*");
59
59
  }
60
60
  };