@tinacms/app 1.0.2 → 1.0.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.
@@ -39,6 +39,13 @@ export const Preview = (
39
39
  setActiveQuery(event.data)
40
40
  }
41
41
  })
42
+ window.addEventListener('message', (event: MessageEvent<PostMessage>) => {
43
+ if (event?.data?.type === 'isEditMode') {
44
+ props.iframeRef?.current?.contentWindow?.postMessage({
45
+ type: 'tina:editMode',
46
+ })
47
+ }
48
+ })
42
49
  }
43
50
  }, [props.iframeRef.current])
44
51
 
@@ -93,13 +100,6 @@ const QueryMachine = (props: {
93
100
 
94
101
  React.useEffect(() => {
95
102
  if (props.iframeRef.current) {
96
- window.addEventListener('message', (event: MessageEvent<PostMessage>) => {
97
- if (event?.data?.type === 'isEditMode') {
98
- props.iframeRef?.current?.contentWindow?.postMessage({
99
- type: 'tina:editMode',
100
- })
101
- }
102
- })
103
103
  send({ type: 'IFRAME_MOUNTED', value: props.iframeRef.current })
104
104
  if (props.payload.type === 'open') {
105
105
  send({ type: 'ADD_QUERY', value: props.payload })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/app",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "main": "dist/index.js",
5
5
  "exports": {
6
6
  ".": {
@@ -37,8 +37,8 @@
37
37
  "@types/react": "17.0.2",
38
38
  "@types/react-dom": "17.0.2",
39
39
  "@tinacms/scripts": "1.0.0",
40
- "tinacms": "1.1.0",
41
- "@tinacms/mdx": "1.0.2",
40
+ "tinacms": "1.1.1",
41
+ "@tinacms/mdx": "1.0.3",
42
42
  "jest": "^27.0.6"
43
43
  },
44
44
  "dependencies": {