@squiz/formatted-text-editor 2.2.4 → 2.2.6
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/AppContext.tsx
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
import
|
2
|
-
import {
|
1
|
+
import DamResourceBrowserPlugin from '@squiz/dam-resource-browser-plugin';
|
2
|
+
import { AiServiceProvider } from '@squiz/dxp-ai-client-react';
|
3
3
|
import MatrixResourceBrowserPlugin, {
|
4
|
-
Source,
|
5
4
|
Resource,
|
6
5
|
ResourceReference,
|
6
|
+
Source,
|
7
7
|
} from '@squiz/matrix-resource-browser-plugin';
|
8
|
-
import
|
8
|
+
import { ResourceBrowserContextProvider, ResourceBrowserSource } from '@squiz/resource-browser';
|
9
|
+
import React, { PropsWithChildren } from 'react';
|
10
|
+
import { QueryClient, QueryClientProvider } from 'react-query';
|
9
11
|
import { EditorContext } from '../src';
|
12
|
+
import { ResolveNodeType } from '../src/types';
|
10
13
|
import resources from './resources.json';
|
11
14
|
import sources from './sources.json';
|
12
|
-
import { ResolveNodeType } from '../src/types';
|
13
|
-
import { AiServiceProvider } from '@squiz/dxp-ai-client-react';
|
14
|
-
import { QueryClientProvider, QueryClient } from 'react-query';
|
15
15
|
|
16
16
|
export type AppContextProps = PropsWithChildren;
|
17
17
|
|
@@ -3,20 +3,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
const react_1 = __importDefault(require("react"));
|
7
|
-
const AiIcon_1 = require("../../../Icons/AiIcon");
|
8
|
-
const sds_1 = require("@squiz/sds");
|
9
|
-
const dxp_ai_client_react_1 = require("@squiz/dxp-ai-client-react");
|
10
|
-
const react_2 = require("@remirror/react");
|
11
6
|
const model_1 = require("@remirror/pm/model");
|
7
|
+
const react_1 = require("@remirror/react");
|
8
|
+
const dxp_ai_client_react_1 = require("@squiz/dxp-ai-client-react");
|
9
|
+
const sds_1 = require("@squiz/sds");
|
12
10
|
const prosemirror_model_1 = require("prosemirror-model");
|
11
|
+
const react_2 = __importDefault(require("react"));
|
12
|
+
const AiIcon_1 = require("../../../Icons/AiIcon");
|
13
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;
|
17
17
|
const { updateActiveDialog } = (0, sds_1.useDialogStore)();
|
18
|
-
const { isSelectionEmpty, getHTML } = (0,
|
19
|
-
const { getState, view } = (0,
|
18
|
+
const { isSelectionEmpty, getHTML } = (0, react_1.useHelpers)();
|
19
|
+
const { getState, view } = (0, react_1.useRemirrorContext)();
|
20
20
|
// No content tools to show, don't show dropdown at all
|
21
21
|
if (!contentTools || contentTools?.length === 0) {
|
22
22
|
return null;
|
@@ -73,31 +73,32 @@ const ContentToolsDropdown = () => {
|
|
73
73
|
classes: ['dxp-ctm-dialog'],
|
74
74
|
dialogContent: {
|
75
75
|
renderContent: (dialogContentProps) => {
|
76
|
-
return (
|
76
|
+
return (react_2.default.createElement(dxp_content_tools_modal_1.ModalContent, { aiServiceOverride: aiService, content: richContent, contentTool: item, dialogContentProps: dialogContentProps, onInsertAfter: onInsertAfter, onReplace: onReplace }));
|
77
77
|
},
|
78
78
|
},
|
79
79
|
dialogSize: sds_1.DIALOG_SIZE_XL,
|
80
80
|
heading: `Rewrite content to ... ${item.name}`,
|
81
81
|
icon: dxp_content_tools_modal_1.ICON_DXP_AI,
|
82
|
-
footer:
|
82
|
+
footer: react_2.default.createElement(dxp_content_tools_modal_1.ModalFooter, { contentTool: item }),
|
83
83
|
stateHandler: sds_1.useDialogStore,
|
84
|
+
showFullScreenButton: true,
|
84
85
|
};
|
85
86
|
updateActiveDialog(dialogProps);
|
86
87
|
},
|
87
88
|
key: item.id,
|
88
|
-
label:
|
89
|
+
label: react_2.default.createElement("span", null, item.name),
|
89
90
|
},
|
90
91
|
],
|
91
92
|
key: item.id,
|
92
93
|
};
|
93
94
|
});
|
94
|
-
return (
|
95
|
-
|
96
|
-
hasContent && (
|
95
|
+
return (react_2.default.createElement(react_2.default.Fragment, null,
|
96
|
+
react_2.default.createElement(react_1.VerticalDivider, null),
|
97
|
+
hasContent && (react_2.default.createElement(sds_1.Dropdown, { title: "Content tools", "aria-label": "Content tools", buttonProps: {
|
97
98
|
format: sds_1.BUTTON_FORMAT_TRANSPARENT,
|
98
99
|
icon: AiIcon_1.ICON_AI,
|
99
100
|
theme: sds_1.BUTTON_THEME_DEFAULT,
|
100
101
|
}, className: "content-tools-dropdown", dropdownPosition: sds_1.DROPDOWN_POSITION_RIGHT, heading: 'Rewrite to...', sections: dropdownItems ?? [], disabled: !hasContent })),
|
101
|
-
!hasContent &&
|
102
|
+
!hasContent && react_2.default.createElement("div", { className: "content-tools-dropdown--disabled" }, AiIcon_1.ICON_AI)));
|
102
103
|
};
|
103
104
|
exports.default = ContentToolsDropdown;
|
package/lib/index.css
CHANGED
@@ -1522,6 +1522,20 @@
|
|
1522
1522
|
.squiz-fte-scope .chip-filter--no-icon .chip-filter__btn-content {
|
1523
1523
|
padding-left: 0.25rem;
|
1524
1524
|
}
|
1525
|
+
.squiz-fte-scope .chip-filter--radio-simplified .chip-filter__dropdown-btn-container,
|
1526
|
+
.squiz-fte-scope .chip-filter--radio-simplified .sds-form-control-option button[role=radio] {
|
1527
|
+
display: none;
|
1528
|
+
}
|
1529
|
+
.squiz-fte-scope .chip-filter--radio-simplified .sds-form-control-item {
|
1530
|
+
cursor: pointer;
|
1531
|
+
transition: 0.3s background-color ease-in-out;
|
1532
|
+
}
|
1533
|
+
.squiz-fte-scope .chip-filter--radio-simplified .sds-form-control-item:hover {
|
1534
|
+
background-color: #ededed;
|
1535
|
+
}
|
1536
|
+
.squiz-fte-scope .chip-filter--radio-simplified .sds-form-control-option {
|
1537
|
+
padding-left: 1.25rem;
|
1538
|
+
}
|
1525
1539
|
.squiz-fte-scope .chip-filter__btn-content {
|
1526
1540
|
align-items: center;
|
1527
1541
|
display: flex;
|
@@ -1567,6 +1581,9 @@
|
|
1567
1581
|
line-height: 1.6875rem;
|
1568
1582
|
color: #000;
|
1569
1583
|
}
|
1584
|
+
.squiz-fte-scope .chip-filter__dropdown-header .chip-filter__dropdown-title {
|
1585
|
+
padding-left: 1.25rem;
|
1586
|
+
}
|
1570
1587
|
.squiz-fte-scope .chip-filter__dropdown-body {
|
1571
1588
|
max-height: 17rem;
|
1572
1589
|
overflow-y: auto;
|
@@ -2080,6 +2097,11 @@
|
|
2080
2097
|
.squiz-fte-scope .sds-dialog.xl {
|
2081
2098
|
max-width: 62.5rem;
|
2082
2099
|
}
|
2100
|
+
.squiz-fte-scope .sds-dialog.fullscreen {
|
2101
|
+
height: 100%;
|
2102
|
+
max-width: 100%;
|
2103
|
+
width: 100%;
|
2104
|
+
}
|
2083
2105
|
.squiz-fte-scope .sds-dialog.sm-md .sds-form,
|
2084
2106
|
.squiz-fte-scope .sds-dialog.md .sds-form {
|
2085
2107
|
max-width: 100%;
|
@@ -2088,13 +2110,20 @@
|
|
2088
2110
|
padding: 1.5rem 1.5rem 1rem 1.5rem;
|
2089
2111
|
position: relative;
|
2090
2112
|
}
|
2091
|
-
.squiz-fte-scope .sds-
|
2113
|
+
.squiz-fte-scope .sds-dialog__action-buttons {
|
2114
|
+
display: flex;
|
2115
|
+
gap: 0.75rem;
|
2092
2116
|
padding: 0.75rem;
|
2093
2117
|
position: absolute;
|
2094
2118
|
right: 0;
|
2095
2119
|
top: 0;
|
2096
2120
|
}
|
2097
|
-
.squiz-fte-scope .sds-
|
2121
|
+
.squiz-fte-scope .sds-dialog__action-buttons button {
|
2122
|
+
background: none;
|
2123
|
+
border: 0;
|
2124
|
+
color: #707070;
|
2125
|
+
}
|
2126
|
+
.squiz-fte-scope .sds-dialog__action-buttons button:hover .svg-wrapper svg {
|
2098
2127
|
fill: #3d3d3d;
|
2099
2128
|
}
|
2100
2129
|
.squiz-fte-scope .sds-dialog__heading {
|
@@ -2170,6 +2199,9 @@
|
|
2170
2199
|
height: -moz-fit-content;
|
2171
2200
|
height: fit-content;
|
2172
2201
|
}
|
2202
|
+
.squiz-fte-scope .sds-dialog__fullscreen {
|
2203
|
+
display: none;
|
2204
|
+
}
|
2173
2205
|
.squiz-fte-scope .sds-dialog__body {
|
2174
2206
|
flex-grow: 1;
|
2175
2207
|
}
|
@@ -2665,6 +2697,9 @@
|
|
2665
2697
|
right: 0;
|
2666
2698
|
top: 0;
|
2667
2699
|
}
|
2700
|
+
.squiz-fte-scope .sds-text-field:has(.sds-text-field__copy-icon) input {
|
2701
|
+
padding-right: 2rem;
|
2702
|
+
}
|
2668
2703
|
.squiz-fte-scope .sds-text-field.readonly input,
|
2669
2704
|
.squiz-fte-scope .sds-text-field.readonly textarea {
|
2670
2705
|
background: rgba(0, 0, 0, 0.04);
|
@@ -4214,6 +4249,7 @@
|
|
4214
4249
|
display: flex;
|
4215
4250
|
flex-flow: row nowrap;
|
4216
4251
|
gap: 0.25rem;
|
4252
|
+
height: 100%;
|
4217
4253
|
}
|
4218
4254
|
.squiz-fte-scope .dxp-ctm-content > .dxp-ctm-section {
|
4219
4255
|
display: flex;
|
@@ -4227,6 +4263,10 @@
|
|
4227
4263
|
.squiz-fte-scope .dxp-ctm-content > .dxp-ctm-section > .squiz-fte-scope:not(.dxp-ctm-section__spinner) {
|
4228
4264
|
background-color: #fff;
|
4229
4265
|
}
|
4266
|
+
.squiz-fte-scope .dxp-ctm-dialog .sds-dialog__content {
|
4267
|
+
height: 100%;
|
4268
|
+
max-height: 100%;
|
4269
|
+
}
|
4230
4270
|
.squiz-fte-scope .dxp-ctm-dialog > .sds-dialog__footer {
|
4231
4271
|
align-items: center;
|
4232
4272
|
color: #707070;
|
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.6",
|
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.3.1",
|
31
31
|
"@squiz/matrix-resource-browser-plugin": "^2.0.0",
|
32
32
|
"@squiz/resource-browser": "^2.0.0",
|
33
|
-
"@squiz/sds": "^1.0.
|
33
|
+
"@squiz/sds": "^1.0.2",
|
34
34
|
"clsx": "2.1.1",
|
35
35
|
"react-hook-form": "7.51.4",
|
36
36
|
"react-image-size": "2.0.0",
|
@@ -1,5 +1,6 @@
|
|
1
|
-
import
|
2
|
-
import {
|
1
|
+
import { DOMSerializer } from '@remirror/pm/model';
|
2
|
+
import { VerticalDivider, useHelpers, useRemirrorContext } from '@remirror/react';
|
3
|
+
import { useAiService } from '@squiz/dxp-ai-client-react';
|
3
4
|
import {
|
4
5
|
BUTTON_FORMAT_TRANSPARENT,
|
5
6
|
BUTTON_THEME_DEFAULT,
|
@@ -11,10 +12,9 @@ import {
|
|
11
12
|
DropdownSectionData,
|
12
13
|
useDialogStore,
|
13
14
|
} from '@squiz/sds';
|
14
|
-
import { useAiService } from '@squiz/dxp-ai-client-react';
|
15
|
-
import { VerticalDivider, useHelpers, useRemirrorContext } from '@remirror/react';
|
16
|
-
import { DOMSerializer } from '@remirror/pm/model';
|
17
15
|
import { DOMParser as ProseMirrorDOMParser } from 'prosemirror-model';
|
16
|
+
import React from 'react';
|
17
|
+
import { ICON_AI } from '../../../Icons/AiIcon';
|
18
18
|
|
19
19
|
import { ICON_DXP_AI, ModalContent, ModalFooter } from '@squiz/dxp-content-tools-modal';
|
20
20
|
|
@@ -109,6 +109,7 @@ const ContentToolsDropdown = () => {
|
|
109
109
|
icon: ICON_DXP_AI,
|
110
110
|
footer: <ModalFooter contentTool={item} />,
|
111
111
|
stateHandler: useDialogStore,
|
112
|
+
showFullScreenButton: true,
|
112
113
|
};
|
113
114
|
|
114
115
|
updateActiveDialog(dialogProps as DialogProps);
|