@squiz/formatted-text-editor 2.2.3 → 2.2.4
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
package/demo/App.tsx
CHANGED
@@ -95,6 +95,7 @@ function App() {
|
|
95
95
|
>
|
96
96
|
{showChildren && <ComponentHandlers />}
|
97
97
|
</Editor>
|
98
|
+
{activeDialog && <Dialog {...activeDialog} />}
|
98
99
|
</AppContext>
|
99
100
|
</div>
|
100
101
|
<h1>Document</h1>
|
@@ -107,7 +108,6 @@ function App() {
|
|
107
108
|
<ReactDiffViewer oldValue={squizDoc} newValue={squizDoc} splitView={false} showDiffOnly={false} />
|
108
109
|
</div>
|
109
110
|
</div>
|
110
|
-
{activeDialog && <Dialog {...activeDialog} />}
|
111
111
|
</div>
|
112
112
|
);
|
113
113
|
}
|
@@ -8,9 +8,9 @@ const AiIcon_1 = require("../../../Icons/AiIcon");
|
|
8
8
|
const sds_1 = require("@squiz/sds");
|
9
9
|
const dxp_ai_client_react_1 = require("@squiz/dxp-ai-client-react");
|
10
10
|
const react_2 = require("@remirror/react");
|
11
|
-
const dxp_content_tools_modal_1 = require("@squiz/dxp-content-tools-modal");
|
12
11
|
const model_1 = require("@remirror/pm/model");
|
13
12
|
const prosemirror_model_1 = require("prosemirror-model");
|
13
|
+
const dxp_content_tools_modal_1 = require("@squiz/dxp-content-tools-modal");
|
14
14
|
const ContentToolsDropdown = () => {
|
15
15
|
const aiService = (0, dxp_ai_client_react_1.useAiService)();
|
16
16
|
const { contentTools } = aiService;
|
@@ -70,6 +70,7 @@ const ContentToolsDropdown = () => {
|
|
70
70
|
// If we don't have a selection, use all text
|
71
71
|
const richContent = isSelectionEmpty() ? getHTML() : getSelectedRichText(); // NOTE: selected rich text may not work as expected
|
72
72
|
const dialogProps = {
|
73
|
+
classes: ['dxp-ctm-dialog'],
|
73
74
|
dialogContent: {
|
74
75
|
renderContent: (dialogContentProps) => {
|
75
76
|
return (react_1.default.createElement(dxp_content_tools_modal_1.ModalContent, { aiServiceOverride: aiService, content: richContent, contentTool: item, dialogContentProps: dialogContentProps, onInsertAfter: onInsertAfter, onReplace: onReplace }));
|
@@ -78,6 +79,7 @@ const ContentToolsDropdown = () => {
|
|
78
79
|
dialogSize: sds_1.DIALOG_SIZE_XL,
|
79
80
|
heading: `Rewrite content to ... ${item.name}`,
|
80
81
|
icon: dxp_content_tools_modal_1.ICON_DXP_AI,
|
82
|
+
footer: react_1.default.createElement(dxp_content_tools_modal_1.ModalFooter, { contentTool: item }),
|
81
83
|
stateHandler: sds_1.useDialogStore,
|
82
84
|
};
|
83
85
|
updateActiveDialog(dialogProps);
|
package/lib/index.css
CHANGED
@@ -2665,9 +2665,6 @@
|
|
2665
2665
|
right: 0;
|
2666
2666
|
top: 0;
|
2667
2667
|
}
|
2668
|
-
.squiz-fte-scope .sds-text-field:has(.sds-text-field__copy-icon) input {
|
2669
|
-
padding-right: 2rem;
|
2670
|
-
}
|
2671
2668
|
.squiz-fte-scope .sds-text-field.readonly input,
|
2672
2669
|
.squiz-fte-scope .sds-text-field.readonly textarea {
|
2673
2670
|
background: rgba(0, 0, 0, 0.04);
|
@@ -4230,6 +4227,32 @@
|
|
4230
4227
|
.squiz-fte-scope .dxp-ctm-content > .dxp-ctm-section > .squiz-fte-scope:not(.dxp-ctm-section__spinner) {
|
4231
4228
|
background-color: #fff;
|
4232
4229
|
}
|
4230
|
+
.squiz-fte-scope .dxp-ctm-dialog > .sds-dialog__footer {
|
4231
|
+
align-items: center;
|
4232
|
+
color: #707070;
|
4233
|
+
display: flex;
|
4234
|
+
}
|
4235
|
+
.squiz-fte-scope .dxp-ctm-dialog > .sds-dialog__footer > .sds-dialog__footer-text {
|
4236
|
+
flex: 1;
|
4237
|
+
padding: 0;
|
4238
|
+
}
|
4239
|
+
.squiz-fte-scope .dxp-ctm-dialog > .sds-dialog__footer > .sds-dialog__footer-text > span {
|
4240
|
+
align-items: center;
|
4241
|
+
display: flex;
|
4242
|
+
font-size: 0.875rem;
|
4243
|
+
gap: 0.5rem;
|
4244
|
+
}
|
4245
|
+
.squiz-fte-scope .dxp-ctm-dialog .dxp-ctm-flagged {
|
4246
|
+
align-items: center;
|
4247
|
+
color: #000;
|
4248
|
+
display: flex;
|
4249
|
+
font-weight: 600;
|
4250
|
+
gap: 0.5rem;
|
4251
|
+
padding-left: 0.5rem;
|
4252
|
+
}
|
4253
|
+
.squiz-fte-scope .dxp-ctm-dialog .dxp-ctm-flagged svg path {
|
4254
|
+
fill: #e96900;
|
4255
|
+
}
|
4233
4256
|
.squiz-fte-scope .dxp-ctm-section {
|
4234
4257
|
background-color: #ededed;
|
4235
4258
|
border-radius: 0.5rem;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@squiz/formatted-text-editor",
|
3
|
-
"version": "2.2.
|
3
|
+
"version": "2.2.4",
|
4
4
|
"main": "lib/index.js",
|
5
5
|
"types": "lib/index.d.ts",
|
6
6
|
"private": false,
|
@@ -27,10 +27,10 @@
|
|
27
27
|
"@squiz/dam-resource-browser-plugin": "^0.9.0-rc.0",
|
28
28
|
"@squiz/dx-json-schema-lib": "^1.72.0",
|
29
29
|
"@squiz/dxp-ai-client-react": "^0.2.0",
|
30
|
-
"@squiz/dxp-content-tools-modal": "^0.
|
30
|
+
"@squiz/dxp-content-tools-modal": "^0.2.0",
|
31
31
|
"@squiz/matrix-resource-browser-plugin": "^2.0.0",
|
32
32
|
"@squiz/resource-browser": "^2.0.0",
|
33
|
-
"@squiz/sds": "^1.0.0
|
33
|
+
"@squiz/sds": "^1.0.0",
|
34
34
|
"clsx": "2.1.1",
|
35
35
|
"react-hook-form": "7.51.4",
|
36
36
|
"react-image-size": "2.0.0",
|
@@ -13,10 +13,11 @@ import {
|
|
13
13
|
} from '@squiz/sds';
|
14
14
|
import { useAiService } from '@squiz/dxp-ai-client-react';
|
15
15
|
import { VerticalDivider, useHelpers, useRemirrorContext } from '@remirror/react';
|
16
|
-
import { ICON_DXP_AI, ModalContent } from '@squiz/dxp-content-tools-modal';
|
17
16
|
import { DOMSerializer } from '@remirror/pm/model';
|
18
17
|
import { DOMParser as ProseMirrorDOMParser } from 'prosemirror-model';
|
19
18
|
|
19
|
+
import { ICON_DXP_AI, ModalContent, ModalFooter } from '@squiz/dxp-content-tools-modal';
|
20
|
+
|
20
21
|
const ContentToolsDropdown = () => {
|
21
22
|
const aiService = useAiService();
|
22
23
|
const { contentTools } = aiService;
|
@@ -87,7 +88,8 @@ const ContentToolsDropdown = () => {
|
|
87
88
|
// If we don't have a selection, use all text
|
88
89
|
const richContent = isSelectionEmpty() ? getHTML() : getSelectedRichText(); // NOTE: selected rich text may not work as expected
|
89
90
|
|
90
|
-
const dialogProps:
|
91
|
+
const dialogProps: unknown = {
|
92
|
+
classes: ['dxp-ctm-dialog'],
|
91
93
|
dialogContent: {
|
92
94
|
renderContent: (dialogContentProps: DialogContentProps) => {
|
93
95
|
return (
|
@@ -105,10 +107,11 @@ const ContentToolsDropdown = () => {
|
|
105
107
|
dialogSize: DIALOG_SIZE_XL,
|
106
108
|
heading: `Rewrite content to ... ${item.name}`,
|
107
109
|
icon: ICON_DXP_AI,
|
110
|
+
footer: <ModalFooter contentTool={item} />,
|
108
111
|
stateHandler: useDialogStore,
|
109
112
|
};
|
110
113
|
|
111
|
-
updateActiveDialog(dialogProps);
|
114
|
+
updateActiveDialog(dialogProps as DialogProps);
|
112
115
|
},
|
113
116
|
key: item.id,
|
114
117
|
label: <span>{item.name}</span>,
|