@tinacms/app 1.2.11 → 1.2.12
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/CHANGELOG.md +8 -0
- package/index.html +56 -0
- package/package.json +3 -3
- package/src/App.tsx +25 -8
package/CHANGELOG.md
CHANGED
package/index.html
CHANGED
|
@@ -8,6 +8,62 @@
|
|
|
8
8
|
</head>
|
|
9
9
|
<body class="tina-tailwind">
|
|
10
10
|
<div id="root"></div>
|
|
11
|
+
<script>
|
|
12
|
+
function handleLoadError() {
|
|
13
|
+
console.error('Failed to load assets')
|
|
14
|
+
// Assets have failed to load
|
|
15
|
+
document.getElementById('root').innerHTML =
|
|
16
|
+
'<style type="text/css">\
|
|
17
|
+
#no-assets-placeholder body {\
|
|
18
|
+
font-family: sans-serif;\
|
|
19
|
+
font-size: 16px;\
|
|
20
|
+
line-height: 1.4;\
|
|
21
|
+
color: #333;\
|
|
22
|
+
background-color: #f5f5f5;\
|
|
23
|
+
}\
|
|
24
|
+
#no-assets-placeholder {\
|
|
25
|
+
max-width: 600px;\
|
|
26
|
+
margin: 0 auto;\
|
|
27
|
+
padding: 40px;\
|
|
28
|
+
text-align: center;\
|
|
29
|
+
background-color: #fff;\
|
|
30
|
+
box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.1);\
|
|
31
|
+
}\
|
|
32
|
+
#no-assets-placeholder h1 {\
|
|
33
|
+
font-size: 24px;\
|
|
34
|
+
margin-bottom: 20px;\
|
|
35
|
+
}\
|
|
36
|
+
#no-assets-placeholder p {\
|
|
37
|
+
margin-bottom: 10px;\
|
|
38
|
+
}\
|
|
39
|
+
#no-assets-placeholder a {\
|
|
40
|
+
color: #0077cc;\
|
|
41
|
+
text-decoration: none;\
|
|
42
|
+
}\
|
|
43
|
+
#no-assets-placeholder a:hover {\
|
|
44
|
+
text-decoration: underline;\
|
|
45
|
+
}\
|
|
46
|
+
</style>\
|
|
47
|
+
<div id=\'no-assets-placeholder\'>\
|
|
48
|
+
<h1>Failed loading TinaCMS assets</h1>\
|
|
49
|
+
<p>\
|
|
50
|
+
Your TinaCMS configuration may be misconfigured, and we could not load\
|
|
51
|
+
the assets for this page.\
|
|
52
|
+
</p>\
|
|
53
|
+
<p>\
|
|
54
|
+
Please visit <a href="https://tina.io/docs/tina-cloud/faq/#how-do-i-resolve-failed-loading-tinacms-assets-error">this doc</a> for help.\
|
|
55
|
+
</p>\
|
|
56
|
+
</div>'
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Check if #root has childen after 2 seconds
|
|
60
|
+
// If not, we assume that the assets have failed to load
|
|
61
|
+
setTimeout(() => {
|
|
62
|
+
if (!document.getElementById('root').children.length) {
|
|
63
|
+
handleLoadError()
|
|
64
|
+
}
|
|
65
|
+
}, 2000)
|
|
66
|
+
</script>
|
|
11
67
|
<script type="module" src="/src/main.tsx"></script>
|
|
12
68
|
</body>
|
|
13
69
|
</html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/app",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.12",
|
|
4
4
|
"main": "src/main.tsx",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"devDependencies": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"@headlessui/react": "1.6.6",
|
|
14
14
|
"@heroicons/react": "1.0.6",
|
|
15
15
|
"@monaco-editor/react": "4.4.5",
|
|
16
|
-
"@tinacms/mdx": "1.3.
|
|
16
|
+
"@tinacms/mdx": "1.3.10",
|
|
17
17
|
"@tinacms/toolkit": "1.7.1",
|
|
18
18
|
"@xstate/react": "3.0.0",
|
|
19
19
|
"final-form": "4.20.7",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"react-is": "17.0.2",
|
|
28
28
|
"react-router-dom": "6.3.0",
|
|
29
29
|
"tailwindcss": "^3.2.7",
|
|
30
|
-
"tinacms": "1.5.
|
|
30
|
+
"tinacms": "1.5.5",
|
|
31
31
|
"typescript": "^4.6.4",
|
|
32
32
|
"zod": "^3.14.3"
|
|
33
33
|
}
|
package/src/App.tsx
CHANGED
|
@@ -28,14 +28,31 @@ const Editor = (props) => {
|
|
|
28
28
|
)
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
const SetPreview = (
|
|
31
|
+
const SetPreview = () => {
|
|
32
32
|
const cms = useCMS()
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
React.useEffect(() => {
|
|
34
|
+
// Override original 'rich-text' field with one that has raw mode support
|
|
35
|
+
cms.fields.add({
|
|
36
|
+
...MdxFieldPluginExtendible,
|
|
37
|
+
Component: Editor,
|
|
38
|
+
})
|
|
39
|
+
let basePath
|
|
40
|
+
if (config.build.basePath) {
|
|
41
|
+
basePath = config.build.basePath.replace(/^\/|\/$/g, '')
|
|
42
|
+
}
|
|
43
|
+
cms.flags.set(
|
|
44
|
+
'tina-preview',
|
|
45
|
+
`${basePath ? `${basePath}/` : ''}${config.build.outputFolder.replace(
|
|
46
|
+
/^\/|\/$/g,
|
|
47
|
+
''
|
|
48
|
+
)}`
|
|
49
|
+
)
|
|
50
|
+
// Override original 'rich-text' field with one that has raw mode support
|
|
51
|
+
cms.fields.add({
|
|
52
|
+
...MdxFieldPluginExtendible,
|
|
53
|
+
Component: Editor,
|
|
54
|
+
})
|
|
55
|
+
}, [])
|
|
39
56
|
return null
|
|
40
57
|
}
|
|
41
58
|
|
|
@@ -50,7 +67,7 @@ export const TinaAdminWrapper = () => {
|
|
|
50
67
|
// THis will be replaced by the version of the graphql package or --garphql-version flag. It is replaced by vite at compile time
|
|
51
68
|
tinaGraphQLVersion={__TINA_GRAPHQL_VERSION__}
|
|
52
69
|
>
|
|
53
|
-
<SetPreview
|
|
70
|
+
<SetPreview />
|
|
54
71
|
<TinaAdmin
|
|
55
72
|
preview={Preview}
|
|
56
73
|
Playground={Playground}
|