@forge/react 10.9.0-next.0 → 10.9.0-next.2
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 +17 -0
- package/out/__test__/components/utils/replaceUnsupportedDocumentNodes.test.js +4 -4
- package/out/components/adf-renderer.d.ts +1 -1
- package/out/components/adf-renderer.d.ts.map +1 -1
- package/out/components/adf-renderer.js +7 -2
- package/out/components/index.d.ts +0 -6
- package/out/components/index.d.ts.map +1 -1
- package/out/components/index.js +1 -8
- package/out/components/utils/replaceUnsupportedDocumentNodes.d.ts +2 -1
- package/out/components/utils/replaceUnsupportedDocumentNodes.d.ts.map +1 -1
- package/out/components/utils/replaceUnsupportedDocumentNodes.js +18 -10
- package/package.json +3 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/out/__test__/createFrame.test.d.ts +0 -2
- package/out/__test__/createFrame.test.d.ts.map +0 -1
- package/out/__test__/createFrame.test.js +0 -33
- package/out/components/createFrame.d.ts +0 -5
- package/out/components/createFrame.d.ts.map +0 -1
- package/out/components/createFrame.js +0 -56
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @forge/react
|
|
2
2
|
|
|
3
|
+
## 10.9.0-next.2
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 5a47bc2: ADFRenderer's replaceUnsupportedNodes allows images in context of MediaProvider
|
|
8
|
+
|
|
9
|
+
## 10.9.0-next.1
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 88de75c: The Frame component is now released into Preview. The `createFrame` function from EAP is no longer supported and is removed in this version.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [88de75c]
|
|
18
|
+
- @forge/bridge@4.2.0-next.0
|
|
19
|
+
|
|
3
20
|
## 10.9.0-next.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
|
@@ -63,7 +63,7 @@ const mediaDocumentExample = {
|
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
|
-
type: '
|
|
66
|
+
type: 'mediaInline',
|
|
67
67
|
attrs: {
|
|
68
68
|
id: '4478e39c-cf9b-41d1-ba92-68589487cd75',
|
|
69
69
|
type: 'file',
|
|
@@ -184,7 +184,7 @@ describe('replaceUnsupportedDocumentNodes', () => {
|
|
|
184
184
|
expect(replacedDocument).toEqual(expectedDocument);
|
|
185
185
|
});
|
|
186
186
|
it('should replace unsupported media with supported nodes', () => {
|
|
187
|
-
const replacedDocument = (0, replaceUnsupportedDocumentNodes_1.
|
|
187
|
+
const replacedDocument = (0, replaceUnsupportedDocumentNodes_1.replaceUnsupportedMediaNodes)(mediaDocumentExample, replaceUnsupportedNode);
|
|
188
188
|
const expectedDocument = {
|
|
189
189
|
type: 'doc',
|
|
190
190
|
version: 1,
|
|
@@ -217,7 +217,7 @@ describe('replaceUnsupportedDocumentNodes', () => {
|
|
|
217
217
|
{
|
|
218
218
|
content: [
|
|
219
219
|
{
|
|
220
|
-
text: 'Unsupported content:
|
|
220
|
+
text: 'Unsupported content: mediaInline',
|
|
221
221
|
type: 'text'
|
|
222
222
|
}
|
|
223
223
|
],
|
|
@@ -322,7 +322,7 @@ describe('replaceUnsupportedDocumentNodes', () => {
|
|
|
322
322
|
expect(replacedDocument).toEqual(expectedDocument);
|
|
323
323
|
});
|
|
324
324
|
it('should drop unsupported media node', () => {
|
|
325
|
-
const replacedDocument = (0, replaceUnsupportedDocumentNodes_1.
|
|
325
|
+
const replacedDocument = (0, replaceUnsupportedDocumentNodes_1.replaceUnsupportedMediaNodes)(mediaDocumentExample, replaceUnsupportedNode);
|
|
326
326
|
const expectedDocument = {
|
|
327
327
|
type: 'doc',
|
|
328
328
|
version: 1,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AdfRendererProps as PlatformAdfRendererProps } from '@atlaskit/forge-react-types';
|
|
2
2
|
import type { Visitor } from '@atlaskit/adf-utils/types/index';
|
|
3
|
-
declare type AdfRendererProps = PlatformAdfRendererProps & {
|
|
3
|
+
declare type AdfRendererProps = Omit<PlatformAdfRendererProps, 'documentWithoutMedia'> & {
|
|
4
4
|
replaceUnsupportedNode?: Visitor;
|
|
5
5
|
};
|
|
6
6
|
export declare const AdfRenderer: (props: AdfRendererProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adf-renderer.d.ts","sourceRoot":"","sources":["../../src/components/adf-renderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,IAAI,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAChG,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"adf-renderer.d.ts","sourceRoot":"","sources":["../../src/components/adf-renderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,IAAI,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAChG,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAI/D,aAAK,gBAAgB,GAAG,IAAI,CAAC,wBAAwB,EAAE,sBAAsB,CAAC,GAAG;IAC/E,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC,CAAC;AAIF,eAAO,MAAM,WAAW,UAAW,gBAAgB,4CAiBlD,CAAC"}
|
|
@@ -6,7 +6,12 @@ const replaceUnsupportedDocumentNodes_1 = require("./utils/replaceUnsupportedDoc
|
|
|
6
6
|
const PlatformAdfRenderer = 'AdfRenderer';
|
|
7
7
|
const AdfRenderer = (props) => {
|
|
8
8
|
const { replaceUnsupportedNode, document, ...adfRendererProps } = props;
|
|
9
|
-
const
|
|
10
|
-
|
|
9
|
+
const documentWithMedia = replaceUnsupportedNode
|
|
10
|
+
? (0, replaceUnsupportedDocumentNodes_1.replaceUnsupportedDocumentNodes)(document, replaceUnsupportedNode)
|
|
11
|
+
: document;
|
|
12
|
+
const documentWithoutMedia = replaceUnsupportedNode
|
|
13
|
+
? (0, replaceUnsupportedDocumentNodes_1.replaceUnsupportedMediaNodes)(documentWithMedia, replaceUnsupportedNode)
|
|
14
|
+
: documentWithMedia;
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)(PlatformAdfRenderer, { ...adfRendererProps, document: documentWithMedia, documentWithoutMedia: documentWithoutMedia }));
|
|
11
16
|
};
|
|
12
17
|
exports.AdfRenderer = AdfRenderer;
|
|
@@ -19,12 +19,6 @@ export declare const Strong: (props: MarkupProps) => ForgeElement;
|
|
|
19
19
|
* For more information, see the {@link https://developer.atlassian.com/platform/forge/ui-kit/components/frame|Frame component} documentation.
|
|
20
20
|
*/
|
|
21
21
|
export declare const Frame: (props: FrameProps) => ForgeElement;
|
|
22
|
-
/**
|
|
23
|
-
* `createFrame` helper for `Frame` component is in EAP (Early Access Program).
|
|
24
|
-
*
|
|
25
|
-
* For more information, see the {@link https://developer.atlassian.com/platform/forge/ui-kit/components/frame|Frame component} documentation.
|
|
26
|
-
*/
|
|
27
|
-
export { createFrame } from './createFrame';
|
|
28
22
|
/**
|
|
29
23
|
* Export Code generated UI Kit 2 Components
|
|
30
24
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,WAAW,EACX,gBAAgB,IAAI,UAAU,EAC9B,eAAe,IAAI,SAAS,EAC5B,eAAe,IAAI,SAAS,EAC5B,qBAAqB,IAAI,eAAe,EACxC,cAAc,EACd,SAAS,EACT,UAAU,EACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,kBAAkB,IAAI,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAC5F,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,S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B,CAAC;AAEjD,eAAO,MAAM,KAAK,UAAiC,UAAU,KAAK,YAAY,CAAC;AAC/E,eAAO,MAAM,IAAI,UAAgC,SAAS,KAAK,YAAY,CAAC;AAC5E,eAAO,MAAM,IAAI,UAAgC,SAAS,KAAK,YAAY,CAAC;AAC5E,eAAO,MAAM,UAAU,UAAsC,eAAe,KAAK,YAAY,CAAC;AAC9F,eAAO,MAAM,IAAI,UAAgC,SAAS,KAAK,YAAY,CAAC;AAC5E,eAAO,MAAM,SAAS,UAAqC,cAAc,KAAK,YAAY,CAAC;AAE3F,eAAO,MAAM,EAAE,UAA8B,WAAW,KAAK,YAAY,CAAC;AAC1E,eAAO,MAAM,MAAM,UAAkC,WAAW,KAAK,YAAY,CAAC;AAClF,eAAO,MAAM,MAAM,UAAkC,WAAW,KAAK,YAAY,CAAC;AAElF;;;;GAIG;AACH,eAAO,MAAM,KAAK,UAAiC,UAAU,KAAK,YAAY,CAAC;AAE/E;;GAEG;AACH,cAAc,qBAAqB,CAAC;AAIpC,UAAU,uBAAuB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC3C,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AACD,aAAK,kBAAkB,GAAG,uBAAuB,GAAG,uBAAuB,CAAC;AAC5E,eAAO,MAAM,aAAa,UAAyC,kBAAkB,KAAK,YAAY,CAAC"}
|
package/out/components/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CheckboxGroup = exports.
|
|
3
|
+
exports.CheckboxGroup = exports.Frame = exports.Strong = exports.Strike = exports.Em = exports.UserGroup = exports.User = exports.UserPicker = exports.Text = exports.Link = exports.Image = exports.AdfRenderer = exports.Popup = exports.InlineEdit = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
var inline_edit_1 = require("./inline-edit");
|
|
6
6
|
Object.defineProperty(exports, "InlineEdit", { enumerable: true, get: function () { return inline_edit_1.InlineEdit; } });
|
|
@@ -23,13 +23,6 @@ exports.Strong = 'Strong';
|
|
|
23
23
|
* For more information, see the {@link https://developer.atlassian.com/platform/forge/ui-kit/components/frame|Frame component} documentation.
|
|
24
24
|
*/
|
|
25
25
|
exports.Frame = 'Frame';
|
|
26
|
-
/**
|
|
27
|
-
* `createFrame` helper for `Frame` component is in EAP (Early Access Program).
|
|
28
|
-
*
|
|
29
|
-
* For more information, see the {@link https://developer.atlassian.com/platform/forge/ui-kit/components/frame|Frame component} documentation.
|
|
30
|
-
*/
|
|
31
|
-
var createFrame_1 = require("./createFrame");
|
|
32
|
-
Object.defineProperty(exports, "createFrame", { enumerable: true, get: function () { return createFrame_1.createFrame; } });
|
|
33
26
|
/**
|
|
34
27
|
* Export Code generated UI Kit 2 Components
|
|
35
28
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type DocNode } from '@atlaskit/adf-schema';
|
|
2
2
|
import { type Visitor } from '@atlaskit/adf-utils/types/index';
|
|
3
|
-
export declare const replaceUnsupportedDocumentNodes: (document: DocNode, replaceUnsupportedNode
|
|
3
|
+
export declare const replaceUnsupportedDocumentNodes: (document: DocNode, replaceUnsupportedNode: Visitor) => DocNode;
|
|
4
|
+
export declare const replaceUnsupportedMediaNodes: (document: DocNode, replaceUnsupportedNode: Visitor) => DocNode;
|
|
4
5
|
//# sourceMappingURL=replaceUnsupportedDocumentNodes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replaceUnsupportedDocumentNodes.d.ts","sourceRoot":"","sources":["../../../src/components/utils/replaceUnsupportedDocumentNodes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAA0B,KAAK,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAEvF,eAAO,MAAM,+BAA+B,aAAc,OAAO,
|
|
1
|
+
{"version":3,"file":"replaceUnsupportedDocumentNodes.d.ts","sourceRoot":"","sources":["../../../src/components/utils/replaceUnsupportedDocumentNodes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAA0B,KAAK,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAEvF,eAAO,MAAM,+BAA+B,aAAc,OAAO,0BAA0B,OAAO,KAAG,OAiCpG,CAAC;AAEF,eAAO,MAAM,4BAA4B,aAAc,OAAO,0BAA0B,OAAO,KAAG,OAYjG,CAAC"}
|
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.replaceUnsupportedDocumentNodes = void 0;
|
|
3
|
+
exports.replaceUnsupportedMediaNodes = exports.replaceUnsupportedDocumentNodes = void 0;
|
|
4
4
|
const uuid_1 = require("uuid");
|
|
5
5
|
const traverse_1 = require("@atlaskit/adf-utils/traverse");
|
|
6
6
|
const replaceUnsupportedDocumentNodes = (document, replaceUnsupportedNode) => {
|
|
7
|
-
if (!replaceUnsupportedNode) {
|
|
8
|
-
return document;
|
|
9
|
-
}
|
|
10
7
|
const visitors = {
|
|
11
8
|
// Partially supported nodes
|
|
12
|
-
media: (node, parent, index, depth) => {
|
|
13
|
-
if (!node?.attrs?.url) {
|
|
14
|
-
return replaceUnsupportedNode(node, parent, index, depth);
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
9
|
emoji: (node, parent, index, depth) => {
|
|
18
10
|
if (node?.attrs?.id) {
|
|
19
11
|
// Custom Atlassian generated emoji
|
|
@@ -39,7 +31,23 @@ const replaceUnsupportedDocumentNodes = (document, replaceUnsupportedNode) => {
|
|
|
39
31
|
unsupportedInline: replaceUnsupportedNode,
|
|
40
32
|
unknownBlock: replaceUnsupportedNode
|
|
41
33
|
};
|
|
34
|
+
return replaceDocumentWithVisitor(document, visitors);
|
|
35
|
+
};
|
|
36
|
+
exports.replaceUnsupportedDocumentNodes = replaceUnsupportedDocumentNodes;
|
|
37
|
+
const replaceUnsupportedMediaNodes = (document, replaceUnsupportedNode) => {
|
|
38
|
+
const mediaVisitor = (node, parent, index, depth) => {
|
|
39
|
+
if (!node?.attrs?.url) {
|
|
40
|
+
return replaceUnsupportedNode(node, parent, index, depth);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const visitors = {
|
|
44
|
+
media: mediaVisitor,
|
|
45
|
+
mediaInline: mediaVisitor
|
|
46
|
+
};
|
|
47
|
+
return replaceDocumentWithVisitor(document, visitors);
|
|
48
|
+
};
|
|
49
|
+
exports.replaceUnsupportedMediaNodes = replaceUnsupportedMediaNodes;
|
|
50
|
+
const replaceDocumentWithVisitor = (document, visitors) => {
|
|
42
51
|
const updatedDoc = (0, traverse_1.traverse)(document, visitors);
|
|
43
52
|
return updatedDoc ? { ...updatedDoc, version: document.version } : document;
|
|
44
53
|
};
|
|
45
|
-
exports.replaceUnsupportedDocumentNodes = replaceUnsupportedDocumentNodes;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/react",
|
|
3
|
-
"version": "10.9.0-next.
|
|
3
|
+
"version": "10.9.0-next.2",
|
|
4
4
|
"description": "Forge React reconciler",
|
|
5
5
|
"author": "Atlassian",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@atlaskit/adf-schema": "^46.0.0",
|
|
21
21
|
"@atlaskit/adf-utils": "^19.12.0",
|
|
22
|
-
"@atlaskit/forge-react-types": "^0.
|
|
23
|
-
"@forge/bridge": "^4.
|
|
22
|
+
"@atlaskit/forge-react-types": "^0.33.2",
|
|
23
|
+
"@forge/bridge": "^4.2.0-next.0",
|
|
24
24
|
"@forge/i18n": "0.0.2",
|
|
25
25
|
"@types/react-reconciler": "^0.28.8",
|
|
26
26
|
"lodash": "^4.17.21",
|