react-datocms 2.1.1 → 3.0.1
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 +29 -19
- package/dist/cjs/Image/__tests__/index.test.js +1 -0
- package/dist/cjs/Image/__tests__/index.test.js.map +1 -1
- package/dist/cjs/Image/index.js +2 -2
- package/dist/cjs/Image/index.js.map +1 -1
- package/dist/cjs/StructuredText/__tests__/index.test.js +77 -67
- package/dist/cjs/StructuredText/__tests__/index.test.js.map +1 -1
- package/dist/cjs/StructuredText/index.js +76 -61
- package/dist/cjs/StructuredText/index.js.map +1 -1
- package/dist/cjs/useQuerySubscription/index.js +1 -1
- package/dist/cjs/useQuerySubscription/index.js.map +1 -1
- package/dist/esm/Image/__tests__/index.test.d.ts +1 -1
- package/dist/esm/Image/__tests__/index.test.js +1 -0
- package/dist/esm/Image/__tests__/index.test.js.map +1 -1
- package/dist/esm/Image/index.d.ts +0 -1
- package/dist/esm/Image/index.js +2 -2
- package/dist/esm/Image/index.js.map +1 -1
- package/dist/esm/StructuredText/__tests__/index.test.js +81 -71
- package/dist/esm/StructuredText/__tests__/index.test.js.map +1 -1
- package/dist/esm/StructuredText/index.d.ts +12 -7
- package/dist/esm/StructuredText/index.js +78 -63
- package/dist/esm/StructuredText/index.js.map +1 -1
- package/dist/esm/useQuerySubscription/index.js +1 -1
- package/dist/esm/useQuerySubscription/index.js.map +1 -1
- package/dist/types/Image/__tests__/index.test.d.ts +1 -1
- package/dist/types/Image/index.d.ts +0 -1
- package/dist/types/StructuredText/index.d.ts +12 -7
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -25,6 +25,7 @@ A set of components and utilities to work faster with [DatoCMS](https://www.dato
|
|
|
25
25
|
- [Example](#example)
|
|
26
26
|
- [Progressive/responsive image](#progressiveresponsive-image)
|
|
27
27
|
- [Out-of-the-box features](#out-of-the-box-features)
|
|
28
|
+
- [Intersection Observer](#intersection-observer)
|
|
28
29
|
- [Usage](#usage)
|
|
29
30
|
- [Example](#example-1)
|
|
30
31
|
- [Props](#props)
|
|
@@ -163,9 +164,7 @@ const App: React.FC = () => {
|
|
|
163
164
|
`<Image />` is a React component specially designed to work seamlessly with DatoCMS’s [`responsiveImage` GraphQL query](https://www.datocms.com/docs/content-delivery-api/uploads#responsive-images) that optimizes image loading for your sites.
|
|
164
165
|
|
|
165
166
|
- TypeScript ready;
|
|
166
|
-
- Compatible with IE11;
|
|
167
167
|
- CSS-in-JS ready;
|
|
168
|
-
- Compatible with any GraphQL library (Apollo, graphql-hooks, graphql-request, etc.);
|
|
169
168
|
- Usable both client and server side;
|
|
170
169
|
- Compatible with vanilla React, Next.js and pretty much any other React-based solution;
|
|
171
170
|
|
|
@@ -173,11 +172,17 @@ const App: React.FC = () => {
|
|
|
173
172
|
|
|
174
173
|
## Out-of-the-box features
|
|
175
174
|
|
|
176
|
-
-
|
|
177
|
-
-
|
|
178
|
-
- Efficiently lazy
|
|
179
|
-
-
|
|
180
|
-
-
|
|
175
|
+
- Offers WebP version of images for browsers that support the format
|
|
176
|
+
- Generates multiple smaller images so smartphones and tablets don’t download desktop-sized images
|
|
177
|
+
- Efficiently lazy loads images to speed initial page load and save bandwidth
|
|
178
|
+
- Holds the image position so your page doesn’t jump while images load
|
|
179
|
+
- Uses either blur-up or background color techniques to show a preview of the image while it loads
|
|
180
|
+
|
|
181
|
+
## Intersection Observer
|
|
182
|
+
|
|
183
|
+
Intersection Observer is the API used to determine if the image is inside the viewport or not. [Browser support is really good](https://caniuse.com/intersectionobserver) - With Safari adding support in 12.1, all major browsers now support Intersection Observers natively.
|
|
184
|
+
|
|
185
|
+
If the IntersectionObserver object is not available, the component treats the image as it's always visible in the viewport. Feel free to add a [polyfill](https://www.npmjs.com/package/intersection-observer) so that it will also 100% work on older versions of iOS and IE11.
|
|
181
186
|
|
|
182
187
|
## Usage
|
|
183
188
|
|
|
@@ -379,7 +384,7 @@ const someMoreComplexHtml = `
|
|
|
379
384
|
|
|
380
385
|
## `toRemixMeta()`
|
|
381
386
|
|
|
382
|
-
This function generates a `HtmlMetaDescriptor`
|
|
387
|
+
This function generates a `HtmlMetaDescriptor` object, compatibile with the [`meta`](https://remix.run/docs/en/v1.1.1/api/conventions#meta) export of the [Remix](https://remix.run/) framework:
|
|
383
388
|
|
|
384
389
|
```js
|
|
385
390
|
import type { MetaFunction } from 'remix';
|
|
@@ -390,9 +395,7 @@ export const meta: MetaFunction = ({ data: { post } }) => {
|
|
|
390
395
|
};
|
|
391
396
|
```
|
|
392
397
|
|
|
393
|
-
Please note that the [`links`](https://remix.run/docs/en/v1.1.1/api/conventions#links) export [doesn't receive any loader data](https://github.com/remix-run/remix/issues/32) for performance reasons, so you cannot use it to declare favicons meta tags!
|
|
394
|
-
|
|
395
|
-
The best way to render favicon meta tags is to use `renderMetaTags` in your root component:
|
|
398
|
+
Please note that the [`links`](https://remix.run/docs/en/v1.1.1/api/conventions#links) export [doesn't receive any loader data](https://github.com/remix-run/remix/issues/32) for performance reasons, so you cannot use it to declare favicons meta tags! The best way to render them is using `renderMetaTags` in your root component:
|
|
396
399
|
|
|
397
400
|
```jsx
|
|
398
401
|
import { renderMetaTags } from 'react-datocms';
|
|
@@ -422,7 +425,7 @@ export default function App() {
|
|
|
422
425
|
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
423
426
|
<Meta />
|
|
424
427
|
<Links />
|
|
425
|
-
{renderMetaTags(
|
|
428
|
+
{renderMetaTags(site.favicon)}
|
|
426
429
|
</head>
|
|
427
430
|
<body>
|
|
428
431
|
<Outlet />
|
|
@@ -661,19 +664,19 @@ For example:
|
|
|
661
664
|
|
|
662
665
|
- For all possible node types, refer to the [list of typeguard functions defined in the main `structured-text` package](https://github.com/datocms/structured-text/tree/main/packages/utils#typescript-type-guards). The [DAST format documentation](https://www.datocms.com/docs/structured-text/dast) has additional details.
|
|
663
666
|
|
|
664
|
-
In this case, you can easily override default rendering rules with the `
|
|
667
|
+
In this case, you can easily override default rendering rules with the `customNodeRules` and `customMarkRules` props.
|
|
665
668
|
|
|
666
669
|
```jsx
|
|
667
|
-
import {
|
|
670
|
+
import { renderNodeRule, renderMarkRule, StructuredText } from 'react-datocms';
|
|
668
671
|
import { isHeading, isCode } from 'datocms-structured-text-utils';
|
|
669
672
|
import { render as toPlainText } from 'datocms-structured-text-to-plain-text';
|
|
670
673
|
import SyntaxHighlight from 'components/SyntaxHighlight';
|
|
671
674
|
|
|
672
675
|
<StructuredText
|
|
673
676
|
data={data.blogPost.content}
|
|
674
|
-
|
|
677
|
+
customNodeRules={[
|
|
675
678
|
// Add HTML anchors to heading levels for in-page navigation
|
|
676
|
-
|
|
679
|
+
renderNodeRule(isHeading, ({ node, children, key }) => {
|
|
677
680
|
const HeadingTag = `h${node.level}`;
|
|
678
681
|
const anchor = toPlainText(node)
|
|
679
682
|
.toLowerCase()
|
|
@@ -689,7 +692,7 @@ import SyntaxHighlight from 'components/SyntaxHighlight';
|
|
|
689
692
|
}),
|
|
690
693
|
|
|
691
694
|
// Use a custom syntax highlighter component for code blocks
|
|
692
|
-
|
|
695
|
+
renderNodeRule(isCode, ({ node, key }) => {
|
|
693
696
|
return (
|
|
694
697
|
<SyntaxHighlight
|
|
695
698
|
key={key}
|
|
@@ -701,7 +704,7 @@ import SyntaxHighlight from 'components/SyntaxHighlight';
|
|
|
701
704
|
}),
|
|
702
705
|
|
|
703
706
|
// Apply different formatting to top-level paragraphs
|
|
704
|
-
|
|
707
|
+
renderNodeRule(
|
|
705
708
|
isParagraph,
|
|
706
709
|
({ adapter: { renderNode }, node, children, key, ancestors }) => {
|
|
707
710
|
if (isRoot(ancestors[0])) {
|
|
@@ -721,6 +724,12 @@ import SyntaxHighlight from 'components/SyntaxHighlight';
|
|
|
721
724
|
},
|
|
722
725
|
),
|
|
723
726
|
]}
|
|
727
|
+
customMarkRules={[
|
|
728
|
+
// convert "strong" marks into <b> tags
|
|
729
|
+
renderMarkRule('strong', ({ mark, children, key }) => {
|
|
730
|
+
return <b key={key}>{children}</b>;
|
|
731
|
+
}),
|
|
732
|
+
]}
|
|
724
733
|
/>;
|
|
725
734
|
```
|
|
726
735
|
|
|
@@ -735,7 +744,8 @@ Note: if you override the rules for `inline_item`, `item_link` or `block` nodes,
|
|
|
735
744
|
| renderLinkToRecord | `({ record, children }) => ReactElement \| null` | Only required if document contains `itemLink` nodes | Convert an `itemLink` DAST node into React | `null` |
|
|
736
745
|
| renderBlock | `({ record }) => ReactElement \| null` | Only required if document contains `block` nodes | Convert a `block` DAST node into React | `null` |
|
|
737
746
|
| metaTransformer | `({ node, meta }) => Object \| null` | :x: | Transform `link` and `itemLink` meta property into HTML props | [See function](https://github.com/datocms/structured-text/blob/main/packages/generic-html-renderer/src/index.ts#L61) |
|
|
738
|
-
|
|
|
747
|
+
| customNodeRules | `Array<RenderRule>` | :x: | Customize how nodes are converted in JSX (use `renderNodeRule()` to generate rules) | `null` |
|
|
748
|
+
| customMarkRules | `Array<RenderMarkRule>` | :x: | Customize how marks are converted in JSX (use `renderMarkRule()` to generate rules) | `null` |
|
|
739
749
|
| renderText | `(text: string, key: string) => ReactElement \| string \| null` | :x: | Convert a simple string text into React | `(text) => text` |
|
|
740
750
|
|
|
741
751
|
# Development
|
|
@@ -21,6 +21,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
21
21
|
exports.__esModule = true;
|
|
22
22
|
var React = __importStar(require("react"));
|
|
23
23
|
var enzyme_1 = require("enzyme");
|
|
24
|
+
require("intersection-observer");
|
|
24
25
|
var index_1 = require("../index");
|
|
25
26
|
var test_utils_1 = require("react-intersection-observer/test-utils");
|
|
26
27
|
var data = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../../src/Image/__tests__/index.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,2CAA+B;AAC/B,iCAA+B;AAC/B,kCAAiC;AACjC,qEAA+E;AAE/E,IAAM,IAAI,GAAG;IACX,GAAG,E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AC"}
|
package/dist/cjs/Image/index.js
CHANGED
|
@@ -32,7 +32,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
32
32
|
exports.__esModule = true;
|
|
33
33
|
exports.Image = void 0;
|
|
34
34
|
var react_1 = __importStar(require("react"));
|
|
35
|
-
require("intersection-observer");
|
|
36
35
|
var react_intersection_observer_1 = require("react-intersection-observer");
|
|
37
36
|
var isSsr = typeof window === 'undefined';
|
|
38
37
|
var universalBtoa = isSsr
|
|
@@ -78,7 +77,8 @@ exports.Image = react_1.forwardRef(function (_a, ref) {
|
|
|
78
77
|
var _h = react_intersection_observer_1.useInView({
|
|
79
78
|
threshold: intersectionThreshold || intersectionTreshold || 0,
|
|
80
79
|
rootMargin: intersectionMargin || '0px 0px 0px 0px',
|
|
81
|
-
triggerOnce: true
|
|
80
|
+
triggerOnce: true,
|
|
81
|
+
fallbackInView: true
|
|
82
82
|
}), viewRef = _h[0], inView = _h[1];
|
|
83
83
|
var callbackRef = react_1.useCallback(function (_ref) {
|
|
84
84
|
viewRef(_ref);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Image/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAgF;AAChF,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Image/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAgF;AAChF,2EAAwD;AAExD,IAAM,KAAK,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC;AAC5C,IAAM,aAAa,GAAG,KAAK;IACzB,CAAC,CAAC,UAAC,GAAW,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAxD,CAAwD;IAC3E,CAAC,CAAC,MAAM,CAAC,IAA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K,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE;gBAC1D,CAAC,CAAC,MAAM,KAAK,OAAO;oBACpB,CAAC,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,OAAA,EAAE;oBACjC,CAAC,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,GACzC,KAAK;QAGT,KAAK;QACL,WAAW;QACX,QAAQ,IAAI,CACX;YACG,UAAU;YACV,aAAa;YACb,IAAI,CAAC,GAAG,IAAI,CACX,0CACE,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE,gBAAgB,EAC3B,KAAK,+BACH,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC1B,UAAU,YAAA,IACP,mBAAmB,KACtB,SAAS,WAAA;oBACT,cAAc,gBAAA,KACX,YAAY,IAEjB,CACH,CACO,CACX;QACD;YACE;gBACG,UAAU;gBACV,aAAa;gBACb,IAAI,CAAC,GAAG,IAAI,CACX,0CACE,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,GAAG,EAAE,MAAA,IAAI,CAAC,GAAG,mCAAI,EAAE,EACnB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,SAAS,EAAE,gBAAgB,EAC3B,KAAK,wBAAO,mBAAmB,GAAK,YAAY,GAChD,OAAO,EAAC,MAAM,GACd,CACH,CACO,CACD,CACP,CACP,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -34,63 +34,75 @@ var enzyme_1 = require("enzyme");
|
|
|
34
34
|
var React = __importStar(require("react"));
|
|
35
35
|
var index_1 = require("../index");
|
|
36
36
|
var datocms_structured_text_utils_1 = require("datocms-structured-text-utils");
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
var datocms_structured_text_generic_html_renderer_1 = require("datocms-structured-text-generic-html-renderer");
|
|
38
|
+
describe('StructuredText', function () {
|
|
39
|
+
describe('with no value', function () {
|
|
40
|
+
it('renders null', function () {
|
|
40
41
|
var wrapper = enzyme_1.mount(React.createElement(index_1.StructuredText, { data: null }));
|
|
41
42
|
expect(wrapper).toMatchSnapshot();
|
|
42
43
|
});
|
|
43
44
|
});
|
|
44
|
-
describe(
|
|
45
|
+
describe('simple dast /2', function () {
|
|
45
46
|
var structuredText = {
|
|
46
|
-
schema:
|
|
47
|
+
schema: 'dast',
|
|
47
48
|
document: {
|
|
48
|
-
type:
|
|
49
|
+
type: 'root',
|
|
49
50
|
children: [
|
|
50
51
|
{
|
|
51
|
-
type:
|
|
52
|
+
type: 'heading',
|
|
52
53
|
level: 1,
|
|
53
54
|
children: [
|
|
54
55
|
{
|
|
55
|
-
type:
|
|
56
|
-
value:
|
|
56
|
+
type: 'span',
|
|
57
|
+
value: 'This\nis a '
|
|
57
58
|
},
|
|
58
59
|
{
|
|
59
|
-
type:
|
|
60
|
-
marks: [
|
|
61
|
-
value:
|
|
60
|
+
type: 'span',
|
|
61
|
+
marks: ['strong'],
|
|
62
|
+
value: 'title'
|
|
62
63
|
},
|
|
63
64
|
]
|
|
64
65
|
},
|
|
65
66
|
]
|
|
66
67
|
}
|
|
67
68
|
};
|
|
68
|
-
describe(
|
|
69
|
-
it(
|
|
69
|
+
describe('with default rules', function () {
|
|
70
|
+
it('renders the document', function () {
|
|
70
71
|
var wrapper = enzyme_1.mount(React.createElement(index_1.StructuredText, { data: structuredText }));
|
|
71
72
|
expect(wrapper).toMatchSnapshot();
|
|
72
73
|
});
|
|
73
74
|
});
|
|
75
|
+
describe('with custom mark rules', function () {
|
|
76
|
+
it('renders the document', function () {
|
|
77
|
+
var wrapper = enzyme_1.mount(React.createElement(index_1.StructuredText, { data: structuredText, customMarkRules: [
|
|
78
|
+
datocms_structured_text_generic_html_renderer_1.renderMarkRule('strong', function (_a) {
|
|
79
|
+
var children = _a.children, key = _a.key;
|
|
80
|
+
return (React.createElement("b", { key: key }, children));
|
|
81
|
+
}),
|
|
82
|
+
] }));
|
|
83
|
+
expect(wrapper).toMatchSnapshot();
|
|
84
|
+
});
|
|
85
|
+
});
|
|
74
86
|
});
|
|
75
|
-
describe(
|
|
87
|
+
describe('simple dast with no links/blocks', function () {
|
|
76
88
|
var structuredText = {
|
|
77
89
|
value: {
|
|
78
|
-
schema:
|
|
90
|
+
schema: 'dast',
|
|
79
91
|
document: {
|
|
80
|
-
type:
|
|
92
|
+
type: 'root',
|
|
81
93
|
children: [
|
|
82
94
|
{
|
|
83
|
-
type:
|
|
95
|
+
type: 'heading',
|
|
84
96
|
level: 1,
|
|
85
97
|
children: [
|
|
86
98
|
{
|
|
87
|
-
type:
|
|
88
|
-
value:
|
|
99
|
+
type: 'span',
|
|
100
|
+
value: 'This\nis a '
|
|
89
101
|
},
|
|
90
102
|
{
|
|
91
|
-
type:
|
|
92
|
-
marks: [
|
|
93
|
-
value:
|
|
103
|
+
type: 'span',
|
|
104
|
+
marks: ['strong'],
|
|
105
|
+
value: 'title'
|
|
94
106
|
},
|
|
95
107
|
]
|
|
96
108
|
},
|
|
@@ -98,18 +110,18 @@ describe("StructuredText", function () {
|
|
|
98
110
|
}
|
|
99
111
|
}
|
|
100
112
|
};
|
|
101
|
-
describe(
|
|
102
|
-
it(
|
|
113
|
+
describe('with default rules', function () {
|
|
114
|
+
it('renders the document', function () {
|
|
103
115
|
var wrapper = enzyme_1.mount(React.createElement(index_1.StructuredText, { data: structuredText }));
|
|
104
116
|
expect(wrapper).toMatchSnapshot();
|
|
105
117
|
});
|
|
106
118
|
});
|
|
107
|
-
describe(
|
|
108
|
-
it(
|
|
119
|
+
describe('with custom rules', function () {
|
|
120
|
+
it('renders the document', function () {
|
|
109
121
|
var wrapper = enzyme_1.mount(React.createElement(index_1.StructuredText, { data: structuredText, renderText: function (text, key) {
|
|
110
|
-
return (React.createElement(React.Fragment, { key: key }, text.replace(/This/,
|
|
111
|
-
},
|
|
112
|
-
index_1.
|
|
122
|
+
return (React.createElement(React.Fragment, { key: key }, text.replace(/This/, 'That')));
|
|
123
|
+
}, customNodeRules: [
|
|
124
|
+
index_1.renderNodeRule(datocms_structured_text_utils_1.isHeading, function (_a) {
|
|
113
125
|
var renderNode = _a.adapter.renderNode, node = _a.node, children = _a.children, key = _a.key;
|
|
114
126
|
return renderNode("h" + (node.level + 1), { key: key }, children);
|
|
115
127
|
}),
|
|
@@ -118,70 +130,68 @@ describe("StructuredText", function () {
|
|
|
118
130
|
});
|
|
119
131
|
});
|
|
120
132
|
});
|
|
121
|
-
describe(
|
|
133
|
+
describe('with links/blocks', function () {
|
|
122
134
|
var structuredText = {
|
|
123
135
|
value: {
|
|
124
|
-
schema:
|
|
136
|
+
schema: 'dast',
|
|
125
137
|
document: {
|
|
126
|
-
type:
|
|
138
|
+
type: 'root',
|
|
127
139
|
children: [
|
|
128
140
|
{
|
|
129
|
-
type:
|
|
141
|
+
type: 'heading',
|
|
130
142
|
level: 1,
|
|
131
143
|
children: [
|
|
132
144
|
{
|
|
133
|
-
type:
|
|
134
|
-
value:
|
|
145
|
+
type: 'span',
|
|
146
|
+
value: 'This is a'
|
|
135
147
|
},
|
|
136
148
|
{
|
|
137
|
-
type:
|
|
138
|
-
marks: [
|
|
139
|
-
value:
|
|
149
|
+
type: 'span',
|
|
150
|
+
marks: ['highlight'],
|
|
151
|
+
value: 'title'
|
|
140
152
|
},
|
|
141
153
|
{
|
|
142
|
-
type:
|
|
143
|
-
item:
|
|
154
|
+
type: 'inlineItem',
|
|
155
|
+
item: '123'
|
|
144
156
|
},
|
|
145
157
|
{
|
|
146
|
-
type:
|
|
147
|
-
item:
|
|
148
|
-
meta: [
|
|
149
|
-
|
|
150
|
-
],
|
|
151
|
-
children: [{ type: "span", value: "here!" }]
|
|
158
|
+
type: 'itemLink',
|
|
159
|
+
item: '123',
|
|
160
|
+
meta: [{ id: 'target', value: '_blank' }],
|
|
161
|
+
children: [{ type: 'span', value: 'here!' }]
|
|
152
162
|
},
|
|
153
163
|
]
|
|
154
164
|
},
|
|
155
165
|
{
|
|
156
|
-
type:
|
|
157
|
-
item:
|
|
166
|
+
type: 'block',
|
|
167
|
+
item: '456'
|
|
158
168
|
},
|
|
159
169
|
]
|
|
160
170
|
}
|
|
161
171
|
},
|
|
162
172
|
blocks: [
|
|
163
173
|
{
|
|
164
|
-
id:
|
|
165
|
-
__typename:
|
|
166
|
-
quote:
|
|
167
|
-
author:
|
|
174
|
+
id: '456',
|
|
175
|
+
__typename: 'QuoteRecord',
|
|
176
|
+
quote: 'Foo bar.',
|
|
177
|
+
author: 'Mark Smith'
|
|
168
178
|
},
|
|
169
179
|
],
|
|
170
180
|
links: [
|
|
171
181
|
{
|
|
172
|
-
id:
|
|
173
|
-
__typename:
|
|
174
|
-
title:
|
|
175
|
-
slug:
|
|
182
|
+
id: '123',
|
|
183
|
+
__typename: 'DocPageRecord',
|
|
184
|
+
title: 'How to code',
|
|
185
|
+
slug: 'how-to-code'
|
|
176
186
|
},
|
|
177
187
|
]
|
|
178
188
|
};
|
|
179
|
-
describe(
|
|
180
|
-
it(
|
|
189
|
+
describe('with default rules', function () {
|
|
190
|
+
it('renders the document', function () {
|
|
181
191
|
var wrapper = enzyme_1.mount(React.createElement(index_1.StructuredText, { data: structuredText, renderInlineRecord: function (_a) {
|
|
182
192
|
var record = _a.record;
|
|
183
193
|
switch (record.__typename) {
|
|
184
|
-
case
|
|
194
|
+
case 'DocPageRecord':
|
|
185
195
|
return React.createElement("a", { href: "/docs/" + record.slug }, record.title);
|
|
186
196
|
default:
|
|
187
197
|
return null;
|
|
@@ -189,15 +199,15 @@ describe("StructuredText", function () {
|
|
|
189
199
|
}, renderLinkToRecord: function (_a) {
|
|
190
200
|
var record = _a.record, children = _a.children, transformedMeta = _a.transformedMeta;
|
|
191
201
|
switch (record.__typename) {
|
|
192
|
-
case
|
|
193
|
-
return React.createElement("a", __assign({}, transformedMeta, { href: "/docs/" + record.slug }), children);
|
|
202
|
+
case 'DocPageRecord':
|
|
203
|
+
return (React.createElement("a", __assign({}, transformedMeta, { href: "/docs/" + record.slug }), children));
|
|
194
204
|
default:
|
|
195
205
|
return null;
|
|
196
206
|
}
|
|
197
207
|
}, renderBlock: function (_a) {
|
|
198
208
|
var record = _a.record;
|
|
199
209
|
switch (record.__typename) {
|
|
200
|
-
case
|
|
210
|
+
case 'QuoteRecord':
|
|
201
211
|
return (React.createElement("figure", null,
|
|
202
212
|
React.createElement("blockquote", null, record.quote),
|
|
203
213
|
React.createElement("figcaption", null, record.author)));
|
|
@@ -208,15 +218,15 @@ describe("StructuredText", function () {
|
|
|
208
218
|
expect(wrapper).toMatchSnapshot();
|
|
209
219
|
});
|
|
210
220
|
});
|
|
211
|
-
describe(
|
|
212
|
-
it(
|
|
221
|
+
describe('with missing renderInlineRecord prop', function () {
|
|
222
|
+
it('raises an error', function () {
|
|
213
223
|
expect(function () {
|
|
214
224
|
enzyme_1.shallow(React.createElement(index_1.StructuredText, { data: structuredText }));
|
|
215
225
|
}).toThrow(index_1.RenderError);
|
|
216
226
|
});
|
|
217
227
|
});
|
|
218
|
-
describe(
|
|
219
|
-
it(
|
|
228
|
+
describe('with missing record', function () {
|
|
229
|
+
it('raises an error', function () {
|
|
220
230
|
expect(function () {
|
|
221
231
|
enzyme_1.shallow(React.createElement(index_1.StructuredText, { data: __assign(__assign({}, structuredText), { links: [] }), renderInlineRecord: function () {
|
|
222
232
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../../src/StructuredText/__tests__/index.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAgD;AAChD,2CAA+B;AAC/B,kCAMkB;AAClB,+EAA0D;
|
|
1
|
+
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../../src/StructuredText/__tests__/index.test.tsx"],"names":[],"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