@pushwoosh/dumb-components 1.1.110 → 1.1.111
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,5 +1,5 @@
|
|
|
1
1
|
import React, { Fragment, useMemo } from 'react';
|
|
2
|
-
import { DynamicContentBracket, DynamicContentRoot } from './RichMessageViewer.styled';
|
|
2
|
+
import { DynamicContentBracket, DynamicContentRoot, Paragraph } from './RichMessageViewer.styled';
|
|
3
3
|
import { isElement, string2content } from './slate/helpers';
|
|
4
4
|
export const RichMessageViewer = ({
|
|
5
5
|
value,
|
|
@@ -8,7 +8,6 @@ export const RichMessageViewer = ({
|
|
|
8
8
|
const content = useMemo(() => {
|
|
9
9
|
return Array.isArray(value) ? value : string2content(value);
|
|
10
10
|
}, [value]);
|
|
11
|
-
const separator = flat ? ' ' : React.createElement("br", null);
|
|
12
11
|
return content.map((node, index) => {
|
|
13
12
|
const children = node.children.map((child, idx) => {
|
|
14
13
|
if (isElement(child) && child.type === 'dc') {
|
|
@@ -21,11 +20,22 @@ export const RichMessageViewer = ({
|
|
|
21
20
|
}
|
|
22
21
|
return child.text;
|
|
23
22
|
});
|
|
23
|
+
if (flat) {
|
|
24
|
+
return (
|
|
25
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
26
|
+
React.createElement(Fragment, {
|
|
27
|
+
key: index
|
|
28
|
+
}, index > 0 && ' ', React.createElement("span", {
|
|
29
|
+
dir: "auto"
|
|
30
|
+
}, children))
|
|
31
|
+
);
|
|
32
|
+
}
|
|
24
33
|
return (
|
|
25
34
|
// eslint-disable-next-line react/no-array-index-key
|
|
26
|
-
React.createElement(
|
|
27
|
-
key: index
|
|
28
|
-
|
|
35
|
+
React.createElement(Paragraph, {
|
|
36
|
+
key: index,
|
|
37
|
+
dir: "auto"
|
|
38
|
+
}, children)
|
|
29
39
|
);
|
|
30
40
|
});
|
|
31
41
|
};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export declare const DynamicContentRoot: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
2
2
|
export declare const DynamicContentBracket: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
3
|
+
export declare const Paragraph: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -7,4 +7,8 @@ export const DynamicContentRoot = styled.span.withConfig({
|
|
|
7
7
|
export const DynamicContentBracket = styled.span.withConfig({
|
|
8
8
|
displayName: "DynamicContentBracket",
|
|
9
9
|
componentId: "sc-f10jz5-1"
|
|
10
|
-
})(["color:", ";"], Color.EXCEPTIONAL);
|
|
10
|
+
})(["color:", ";"], Color.EXCEPTIONAL);
|
|
11
|
+
export const Paragraph = styled.div.withConfig({
|
|
12
|
+
displayName: "Paragraph",
|
|
13
|
+
componentId: "sc-f10jz5-2"
|
|
14
|
+
})(["min-height:1em;"]);
|