@pega/cosmos-react-rte 3.0.0-dev.23.0 → 3.0.0-dev.23.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextTreeRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/RichTextEditor/RichTextTreeRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"RichTextTreeRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/RichTextEditor/RichTextTreeRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAMrC,aAAK,UAAU,GAAG,YAAY,CAAC,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC;AAU3D,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,UAAU,EAAE,CAAC;CACrB;AAED,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC,yBAAyB,CAE9D,CAAC"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment } from 'react';
|
|
2
3
|
import { hasProp } from '@pega/cosmos-react-core';
|
|
3
4
|
import { nodeRenderer, leafRenderer } from './utils/renderers';
|
|
5
|
+
const getNode = (node, index) => {
|
|
6
|
+
if (hasProp(node, 'children')) {
|
|
7
|
+
const children = node.children.map((childNode, i) => getNode(childNode, i));
|
|
8
|
+
return _jsx(Fragment, { children: nodeRenderer({ ...node, children }) }, index);
|
|
9
|
+
}
|
|
10
|
+
return _jsx(Fragment, { children: leafRenderer(node) }, index);
|
|
11
|
+
};
|
|
4
12
|
export const RichTextTreeRenderer = ({ nodes }) => {
|
|
5
|
-
|
|
6
|
-
if (hasProp(node, 'children')) {
|
|
7
|
-
const children = node.children.map(childNode => getNode(childNode));
|
|
8
|
-
return nodeRenderer({ ...node, children });
|
|
9
|
-
}
|
|
10
|
-
return leafRenderer(node);
|
|
11
|
-
};
|
|
12
|
-
return _jsx(_Fragment, { children: nodes.map(node => getNode(node)) });
|
|
13
|
+
return _jsx(_Fragment, { children: nodes.map((node, i) => getNode(node, i)) });
|
|
13
14
|
};
|
|
14
15
|
//# sourceMappingURL=RichTextTreeRenderer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextTreeRenderer.js","sourceRoot":"","sources":["../../../src/components/RichTextEditor/RichTextTreeRenderer.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"RichTextTreeRenderer.js","sourceRoot":"","sources":["../../../src/components/RichTextEditor/RichTextTreeRenderer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGrC,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAI/D,MAAM,OAAO,GAAG,CAAC,IAAgB,EAAE,KAAa,EAAE,EAAE;IAClD,IAAI,OAAO,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE;QAC7B,MAAM,QAAQ,GAAkB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC;QAC3F,OAAO,KAAC,QAAQ,cAAc,YAAY,CAAC,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,CAAC,IAA3C,KAAK,CAAkD,CAAC;KAC/E;IACD,OAAO,KAAC,QAAQ,cAAc,YAAY,CAAC,IAAI,CAAC,IAA1B,KAAK,CAAiC,CAAC;AAC/D,CAAC,CAAC;AAMF,MAAM,CAAC,MAAM,oBAAoB,GAAkC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC/E,OAAO,4BAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,GAAI,CAAC;AACzD,CAAC,CAAC","sourcesContent":["import { FC, Fragment } from 'react';\nimport { CosmosCustom } from 'slate';\n\nimport { hasProp } from '@pega/cosmos-react-core';\n\nimport { nodeRenderer, leafRenderer } from './utils/renderers';\n\ntype CosmosNode = CosmosCustom.Element | CosmosCustom.Text;\n\nconst getNode = (node: CosmosNode, index: number) => {\n if (hasProp(node, 'children')) {\n const children: JSX.Element[] = node.children.map((childNode, i) => getNode(childNode, i));\n return <Fragment key={index}>{nodeRenderer({ ...node, children })}</Fragment>;\n }\n return <Fragment key={index}>{leafRenderer(node)}</Fragment>;\n};\n\nexport interface RichTextTreeRendererProps {\n nodes: CosmosNode[];\n}\n\nexport const RichTextTreeRenderer: FC<RichTextTreeRendererProps> = ({ nodes }) => {\n return <>{nodes.map((node, i) => getNode(node, i))}</>;\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/cosmos-react-rte",
|
|
3
|
-
"version": "3.0.0-dev.23.
|
|
3
|
+
"version": "3.0.0-dev.23.1",
|
|
4
4
|
"author": "Pegasystems",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"repository": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"build": "tsc -b"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@pega/cosmos-react-core": "3.0.0-dev.23.
|
|
23
|
+
"@pega/cosmos-react-core": "3.0.0-dev.23.1",
|
|
24
24
|
"@popperjs/core": "^2.11.4",
|
|
25
25
|
"@types/marked": "^4.0.2",
|
|
26
26
|
"@types/parse5": "^6.0.0",
|