@tinacms/vercel-previews 0.0.0-20230516185052 → 0.0.0-20230516192308
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/README.md +23 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -10,15 +10,35 @@ If an element has a `[data-vercel-edit-info]` attribute on it, it will be consid
|
|
|
10
10
|
|
|
11
11
|
#### The `vercelEditInfo` helper
|
|
12
12
|
|
|
13
|
-
> NOTE: this should be used in conjuction with the `withSourceMaps` function described below
|
|
14
|
-
|
|
15
13
|
```tsx
|
|
16
14
|
// pages/[slug].tsx
|
|
17
15
|
import { useTina } from 'tinacms/dist/react'
|
|
18
16
|
import { vercelEditInfo } from '@tinacms/vercel-previews/dist/react'
|
|
19
17
|
|
|
20
18
|
export const Post = (props) => {
|
|
21
|
-
const { data } = useTina(props)
|
|
19
|
+
const { data: tinaData } = useTina(props)
|
|
20
|
+
const data = useVisualEditing({
|
|
21
|
+
data: tinaData,
|
|
22
|
+
// metadata is derived from the query and variables
|
|
23
|
+
query: props.query,
|
|
24
|
+
variables: props.variables,
|
|
25
|
+
// When clicking on an editable element for the first time, redirect to the TinaCMS app
|
|
26
|
+
redirect: '/admin',
|
|
27
|
+
// Only enable visual editing on preview deploys
|
|
28
|
+
enabled: props.visualEditingEnabled
|
|
29
|
+
// stringEncoding automatically adds metadata to strings
|
|
30
|
+
stringEncoding: true,
|
|
31
|
+
// Alternatively, you can skip some strings from being encoded
|
|
32
|
+
stringEncoding: {
|
|
33
|
+
skipPaths: (path) => {
|
|
34
|
+
if ('page.blocks.0.image' === path) {
|
|
35
|
+
return true
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return false
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
})
|
|
22
42
|
|
|
23
43
|
return (
|
|
24
44
|
<div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/vercel-previews",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-20230516192308",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"module": "./dist/index.es.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@vercel/stega": "^0.0.4",
|
|
44
|
-
"tinacms": "0.0.0-
|
|
44
|
+
"tinacms": "0.0.0-20230516192308"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"react": ">=16.14"
|