@tinacms/app 0.0.0-67b5c0b-20250414080731 → 0.0.0-67e1a3d-20251124055417

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 CHANGED
@@ -1,13 +1,144 @@
1
1
  # @tinacms/app
2
2
 
3
- ## 0.0.0-67b5c0b-20250414080731
3
+ ## 0.0.0-67e1a3d-20251124055417
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - [#5623](https://github.com/tinacms/tinacms/pull/5623) [`613fbf0`](https://github.com/tinacms/tinacms/commit/613fbf04bd3ebcc0dbfdfadecc07f5e1068408e4) Thanks [@JackDevAU](https://github.com/JackDevAU)! - ⚠️ TESTING
7
+ - [#5822](https://github.com/tinacms/tinacms/pull/5822) [`4b824be`](https://github.com/tinacms/tinacms/commit/4b824be53572f9231753ebd3b5f14fd778fd73d6) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Migrate from react-beautiful-dnd to dnd-kit to fix deprecation error.
8
8
 
9
- - Updated dependencies [[`613fbf0`](https://github.com/tinacms/tinacms/commit/613fbf04bd3ebcc0dbfdfadecc07f5e1068408e4)]:
10
- - tinacms@0.0.0-67b5c0b-20250414080731
9
+ - Updated dependencies [[`f2577b9`](https://github.com/tinacms/tinacms/commit/f2577b911a97ecc1c3f53a98ae8218cc33bc9867), [`3ffa092`](https://github.com/tinacms/tinacms/commit/3ffa0929e4964f17d5ffa05e0d4cbbff5d9ef4d9), [`38920ce`](https://github.com/tinacms/tinacms/commit/38920ce29a9b63c54b04f39537f19beab62d2c86), [`d1bd1a1`](https://github.com/tinacms/tinacms/commit/d1bd1a1312fa910e237ec06608e7c11830c78346), [`67e1a3d`](https://github.com/tinacms/tinacms/commit/67e1a3d4c52e0acdab0a8dc53956e39f2e3075fa), [`9fb1402`](https://github.com/tinacms/tinacms/commit/9fb1402491f52d16e763c875ee550f7d879c83c8), [`3fa1098`](https://github.com/tinacms/tinacms/commit/3fa109849f552406dd0059041afe0bf09edadb25), [`ccab7a5`](https://github.com/tinacms/tinacms/commit/ccab7a5d0fd1f4167e8f72306e9d32e8750ed9bf), [`4b824be`](https://github.com/tinacms/tinacms/commit/4b824be53572f9231753ebd3b5f14fd778fd73d6), [`d9487bf`](https://github.com/tinacms/tinacms/commit/d9487bff276ba20a84b76944c5a7a333666f4984)]:
10
+ - tinacms@0.0.0-67e1a3d-20251124055417
11
+ - @tinacms/mdx@0.0.0-67e1a3d-20251124055417
12
+
13
+ ## 2.3.9
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [[`d900f4e`](https://github.com/tinacms/tinacms/commit/d900f4e6c6f0a86c94bba5f0925bbaa54eeb90db)]:
18
+ - tinacms@2.9.5
19
+
20
+ ## 2.3.8
21
+
22
+ ### Patch Changes
23
+
24
+ - Updated dependencies [[`e1b6d05`](https://github.com/tinacms/tinacms/commit/e1b6d05c6b31c5c0928633064a065ddd331667ca), [`4ee0dd9`](https://github.com/tinacms/tinacms/commit/4ee0dd95913392b0da12dd5c9344909e5292e911), [`27e5ca9`](https://github.com/tinacms/tinacms/commit/27e5ca9b18a90f13f92425ebb2628b143d6a81be)]:
25
+ - tinacms@2.9.4
26
+
27
+ ## 2.3.7
28
+
29
+ ### Patch Changes
30
+
31
+ - Updated dependencies [[`9e8bc37`](https://github.com/tinacms/tinacms/commit/9e8bc37402c8aa4d408c38e00d4402d596b0d896), [`0f265aa`](https://github.com/tinacms/tinacms/commit/0f265aadf918ae6f5b789e298fc2c406a6df0b16), [`32bd9b2`](https://github.com/tinacms/tinacms/commit/32bd9b21b54462be3e83b2d3e4b4237a48758bb1), [`ce1414c`](https://github.com/tinacms/tinacms/commit/ce1414ce1b82e6755a96c9c12949cd469b43e283)]:
32
+ - tinacms@2.9.3
33
+
34
+ ## 2.3.6
35
+
36
+ ### Patch Changes
37
+
38
+ - [#6087](https://github.com/tinacms/tinacms/pull/6087) [`1286e87`](https://github.com/tinacms/tinacms/commit/1286e87323694dc819edc56360613dc654f3d3ca) Thanks [@kulesy](https://github.com/kulesy)! - feat: Enhance branch creation modal with improved UI/UX and dropdown button component
39
+
40
+ - [#6098](https://github.com/tinacms/tinacms/pull/6098) [`a2d983e`](https://github.com/tinacms/tinacms/commit/a2d983ed886f66db2c133e902eacaa8d07e88bdb) Thanks [@Pat-Stuart](https://github.com/Pat-Stuart)! - Change from blue accent coloring to orange
41
+
42
+ - Updated dependencies [[`1286e87`](https://github.com/tinacms/tinacms/commit/1286e87323694dc819edc56360613dc654f3d3ca), [`4416a28`](https://github.com/tinacms/tinacms/commit/4416a283ac1cfea5e9c4890cd71f2edf3b704344), [`6cba118`](https://github.com/tinacms/tinacms/commit/6cba118c90f7c7ab6356c0ef83fca18526e47f8d), [`572fb28`](https://github.com/tinacms/tinacms/commit/572fb28236b56db4ede5fe53b177b80323ae7284), [`f224124`](https://github.com/tinacms/tinacms/commit/f224124220811fb44749122d46eb7100af89ee77), [`a2d983e`](https://github.com/tinacms/tinacms/commit/a2d983ed886f66db2c133e902eacaa8d07e88bdb), [`bc35474`](https://github.com/tinacms/tinacms/commit/bc354740d0cb359c372ba287974e7e9db3c5119c)]:
43
+ - tinacms@2.9.2
44
+
45
+ ## 2.3.5
46
+
47
+ ### Patch Changes
48
+
49
+ - Updated dependencies [[`003e348`](https://github.com/tinacms/tinacms/commit/003e348472ddc08eee63d78190038097542b6311), [`5527e8a`](https://github.com/tinacms/tinacms/commit/5527e8ab5821c8613fcfd1b0b8bc6d93291a6d03), [`5ffd60e`](https://github.com/tinacms/tinacms/commit/5ffd60e7b07b19cde6fab36a911503276c83715f), [`b23aa0c`](https://github.com/tinacms/tinacms/commit/b23aa0c5defc51b8f9fe00a59dd87e1d2f8b9f0b), [`5d13c0d`](https://github.com/tinacms/tinacms/commit/5d13c0d023373692233c8be2127ae6e3d7d68b47)]:
50
+ - tinacms@2.9.1
51
+
52
+ ## 2.3.4
53
+
54
+ ### Patch Changes
55
+
56
+ - Updated dependencies [[`0bbe080`](https://github.com/tinacms/tinacms/commit/0bbe0804e334238850a4f8f33be5cd123ff68ab3), [`98fbc94`](https://github.com/tinacms/tinacms/commit/98fbc941a07fbc52edafaeb43b49b5ea30ea4172), [`ced9076`](https://github.com/tinacms/tinacms/commit/ced9076d25d7177bd8d9ae3c6133d0560366511c)]:
57
+ - tinacms@2.9.0
58
+
59
+ ## 2.3.3
60
+
61
+ ### Patch Changes
62
+
63
+ - Updated dependencies [[`ea917dd`](https://github.com/tinacms/tinacms/commit/ea917dd2840c955d462b66b58009d2a16da39377), [`b012b6c`](https://github.com/tinacms/tinacms/commit/b012b6c7fae2674c613fd4c54e1819a86c6d2c3e), [`39e5b05`](https://github.com/tinacms/tinacms/commit/39e5b0562af7bca1e2923fc94b7c8119e12a0133), [`55e018b`](https://github.com/tinacms/tinacms/commit/55e018b9826a540005bbadf8fd51e9bac456d531)]:
64
+ - tinacms@2.8.3
65
+
66
+ ## 2.3.2
67
+
68
+ ### Patch Changes
69
+
70
+ - Updated dependencies [[`eaa6ed5`](https://github.com/tinacms/tinacms/commit/eaa6ed551c76349c5849cd1e19a8066ecbbe205c), [`60a15d5`](https://github.com/tinacms/tinacms/commit/60a15d533b85a0c3f9f483f6f0f0b6824616284b), [`2fb1c4e`](https://github.com/tinacms/tinacms/commit/2fb1c4e79d1cae5ab29c3f93b0867214e193f59c)]:
71
+ - tinacms@2.8.2
72
+ - @tinacms/mdx@1.8.1
73
+
74
+ ## 2.3.1
75
+
76
+ ### Patch Changes
77
+
78
+ - Updated dependencies [[`41359ed`](https://github.com/tinacms/tinacms/commit/41359edaf08def7a5e26969ec114155038c09752), [`b20a2c4`](https://github.com/tinacms/tinacms/commit/b20a2c4fd64fa2d06711850db63fb317302ee361), [`41359ed`](https://github.com/tinacms/tinacms/commit/41359edaf08def7a5e26969ec114155038c09752)]:
79
+ - tinacms@2.8.1
80
+
81
+ ## 2.3.0
82
+
83
+ ### Minor Changes
84
+
85
+ - [#5744](https://github.com/tinacms/tinacms/pull/5744) [`98a61e2`](https://github.com/tinacms/tinacms/commit/98a61e2d263978a7096cc23ac7e94aa0039981be) Thanks [@Ben0189](https://github.com/Ben0189)! - Upgrade Plate editor to v48 beta, integrating latest features and improvements.
86
+
87
+ ### Patch Changes
88
+
89
+ - Updated dependencies [[`98a61e2`](https://github.com/tinacms/tinacms/commit/98a61e2d263978a7096cc23ac7e94aa0039981be)]:
90
+ - @tinacms/mdx@1.8.0
91
+ - tinacms@2.8.0
92
+
93
+ ## 2.2.10
94
+
95
+ ### Patch Changes
96
+
97
+ - [#5833](https://github.com/tinacms/tinacms/pull/5833) [`5269d65`](https://github.com/tinacms/tinacms/commit/5269d6578d361c55326f39375eaa175707342d51) Thanks [@JackDevAU](https://github.com/JackDevAU)! - 🐛 FIX - Visual Editor Webpack HMR loading issue
98
+
99
+ - Updated dependencies [[`5269d65`](https://github.com/tinacms/tinacms/commit/5269d6578d361c55326f39375eaa175707342d51), [`3026a2b`](https://github.com/tinacms/tinacms/commit/3026a2b492113a53c036e43d5d85837cea4a6de3), [`28a94a6`](https://github.com/tinacms/tinacms/commit/28a94a602186f48b528b91236007839e5d02a9de)]:
100
+ - tinacms@2.7.10
101
+
102
+ ## 2.2.9
103
+
104
+ ### Patch Changes
105
+
106
+ - [#5741](https://github.com/tinacms/tinacms/pull/5741) [`0e9de37`](https://github.com/tinacms/tinacms/commit/0e9de379dab2970206b9b60eb014808662f67287) Thanks [@wicksipedia](https://github.com/wicksipedia)! - CMS admin UI - Refactor Sidebar and Branch Button Components
107
+ Forms header - Adds breadcrumb navigation
108
+
109
+ - [#5784](https://github.com/tinacms/tinacms/pull/5784) [`b25c5f0`](https://github.com/tinacms/tinacms/commit/b25c5f0b0e1d3f37870b780230b41dbc56bef1ab) Thanks [@JackDevAU](https://github.com/JackDevAU)! - - Fixed padding issues in FormLists
110
+
111
+ - Fixed Visual Editing's "Edit" button (Reference Fields)
112
+
113
+ - [#5789](https://github.com/tinacms/tinacms/pull/5789) [`5040a6a`](https://github.com/tinacms/tinacms/commit/5040a6aa24e62166d942c47b61a3f18585caded6) Thanks [@JackDevAU](https://github.com/JackDevAU)! - ✨ Adds click to focus for nested objects
114
+
115
+ - Updated dependencies [[`2a3ed6c`](https://github.com/tinacms/tinacms/commit/2a3ed6c3ec3233fd90fd94f3dd3d0243aaad079a), [`bc47f93`](https://github.com/tinacms/tinacms/commit/bc47f938431c400714808613f633b05659a87be1), [`0e9de37`](https://github.com/tinacms/tinacms/commit/0e9de379dab2970206b9b60eb014808662f67287), [`468f0ee`](https://github.com/tinacms/tinacms/commit/468f0eefc0a15a9a9a23737d29ea9a5cb5c6aef6), [`e27c017`](https://github.com/tinacms/tinacms/commit/e27c0172005797af93b908152d51b2966c0cf059), [`b25c5f0`](https://github.com/tinacms/tinacms/commit/b25c5f0b0e1d3f37870b780230b41dbc56bef1ab), [`5040a6a`](https://github.com/tinacms/tinacms/commit/5040a6aa24e62166d942c47b61a3f18585caded6), [`dbef36f`](https://github.com/tinacms/tinacms/commit/dbef36f594b949024d5525184b6a9e1b9085b759), [`3ba6d78`](https://github.com/tinacms/tinacms/commit/3ba6d78f35f817d55bfc3d12b750e54b7e0d11f2)]:
116
+ - tinacms@2.7.9
117
+ - @tinacms/mdx@1.7.0
118
+
119
+ ## 2.2.8
120
+
121
+ ### Patch Changes
122
+
123
+ - Updated dependencies [[`5e36123`](https://github.com/tinacms/tinacms/commit/5e361239a372e21dda624d17b4ff274bab23ce90), [`856e07a`](https://github.com/tinacms/tinacms/commit/856e07a0b8d742ee78d5eba565623cf081a61534), [`4d9c8ab`](https://github.com/tinacms/tinacms/commit/4d9c8abf6badd1bcc833bda432ab22dace4925ae), [`7346dc9`](https://github.com/tinacms/tinacms/commit/7346dc996fd81ecb395b62f373976512e8224c21)]:
124
+ - tinacms@2.7.8
125
+ - @tinacms/mdx@1.6.3
126
+
127
+ ## 2.2.7
128
+
129
+ ### Patch Changes
130
+
131
+ - [#5607](https://github.com/tinacms/tinacms/pull/5607) [`1965236`](https://github.com/tinacms/tinacms/commit/19652363784e48b065ec1924a9cd9611c8e79cae) Thanks [@jeffsee55](https://github.com/jeffsee55)! - Specify react and react-dom as peer deps
132
+
133
+ - Updated dependencies [[`1965236`](https://github.com/tinacms/tinacms/commit/19652363784e48b065ec1924a9cd9611c8e79cae)]:
134
+ - tinacms@2.7.7
135
+
136
+ ## 2.2.6
137
+
138
+ ### Patch Changes
139
+
140
+ - Updated dependencies [[`65cee5d`](https://github.com/tinacms/tinacms/commit/65cee5d6ae16c7320a4a14f0d9a82dc5f9103e34)]:
141
+ - tinacms@2.7.6
11
142
 
12
143
  ## 2.2.5
13
144
 
package/index.html CHANGED
@@ -51,7 +51,7 @@
51
51
  the assets for this page.\
52
52
  </p>\
53
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.\
54
+ Please visit <a href="https://tina.io/docs/r/FAQ/#13-how-do-i-resolve-failed-loading-tinacms-assets-error">this doc</a> for help.\
55
55
  </p>\
56
56
  </div>'
57
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/app",
3
- "version": "0.0.0-67b5c0b-20250414080731",
3
+ "version": "0.0.0-67e1a3d-20251124055417",
4
4
  "main": "src/main.tsx",
5
5
  "license": "Apache-2.0",
6
6
  "devDependencies": {
@@ -21,10 +21,12 @@
21
21
  "graphiql": "3.0.0-alpha.1",
22
22
  "graphql": "15.8.0",
23
23
  "monaco-editor": "0.31.0",
24
+ "react": "^18.3.1",
25
+ "react-dom": "^18.3.1",
24
26
  "react-router-dom": "6.3.0",
25
27
  "typescript": "^5.7.3",
26
28
  "zod": "^3.24.2",
27
- "@tinacms/mdx": "1.6.2",
28
- "tinacms": "0.0.0-67b5c0b-20250414080731"
29
+ "@tinacms/mdx": "0.0.0-67e1a3d-20251124055417",
30
+ "tinacms": "0.0.0-67e1a3d-20251124055417"
29
31
  }
30
32
  }
@@ -74,9 +74,7 @@ const Playground = () => {
74
74
  {noAutoQueries
75
75
  ? 'No auto-generated queries found, the Tina config is likely set to client.skip = true'
76
76
  : "Tina's auto-generated queries can be found here as well as any queries you may have defined yourself."}{' '}
77
- <a href='https://tina.io/docs/data-fetching/custom-queries/'>
78
- Learn more here
79
- </a>
77
+ <a href='https://tina.io/docs/r/custom-queries/'>Learn more here</a>
80
78
  </div>
81
79
  <nav className='space-y-1' aria-label='Sidebar'>
82
80
  <ul>
@@ -100,7 +98,7 @@ const Playground = () => {
100
98
  false
101
99
  ? 'bg-gray-100 text-gray-900'
102
100
  : 'text-gray-600 hover:bg-gray-50 hover:text-gray-900',
103
- 'flex items-center rounded-md px-3 py-2 text-sm font-medium w-full text-left'
101
+ 'flex items-center rounded px-3 py-2 text-sm font-medium w-full text-left'
104
102
  )}
105
103
  onClick={async () => {
106
104
  if (typeof value === 'function') {
@@ -1,16 +1,16 @@
1
- /**
2
-
3
-
4
-
5
- */
6
- import React from 'react';
7
- import { XCircleIcon } from '@heroicons/react/solid';
8
1
  import {
9
2
  Popover,
10
3
  PopoverButton,
11
4
  PopoverPanel,
12
5
  Transition,
13
6
  } from '@headlessui/react';
7
+ import { XCircleIcon } from '@heroicons/react/solid';
8
+ /**
9
+
10
+
11
+
12
+ */
13
+ import React from 'react';
14
14
  import { Fragment } from 'react';
15
15
  // import { InvalidMarkdownElement } from '@tinacms/mdx/src/parse/plate'
16
16
  export type EmptyTextElement = { type: 'text'; text: '' };
@@ -93,7 +93,7 @@ export function ErrorMessage({ error }: { error: InvalidMarkdownElement }) {
93
93
  >
94
94
  <PopoverPanel className='absolute top-8 w-[300px] -right-3 z-10 mt-3 px-4 sm:px-0'>
95
95
  <div className='overflow-hidden rounded-lg shadow-lg ring-1 ring-black ring-opacity-5'>
96
- <div className='rounded-md bg-red-50 p-4 overflow-scroll'>
96
+ <div className='rounded bg-red-50 p-4 overflow-scroll'>
97
97
  <div className='flex'>
98
98
  <div className='flex-shrink-0'>
99
99
  <XCircleIcon
@@ -1,7 +1,13 @@
1
- import MonacoEditor, { Monaco } from '@monaco-editor/react';
2
- import { parseMDX, stringifyMDX } from '@tinacms/mdx';
3
- import type * as monaco from 'monaco-editor';
4
1
  import React from 'react';
2
+ import MonacoEditor, { useMonaco, loader } from '@monaco-editor/react';
3
+ /**
4
+ * MDX is built directly to the app because of how we load dependencies.
5
+ * Since we drop the package.json in to the end users folder, we can't
6
+ * easily install the current version of the mdx package in all scenarios
7
+ * (when we're working in the monorepo, or working with a tagged npm version)
8
+ */
9
+ import { parseMDX, serializeMDX } from '@tinacms/mdx';
10
+ import type * as monaco from 'monaco-editor';
5
11
  import { RichTextType } from 'tinacms';
6
12
  import {
7
13
  ErrorMessage,
@@ -9,9 +15,9 @@ import {
9
15
  buildError,
10
16
  } from './error-message';
11
17
  import { useDebounce } from './use-debounce';
12
- import useCustomMonaco from './use-monaco';
13
18
 
14
19
  export const uuid = () => {
20
+ // @ts-ignore
15
21
  return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (c) =>
16
22
  (
17
23
  c ^
@@ -20,143 +26,128 @@ export const uuid = () => {
20
26
  );
21
27
  };
22
28
 
29
+ type Monaco = typeof monaco;
30
+
23
31
  /**
24
32
  * Since monaco lazy-loads we may have a delay from when the block is inserted
25
- * to when monaco has instantiated.
33
+ * to when monaco has intantiated, keep trying to focus on it.
34
+ *
35
+ * Will try for 3 seconds before moving on
26
36
  */
27
- const retryFocus = (editor) => {
28
- if (editor && editor.focus) {
29
- try {
30
- editor.focus();
31
- } catch (err) {
32
- console.warn('Error focusing editor:', err);
37
+ let retryCount = 0;
38
+ const retryFocus = (ref) => {
39
+ if (ref.current) {
40
+ ref.current.focus();
41
+ } else {
42
+ if (retryCount < 30) {
43
+ setTimeout(() => {
44
+ retryCount = retryCount + 1;
45
+ retryFocus(ref);
46
+ }, 100);
33
47
  }
34
48
  }
35
49
  };
36
50
 
37
51
  export const RawEditor = (props: RichTextType) => {
38
- const monacoInstance = useCustomMonaco();
39
- const editorRef = React.useRef<monaco.editor.IStandaloneCodeEditor | null>(
40
- null
41
- );
52
+ const monaco = useMonaco() as Monaco;
53
+ const monacoEditorRef =
54
+ React.useRef<monaco.editor.IStandaloneCodeEditor>(null);
42
55
  const [height, setHeight] = React.useState(100);
43
56
  const id = React.useMemo(() => uuid(), []);
44
57
  const field = props.field;
45
-
46
- // Get initial value safely
47
58
  const inputValue = React.useMemo(() => {
48
- try {
49
- // @ts-ignore no access to the rich-text type from this package
50
- const res = stringifyMDX(props.input.value, field, (value) => value);
51
- return typeof props.input.value === 'string' ? props.input.value : res;
52
- } catch (err) {
53
- console.error('Error stringifying MDX:', err);
54
- return '';
55
- }
56
- }, []); // Empty dependency array to only run once
57
-
59
+ // @ts-ignore no access to the rich-text type from this package
60
+ const res = serializeMDX(props.input.value, field, (value) => value);
61
+ return typeof props.input.value === 'string' ? props.input.value : res;
62
+ }, []);
58
63
  const [value, setValue] = React.useState(inputValue);
59
64
  const [error, setError] = React.useState<InvalidMarkdownElement>(null);
60
65
 
61
66
  const debouncedValue = useDebounce(value, 500);
62
67
 
63
- // Update parsed MDX when value changes
64
68
  React.useEffect(() => {
65
- let isMounted = true;
66
-
67
- try {
68
- // @ts-ignore no access to the rich-text type from this package
69
- const parsedValue = parseMDX(debouncedValue, field, (value) => value);
70
-
71
- if (!isMounted) return;
72
-
73
- if (
74
- parsedValue.children[0] &&
75
- parsedValue.children[0].type === 'invalid_markdown'
76
- ) {
77
- setError(parsedValue.children[0]);
78
- } else {
79
- setError(null);
80
- props.input.onChange(parsedValue);
81
- }
82
- } catch (err) {
83
- console.error('Error parsing MDX:', err);
69
+ // @ts-ignore no access to the rich-text type from this package
70
+ const parsedValue = parseMDX(value, field, (value) => value);
71
+ if (
72
+ parsedValue.children[0] &&
73
+ parsedValue.children[0].type === 'invalid_markdown'
74
+ ) {
75
+ const invalidMarkdown = parsedValue.children[0];
76
+ setError(invalidMarkdown);
77
+ } else {
78
+ setError(null);
84
79
  }
80
+ props.input.onChange(parsedValue);
81
+ }, [JSON.stringify(debouncedValue)]);
85
82
 
86
- return () => {
87
- isMounted = false;
88
- };
89
- }, [debouncedValue, field]); // Only dependency should be the debounced value and field
90
-
91
- // Handle error markers in editor
92
83
  React.useEffect(() => {
93
- if (!monacoInstance || !editorRef.current) return;
94
-
95
- try {
96
- const model = editorRef.current.getModel();
97
- if (!model) return;
98
-
84
+ if (monacoEditorRef.current) {
99
85
  if (error) {
100
86
  const errorMessage = buildError(error);
101
-
102
- // Make sure all position properties are numbers (not undefined)
103
- const markerData = {
104
- message: errorMessage.message,
105
- severity: monacoInstance.MarkerSeverity?.Error || 8,
106
- startLineNumber: errorMessage.position?.startLineNumber || 1,
107
- endLineNumber: errorMessage.position?.endLineNumber || 1,
108
- startColumn: errorMessage.position?.startColumn || 1,
109
- endColumn: errorMessage.position?.endColumn || 1,
110
- };
111
-
112
- monacoInstance.editor.setModelMarkers(model, id, [markerData]);
87
+ monaco.editor.setModelMarkers(monacoEditorRef.current.getModel(), id, [
88
+ {
89
+ ...errorMessage.position,
90
+ message: errorMessage.message,
91
+ severity: 8,
92
+ },
93
+ ]);
113
94
  } else {
114
- monacoInstance.editor.setModelMarkers(model, id, []);
95
+ monaco.editor.setModelMarkers(
96
+ monacoEditorRef.current.getModel(),
97
+ id,
98
+ []
99
+ );
115
100
  }
116
- } catch (err) {
117
- console.error('Error setting model markers:', err);
118
101
  }
119
- }, [error, monacoInstance, id]);
102
+ }, [JSON.stringify(error), monacoEditorRef.current]);
120
103
 
121
- // Configure TypeScript settings once when Monaco loads
122
104
  React.useEffect(() => {
123
- if (!monacoInstance) return;
124
-
125
- try {
126
- monacoInstance.languages.typescript.typescriptDefaults.setEagerModelSync(
127
- true
128
- );
129
- monacoInstance.languages.typescript.typescriptDefaults.setDiagnosticsOptions(
130
- {
131
- noSemanticValidation: true,
132
- noSyntaxValidation: true,
133
- }
134
- );
135
- } catch (err) {
136
- console.error('Error configuring Monaco TypeScript settings:', err);
105
+ if (monaco) {
106
+ monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true);
107
+ monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
108
+ // disable errors
109
+ noSemanticValidation: true,
110
+ noSyntaxValidation: true,
111
+ });
112
+ // TODO: autocomplete suggestions
113
+ // monaco.languages.registerCompletionItemProvider('markdown', {
114
+ // provideCompletionItems: function (model, position) {
115
+ // const word = model.getWordUntilPosition(position)
116
+ // const range = {
117
+ // startLineNumber: position.lineNumber,
118
+ // endLineNumber: position.lineNumber,
119
+ // startColumn: word.startColumn,
120
+ // endColumn: word.endColumn,
121
+ // }
122
+ // return {
123
+ // suggestions: [
124
+ // {
125
+ // label: '<DateTime />',
126
+ // insertText: '<DateTime format="iso" />',
127
+ // kind: 0,
128
+ // range,
129
+ // },
130
+ // ],
131
+ // }
132
+ // },
133
+ // })
137
134
  }
138
- }, [monacoInstance]);
135
+ }, [monaco]);
139
136
 
140
137
  function handleEditorDidMount(
141
- editor: monaco.editor.IStandaloneCodeEditor,
138
+ monacoEditor: monaco.editor.IStandaloneCodeEditor,
142
139
  monaco: Monaco
143
140
  ) {
144
- if (!editor) return;
145
-
146
- try {
147
- editorRef.current = editor;
148
-
149
- // Focus the editor once when mounted
150
- setTimeout(() => editor.focus(), 100);
151
-
152
- // Set up content size listener
153
- editor.onDidContentSizeChange(() => {
154
- const contentHeight = editor.getContentHeight();
155
- setHeight(Math.min(Math.max(100, contentHeight), 1000));
156
- editor.layout();
141
+ if (monacoEditor) {
142
+ monacoEditorRef.current = monacoEditor;
143
+ monacoEditor.onDidContentSizeChange(() => {
144
+ // FIXME: if the window is too tall the performance degrades, come up with a nice
145
+ // balance between the two
146
+ setHeight(
147
+ Math.min(Math.max(100, monacoEditor.getContentHeight()), 1000)
148
+ );
149
+ monacoEditor.layout();
157
150
  });
158
- } catch (err) {
159
- console.error('Error in editor mount handler:', err);
160
151
  }
161
152
  }
162
153
 
@@ -170,8 +161,14 @@ export const RawEditor = (props: RichTextType) => {
170
161
  </div>
171
162
  <div style={{ height: `${height}px` }}>
172
163
  <MonacoEditor
164
+ beforeMount={() => {}}
165
+ height='100%'
166
+ width='100%'
173
167
  path={id}
174
168
  onMount={handleEditorDidMount}
169
+ // Setting a custom theme is kind of buggy because it doesn't get defined until monaco has mounted.
170
+ // So we end up with the default (light) theme in some scenarios. Seems like a race condition.
171
+ // theme="vs-dark"
175
172
  options={{
176
173
  scrollBeyondLastLine: false,
177
174
  tabSize: 2,
@@ -189,19 +186,23 @@ export const RawEditor = (props: RichTextType) => {
189
186
  lineNumbersMinChars: 2,
190
187
  formatOnType: true,
191
188
  fixedOverflowWidgets: true,
189
+ // Takes too much horizontal space for iframe
192
190
  folding: false,
193
191
  renderLineHighlight: 'none',
194
192
  scrollbar: {
195
193
  verticalScrollbarSize: 4,
196
194
  horizontalScrollbarSize: 4,
195
+ // https://github.com/microsoft/monaco-editor/issues/2007#issuecomment-644425664
197
196
  alwaysConsumeMouseWheel: false,
198
197
  },
199
198
  }}
200
- language='markdown'
199
+ language={'markdown'}
201
200
  value={value}
202
- onChange={(newValue) => {
203
- if (newValue !== undefined) {
204
- setValue(newValue);
201
+ onChange={(value) => {
202
+ try {
203
+ setValue(value);
204
+ } catch (e) {
205
+ console.log('error', e);
205
206
  }
206
207
  }}
207
208
  />
@@ -214,10 +215,8 @@ const Button = (props) => {
214
215
  return (
215
216
  <button
216
217
  className={`${
217
- props.align === 'left'
218
- ? 'rounded-l-md border-r-0'
219
- : 'rounded-r-md border-l-0'
220
- } flex justify-center w-full shadow rounded-md bg-white cursor-pointer relative inline-flex items-center px-2 py-2 border border-gray-200 hover:text-white text-sm font-medium transition-all ease-out duration-150 hover:bg-blue-500 focus:z-10 focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500`}
218
+ props.align === 'left' ? 'rounded-l border-r-0' : 'rounded-r border-l-0'
219
+ } flex justify-center w-full shadow rounded bg-white cursor-pointer relative inline-flex items-center px-2 py-2 border border-gray-200 hover:text-white text-sm font-medium transition-all ease-out duration-150 hover:bg-blue-500 focus:z-10 focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500`}
221
220
  type='button'
222
221
  onClick={props.onClick}
223
222
  >
package/src/index.css CHANGED
@@ -13,6 +13,10 @@
13
13
  fill: currentColor;
14
14
  }
15
15
 
16
+ .font-libre-baskerville {
17
+ font-family: "Libre Baskerville", serif;
18
+ }
19
+
16
20
  body {
17
21
  margin: 0;
18
22
  padding: 0;
@@ -382,3 +386,8 @@ td.rdtYear:hover {
382
386
  .tina-date-field .rdtTime td {
383
387
  cursor: default;
384
388
  }
389
+
390
+ /* Override Radix UI Portal wrapper z-index for dropdown menus */
391
+ [data-radix-popper-content-wrapper] {
392
+ z-index: 10800 !important;
393
+ }
@@ -103,12 +103,11 @@ const addMetadataField = (
103
103
  kind: 'SelectionSet',
104
104
  selections: [],
105
105
  }),
106
- selections:
107
- [
108
- ...(node.selectionSet?.selections || []),
109
- METADATA_FIELD,
110
- CONTENT_SOURCE_FIELD,
111
- ] || [],
106
+ selections: [
107
+ ...(node.selectionSet?.selections || []),
108
+ METADATA_FIELD,
109
+ CONTENT_SOURCE_FIELD,
110
+ ],
112
111
  },
113
112
  };
114
113
  };
@@ -127,8 +126,7 @@ const addMetaFieldsToQuery = (
127
126
  kind: 'SelectionSet',
128
127
  selections: [],
129
128
  }),
130
- selections:
131
- [...(node.selectionSet?.selections || []), ...metaFields] || [],
129
+ selections: [...(node.selectionSet?.selections || []), ...metaFields],
132
130
  },
133
131
  };
134
132
  };
@@ -242,6 +240,7 @@ export const isNodeType = (type: G.GraphQLOutputType) => {
242
240
  return true;
243
241
  }
244
242
  }
243
+ return false;
245
244
  };
246
245
 
247
246
  export const isConnectionType = (type: G.GraphQLOutputType) => {
@@ -270,4 +269,5 @@ export const isConnectionType = (type: G.GraphQLOutputType) => {
270
269
  return true;
271
270
  }
272
271
  }
272
+ return false;
273
273
  };
@@ -45,7 +45,7 @@ const sysSchema = z.object({
45
45
  collection: z.object({
46
46
  name: z.string(),
47
47
  slug: z.string(),
48
- label: z.string(),
48
+ label: z.string().optional().nullable(),
49
49
  path: z.string(),
50
50
  format: z.string().optional().nullable(),
51
51
  matches: z.string().optional().nullable(),
@@ -305,6 +305,7 @@ export const useGraphQLReducer = (
305
305
  prefix: '',
306
306
  };
307
307
  }
308
+
308
309
  if (isConnectionType(info.returnType)) {
309
310
  const name = G.getNamedType(info.returnType).name;
310
311
  const connectionCollection = tinaSchema
@@ -339,6 +340,7 @@ export const useGraphQLReducer = (
339
340
  const maybeResolvedDocument = resolvedDocuments.find(
340
341
  (doc) => doc._internalSys.path === value
341
342
  );
343
+
342
344
  // If we already have this document, use it.
343
345
  if (maybeResolvedDocument) {
344
346
  resolvedDocument = maybeResolvedDocument;
@@ -349,6 +351,7 @@ export const useGraphQLReducer = (
349
351
  // here and just grab it from the response
350
352
  const maybeResolvedDocument =
351
353
  documentSchema.parse(valueFromSetup);
354
+
352
355
  if (maybeResolvedDocument._internalSys.path === value) {
353
356
  resolvedDocument = maybeResolvedDocument;
354
357
  } else {
@@ -559,12 +562,14 @@ export const useGraphQLReducer = (
559
562
  payload,
560
563
  ]);
561
564
  }
562
- if (event.data.type === 'url-changed') {
563
- cms.dispatch({
564
- type: 'sidebar:set-loading-state',
565
- value: true,
566
- });
567
- }
565
+ // TODO: This is causing a webpack HMR issue - look into refactoring this logic
566
+ // if (event.data.type === 'url-changed') {
567
+ // console.log('[EVENT_TRIGGERED] url-changed: ', event);
568
+ // cms.dispatch({
569
+ // type: 'sidebar:set-loading-state',
570
+ // value: true,
571
+ // });
572
+ // }
568
573
  },
569
574
  [cms, JSON.stringify(results)]
570
575
  );
package/src/lib/util.ts CHANGED
@@ -108,27 +108,22 @@ export const getFormAndFieldNameFromMetadata = (
108
108
  object: object,
109
109
  eventFieldName: string
110
110
  ) => {
111
- let formId;
112
- let n;
113
- const value = getDeepestMetadata(object, eventFieldName);
114
- if (value) {
115
- if (value.prefix) {
116
- const fieldName = eventFieldName.slice(value?.prefix?.length + 1);
117
- const localFieldName = value.name
118
- ? fieldName.slice(value?.name?.length + 1)
119
- : fieldName;
120
- if (localFieldName) {
121
- // If localFieldName is tags.2, just use `tags`
122
- if (!isNaN(Number(localFieldName.split('.')[1]))) {
123
- n = value.fields[localFieldName.split('.')[0]];
124
- } else {
125
- n = value.fields[localFieldName];
126
- }
127
- } else {
128
- n = value.name;
129
- }
130
- formId = value.id;
131
- }
111
+ const metadata = getDeepestMetadata(object, eventFieldName);
112
+
113
+ if (!metadata) {
114
+ console.warn(
115
+ '[getFormAndFieldNameFromMetadata] No metadata found for:',
116
+ eventFieldName
117
+ );
118
+ return { formId: undefined, fieldName: undefined };
132
119
  }
133
- return { formId, fieldName: n };
120
+
121
+ const { id: formId, prefix } = metadata;
122
+ const prefixLength = prefix?.length ?? 0;
123
+ const localFieldName = eventFieldName.slice(prefixLength + 1);
124
+
125
+ return {
126
+ formId,
127
+ fieldName: localFieldName,
128
+ };
134
129
  };
@@ -1,53 +0,0 @@
1
- import { loader } from '@monaco-editor/react';
2
- import * as monaco from 'monaco-editor';
3
- // hooks/useCustomMonaco.ts
4
- import { useEffect, useRef, useState } from 'react';
5
-
6
- export function useCustomMonaco() {
7
- const [monacoInstance, setMonacoInstance] = useState<typeof monaco | null>(
8
- null
9
- );
10
- const mountedRef = useRef(true);
11
- const loaderRef = useRef<any>(null);
12
-
13
- useEffect(() => {
14
- const instance = loader.__getMonacoInstance();
15
-
16
- if (instance) {
17
- setMonacoInstance(instance);
18
- return;
19
- }
20
-
21
- if (!loaderRef.current) {
22
- loader.config({
23
- 'vs/nls': { availableLanguages: {} },
24
- });
25
-
26
- try {
27
- loaderRef.current = loader.init();
28
-
29
- loaderRef.current
30
- .then((monacoApi: typeof monaco) => {
31
- if (mountedRef.current) {
32
- setMonacoInstance(monacoApi);
33
- }
34
- })
35
- .catch((error: any) => {
36
- if (mountedRef.current && error.type !== 'cancelation') {
37
- console.error('Monaco initialization error:', error);
38
- }
39
- });
40
- } catch (err) {
41
- console.error('Failed to initialize Monaco:', err);
42
- }
43
- }
44
-
45
- return () => {
46
- mountedRef.current = false;
47
- };
48
- }, []);
49
-
50
- return monacoInstance;
51
- }
52
-
53
- export default useCustomMonaco;