From 15f8b74e3f59c1b07135bd870c5c766f0b5ef4d8 Mon Sep 17 00:00:00 2001 From: phaneendra <58028287+cricket-lover@users.noreply.github.com> Date: Wed, 14 Apr 2021 16:40:19 +0530 Subject: [PATCH 1/6] action changed from reloadStory to sendStoryToIFrame --- src/components/with-preview.js | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/components/with-preview.js b/src/components/with-preview.js index c463db72..b4a5ebe6 100644 --- a/src/components/with-preview.js +++ b/src/components/with-preview.js @@ -2,7 +2,7 @@ import React from "react"; /** * This higher order function can be used for the home or story page preview. It takes a component, and a function to map the story into props suitable for the component - * + * * Preview in the Quintype CMS works by sending a postMessage to an iframe every time the story changes. This file abstracts this for you, and will just render the given component * * Example @@ -36,20 +36,27 @@ export function WithPreview(klazz, updateData) { } componentDidMount() { - global.addEventListener("message", event => { - if (event.data && event.data.action == 'reloadStory' && event.data.story) { - this.setState({ story: event.data.story }) + global.addEventListener("message", (event) => { + if ( + event.data && + event.data.action == "sendStoryToIFrame" && + event.data.story + ) { + this.setState({ story: event.data.story }); } }); } render() { - if(!this.state.story) { - return
+ if (!this.state.story) { + return
; } - return React.createElement(klazz, Object.assign({}, this.props, { - data: updateData(this.props.data, this.state.story) - })) + return React.createElement( + klazz, + Object.assign({}, this.props, { + data: updateData(this.props.data, this.state.story), + }) + ); } - } + }; } From 1a5b9e6d5c5f1b96aac4ebc02e09a210ee67f38f Mon Sep 17 00:00:00 2001 From: nandap4790 Date: Wed, 14 Apr 2021 16:41:51 +0530 Subject: [PATCH 2/6] chore(release): 2.27.3-bold-preview.0 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index a8eeb648..a2555766 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@quintype/components", - "version": "2.27.2", + "version": "2.27.3-bold-preview.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index e5cacb52..b0edcc6a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@quintype/components", - "version": "2.27.2", + "version": "2.27.3-bold-preview.0", "description": "Components to help build Quintype Node.js apps", "main": "dist/cjs/index.js", "module": "dist/es/index.js", From dd20885ff02cf5310aa1ba74187f30b960646c5e Mon Sep 17 00:00:00 2001 From: phaneendra <58028287+cricket-lover@users.noreply.github.com> Date: Wed, 14 Apr 2021 17:17:38 +0530 Subject: [PATCH 3/6] action changed from reloadStory to sendStoryToIframe --- src/components/with-preview.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/with-preview.js b/src/components/with-preview.js index b4a5ebe6..b9458856 100644 --- a/src/components/with-preview.js +++ b/src/components/with-preview.js @@ -39,7 +39,7 @@ export function WithPreview(klazz, updateData) { global.addEventListener("message", (event) => { if ( event.data && - event.data.action == "sendStoryToIFrame" && + event.data.action == "sendStoryToIframe" && event.data.story ) { this.setState({ story: event.data.story }); From d98bb28842888f317ab17f8ef0fc55686e2d5c17 Mon Sep 17 00:00:00 2001 From: nandap4790 Date: Wed, 14 Apr 2021 17:20:45 +0530 Subject: [PATCH 4/6] chore(release): 2.27.3-bold-preview.1 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index a2555766..a39df3a7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@quintype/components", - "version": "2.27.3-bold-preview.0", + "version": "2.27.3-bold-preview.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index b0edcc6a..8eb7f34b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@quintype/components", - "version": "2.27.3-bold-preview.0", + "version": "2.27.3-bold-preview.1", "description": "Components to help build Quintype Node.js apps", "main": "dist/cjs/index.js", "module": "dist/es/index.js", From cdeb4e6b8bc491c3fa629e1a44160f6b54cb821b Mon Sep 17 00:00:00 2001 From: phaneendra <58028287+cricket-lover@users.noreply.github.com> Date: Wed, 14 Apr 2021 18:08:01 +0530 Subject: [PATCH 5/6] remove data.action check --- src/components/with-preview.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/components/with-preview.js b/src/components/with-preview.js index b9458856..8cafe084 100644 --- a/src/components/with-preview.js +++ b/src/components/with-preview.js @@ -37,11 +37,7 @@ export function WithPreview(klazz, updateData) { componentDidMount() { global.addEventListener("message", (event) => { - if ( - event.data && - event.data.action == "sendStoryToIframe" && - event.data.story - ) { + if (event.data && event.data.story) { this.setState({ story: event.data.story }); } }); From ea3fae19632a2964a26d0494d22063ea20cc6a8c Mon Sep 17 00:00:00 2001 From: nandap4790 Date: Wed, 14 Apr 2021 18:10:41 +0530 Subject: [PATCH 6/6] chore(release): 2.27.3-bold-preview.2 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index a39df3a7..a95d5c1c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@quintype/components", - "version": "2.27.3-bold-preview.1", + "version": "2.27.3-bold-preview.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 8eb7f34b..72734ddd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@quintype/components", - "version": "2.27.3-bold-preview.1", + "version": "2.27.3-bold-preview.2", "description": "Components to help build Quintype Node.js apps", "main": "dist/cjs/index.js", "module": "dist/es/index.js",