gt-sanity 0.0.5 → 1.0.0

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.
Files changed (108) hide show
  1. package/LICENSE.md +1 -8
  2. package/README.md +5 -5
  3. package/dist/index.d.mts +122 -95
  4. package/dist/index.d.ts +122 -95
  5. package/dist/index.js +9089 -1119
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +9099 -1100
  8. package/dist/index.mjs.map +1 -1
  9. package/package.json +11 -4
  10. package/src/adapter/core.ts +111 -9
  11. package/src/adapter/createTask.ts +1 -1
  12. package/src/adapter/getLocales.ts +2 -2
  13. package/src/adapter/types.ts +9 -0
  14. package/src/components/TranslationsProvider.tsx +942 -0
  15. package/src/components/page/BatchProgress.tsx +27 -0
  16. package/src/components/page/ImportAllDialog.tsx +51 -0
  17. package/src/components/page/ImportMissingDialog.tsx +55 -0
  18. package/src/components/page/TranslateAllDialog.tsx +55 -0
  19. package/src/components/page/TranslationsTable.tsx +81 -0
  20. package/src/components/page/TranslationsTool.tsx +338 -0
  21. package/src/components/shared/BaseTranslationWrapper.tsx +82 -0
  22. package/src/components/{LanguageStatus.tsx → shared/LanguageStatus.tsx} +2 -0
  23. package/src/components/shared/LocaleCheckbox.tsx +47 -0
  24. package/src/components/{ProgressBar.tsx → shared/ProgressBar.tsx} +2 -0
  25. package/src/components/shared/SingleDocumentView.tsx +108 -0
  26. package/src/components/tab/TranslationView.tsx +379 -0
  27. package/src/components/tab/TranslationsTab.tsx +25 -0
  28. package/src/configuration/baseDocumentLevelConfig/documentLevelPatch.ts +21 -11
  29. package/src/configuration/baseDocumentLevelConfig/helpers/createI18nDocAndPatchMetadata.ts +57 -23
  30. package/src/configuration/baseDocumentLevelConfig/helpers/createTranslationMetadata.ts +2 -0
  31. package/src/configuration/baseDocumentLevelConfig/helpers/getOrCreateTranslationMetadata.ts +2 -0
  32. package/src/configuration/baseDocumentLevelConfig/helpers/getTranslationMetadata.ts +2 -0
  33. package/src/configuration/baseDocumentLevelConfig/helpers/patchI18nDoc.ts +31 -8
  34. package/src/configuration/baseDocumentLevelConfig/index.ts +18 -101
  35. package/src/configuration/baseFieldLevelConfig.ts +19 -51
  36. package/src/configuration/utils/checkSerializationVersion.ts +2 -0
  37. package/src/configuration/utils/findDocumentAtRevision.ts +2 -0
  38. package/src/configuration/utils/findLatestDraft.ts +2 -0
  39. package/src/hooks/useClient.ts +3 -1
  40. package/src/hooks/useSecrets.ts +2 -0
  41. package/src/index.ts +91 -67
  42. package/src/sanity-api/findDocuments.ts +44 -0
  43. package/src/sanity-api/publishDocuments.ts +49 -0
  44. package/src/sanity-api/resolveRefs.ts +146 -0
  45. package/src/serialization/BaseDocumentMerger.ts +138 -0
  46. package/src/serialization/BaseSerializationConfig.ts +220 -0
  47. package/src/serialization/__tests__/BaseDocumentDeserializer/__snapshots__/documentLevelDeserialization.test.ts.snap +189 -0
  48. package/src/serialization/__tests__/BaseDocumentDeserializer/__snapshots__/fieldLevelDeserialization.test.ts.snap +107 -0
  49. package/src/serialization/__tests__/BaseDocumentDeserializer/baseDeserialization.test.ts +397 -0
  50. package/src/serialization/__tests__/BaseDocumentDeserializer/documentLevelDeserialization.test.ts +107 -0
  51. package/src/serialization/__tests__/BaseDocumentDeserializer/fieldLevelDeserialization.test.ts +107 -0
  52. package/src/serialization/__tests__/BaseDocumentMerger/__snapshots__/documentLevelMerge.test.ts.snap +193 -0
  53. package/src/serialization/__tests__/BaseDocumentMerger/__snapshots__/fieldLevelMerge.test.ts.snap +97 -0
  54. package/src/serialization/__tests__/BaseDocumentMerger/baseMerge.test.ts +36 -0
  55. package/src/serialization/__tests__/BaseDocumentMerger/documentLevelMerge.test.ts +96 -0
  56. package/src/serialization/__tests__/BaseDocumentMerger/fieldLevelMerge.test.ts +142 -0
  57. package/src/serialization/__tests__/BaseDocumentMerger/utils.ts +52 -0
  58. package/src/serialization/__tests__/BaseDocumentSerializer/__snapshots__/documentInlineMarks.test.ts.snap +39 -0
  59. package/src/serialization/__tests__/BaseDocumentSerializer/__snapshots__/documentLevelSerialization.test.ts.snap +8 -0
  60. package/src/serialization/__tests__/BaseDocumentSerializer/__snapshots__/fieldLevelSerialization.test.ts.snap +8 -0
  61. package/src/serialization/__tests__/BaseDocumentSerializer/baseSerialization.test.ts +345 -0
  62. package/src/serialization/__tests__/BaseDocumentSerializer/documentInlineMarks.test.ts +53 -0
  63. package/src/serialization/__tests__/BaseDocumentSerializer/documentLevelSerialization.test.ts +120 -0
  64. package/src/serialization/__tests__/BaseDocumentSerializer/fieldLevelSerialization.test.ts +153 -0
  65. package/src/serialization/__tests__/BaseDocumentSerializer/utils.ts +27 -0
  66. package/src/serialization/__tests__/README +2 -0
  67. package/src/serialization/__tests__/__fixtures__/annotationAndInlineBlocks.json +140 -0
  68. package/src/serialization/__tests__/__fixtures__/customStyles.json +62 -0
  69. package/src/serialization/__tests__/__fixtures__/documentInlineMarks.json +70 -0
  70. package/src/serialization/__tests__/__fixtures__/documentLevelArticle.json +185 -0
  71. package/src/serialization/__tests__/__fixtures__/fieldLevelArticle.json +107 -0
  72. package/src/serialization/__tests__/__fixtures__/inlineDocumentLevelArticle.json +134 -0
  73. package/src/serialization/__tests__/__fixtures__/inlineSchema.ts +270 -0
  74. package/src/serialization/__tests__/__fixtures__/messy-html.html +26 -0
  75. package/src/serialization/__tests__/__fixtures__/nestedLanguageFields.json +54 -0
  76. package/src/serialization/__tests__/__fixtures__/schema.ts +310 -0
  77. package/src/serialization/__tests__/global.setup.ts +40 -0
  78. package/src/serialization/__tests__/helpers.ts +132 -0
  79. package/src/serialization/data.ts +82 -0
  80. package/src/serialization/deserialize/BaseDocumentDeserializer.ts +171 -0
  81. package/src/serialization/deserialize/helpers.ts +42 -0
  82. package/src/serialization/helpers.ts +18 -0
  83. package/src/serialization/index.ts +11 -0
  84. package/src/serialization/serialize/fieldFilters.ts +124 -0
  85. package/src/serialization/serialize/index.ts +284 -0
  86. package/src/serialization/types.ts +41 -0
  87. package/src/translation/checkTranslationStatus.ts +42 -0
  88. package/src/translation/createJobs.ts +16 -0
  89. package/src/translation/downloadTranslations.ts +68 -0
  90. package/src/translation/importDocument.ts +23 -0
  91. package/src/translation/initProject.ts +61 -0
  92. package/src/translation/uploadFiles.ts +32 -0
  93. package/src/types.ts +7 -20
  94. package/src/utils/applyDocuments.ts +72 -0
  95. package/src/utils/batchProcessor.ts +111 -0
  96. package/src/utils/importUtils.ts +95 -0
  97. package/src/utils/serialize.ts +52 -0
  98. package/src/utils/shared.ts +1 -0
  99. package/src/adapter/index.ts +0 -13
  100. package/src/components/NewTask.tsx +0 -249
  101. package/src/components/TaskView.tsx +0 -255
  102. package/src/components/TranslationContext.tsx +0 -19
  103. package/src/components/TranslationView.tsx +0 -82
  104. package/src/components/TranslationsTab.tsx +0 -177
  105. package/src/configuration/baseDocumentLevelConfig/helpers/index.ts +0 -5
  106. package/src/configuration/baseDocumentLevelConfig/legacyDocumentLevelPatch.ts +0 -69
  107. package/src/configuration/index.ts +0 -18
  108. package/src/configuration/utils/index.ts +0 -3
