@vonaffenfels/slate-editor 1.2.15 → 1.2.19

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.
Files changed (84) hide show
  1. package/.babelrc +43 -43
  2. package/README.md +5 -5
  3. package/componentLoader.js +93 -93
  4. package/dist/BlockEditor.js +1 -1
  5. package/dist/Renderer.js +1 -1
  6. package/dist/index.js +1 -1
  7. package/package.json +2 -2
  8. package/postcss.config.js +6 -6
  9. package/scss/demo.scss +148 -148
  10. package/scss/sidebarEditor.scss +185 -185
  11. package/scss/toolbar.scss +162 -162
  12. package/src/Blocks/EmptyBlock.js +11 -11
  13. package/src/Blocks/EmptyWrapper.js +4 -4
  14. package/src/Blocks/ErrorBoundary.js +40 -40
  15. package/src/Blocks/LayoutBlock.js +274 -274
  16. package/src/Blocks/LayoutSlot.js +90 -90
  17. package/src/CollapsableMenu/CollapsableMenu.js +48 -48
  18. package/src/Context/StorybookContext.js +6 -6
  19. package/src/ElementAutocomplete.js +134 -134
  20. package/src/Loader.js +137 -137
  21. package/src/Nodes/Default.js +162 -158
  22. package/src/Nodes/Leaf.js +54 -54
  23. package/src/Nodes/Text.js +97 -97
  24. package/src/ObjectId.js +3 -3
  25. package/src/Renderer.js +73 -73
  26. package/src/Serializer/Html.js +42 -42
  27. package/src/Serializer/Serializer.js +371 -371
  28. package/src/Serializer/Text.js +17 -17
  29. package/src/Serializer/ads.js +187 -187
  30. package/src/Serializer/index.js +3 -3
  31. package/src/SidebarEditor/AssetList.js +181 -181
  32. package/src/SidebarEditor/Fields/CloudinaryContentSelect.js +89 -89
  33. package/src/SidebarEditor/Fields/ColorPicker.js +89 -89
  34. package/src/SidebarEditor/Fields/ContentfulContentSelect.js +62 -62
  35. package/src/SidebarEditor/Fields/DateTime.js +55 -55
  36. package/src/SidebarEditor/Fields/MVP.js +66 -66
  37. package/src/SidebarEditor/Fields/MultiSelect.js +13 -13
  38. package/src/SidebarEditor/Fields/RemoteMultiSelect.js +40 -40
  39. package/src/SidebarEditor/Fields/RemoteSelect.js +39 -39
  40. package/src/SidebarEditor/Fields/Select.js +47 -47
  41. package/src/SidebarEditor/Fields/StreamSelect.js +15 -15
  42. package/src/SidebarEditor/Fields/Switch.js +34 -34
  43. package/src/SidebarEditor/Fields/Textarea.js +21 -21
  44. package/src/SidebarEditor/Resizable.js +85 -85
  45. package/src/Storybook.js +151 -151
  46. package/src/Toolbar/Align.js +64 -64
  47. package/src/Toolbar/Anchor.js +94 -94
  48. package/src/Toolbar/Block.js +135 -135
  49. package/src/Toolbar/Element.js +44 -44
  50. package/src/Toolbar/Formats.js +71 -71
  51. package/src/Toolbar/Insert.js +28 -28
  52. package/src/Toolbar/Layout.js +399 -399
  53. package/src/Toolbar/Link.js +164 -164
  54. package/src/Toolbar/Toolbar.js +235 -235
  55. package/src/Tools/Margin.js +51 -51
  56. package/src/Translation/TranslationToolbarButton.js +119 -119
  57. package/src/dev/draftToSlate.json +3147 -3147
  58. package/src/dev/index.css +2 -2
  59. package/src/dev/index.html +10 -10
  60. package/src/dev/index.js +4 -4
  61. package/src/dev/sampleValue1.json +4294 -4294
  62. package/src/dev/sampleValueValid.json +410 -410
  63. package/src/dev/testComponents/TestStory.js +74 -74
  64. package/src/dev/testComponents/TestStory.stories.js +216 -216
  65. package/src/dev/testComponents/TestStory2.js +74 -74
  66. package/src/dev/testComponents/TestStory2.stories.js +197 -197
  67. package/src/dev/testComponents/TestStory3.js +74 -74
  68. package/src/dev/testComponents/TestStory3.stories.js +197 -197
  69. package/src/dev/testSampleValue.json +746 -746
  70. package/src/fromHTML.js +4 -4
  71. package/src/helper/array.js +8 -8
  72. package/src/index.js +10 -10
  73. package/src/plugins/ListItem.js +48 -48
  74. package/src/plugins/SoftBreak.js +23 -23
  75. package/src/toHTML.js +6 -6
  76. package/src/toText.js +6 -6
  77. package/src/util/reduceContentfulResponse.js +64 -64
  78. package/src/util.js +19 -19
  79. package/storyLoader.js +47 -47
  80. package/tailwind.config.js +4 -4
  81. package/webpack.config.build.js +55 -55
  82. package/webpack.config.dev.js +60 -60
  83. package/webpack.config.js +130 -130
  84. package/webpack.config.watch.js +4 -4
