gt-sanity 0.0.6 → 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.
- package/LICENSE.md +1 -1
- package/dist/index.d.mts +95 -73
- package/dist/index.d.ts +95 -73
- package/dist/index.js +9066 -1207
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9083 -1197
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -3
- package/src/adapter/core.ts +41 -4
- package/src/adapter/getLocales.ts +2 -2
- package/src/components/TranslationsProvider.tsx +942 -0
- package/src/components/page/BatchProgress.tsx +27 -0
- package/src/components/page/ImportAllDialog.tsx +51 -0
- package/src/components/page/ImportMissingDialog.tsx +55 -0
- package/src/components/page/TranslateAllDialog.tsx +55 -0
- package/src/components/page/TranslationsTable.tsx +81 -0
- package/src/components/page/TranslationsTool.tsx +299 -837
- package/src/components/shared/BaseTranslationWrapper.tsx +82 -0
- package/src/components/shared/LocaleCheckbox.tsx +47 -0
- package/src/components/shared/SingleDocumentView.tsx +108 -0
- package/src/components/tab/TranslationView.tsx +379 -0
- package/src/components/tab/TranslationsTab.tsx +25 -0
- package/src/configuration/baseDocumentLevelConfig/documentLevelPatch.ts +6 -9
- package/src/configuration/baseDocumentLevelConfig/helpers/createI18nDocAndPatchMetadata.ts +5 -24
- package/src/configuration/baseDocumentLevelConfig/helpers/patchI18nDoc.ts +3 -23
- package/src/configuration/baseDocumentLevelConfig/index.ts +16 -68
- package/src/configuration/baseFieldLevelConfig.ts +15 -50
- package/src/index.ts +29 -43
- package/src/sanity-api/findDocuments.ts +44 -0
- package/src/sanity-api/publishDocuments.ts +49 -0
- package/src/sanity-api/resolveRefs.ts +146 -0
- package/src/serialization/BaseDocumentMerger.ts +138 -0
- package/src/serialization/BaseSerializationConfig.ts +220 -0
- package/src/serialization/__tests__/BaseDocumentDeserializer/__snapshots__/documentLevelDeserialization.test.ts.snap +189 -0
- package/src/serialization/__tests__/BaseDocumentDeserializer/__snapshots__/fieldLevelDeserialization.test.ts.snap +107 -0
- package/src/serialization/__tests__/BaseDocumentDeserializer/baseDeserialization.test.ts +397 -0
- package/src/serialization/__tests__/BaseDocumentDeserializer/documentLevelDeserialization.test.ts +107 -0
- package/src/serialization/__tests__/BaseDocumentDeserializer/fieldLevelDeserialization.test.ts +107 -0
- package/src/serialization/__tests__/BaseDocumentMerger/__snapshots__/documentLevelMerge.test.ts.snap +193 -0
- package/src/serialization/__tests__/BaseDocumentMerger/__snapshots__/fieldLevelMerge.test.ts.snap +97 -0
- package/src/serialization/__tests__/BaseDocumentMerger/baseMerge.test.ts +36 -0
- package/src/serialization/__tests__/BaseDocumentMerger/documentLevelMerge.test.ts +96 -0
- package/src/serialization/__tests__/BaseDocumentMerger/fieldLevelMerge.test.ts +142 -0
- package/src/serialization/__tests__/BaseDocumentMerger/utils.ts +52 -0
- package/src/serialization/__tests__/BaseDocumentSerializer/__snapshots__/documentInlineMarks.test.ts.snap +39 -0
- package/src/serialization/__tests__/BaseDocumentSerializer/__snapshots__/documentLevelSerialization.test.ts.snap +8 -0
- package/src/serialization/__tests__/BaseDocumentSerializer/__snapshots__/fieldLevelSerialization.test.ts.snap +8 -0
- package/src/serialization/__tests__/BaseDocumentSerializer/baseSerialization.test.ts +345 -0
- package/src/serialization/__tests__/BaseDocumentSerializer/documentInlineMarks.test.ts +53 -0
- package/src/serialization/__tests__/BaseDocumentSerializer/documentLevelSerialization.test.ts +120 -0
- package/src/serialization/__tests__/BaseDocumentSerializer/fieldLevelSerialization.test.ts +153 -0
- package/src/serialization/__tests__/BaseDocumentSerializer/utils.ts +27 -0
- package/src/serialization/__tests__/README +2 -0
- package/src/serialization/__tests__/__fixtures__/annotationAndInlineBlocks.json +140 -0
- package/src/serialization/__tests__/__fixtures__/customStyles.json +62 -0
- package/src/serialization/__tests__/__fixtures__/documentInlineMarks.json +70 -0
- package/src/serialization/__tests__/__fixtures__/documentLevelArticle.json +185 -0
- package/src/serialization/__tests__/__fixtures__/fieldLevelArticle.json +107 -0
- package/src/serialization/__tests__/__fixtures__/inlineDocumentLevelArticle.json +134 -0
- package/src/serialization/__tests__/__fixtures__/inlineSchema.ts +270 -0
- package/src/serialization/__tests__/__fixtures__/messy-html.html +26 -0
- package/src/serialization/__tests__/__fixtures__/nestedLanguageFields.json +54 -0
- package/src/serialization/__tests__/__fixtures__/schema.ts +310 -0
- package/src/serialization/__tests__/global.setup.ts +40 -0
- package/src/serialization/__tests__/helpers.ts +132 -0
- package/src/serialization/data.ts +82 -0
- package/src/serialization/deserialize/BaseDocumentDeserializer.ts +171 -0
- package/src/serialization/deserialize/helpers.ts +42 -0
- package/src/serialization/helpers.ts +18 -0
- package/src/serialization/index.ts +11 -0
- package/src/serialization/serialize/fieldFilters.ts +124 -0
- package/src/serialization/serialize/index.ts +284 -0
- package/src/serialization/types.ts +41 -0
- package/src/translation/importDocument.ts +4 -5
- package/src/translation/uploadFiles.ts +1 -1
- package/src/types.ts +3 -19
- package/src/utils/batchProcessor.ts +111 -0
- package/src/utils/importUtils.ts +95 -0
- package/src/utils/serialize.ts +25 -5
- package/src/utils/shared.ts +1 -1
- package/src/adapter/index.ts +0 -13
- package/src/components/NewTask.tsx +0 -251
- package/src/components/TaskView.tsx +0 -257
- package/src/components/TranslationContext.tsx +0 -24
- package/src/components/TranslationView.tsx +0 -114
- package/src/components/TranslationsTab.tsx +0 -181
- /package/src/components/{LanguageStatus.tsx → shared/LanguageStatus.tsx} +0 -0
- /package/src/components/{ProgressBar.tsx → shared/ProgressBar.tsx} +0 -0
|
@@ -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,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
|
+
}
|
|
@@ -0,0 +1,185 @@
|
|
|
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
|
+
"config": {
|
|
8
|
+
"_type": "objectField",
|
|
9
|
+
"nestedArrayField": [
|
|
10
|
+
{
|
|
11
|
+
"_key": "4a58adc7c507",
|
|
12
|
+
"_type": "block",
|
|
13
|
+
"children": [
|
|
14
|
+
{
|
|
15
|
+
"_key": "4f6bc15ae261",
|
|
16
|
+
"_type": "span",
|
|
17
|
+
"marks": [],
|
|
18
|
+
"text": "This is block text 1 level deep"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"markDefs": [],
|
|
22
|
+
"style": "normal"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"objectAsField": {
|
|
26
|
+
"_type": "childObjectField",
|
|
27
|
+
"content": [
|
|
28
|
+
{
|
|
29
|
+
"_key": "1aa228ac848b",
|
|
30
|
+
"_type": "block",
|
|
31
|
+
"children": [
|
|
32
|
+
{
|
|
33
|
+
"_key": "e2cf67af8e62",
|
|
34
|
+
"_type": "span",
|
|
35
|
+
"marks": [],
|
|
36
|
+
"text": "This is a block text 2 levels deep"
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"markDefs": [],
|
|
40
|
+
"style": "normal"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"title": "This is one level deeper"
|
|
44
|
+
},
|
|
45
|
+
"title": "This is an object nested in a document"
|
|
46
|
+
},
|
|
47
|
+
"content": [
|
|
48
|
+
{
|
|
49
|
+
"_key": "a4d177e92666",
|
|
50
|
+
"_type": "block",
|
|
51
|
+
"children": [
|
|
52
|
+
{
|
|
53
|
+
"_key": "a896ea6fcd59",
|
|
54
|
+
"_type": "span",
|
|
55
|
+
"marks": [],
|
|
56
|
+
"text": "This is block text at the top level."
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"markDefs": [],
|
|
60
|
+
"style": "normal"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"_key": "c0313627775e",
|
|
64
|
+
"_type": "objectField",
|
|
65
|
+
"objectAsField": {
|
|
66
|
+
"_type": "childObjectField",
|
|
67
|
+
"content": [
|
|
68
|
+
{
|
|
69
|
+
"_key": "4f24f6fbfae7",
|
|
70
|
+
"_type": "block",
|
|
71
|
+
"children": [
|
|
72
|
+
{
|
|
73
|
+
"_key": "d68f4288f5b7",
|
|
74
|
+
"_type": "span",
|
|
75
|
+
"marks": [],
|
|
76
|
+
"text": "This is block text in a nested object in an object in top-level block text."
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
"markDefs": [],
|
|
80
|
+
"style": "normal"
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
"title": "This is a nested object in an object in top-level block text."
|
|
84
|
+
},
|
|
85
|
+
"title": "This is an object in top-level block text."
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"_key": "9e2ab13c6d63",
|
|
89
|
+
"_type": "block",
|
|
90
|
+
"children": [
|
|
91
|
+
{
|
|
92
|
+
"_key": "17e856dc4766",
|
|
93
|
+
"_type": "span",
|
|
94
|
+
"marks": [],
|
|
95
|
+
"text": "This is h1 text"
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
"markDefs": [],
|
|
99
|
+
"style": "h1"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"_key": "297142fbaf21",
|
|
103
|
+
"_type": "block",
|
|
104
|
+
"children": [
|
|
105
|
+
{
|
|
106
|
+
"_key": "0b2f9e94a161",
|
|
107
|
+
"_type": "span",
|
|
108
|
+
"marks": [],
|
|
109
|
+
"text": "This is h2 text"
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
"markDefs": [],
|
|
113
|
+
"style": "h2"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"_key": "76e648fc3845",
|
|
117
|
+
"_type": "block",
|
|
118
|
+
"children": [
|
|
119
|
+
{
|
|
120
|
+
"_key": "49f466bbc78c",
|
|
121
|
+
"_type": "span",
|
|
122
|
+
"marks": [],
|
|
123
|
+
"text": "Bullet 1"
|
|
124
|
+
}
|
|
125
|
+
],
|
|
126
|
+
"level": 1,
|
|
127
|
+
"listItem": "bullet",
|
|
128
|
+
"markDefs": [],
|
|
129
|
+
"style": "normal"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"_key": "d090cd8b27d2",
|
|
133
|
+
"_type": "block",
|
|
134
|
+
"children": [
|
|
135
|
+
{
|
|
136
|
+
"_key": "599c6991018f",
|
|
137
|
+
"_type": "span",
|
|
138
|
+
"marks": [],
|
|
139
|
+
"text": "nested bullet a"
|
|
140
|
+
}
|
|
141
|
+
],
|
|
142
|
+
"level": 2,
|
|
143
|
+
"listItem": "bullet",
|
|
144
|
+
"markDefs": [],
|
|
145
|
+
"style": "normal"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"_key": "1cdffa5d50f5",
|
|
149
|
+
"_type": "block",
|
|
150
|
+
"children": [
|
|
151
|
+
{
|
|
152
|
+
"_key": "c16eb16f01cb",
|
|
153
|
+
"_type": "span",
|
|
154
|
+
"marks": [],
|
|
155
|
+
"text": "Styled bullet 2"
|
|
156
|
+
}
|
|
157
|
+
],
|
|
158
|
+
"level": 1,
|
|
159
|
+
"listItem": "bullet",
|
|
160
|
+
"markDefs": [],
|
|
161
|
+
"style": "h2"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"_key": "da29f5063059",
|
|
165
|
+
"_type": "block",
|
|
166
|
+
"children": [
|
|
167
|
+
{
|
|
168
|
+
"_key": "e3d7e3eaad54",
|
|
169
|
+
"_type": "span",
|
|
170
|
+
"marks": [],
|
|
171
|
+
"text": "Number 1"
|
|
172
|
+
}
|
|
173
|
+
],
|
|
174
|
+
"level": 1,
|
|
175
|
+
"listItem": "number",
|
|
176
|
+
"markDefs": [],
|
|
177
|
+
"style": "h3"
|
|
178
|
+
}
|
|
179
|
+
],
|
|
180
|
+
"hidden": true,
|
|
181
|
+
"meta": "Do not translate this",
|
|
182
|
+
"snippet": "This is text in my text field.",
|
|
183
|
+
"tags": ["tag 1", "tag 2", "tag 3"],
|
|
184
|
+
"title": "My Document-Level Article"
|
|
185
|
+
}
|