@@ -0,0 +1,120 @@
1
+ import { PortableTextBlock } from 'sanity';
2
+ import { describe, expect, test } from 'vitest';
3
+ import { getSerialized, getValidFields, toPlainText } from '../helpers';
4
+ import { documentLevelArticle, findByClass, getHTMLNode } from './utils';
5
+
6
+ const serialized = getSerialized(documentLevelArticle, 'document');
7
+ const docTree = getHTMLNode(serialized).body.children[0];
8
+
9
+ test('Global test of working doc-level functionality and snapshot match', () => {
10
+ expect(serialized).toMatchSnapshot();
11
+ });
12
+ /*
13
+ * Top-level plain text
14
+ */
15
+ test('String and text types get serialized correctly at top-level', () => {
16
+ const HTMLString = findByClass(docTree.children, 'title');
17
+ const HTMLText = findByClass(docTree.children, 'snippet');
18
+ expect(HTMLString?.innerHTML).toEqual(documentLevelArticle.title);
19
+ expect(HTMLText?.innerHTML).toEqual(documentLevelArticle.snippet);
20
+ });
21
+
22
+ /*
23
+ * Presence and accuracy of fields
24
+ */
25
+ describe('Presence and accuracy of fields in "vanilla" deserialization -- objects', () => {
26
+ //parent node is always div with classname of field with a nested div
27
+ //that has classname of obj type
28
+ const configObj = findByClass(docTree.children, 'config');
29
+ const objectField = configObj!.children[0];
30
+
31
+ test('Top-level nested objects contain all serializable fields -- document level', () => {
32
+ const fieldNames = getValidFields(documentLevelArticle.config);
33
+ const foundFieldNames = Array.from(objectField!.children).map(
34
+ (child) => child.className
35
+ );
36
+ expect(foundFieldNames.sort()).toEqual(fieldNames.sort());
37
+ });
38
+
39
+ test('Nested object in object contains all serializable fields -- document level', () => {
40
+ const nestedObject = findByClass(objectField!.children, 'objectAsField')!
41
+ .children[0];
42
+ const fieldNames = getValidFields(
43
+ documentLevelArticle.config.objectAsField
44
+ );
45
+ const foundFieldNames = Array.from(nestedObject!.children).map(
46
+ (child) => child.className
47
+ );
48
+ expect(foundFieldNames.sort()).toEqual(fieldNames.sort());
49
+ });
50
+
51
+ test('Nested object contains accurate values -- document level', () => {
52
+ const title = documentLevelArticle.config.title;
53
+ const blockText = toPlainText(documentLevelArticle.config.nestedArrayField);
54
+
55
+ expect(objectField?.innerHTML).toContain(title);
56
+ expect(objectField?.innerHTML).toContain(blockText);
57
+ });
58
+
59
+ test('Nested object in an object contains accurate values -- document level', () => {
60
+ const nestedObject = findByClass(objectField!.children, 'objectAsField')!
61
+ .children[0];
62
+ const title = documentLevelArticle.config.objectAsField.title;
63
+ const blockText = toPlainText(
64
+ documentLevelArticle.config.objectAsField.content
65
+ );
66
+
67
+ expect(nestedObject.innerHTML).toContain(title);
68
+ expect(nestedObject.innerHTML).toContain(blockText);
69
+ });
70
+ });
71
+
72
+ describe('Presence and accuracy of fields in vanilla deserialization -- arrays', () => {
73
+ const arrayField = findByClass(docTree.children, 'content');
74
+
75
+ test('Array contains all serializable blocks with keys, in order -- document level', () => {
76
+ const origKeys = documentLevelArticle.content.map(
77
+ (block: PortableTextBlock) => block._key
78
+ );
79
+ const serializedKeys = Array.from(arrayField!.children).map(
80
+ (block) => block.id
81
+ );
82
+ expect(serializedKeys).toEqual(origKeys);
83
+ });
84
+
85
+ test('Array contains top-level block text -- document level', () => {
86
+ const blockText = toPlainText(documentLevelArticle.content).trim();
87
+ const blockStrings = blockText.split('\n\n');
88
+ blockStrings.forEach((substring: string) =>
89
+ expect(arrayField?.innerHTML).toContain(substring)
90
+ );
91
+ });
92
+
93
+ test('Object in array contains all serializable fields -- document level', () => {
94
+ const objectInArray = findByClass(arrayField!.children, 'objectField');
95
+ const fieldNames = getValidFields(
96
+ documentLevelArticle.content.find(
97
+ (block: Record<string, any>) => block._type === 'objectField'
98
+ )
99
+ );
100
+ const foundFieldNames = Array.from(objectInArray!.children).map(
101
+ (child) => child.className
102
+ );
103
+ expect(foundFieldNames.sort()).toEqual(fieldNames.sort());
104
+ });
105
+
106
+ test('Object in array contains accurate values in nested object -- document level', () => {
107
+ const objectInArray = findByClass(arrayField!.children, 'objectField');
108
+ const nestedObject = findByClass(objectInArray!.children, 'objectAsField');
109
+ const title = documentLevelArticle.content.find(
110
+ (block: Record<string, any>) => block._type === 'objectField'
111
+ ).objectAsField.title;
112
+ const blockText = toPlainText(
113
+ documentLevelArticle.content.find(
114
+ (block: Record<string, any>) => block._type === 'objectField'
115
+ ).objectAsField.content
116
+ ).trim();
117
+ expect(nestedObject?.innerHTML).toContain(title);
118
+ expect(nestedObject?.innerHTML).toContain(blockText);
119
+ });
120
+ });
@@ -0,0 +1,153 @@
1
+ import { PortableTextBlock } from 'sanity';
2
+ import { describe, expect, test } from 'vitest';
3
+ import { getSerialized, getValidFields, toPlainText } from '../helpers';
4
+ import {
5
+ fieldLevelArticle,
6
+ findByClass,
7
+ getHTMLNode,
8
+ nestedLanguageFields,
9
+ } from './utils';
10
+
11
+ const serialized = getSerialized(fieldLevelArticle, 'field');
12
+ const docTree = getHTMLNode(serialized).body.children[0];
13
+
14
+ test('Global test of working field-level functionality and snapshot match', () => {
15
+ expect(serialized).toMatchSnapshot();
16
+ });
17
+
18
+ test('String and text types get serialized correctly at top-level -- field level', () => {
19
+ const titleObj = findByClass(docTree.children, 'title')?.children[0];
20
+ const HTMLString = findByClass(titleObj!.children, 'en');
21
+ const snippetObj = findByClass(docTree.children, 'snippet')?.children[0];
22
+ const HTMLText = findByClass(snippetObj!.children, 'en');
23
+ expect(HTMLString?.innerHTML).toEqual(fieldLevelArticle.title.en);
24
+ expect(HTMLText?.innerHTML).toEqual(fieldLevelArticle.snippet.en);
25
+ });
26
+
27
+ describe('Presence and accuracy of fields in "vanilla" deserialization -- objects', () => {
28
+ const getFieldLevelObjectField = () => {
29
+ const config = findByClass(docTree.children, 'config')?.children[0];
30
+ //return english field
31
+ const englishConfig = findByClass(config!.children, 'en');
32
+ return findByClass(englishConfig!.children, 'objectField');
33
+ };
34
+
35
+ const objectField = getFieldLevelObjectField();
36
+
37
+ test('Top-level nested objects contain all serializable fields -- field level', () => {
38
+ const fieldNames = getValidFields(fieldLevelArticle.config.en);
39
+ const foundFieldNames = Array.from(objectField!.children).map(
40
+ (child) => child.className
41
+ );
42
+
43
+ expect(foundFieldNames.sort()).toEqual(fieldNames.sort());
44
+ });
45
+
46
+ test('Nested object in object contains all serializable fields -- field Level', () => {
47
+ const nestedObject = findByClass(objectField!.children, 'objectAsField')!
48
+ .children[0];
49
+ const fieldNames = getValidFields(
50
+ fieldLevelArticle.config.en.objectAsField
51
+ );
52
+ const foundFieldNames = Array.from(nestedObject!.children).map(
53
+ (child) => child.className
54
+ );
55
+ expect(foundFieldNames.sort()).toEqual(fieldNames.sort());
56
+ });
57
+
58
+ test('Nested object contains accurate values -- field level', () => {
59
+ const title = fieldLevelArticle.config.en.title;
60
+ const blockText = toPlainText(fieldLevelArticle.config.en.nestedArrayField);
61
+
62
+ expect(objectField?.innerHTML).toContain(title);
63
+ expect(objectField?.innerHTML).toContain(blockText);
64
+ });
65
+
66
+ test('Nested object in an object contains accurate values -- field level', () => {
67
+ const nestedObject = findByClass(objectField!.children, 'objectAsField')!
68
+ .children[0];
69
+ const title = fieldLevelArticle.config.en.objectAsField.title;
70
+ const blockText = toPlainText(
71
+ fieldLevelArticle.config.en.objectAsField.content
72
+ );
73
+
74
+ expect(nestedObject.innerHTML).toContain(title);
75
+ expect(nestedObject.innerHTML).toContain(blockText);
76
+ });
77
+ });
78
+
79
+ /*
80
+ * Presence and accuracy of fields in "vanilla" deserialization -- arrays
81
+ */
82
+ describe('Presence and accurancy of fields in "vanilla" deserialization -- arrays', () => {
83
+ const getFieldLevelArrayField = () => {
84
+ const content = findByClass(docTree.children, 'content')?.children[0];
85
+ return findByClass(content!.children, 'en');
86
+ };
87
+ const arrayField = getFieldLevelArrayField();
88
+
89
+ test('Array contains all serializable blocks with keys, in order -- field level', () => {
90
+ const origKeys = fieldLevelArticle.content.en.map(
91
+ (block: PortableTextBlock) => block._key
92
+ );
93
+ const serializedKeys = Array.from(arrayField!.children).map(
94
+ (block) => block.id
95
+ );
96
+ expect(serializedKeys).toEqual(origKeys);
97
+ });
98
+
99
+ test('Array contains top-level block text -- field level', () => {
100
+ const blockText = toPlainText(fieldLevelArticle.content.en).trim();
101
+ expect(arrayField?.innerHTML).toContain(blockText);
102
+ });
103
+
104
+ test('Object in array contains all serializable fields -- field level', () => {
105
+ const objectInArray = findByClass(arrayField!.children, 'objectField');
106
+ const fieldNames = getValidFields(
107
+ fieldLevelArticle.content.en.find(
108
+ (block: Record<string, any>) => block._type === 'objectField'
109
+ )
110
+ );
111
+ const foundFieldNames = Array.from(objectInArray!.children).map(
112
+ (child) => child.className
113
+ );
114
+ expect(foundFieldNames.sort()).toEqual(fieldNames.sort());
115
+ });
116
+
117
+ test('Object in array contains accurate values in nested object -- field level', () => {
118
+ const objectInArray = findByClass(arrayField!.children, 'objectField');
119
+ const nestedObject = findByClass(objectInArray!.children, 'objectAsField');
120
+ const title = fieldLevelArticle.content.en.find(
121
+ (block: Record<string, any>) => block._type === 'objectField'
122
+ ).objectAsField.title;
123
+ const blockText = toPlainText(
124
+ fieldLevelArticle.content.en.find(
125
+ (block: Record<string, any>) => block._type === 'objectField'
126
+ ).objectAsField.content
127
+ ).trim();
128
+ expect(nestedObject?.innerHTML).toContain(title);
129
+ expect(nestedObject?.innerHTML).toContain(blockText);
130
+ });
131
+ });
132
+
133
+ test('Nested locale fields make it to serialization, but only base lang', () => {
134
+ const nestedLocales = { ...fieldLevelArticle, ...nestedLanguageFields };
135
+ const nestedSerialized = getSerialized(nestedLocales, 'field');
136
+ const nestedDocTree = getHTMLNode(nestedSerialized).body.children[0];
137
+ const slices = findByClass(nestedDocTree.children, 'slices');
138
+ const pageFields = findByClass(nestedDocTree.children, 'pageFields');
139
+ expect(slices?.innerHTML).toContain(
140
+ nestedLanguageFields.slices[0].en[0].children[0].text
141
+ );
142
+ expect(pageFields?.innerHTML).toContain(
143
+ nestedLanguageFields.pageFields.name.en
144
+ );
145
+ expect(slices?.innerHTML).not.toContain(
146
+ nestedLanguageFields.slices[0].fr_FR[0].children[0].text
147
+ );
148
+ expect(pageFields?.innerHTML).not.toContain(
149
+ nestedLanguageFields.pageFields.name.fr_FR
150
+ );
151
+ });
152
+
153
+ //also test: setting different base language!
@@ -0,0 +1,27 @@
1
+ import { createRequire } from 'module';
2
+
3
+ import { SerializedDocument } from '../../types';
4
+
5
+ const require = createRequire(import.meta.url);
6
+
7
+ export { default as inlineSchema } from '../__fixtures__/inlineSchema';
8
+ export { default as schema } from '../__fixtures__/schema';
9
+ export const documentLevelArticle = require('../__fixtures__/documentLevelArticle.json');
10
+ export const docWithInlineMarks = require('../__fixtures__/documentInlineMarks.json');
11
+ export const inlineDocumentLevelArticle = require('../__fixtures__/inlineDocumentLevelArticle.json');
12
+ export const fieldLevelArticle = require('../__fixtures__/fieldLevelArticle.json');
13
+ export const annotationAndInlineBlocks = require('../__fixtures__/annotationAndInlineBlocks.json');
14
+ export const nestedLanguageFields = require('../__fixtures__/nestedLanguageFields.json');
15
+
16
+ export const getHTMLNode = (serialized: SerializedDocument): Document => {
17
+ const htmlString = serialized.content;
18
+ const parser = new DOMParser();
19
+ return parser.parseFromString(htmlString, 'text/html');
20
+ };
21
+
22
+ export const findByClass = (
23
+ children: HTMLCollection,
24
+ className: string
25
+ ): Element | undefined => {
26
+ return Array.from(children).find((node) => node.className === className);
27
+ };
@@ -0,0 +1,2 @@
1
+ Files in this directory are adapted from https://github.com/sanity-io/sanity-naive-html-serializer
2
+ and are licensed under MIT. See LICENSE.md for more details.
@@ -0,0 +1,140 @@
1
+ {
2
+ "content": [
3
+ {
4
+ "_key": "6fe9a3ecaf0f",
5
+ "style": "normal",
6
+ "markDefs": [],
7
+ "_type": "block",
8
+ "listItem": "number",
9
+ "level": 1,
10
+ "children": [
11
+ {
12
+ "_type": "span",
13
+ "marks": [],
14
+ "text": "",
15
+ "_key": "47eb0224d6b5"
16
+ },
17
+ {
18
+ "_key": "d3dcb15f4bfe",
19
+ "_type": "childObjectField",
20
+ "title": "This is an inline object in a top-level block list"
21
+ }
22
+ ]
23
+ },
24
+ {
25
+ "_key": "a1b026261117",
26
+ "_type": "block",
27
+ "markDefs": [],
28
+ "style": "normal",
29
+ "level": 2,
30
+ "listItem": "number",
31
+ "children": [
32
+ {
33
+ "_key": "d3dcb15f4bfe",
34
+ "_type": "childObjectField",
35
+ "title": "This is an inline object in a nested list item"
36
+ }
37
+ ]
38
+ },
39
+ {
40
+ "_key": "0e55995095df",
41
+ "_type": "block",
42
+ "children": [
43
+ {
44
+ "_key": "a94d5e26cc99",
45
+ "_type": "span",
46
+ "marks": [],
47
+ "text": "This is block "
48
+ },
49
+ {
50
+ "_key": "3d31216296ab",
51
+ "_type": "span",
52
+ "marks": ["2f5ec56ab061"],
53
+ "text": "text"
54
+ },
55
+ {
56
+ "_key": "d669ccc1799e",
57
+ "_type": "span",
58
+ "marks": [],
59
+ "text": " at the top level. "
60
+ },
61
+ {
62
+ "_key": "0871af4fa11c",
63
+ "_type": "childObjectField",
64
+ "title": "This is an inline object in a top-level block text field"
65
+ },
66
+ {
67
+ "_key": "be01d00a77a2",
68
+ "_type": "span",
69
+ "marks": [],
70
+ "text": ""
71
+ }
72
+ ],
73
+ "markDefs": [
74
+ {
75
+ "_key": "2f5ec56ab061",
76
+ "_type": "annotation",
77
+ "content": [
78
+ {
79
+ "_key": "f94daf68d620",
80
+ "_type": "block",
81
+ "children": [
82
+ {
83
+ "_key": "0f9944aec4a2",
84
+ "_type": "span",
85
+ "marks": [],
86
+ "text": "This is an annotation on the word \"text\" on block-level content"
87
+ }
88
+ ],
89
+ "markDefs": [],
90
+ "style": "normal"
91
+ }
92
+ ],
93
+ "title": "Annotation"
94
+ }
95
+ ],
96
+ "style": "normal"
97
+ },
98
+ {
99
+ "_key": "7e1268803bda",
100
+ "_type": "objectField",
101
+ "nestedArrayField": [
102
+ {
103
+ "_key": "40703bc96a33",
104
+ "_type": "block",
105
+ "children": [
106
+ {
107
+ "_key": "103500a73aa4",
108
+ "_type": "span",
109
+ "marks": [],
110
+ "text": "This is block text in a nested object."
111
+ }
112
+ ],
113
+ "markDefs": [],
114
+ "style": "normal"
115
+ }
116
+ ],
117
+ "objectAsField": {
118
+ "_type": "childObjectField",
119
+ "content": [
120
+ {
121
+ "_key": "663b9b01b63a",
122
+ "_type": "block",
123
+ "children": [
124
+ {
125
+ "_key": "c64b6cda3790",
126
+ "_type": "span",
127
+ "marks": [],
128
+ "text": "This is block text in a nested object in an object in top-level block text."
129
+ }
130
+ ],
131
+ "markDefs": [],
132
+ "style": "normal"
133
+ }
134
+ ],
135
+ "title": "This is a nested object in an object in top-level block text."
136
+ },
137
+ "title": "This is an object in top-level block text."
138
+ }
139
+ ]
140
+ }
@@ -0,0 +1,62 @@
1
+ {
2
+ "content": [
3
+ {
4
+ "_key": "a4d177e92666",
5
+ "_type": "block",
6
+ "children": [
7
+ {
8
+ "_key": "a896ea6fcd59",
9
+ "_type": "span",
10
+ "marks": [],
11
+ "text": "This is block text at the top level."
12
+ }
13
+ ],
14
+ "markDefs": [],
15
+ "style": "custom1"
16
+ },
17
+ {
18
+ "_key": "6fe9a3ecaf0f",
19
+ "style": "custom1",
20
+ "markDefs": [],
21
+ "_type": "block",
22
+ "listItem": "number",
23
+ "level": 1,
24
+ "children": [
25
+ {
26
+ "_type": "span",
27
+ "marks": [],
28
+ "text": "This is custom-styled text in a list item",
29
+ "_key": "47eb0224d6b5"
30
+ }
31
+ ]
32
+ },
33
+ {
34
+ "_key": "9e2ab13c6d63",
35
+ "_type": "block",
36
+ "children": [
37
+ {
38
+ "_key": "17e856dc4766",
39
+ "_type": "span",
40
+ "marks": [],
41
+ "text": "This is h1 text"
42
+ }
43
+ ],
44
+ "markDefs": [],
45
+ "style": "h1"
46
+ },
47
+ {
48
+ "_key": "297142fbaf21",
49
+ "_type": "block",
50
+ "children": [
51
+ {
52
+ "_key": "0b2f9e94a161",
53
+ "_type": "span",
54
+ "marks": [],
55
+ "text": "This is h2 text"
56
+ }
57
+ ],
58
+ "markDefs": [],
59
+ "style": "h2"
60
+ }
61
+ ]
62
+ }
@@ -0,0 +1,70 @@
1
+ {
2
+ "_id": "drafts.d8ffc675-ce86-4f60-9ac8-da164cde3b0a",
3
+ "_rev": "fxcnqj-uew-gr7-v6r-z965tfm69",
4
+ "_type": "documentLevelArticle",
5
+ "_createdAt": "2021-09-01T23:00:13Z",
6
+ "_updatedAt": "2021-09-01T23:02:05Z",
7
+ "content": [
8
+ {
9
+ "_key": "a4d177e92666",
10
+ "_type": "block",
11
+ "children": [
12
+ {
13
+ "_key": "a896ea6fcd59",
14
+ "_type": "span",
15
+ "marks": [],
16
+ "text": "This is block text with "
17
+ },
18
+ {
19
+ "_key": "b997fb7gce60",
20
+ "_type": "span",
21
+ "marks": ["topLink1"],
22
+ "text": "a website link"
23
+ },
24
+ {
25
+ "_key": "c008gc8hdf71",
26
+ "_type": "span",
27
+ "marks": [],
28
+ "text": " and "
29
+ },
30
+ {
31
+ "_key": "d119hd9ieg82",
32
+ "_type": "span",
33
+ "marks": ["topLink2"],
34
+ "text": "a post reference"
35
+ },
36
+ {
37
+ "_key": "e220ie0jfh93",
38
+ "_type": "span",
39
+ "marks": ["topLink1"],
40
+ "text": " at the top level."
41
+ }
42
+ ],
43
+ "markDefs": [
44
+ {
45
+ "_key": "topLink1",
46
+ "_type": "linkField",
47
+ "linkType": "href",
48
+ "href": "https://example.com",
49
+ "openInNewTab": true
50
+ },
51
+ {
52
+ "_key": "topLink2",
53
+ "_type": "linkField",
54
+ "linkType": "post",
55
+ "post": {
56
+ "_ref": "post-123-abc",
57
+ "_type": "reference"
58
+ },
59
+ "openInNewTab": false
60
+ }
61
+ ],
62
+ "style": "normal"
63
+ }
64
+ ],
65
+ "hidden": true,
66
+ "meta": "Do not translate this",
67
+ "snippet": "This is text in my text field.",
68
+ "tags": ["tag 1", "tag 2", "tag 3"],
69
+ "title": "My Document-Level Article"
70
+ }