package/src/Loader.js CHANGED
@@ -1,138 +1,138 @@
1
- export const Loader = ({
2
- width = "240px",
3
- height = "240px",
4
- }) => {
5
- return <svg
6
- style={{
7
- margin: "auto",
8
- background: "none",
9
- display: "block",
10
- shapeRendering: "auto",
11
- }}
12
- width={width}
13
- height={height}
14
- viewBox="0 0 100 100"
15
- preserveAspectRatio="xMidYMid">
16
- <g transform="rotate(0 50 50)">
17
- <rect x="46.5" y="17.5" rx="3.5" ry="1.5" width="7" height="3" fill="#000000">
18
- <animate
19
- attributeName="opacity"
20
- values="1;0"
21
- keyTimes="0;1"
22
- dur="0.9174311926605504s"
23
- begin="-0.8340283569641368s"
24
- repeatCount="indefinite" />
25
- </rect>
26
- </g>
27
- <g transform="rotate(32.72727272727273 50 50)">
28
- <rect x="46.5" y="17.5" rx="3.5" ry="1.5" width="7" height="3" fill="#000000">
29
- <animate
30
- attributeName="opacity"
31
- values="1;0"
32
- keyTimes="0;1"
33
- dur="0.9174311926605504s"
34
- begin="-0.7506255212677231s"
35
- repeatCount="indefinite" />
36
- </rect>
37
- </g>
38
- <g transform="rotate(65.45454545454545 50 50)">
39
- <rect x="46.5" y="17.5" rx="3.5" ry="1.5" width="7" height="3" fill="#000000">
40
- <animate
41
- attributeName="opacity"
42
- values="1;0"
43
- keyTimes="0;1"
44
- dur="0.9174311926605504s"
45
- begin="-0.6672226855713094s"
46
- repeatCount="indefinite" />
47
- </rect>
48
- </g>
49
- <g transform="rotate(98.18181818181819 50 50)">
50
- <rect x="46.5" y="17.5" rx="3.5" ry="1.5" width="7" height="3" fill="#000000">
51
- <animate
52
- attributeName="opacity"
53
- values="1;0"
54
- keyTimes="0;1"
55
- dur="0.9174311926605504s"
56
- begin="-0.5838198498748958s"
57
- repeatCount="indefinite" />
58
- </rect>
59
- </g>
60
- <g transform="rotate(130.9090909090909 50 50)">
61
- <rect x="46.5" y="17.5" rx="3.5" ry="1.5" width="7" height="3" fill="#000000">
62
- <animate
63
- attributeName="opacity"
64
- values="1;0"
65
- keyTimes="0;1"
66
- dur="0.9174311926605504s"
67
- begin="-0.5004170141784821s"
68
- repeatCount="indefinite" />
69
- </rect>
70
- </g>
71
- <g transform="rotate(163.63636363636363 50 50)">
72
- <rect x="46.5" y="17.5" rx="3.5" ry="1.5" width="7" height="3" fill="#000000">
73
- <animate
74
- attributeName="opacity"
75
- values="1;0"
76
- keyTimes="0;1"
77
- dur="0.9174311926605504s"
78
- begin="-0.4170141784820684s"
79
- repeatCount="indefinite" />
80
- </rect>
81
- </g>
82
- <g transform="rotate(196.36363636363637 50 50)">
83
- <rect x="46.5" y="17.5" rx="3.5" ry="1.5" width="7" height="3" fill="#000000">
84
- <animate
85
- attributeName="opacity"
86
- values="1;0"
87
- keyTimes="0;1"
88
- dur="0.9174311926605504s"
89
- begin="-0.3336113427856547s"
90
- repeatCount="indefinite" />
91
- </rect>
92
- </g>
93
- <g transform="rotate(229.0909090909091 50 50)">
94
- <rect x="46.5" y="17.5" rx="3.5" ry="1.5" width="7" height="3" fill="#000000">
95
- <animate
96
- attributeName="opacity"
97
- values="1;0"
98
- keyTimes="0;1"
99
- dur="0.9174311926605504s"
100
- begin="-0.25020850708924103s"
101
- repeatCount="indefinite" />
102
- </rect>
103
- </g>
104
- <g transform="rotate(261.8181818181818 50 50)">
105
- <rect x="46.5" y="17.5" rx="3.5" ry="1.5" width="7" height="3" fill="#000000">
106
- <animate
107
- attributeName="opacity"
108
- values="1;0"
109
- keyTimes="0;1"
110
- dur="0.9174311926605504s"
111
- begin="-0.16680567139282734s"
112
- repeatCount="indefinite" />
113
- </rect>
114
- </g>
115
- <g transform="rotate(294.54545454545456 50 50)">
116
- <rect x="46.5" y="17.5" rx="3.5" ry="1.5" width="7" height="3" fill="#000000">
117
- <animate
118
- attributeName="opacity"
119
- values="1;0"
120
- keyTimes="0;1"
121
- dur="0.9174311926605504s"
122
- begin="-0.08340283569641367s"
123
- repeatCount="indefinite" />
124
- </rect>
125
- </g>
126
- <g transform="rotate(327.27272727272725 50 50)">
127
- <rect x="46.5" y="17.5" rx="3.5" ry="1.5" width="7" height="3" fill="#000000">
128
- <animate
129
- attributeName="opacity"
130
- values="1;0"
131
- keyTimes="0;1"
132
- dur="0.9174311926605504s"
133
- begin="0s"
134
- repeatCount="indefinite" />
135
- </rect>
136
- </g>
137
- </svg>;
1
+ export const Loader = ({
2
+ width = "240px",
3
+ height = "240px",
4
+ }) => {
5
+ return <svg
6
+ style={{
7
+ margin: "auto",
8
+ background: "none",
9
+ display: "block",
10
+ shapeRendering: "auto",
11
+ }}
12
+ width={width}
13
+ height={height}
14
+ viewBox="0 0 100 100"
15
+ preserveAspectRatio="xMidYMid">
16
+ <g transform="rotate(0 50 50)">
17
+ <rect x="46.5" y="17.5" rx="3.5" ry="1.5" width="7" height="3" fill="#000000">
18
+ <animate
19
+ attributeName="opacity"
20
+ values="1;0"
21
+ keyTimes="0;1"
22
+ dur="0.9174311926605504s"
23
+ begin="-0.8340283569641368s"
24
+ repeatCount="indefinite" />
25
+ </rect>
26
+ </g>
27
+ <g transform="rotate(32.72727272727273 50 50)">
28
+ <rect x="46.5" y="17.5" rx="3.5" ry="1.5" width="7" height="3" fill="#000000">
29
+ <animate
30
+ attributeName="opacity"
31
+ values="1;0"
32
+ keyTimes="0;1"
33
+ dur="0.9174311926605504s"
34
+ begin="-0.7506255212677231s"
35
+ repeatCount="indefinite" />
36
+ </rect>
37
+ </g>
38
+ <g transform="rotate(65.45454545454545 50 50)">
39
+ <rect x="46.5" y="17.5" rx="3.5" ry="1.5" width="7" height="3" fill="#000000">
40
+ <animate
41
+ attributeName="opacity"
42
+ values="1;0"
43
+ keyTimes="0;1"
44
+ dur="0.9174311926605504s"
45
+ begin="-0.6672226855713094s"
46
+ repeatCount="indefinite" />
47
+ </rect>
48
+ </g>
49
+ <g transform="rotate(98.18181818181819 50 50)">
50
+ <rect x="46.5" y="17.5" rx="3.5" ry="1.5" width="7" height="3" fill="#000000">
51
+ <animate
52
+ attributeName="opacity"
53
+ values="1;0"
54
+ keyTimes="0;1"
55
+ dur="0.9174311926605504s"
56
+ begin="-0.5838198498748958s"
57
+ repeatCount="indefinite" />
58
+ </rect>
59
+ </g>
60
+ <g transform="rotate(130.9090909090909 50 50)">
61
+ <rect x="46.5" y="17.5" rx="3.5" ry="1.5" width="7" height="3" fill="#000000">
62
+ <animate
63
+ attributeName="opacity"
64
+ values="1;0"
65
+ keyTimes="0;1"
66
+ dur="0.9174311926605504s"
67
+ begin="-0.5004170141784821s"
68
+ repeatCount="indefinite" />
69
+ </rect>
70
+ </g>
71
+ <g transform="rotate(163.63636363636363 50 50)">
72
+ <rect x="46.5" y="17.5" rx="3.5" ry="1.5" width="7" height="3" fill="#000000">
73
+ <animate
74
+ attributeName="opacity"
75
+ values="1;0"
76
+ keyTimes="0;1"
77
+ dur="0.9174311926605504s"
78
+ begin="-0.4170141784820684s"
79
+ repeatCount="indefinite" />
80
+ </rect>
81
+ </g>
82
+ <g transform="rotate(196.36363636363637 50 50)">
83
+ <rect x="46.5" y="17.5" rx="3.5" ry="1.5" width="7" height="3" fill="#000000">
84
+ <animate
85
+ attributeName="opacity"
86
+ values="1;0"
87
+ keyTimes="0;1"
88
+ dur="0.9174311926605504s"
89
+ begin="-0.3336113427856547s"
90
+ repeatCount="indefinite" />
91
+ </rect>
92
+ </g>
93
+ <g transform="rotate(229.0909090909091 50 50)">
94
+ <rect x="46.5" y="17.5" rx="3.5" ry="1.5" width="7" height="3" fill="#000000">
95
+ <animate
96
+ attributeName="opacity"
97
+ values="1;0"
98
+ keyTimes="0;1"
99
+ dur="0.9174311926605504s"
100
+ begin="-0.25020850708924103s"
101
+ repeatCount="indefinite" />
102
+ </rect>
103
+ </g>
104
+ <g transform="rotate(261.8181818181818 50 50)">
105
+ <rect x="46.5" y="17.5" rx="3.5" ry="1.5" width="7" height="3" fill="#000000">
106
+ <animate
107
+ attributeName="opacity"
108
+ values="1;0"
109
+ keyTimes="0;1"
110
+ dur="0.9174311926605504s"
111
+ begin="-0.16680567139282734s"
112
+ repeatCount="indefinite" />
113
+ </rect>
114
+ </g>
115
+ <g transform="rotate(294.54545454545456 50 50)">
116
+ <rect x="46.5" y="17.5" rx="3.5" ry="1.5" width="7" height="3" fill="#000000">
117
+ <animate
118
+ attributeName="opacity"
119
+ values="1;0"
120
+ keyTimes="0;1"
121
+ dur="0.9174311926605504s"
122
+ begin="-0.08340283569641367s"
123
+ repeatCount="indefinite" />
124
+ </rect>
125
+ </g>
126
+ <g transform="rotate(327.27272727272725 50 50)">
127
+ <rect x="46.5" y="17.5" rx="3.5" ry="1.5" width="7" height="3" fill="#000000">
128
+ <animate
129
+ attributeName="opacity"
130
+ values="1;0"
131
+ keyTimes="0;1"
132
+ dur="0.9174311926605504s"
133
+ begin="0s"
134
+ repeatCount="indefinite" />
135
+ </rect>
136
+ </g>
137
+ </svg>;
138
138
  };
@@ -1,159 +1,163 @@
1
- import classNames from "classnames";
2
- import React from "react";
3
-
4
- export const Default = ({
5
- attributes,
6
- elementPropsMap,
7
- specialClassMap,
8
- transformAttributes,
9
- children,
10
- element,
11
- isRenderer,
12
- isInSlot = false,
13
- defaultComponentReplacement,
14
- onElementClick = () => {
15
- },
16
- ...props
17
- }) => {
18
- const getPropsForType = (type) => {
19
- if (!elementPropsMap) {
20
- return {};
21
- }
22
-
23
- if (isInSlot) {
24
- if (elementPropsMap[type + "-in-slot"]) {
25
- return elementPropsMap[type + "-in-slot"];
26
- }
27
- }
28
-
29
- return elementPropsMap[type] || {};
30
- };
31
- const {
32
- type,
33
- align,
34
- } = element;
35
- let elementAttributes = {
36
- ...(element.attributes || {}),
37
- ...getPropsForType(type),
38
- };
39
-
40
- if (typeof transformAttributes === "function") {
41
- elementAttributes = transformAttributes(type, elementAttributes);
42
- }
43
-
44
- let alignedClassname = attributes.className || elementAttributes.className || "";
45
- let Wrapper = elementAttributes.wrapper || function ({children}) {
46
- return <>{children}</>;
47
- };
48
-
49
- if (align) {
50
- if (specialClassMap && specialClassMap[align]) {
51
- alignedClassname += specialClassMap[align];
52
- } else {
53
- alignedClassname += "align-" + align;
54
- }
55
- }
56
-
57
- attributes.onClick = () => onElementClick(element);
58
- attributes.className = alignedClassname.trim() || undefined;
59
-
60
- switch (type) {
61
- case "blockquote":
62
- return <Wrapper type={type}>
63
- <blockquote {...attributes}>{children}</blockquote>
64
- </Wrapper>;
65
- case "list-item":
66
- return <Wrapper type={type}>
67
- <li {...attributes}>{children}</li>
68
- </Wrapper>;
69
- case "unordered-list":
70
- return <Wrapper type={type}>
71
- <ul {...attributes}>{children}</ul>
72
- </Wrapper>;
73
- case "ordered-list":
74
- return <Wrapper type={type}>
75
- <ol {...attributes}>{children}</ol>
76
- </Wrapper>;
77
- case "arrow-list":
78
- return <Wrapper type={type}>
79
- <ul
80
- {...attributes}
81
- className={classNames("arrow-list", attributes.className)}>{children}</ul>
82
- </Wrapper>;
83
- case "code":
84
- if (isRenderer) {
85
- return <Wrapper code={element?.attributes?.code} type={type}/>;
86
- } else {
87
- return <Wrapper type={type}>
88
- <div {...attributes} >
89
- <div dangerouslySetInnerHTML={{__html: element?.attributes?.code}}/>
90
- </div>
91
- </Wrapper>;
92
- }
93
- case "heading": {
94
- const HeadingTag = `h${element.attributes.level || 1}`;
95
- return <Wrapper level={element.attributes.level} type={type}>
96
- <HeadingTag
97
- {...attributes}
98
- id={element?.attributes?.id || undefined}
99
- >
100
- {children}
101
- </HeadingTag>
102
- </Wrapper>;
103
- }
104
- case "link": {
105
- let relProp = `noopener noreferrer`;
106
- let {
107
- noFollow,
108
- nofollow,
109
- ...linkAttributes
110
- } = elementAttributes;
111
-
112
- const nofollowProp = noFollow || nofollow;
113
-
114
- if (nofollowProp) {
115
- relProp += " nofollow";
116
- }
117
-
118
- let CustomLink = typeof defaultComponentReplacement === "function" ? defaultComponentReplacement(type) : null;
119
-
120
- if (CustomLink) {
121
- return <Wrapper type={type}><CustomLink
122
- {...linkAttributes}
123
- {...attributes}
124
- rel={relProp}
125
- className={alignedClassname.trim()}>{children}</CustomLink></Wrapper>;
126
- } else {
127
- return <Wrapper type={type}><a
128
- {...linkAttributes}
129
- {...attributes}
130
- rel={relProp}
131
- className={alignedClassname.trim()}>{children}</a></Wrapper>;
132
- }
133
- }
134
- case "paragraph":
135
- return <Wrapper type={type}><p
136
- {...element.attributes}
137
- {...attributes}
138
- className={alignedClassname.trim()}>{children}</p></Wrapper>;
139
- case "divider":
140
- return <Wrapper type={type}>
141
- <hr {...attributes} />
142
- {children}
143
- </Wrapper>;
144
- case "div":
145
- return <Wrapper type={type}>
146
- <div {...element.attributes} {...attributes}>{children}</div>
147
- </Wrapper>;
148
- case "span":
149
- return <Wrapper type={type}>
150
- <span {...element.attributes} {...attributes}>{children}</span>
151
- </Wrapper>;
152
- default:
153
- if (isRenderer) {
154
- return <Wrapper type={type}>{children}</Wrapper>;
155
- } else {
156
- return <span {...attributes} className={alignedClassname.trim()}>{children}</span>;
157
- }
158
- }
1
+ import classNames from "classnames";
2
+ import React from "react";
3
+
4
+ export const Default = ({
5
+ attributes,
6
+ elementPropsMap,
7
+ specialClassMap,
8
+ transformAttributes,
9
+ children,
10
+ element,
11
+ isRenderer,
12
+ isInSlot = false,
13
+ defaultComponentReplacement,
14
+ onElementClick = () => {
15
+ },
16
+ ...props
17
+ }) => {
18
+ const getPropsForType = (type) => {
19
+ if (!elementPropsMap) {
20
+ return {};
21
+ }
22
+
23
+ if (isInSlot) {
24
+ if (elementPropsMap[type + "-in-slot"]) {
25
+ return elementPropsMap[type + "-in-slot"];
26
+ }
27
+ }
28
+
29
+ return elementPropsMap[type] || {};
30
+ };
31
+ const {
32
+ type,
33
+ align,
34
+ } = element;
35
+ let elementAttributes = {
36
+ ...(element.attributes || {}),
37
+ ...getPropsForType(type),
38
+ };
39
+
40
+ if (typeof transformAttributes === "function") {
41
+ elementAttributes = transformAttributes(type, elementAttributes);
42
+ }
43
+
44
+ let alignedClassname = attributes.className || elementAttributes.className || "";
45
+ let Wrapper = elementAttributes.wrapper || function ({children}) {
46
+ return <>{children}</>;
47
+ };
48
+
49
+ if (align) {
50
+ if (specialClassMap && specialClassMap[align]) {
51
+ alignedClassname += specialClassMap[align];
52
+ } else {
53
+ alignedClassname += "align-" + align;
54
+ }
55
+ }
56
+
57
+ attributes.onClick = () => onElementClick(element);
58
+ attributes.className = alignedClassname.trim() || undefined;
59
+
60
+ switch (type) {
61
+ case "blockquote":
62
+ return <Wrapper type={type}>
63
+ <blockquote {...attributes}>{children}</blockquote>
64
+ </Wrapper>;
65
+ case "list-item":
66
+ return <Wrapper type={type}>
67
+ <li {...attributes}>{children}</li>
68
+ </Wrapper>;
69
+ case "unordered-list":
70
+ return <Wrapper type={type}>
71
+ <ul {...attributes}>{children}</ul>
72
+ </Wrapper>;
73
+ case "ordered-list":
74
+ return <Wrapper type={type}>
75
+ <ol {...attributes}>{children}</ol>
76
+ </Wrapper>;
77
+ case "arrow-list":
78
+ return <Wrapper type={type}>
79
+ <ul
80
+ {...attributes}
81
+ className={classNames("arrow-list", attributes.className)}>{children}</ul>
82
+ </Wrapper>;
83
+ case "code":
84
+ if (isRenderer) {
85
+ return <Wrapper code={element?.attributes?.code} type={type}/>;
86
+ } else {
87
+ return <Wrapper type={type}>
88
+ <div {...attributes} >
89
+ <div dangerouslySetInnerHTML={{__html: element?.attributes?.code}}/>
90
+ </div>
91
+ </Wrapper>;
92
+ }
93
+ case "heading": {
94
+ const HeadingTag = `h${element.attributes.level || 1}`;
95
+ return <Wrapper level={element.attributes.level} type={type}>
96
+ <HeadingTag
97
+ {...attributes}
98
+ id={element?.attributes?.id || undefined}
99
+ >
100
+ {children}
101
+ </HeadingTag>
102
+ </Wrapper>;
103
+ }
104
+ case "link": {
105
+ let relProp = `noopener noreferrer`;
106
+ let {
107
+ noFollow,
108
+ nofollow,
109
+ ...linkAttributes
110
+ } = elementAttributes;
111
+
112
+ const nofollowProp = noFollow || nofollow;
113
+
114
+ if (linkAttributes.href?.startsWith("/mailto:") || linkAttributes.href?.startsWith("/tel:")) {
115
+ linkAttributes.href = linkAttributes.href.slice(1);
116
+ }
117
+
118
+ if (nofollowProp) {
119
+ relProp += " nofollow";
120
+ }
121
+
122
+ let CustomLink = typeof defaultComponentReplacement === "function" ? defaultComponentReplacement(type) : null;
123
+
124
+ if (CustomLink) {
125
+ return <Wrapper type={type}><CustomLink
126
+ {...linkAttributes}
127
+ {...attributes}
128
+ rel={relProp}
129
+ className={alignedClassname.trim()}>{children}</CustomLink></Wrapper>;
130
+ } else {
131
+ return <Wrapper type={type}><a
132
+ {...linkAttributes}
133
+ {...attributes}
134
+ rel={relProp}
135
+ className={alignedClassname.trim()}>{children}</a></Wrapper>;
136
+ }
137
+ }
138
+ case "paragraph":
139
+ return <Wrapper type={type}><p
140
+ {...element.attributes}
141
+ {...attributes}
142
+ className={alignedClassname.trim()}>{children}</p></Wrapper>;
143
+ case "divider":
144
+ return <Wrapper type={type}>
145
+ <hr {...attributes} />
146
+ {children}
147
+ </Wrapper>;
148
+ case "div":
149
+ return <Wrapper type={type}>
150
+ <div {...element.attributes} {...attributes}>{children}</div>
151
+ </Wrapper>;
152
+ case "span":
153
+ return <Wrapper type={type}>
154
+ <span {...element.attributes} {...attributes}>{children}</span>
155
+ </Wrapper>;
156
+ default:
157
+ if (isRenderer) {
158
+ return <Wrapper type={type}>{children}</Wrapper>;
159
+ } else {
160
+ return <span {...attributes} className={alignedClassname.trim()}>{children}</span>;
161
+ }
162
+ }
159
163
  };