@squiz/formatted-text-editor 2.2.0 → 2.2.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/CHANGELOG.md
CHANGED
@@ -10,7 +10,7 @@ const dxp_ai_client_react_1 = require("@squiz/dxp-ai-client-react");
|
|
10
10
|
const react_2 = require("@remirror/react");
|
11
11
|
const ContentToolsDropdown = () => {
|
12
12
|
const { contentTools } = (0, dxp_ai_client_react_1.useAiService)();
|
13
|
-
const dropdownItems = contentTools
|
13
|
+
const dropdownItems = contentTools?.map((item) => ({
|
14
14
|
items: [
|
15
15
|
{
|
16
16
|
action: () => alert(JSON.stringify(item, null, 2)),
|
@@ -21,7 +21,7 @@ const ContentToolsDropdown = () => {
|
|
21
21
|
key: item.id,
|
22
22
|
}));
|
23
23
|
// No content tools to show, don't show dropdown at all
|
24
|
-
if (contentTools
|
24
|
+
if (!contentTools || contentTools?.length === 0) {
|
25
25
|
return null;
|
26
26
|
}
|
27
27
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
@@ -30,6 +30,6 @@ const ContentToolsDropdown = () => {
|
|
30
30
|
format: sds_1.BUTTON_FORMAT_TRANSPARENT,
|
31
31
|
icon: AiIcon_1.ICON_AI,
|
32
32
|
theme: sds_1.BUTTON_THEME_DEFAULT,
|
33
|
-
}, className: "content-tools-dropdown", dropdownPosition: sds_1.DROPDOWN_POSITION_RIGHT, heading: 'Rewrite to...', sections: dropdownItems })));
|
33
|
+
}, className: "content-tools-dropdown", dropdownPosition: sds_1.DROPDOWN_POSITION_RIGHT, heading: 'Rewrite to...', sections: dropdownItems ?? [] })));
|
34
34
|
};
|
35
35
|
exports.default = ContentToolsDropdown;
|
package/package.json
CHANGED
@@ -7,7 +7,7 @@ import { VerticalDivider } from '@remirror/react';
|
|
7
7
|
const ContentToolsDropdown = () => {
|
8
8
|
const { contentTools } = useAiService();
|
9
9
|
|
10
|
-
const dropdownItems = contentTools
|
10
|
+
const dropdownItems = contentTools?.map((item) => ({
|
11
11
|
items: [
|
12
12
|
{
|
13
13
|
action: () => alert(JSON.stringify(item, null, 2)),
|
@@ -19,7 +19,7 @@ const ContentToolsDropdown = () => {
|
|
19
19
|
}));
|
20
20
|
|
21
21
|
// No content tools to show, don't show dropdown at all
|
22
|
-
if (contentTools
|
22
|
+
if (!contentTools || contentTools?.length === 0) {
|
23
23
|
return null;
|
24
24
|
}
|
25
25
|
|
@@ -37,7 +37,7 @@ const ContentToolsDropdown = () => {
|
|
37
37
|
className="content-tools-dropdown"
|
38
38
|
dropdownPosition={DROPDOWN_POSITION_RIGHT}
|
39
39
|
heading={'Rewrite to...'}
|
40
|
-
sections={dropdownItems}
|
40
|
+
sections={dropdownItems ?? []}
|
41
41
|
/>
|
42
42
|
</>
|
43
43
|
);
|