@squiz/formatted-text-editor 2.5.0 → 2.6.0
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 +6 -0
- package/demo/diff/App.tsx +0 -5
- package/demo/diff/AppContext.tsx +14 -8
- package/demo/diff/index.scss +3 -0
- package/lib/index.css +157 -3
- package/package.json +5 -4
- package/src/Editor/Editor.spec.tsx +1 -0
- package/tests/mockResourceBrowserContext.tsx +17 -1
- package/tests/renderWithContext.tsx +3 -0
package/CHANGELOG.md
CHANGED
package/demo/diff/App.tsx
CHANGED
@@ -84,11 +84,6 @@ function App() {
|
|
84
84
|
<a href="https://www.google.com"><strong>Mr Bean</strong></a>, nice to <a href="https://www.google.com">meet you</a>.
|
85
85
|
<img src="https://media2.giphy.com/media/3o6ozsIxg5legYvggo/giphy.gif" height="150" width="200"/>
|
86
86
|
<img data-matrix-asset-id="1" data-matrix-identifier="matrixIdentifier" data-matrix-domain="https://matrix-domain.squiz.net">
|
87
|
-
<img
|
88
|
-
data-dam-object-id="CA87B42E-9410-402F-B3669D6900DD0793"
|
89
|
-
data-dam-system-identifier="byder001"
|
90
|
-
data-dam-system-type="bynder"
|
91
|
-
>
|
92
87
|
</p>
|
93
88
|
`}
|
94
89
|
onChange={handleEditorChange}
|
package/demo/diff/AppContext.tsx
CHANGED
@@ -30,6 +30,7 @@ export const AppContext = ({ children }: AppContextProps) => (
|
|
30
30
|
<QueryClientProvider client={testQueryClient}>
|
31
31
|
<ResourceBrowserContextProvider
|
32
32
|
value={{
|
33
|
+
searchEnabled: true,
|
33
34
|
onRequestSources: (): Promise<ResourceBrowserSource[]> =>
|
34
35
|
Promise.resolve([
|
35
36
|
{
|
@@ -37,14 +38,6 @@ export const AppContext = ({ children }: AppContextProps) => (
|
|
37
38
|
id: 'matrixIdentifier',
|
38
39
|
type: 'matrix',
|
39
40
|
},
|
40
|
-
{
|
41
|
-
name: 'Bynder',
|
42
|
-
id: 'byder001',
|
43
|
-
type: 'dam',
|
44
|
-
configuration: {
|
45
|
-
externalType: 'bynder',
|
46
|
-
},
|
47
|
-
},
|
48
41
|
]),
|
49
42
|
plugins: [
|
50
43
|
DamResourceBrowserPlugin(),
|
@@ -66,6 +59,19 @@ export const AppContext = ({ children }: AppContextProps) => (
|
|
66
59
|
flattenResources(resources).find((resource) => resource.id === reference.resource) || null,
|
67
60
|
);
|
68
61
|
},
|
62
|
+
onSearchRequest: () =>
|
63
|
+
Promise.resolve({
|
64
|
+
results: [],
|
65
|
+
filters: [],
|
66
|
+
resultsSummary: {
|
67
|
+
totalMatching: 0,
|
68
|
+
numRanks: 10,
|
69
|
+
currStart: 0,
|
70
|
+
currEnd: 0,
|
71
|
+
prevStart: null,
|
72
|
+
nextStart: null,
|
73
|
+
},
|
74
|
+
}),
|
69
75
|
}),
|
70
76
|
],
|
71
77
|
}}
|
package/demo/diff/index.scss
CHANGED
package/lib/index.css
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
@import "https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded";
|
2
2
|
|
3
|
-
/* node_modules/@squiz/sds/lib/package.css */
|
3
|
+
/* ../../node_modules/@squiz/sds/lib/package.css */
|
4
4
|
.squiz-fte-scope code[class*=language-],
|
5
5
|
.squiz-fte-scope pre[class*=language-] {
|
6
6
|
color: #ccc;
|
@@ -280,6 +280,9 @@
|
|
280
280
|
margin-right: 0.5rem;
|
281
281
|
max-width: 100%;
|
282
282
|
}
|
283
|
+
.squiz-fte-scope .sds-alert__title .svg-wrapper svg {
|
284
|
+
fill: #3d3d3d;
|
285
|
+
}
|
283
286
|
.squiz-fte-scope .sds-alert__buttons {
|
284
287
|
display: flex;
|
285
288
|
margin-bottom: 0.375rem;
|
@@ -1100,6 +1103,9 @@
|
|
1100
1103
|
letter-spacing: -0.5px;
|
1101
1104
|
line-height: 1.5rem;
|
1102
1105
|
}
|
1106
|
+
.squiz-fte-scope .sds-card-title .svg-wrapper svg {
|
1107
|
+
fill: #3d3d3d;
|
1108
|
+
}
|
1103
1109
|
.squiz-fte-scope .sds-card-subtitle {
|
1104
1110
|
font-size: 1rem;
|
1105
1111
|
font-weight: 700;
|
@@ -2020,6 +2026,9 @@
|
|
2020
2026
|
line-height: 1.25rem;
|
2021
2027
|
color: #3d3d3d;
|
2022
2028
|
}
|
2029
|
+
.squiz-fte-scope .sds-data-list__title .svg-wrapper svg {
|
2030
|
+
fill: #3d3d3d;
|
2031
|
+
}
|
2023
2032
|
@media screen and (min-width: 768px) {
|
2024
2033
|
.squiz-fte-scope .sds-data-list__icon + div {
|
2025
2034
|
align-items: center;
|
@@ -2136,6 +2145,9 @@
|
|
2136
2145
|
letter-spacing: -0.5px;
|
2137
2146
|
line-height: 1.5rem;
|
2138
2147
|
}
|
2148
|
+
.squiz-fte-scope .sds-dialog__heading span .svg-wrapper svg {
|
2149
|
+
fill: #3d3d3d;
|
2150
|
+
}
|
2139
2151
|
.squiz-fte-scope .sds-dialog__icon {
|
2140
2152
|
flex-shrink: 0;
|
2141
2153
|
margin-right: 0.75rem;
|
@@ -2318,7 +2330,7 @@
|
|
2318
2330
|
.squiz-fte-scope .sds-dropdown-label {
|
2319
2331
|
display: block;
|
2320
2332
|
padding: 0.5rem;
|
2321
|
-
word-break: break-
|
2333
|
+
word-break: break-word;
|
2322
2334
|
}
|
2323
2335
|
.squiz-fte-scope .sds-empty-state-card {
|
2324
2336
|
align-items: center;
|
@@ -2355,6 +2367,9 @@
|
|
2355
2367
|
margin-top: 1rem;
|
2356
2368
|
text-align: center;
|
2357
2369
|
}
|
2370
|
+
.squiz-fte-scope .sds-empty-state-card__title .svg-wrapper svg {
|
2371
|
+
fill: #3d3d3d;
|
2372
|
+
}
|
2358
2373
|
.squiz-fte-scope .sds-empty-state-card__icon > svg {
|
2359
2374
|
height: 11rem;
|
2360
2375
|
width: auto;
|
@@ -2818,11 +2833,21 @@
|
|
2818
2833
|
font-weight: 600;
|
2819
2834
|
margin-bottom: 0.25rem;
|
2820
2835
|
}
|
2836
|
+
.squiz-fte-scope .sds-form-control-text {
|
2837
|
+
align-items: center;
|
2838
|
+
display: flex;
|
2839
|
+
}
|
2821
2840
|
.squiz-fte-scope .sds-form-control-label {
|
2822
2841
|
color: #3d3d3d;
|
2823
2842
|
flex-grow: 1;
|
2824
2843
|
text-align: left;
|
2825
|
-
word-break: break-
|
2844
|
+
word-break: break-word;
|
2845
|
+
}
|
2846
|
+
.squiz-fte-scope .sds-form-control--prominent .sds-form-control-item {
|
2847
|
+
margin-bottom: 1.25rem;
|
2848
|
+
}
|
2849
|
+
.squiz-fte-scope .sds-form-control--prominent .sds-form-control-item:last-child {
|
2850
|
+
margin-bottom: 0;
|
2826
2851
|
}
|
2827
2852
|
.squiz-fte-scope ::-moz-placeholder {
|
2828
2853
|
color: #949494;
|
@@ -2941,6 +2966,9 @@
|
|
2941
2966
|
display: block;
|
2942
2967
|
margin-bottom: 0.75rem;
|
2943
2968
|
}
|
2969
|
+
.squiz-fte-scope .sds-link-list__heading .svg-wrapper svg {
|
2970
|
+
fill: #3d3d3d;
|
2971
|
+
}
|
2944
2972
|
.squiz-fte-scope .sds-link-list {
|
2945
2973
|
list-style-type: none;
|
2946
2974
|
margin: 0;
|
@@ -3045,6 +3073,9 @@
|
|
3045
3073
|
display: block;
|
3046
3074
|
margin-bottom: 0.75rem;
|
3047
3075
|
}
|
3076
|
+
.squiz-fte-scope .sds-row__title .svg-wrapper svg {
|
3077
|
+
fill: #3d3d3d;
|
3078
|
+
}
|
3048
3079
|
.squiz-fte-scope .sds-row__title:only-child,
|
3049
3080
|
.squiz-fte-scope .sds-row__title:last-child {
|
3050
3081
|
margin-bottom: 0;
|
@@ -3057,36 +3088,54 @@
|
|
3057
3088
|
margin-bottom: 1.75rem;
|
3058
3089
|
margin-top: 1.75rem;
|
3059
3090
|
}
|
3091
|
+
.squiz-fte-scope .sds-heading--level-1 .svg-wrapper svg {
|
3092
|
+
fill: #3d3d3d;
|
3093
|
+
}
|
3060
3094
|
.squiz-fte-scope .sds-heading--level-2 {
|
3061
3095
|
font-size: 1.25rem;
|
3062
3096
|
font-weight: 600;
|
3063
3097
|
letter-spacing: -0.5px;
|
3064
3098
|
line-height: 1.5rem;
|
3065
3099
|
}
|
3100
|
+
.squiz-fte-scope .sds-heading--level-2 .svg-wrapper svg {
|
3101
|
+
fill: #3d3d3d;
|
3102
|
+
}
|
3066
3103
|
.squiz-fte-scope .sds-heading--level-3 {
|
3067
3104
|
font-size: 1.125rem;
|
3068
3105
|
font-weight: 600;
|
3069
3106
|
letter-spacing: -0.2px;
|
3070
3107
|
line-height: 1.375rem;
|
3071
3108
|
}
|
3109
|
+
.squiz-fte-scope .sds-heading--level-3 .svg-wrapper svg {
|
3110
|
+
fill: #3d3d3d;
|
3111
|
+
}
|
3072
3112
|
.squiz-fte-scope .sds-heading--level-4 {
|
3073
3113
|
font-size: 1rem;
|
3074
3114
|
font-weight: 700;
|
3075
3115
|
letter-spacing: -0.2px;
|
3076
3116
|
line-height: 1.25rem;
|
3077
3117
|
}
|
3118
|
+
.squiz-fte-scope .sds-heading--level-4 .svg-wrapper svg {
|
3119
|
+
fill: #3d3d3d;
|
3120
|
+
}
|
3078
3121
|
.squiz-fte-scope .sds-heading--level-5 {
|
3079
3122
|
font-size: 1rem;
|
3080
3123
|
font-weight: 600;
|
3081
3124
|
letter-spacing: -0.2px;
|
3082
3125
|
line-height: 1.25rem;
|
3083
3126
|
}
|
3127
|
+
.squiz-fte-scope .sds-heading--level-5 .svg-wrapper svg {
|
3128
|
+
fill: #3d3d3d;
|
3129
|
+
}
|
3084
3130
|
.squiz-fte-scope .sds-heading--level-6 {
|
3085
3131
|
font-size: 0.875rem;
|
3086
3132
|
font-weight: 600;
|
3087
3133
|
letter-spacing: -0.2px;
|
3088
3134
|
line-height: 1.25rem;
|
3089
3135
|
}
|
3136
|
+
.squiz-fte-scope .sds-heading--level-6 .svg-wrapper svg {
|
3137
|
+
fill: #3d3d3d;
|
3138
|
+
}
|
3090
3139
|
.squiz-fte-scope .sds-text--sm-regular {
|
3091
3140
|
font-size: 0.8125rem;
|
3092
3141
|
font-weight: 400;
|
@@ -4175,6 +4224,9 @@
|
|
4175
4224
|
margin-bottom: 1rem;
|
4176
4225
|
margin-top: 0;
|
4177
4226
|
}
|
4227
|
+
.squiz-fte-scope .sds-popover__title .svg-wrapper svg {
|
4228
|
+
fill: #3d3d3d;
|
4229
|
+
}
|
4178
4230
|
.squiz-fte-scope .sds-popover--left .sds-popover__content-wrapper {
|
4179
4231
|
bottom: 50%;
|
4180
4232
|
right: calc(100% + 1rem);
|
@@ -4214,6 +4266,108 @@
|
|
4214
4266
|
.squiz-fte-scope .sds-popover--medium .sds-popover__content-wrapper {
|
4215
4267
|
width: 400px;
|
4216
4268
|
}
|
4269
|
+
.squiz-fte-scope .sds-sequence-list.presentation-only .sds-sequence-list__item-content {
|
4270
|
+
margin-right: unset;
|
4271
|
+
}
|
4272
|
+
.squiz-fte-scope .sds-sequence-list__item {
|
4273
|
+
background-color: #ededed;
|
4274
|
+
border-radius: 0.25rem;
|
4275
|
+
display: flex;
|
4276
|
+
gap: 0.75rem;
|
4277
|
+
padding: 0.75rem 1rem;
|
4278
|
+
position: relative;
|
4279
|
+
transition: 0.3s background-color ease-in;
|
4280
|
+
}
|
4281
|
+
.squiz-fte-scope .sds-sequence-list__item--dragging {
|
4282
|
+
background-color: #e0e0e0;
|
4283
|
+
}
|
4284
|
+
.squiz-fte-scope .sds-sequence-list__item:last-of-type::before {
|
4285
|
+
content: none;
|
4286
|
+
}
|
4287
|
+
.squiz-fte-scope .sds-sequence-list__list {
|
4288
|
+
display: flex;
|
4289
|
+
flex-direction: column;
|
4290
|
+
gap: 0.75rem;
|
4291
|
+
list-style-type: none;
|
4292
|
+
}
|
4293
|
+
.squiz-fte-scope .sds-sequence-list__list--dragging .sds-sequence-list__item-dots {
|
4294
|
+
display: none;
|
4295
|
+
}
|
4296
|
+
.squiz-fte-scope .sds-sequence-list__list--dragging .sds-tooltip {
|
4297
|
+
visibility: hidden;
|
4298
|
+
}
|
4299
|
+
.squiz-fte-scope .sds-sequence-list__item-content {
|
4300
|
+
display: flex;
|
4301
|
+
flex-direction: column;
|
4302
|
+
gap: 0.5rem;
|
4303
|
+
margin-right: 1.5rem;
|
4304
|
+
width: 100%;
|
4305
|
+
}
|
4306
|
+
@media screen and (min-width: 576px) {
|
4307
|
+
.squiz-fte-scope .sds-sequence-list__item-content {
|
4308
|
+
flex-direction: row;
|
4309
|
+
gap: 1rem;
|
4310
|
+
justify-content: space-evenly;
|
4311
|
+
}
|
4312
|
+
}
|
4313
|
+
.squiz-fte-scope .sds-sequence-list__item-content .sds-form-field {
|
4314
|
+
width: 100%;
|
4315
|
+
}
|
4316
|
+
.squiz-fte-scope .sds-sequence-list .sds-tooltip__wrapper {
|
4317
|
+
height: -moz-min-content;
|
4318
|
+
height: min-content;
|
4319
|
+
}
|
4320
|
+
.squiz-fte-scope .sds-sequence-list .sds-tooltip__wrapper:has(.sds-sequence-list__item-remove) {
|
4321
|
+
position: absolute;
|
4322
|
+
right: 1rem;
|
4323
|
+
top: 0.75rem;
|
4324
|
+
}
|
4325
|
+
.squiz-fte-scope .sds-sequence-list__item-remove--disabled {
|
4326
|
+
cursor: not-allowed;
|
4327
|
+
opacity: 0.5;
|
4328
|
+
}
|
4329
|
+
.squiz-fte-scope .sds-sequence-list__item-dots {
|
4330
|
+
left: -30px;
|
4331
|
+
position: absolute;
|
4332
|
+
width: 0.25rem;
|
4333
|
+
}
|
4334
|
+
.squiz-fte-scope .sds-sequence-list__item-index-mark {
|
4335
|
+
font-size: 0.875rem;
|
4336
|
+
font-weight: 400;
|
4337
|
+
letter-spacing: -0.2px;
|
4338
|
+
line-height: 1.25rem;
|
4339
|
+
background-color: #f5bb8c;
|
4340
|
+
border-radius: 100%;
|
4341
|
+
display: grid;
|
4342
|
+
height: 2rem;
|
4343
|
+
left: -0.75rem;
|
4344
|
+
place-items: center;
|
4345
|
+
position: absolute;
|
4346
|
+
top: 50%;
|
4347
|
+
transform: translate(-100%, -50%);
|
4348
|
+
width: 2rem;
|
4349
|
+
}
|
4350
|
+
.squiz-fte-scope .sds-sequence-list__item-drag-btn {
|
4351
|
+
align-self: baseline;
|
4352
|
+
}
|
4353
|
+
.squiz-fte-scope .sds-sequence-list__item-drag-btn svg {
|
4354
|
+
height: 1.5rem;
|
4355
|
+
width: 1.5rem;
|
4356
|
+
}
|
4357
|
+
.squiz-fte-scope .sds-sequence-list__item-drag-btn--disabled {
|
4358
|
+
opacity: 0.5;
|
4359
|
+
pointer-events: none;
|
4360
|
+
}
|
4361
|
+
.squiz-fte-scope .sds-sequence-list__add-item-btn {
|
4362
|
+
font-size: 0.875rem;
|
4363
|
+
font-weight: 600;
|
4364
|
+
letter-spacing: -0.2px;
|
4365
|
+
line-height: 1.25rem;
|
4366
|
+
align-items: center;
|
4367
|
+
display: flex;
|
4368
|
+
gap: 0.75rem;
|
4369
|
+
margin-left: 3rem;
|
4370
|
+
}
|
4217
4371
|
|
4218
4372
|
/* ../../node_modules/@squiz/dxp-content-tools-modal/lib/package.css */
|
4219
4373
|
.dxp-ctm-section .squiz-fte-scope.squiz-fte-scope__editor.squiz-fte-scope__editor--is-disabled.squiz-fte-scope__editor--bordered {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@squiz/formatted-text-editor",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.6.0",
|
4
4
|
"main": "lib/index.js",
|
5
5
|
"types": "lib/index.d.ts",
|
6
6
|
"private": false,
|
@@ -25,12 +25,12 @@
|
|
25
25
|
"@mui/icons-material": "5.15.18",
|
26
26
|
"@remirror/extension-react-tables": "^2.2.19",
|
27
27
|
"@remirror/react": "2.0.35",
|
28
|
-
"@squiz/dam-resource-browser-plugin": "^0.
|
28
|
+
"@squiz/dam-resource-browser-plugin": "^3.0.3-rc.0",
|
29
29
|
"@squiz/dx-json-schema-lib": "^1.74.1",
|
30
30
|
"@squiz/dxp-ai-client-react": "^0.2.0",
|
31
31
|
"@squiz/dxp-content-tools-modal": "^0.3.2",
|
32
|
-
"@squiz/matrix-resource-browser-plugin": "^
|
33
|
-
"@squiz/resource-browser": "^
|
32
|
+
"@squiz/matrix-resource-browser-plugin": "^3.0.3-rc.0",
|
33
|
+
"@squiz/resource-browser": "^3.0.1-rc.0",
|
34
34
|
"@squiz/sds": "^1.0.2",
|
35
35
|
"clsx": "2.1.1",
|
36
36
|
"react-hook-form": "7.51.4",
|
@@ -49,6 +49,7 @@
|
|
49
49
|
"autoprefixer": "10.4.13",
|
50
50
|
"cypress": "12.5.1",
|
51
51
|
"deepmerge": "4.3.0",
|
52
|
+
"esbuild-sass-plugin": "^2.8.0",
|
52
53
|
"eslint-plugin-cypress": "2.12.1",
|
53
54
|
"eslint-plugin-jsx-a11y": "6.7.1",
|
54
55
|
"eslint-plugin-react": "7.32.2",
|
@@ -63,10 +63,25 @@ export const mockResourceBrowserContext = ({ sources, resources, pluginProps }:
|
|
63
63
|
Promise.resolve(resources?.find((resource) => resource.id === reference.resource) || null),
|
64
64
|
);
|
65
65
|
|
66
|
+
const onSearchRequest = () =>
|
67
|
+
Promise.resolve({
|
68
|
+
results: [],
|
69
|
+
filters: [],
|
70
|
+
resultsSummary: {
|
71
|
+
totalMatching: 0,
|
72
|
+
numRanks: 10,
|
73
|
+
currStart: 0,
|
74
|
+
currEnd: 0,
|
75
|
+
prevStart: null,
|
76
|
+
nextStart: null,
|
77
|
+
},
|
78
|
+
});
|
79
|
+
|
66
80
|
return {
|
67
81
|
MockResourceBrowserContext: ({ children }: { children: ReactNode }) => (
|
68
82
|
<ResourceBrowserContextProvider
|
69
83
|
value={{
|
84
|
+
searchEnabled: false,
|
70
85
|
onRequestSources: (): Promise<ResourceBrowserSource[]> =>
|
71
86
|
Promise.resolve([
|
72
87
|
{
|
@@ -80,7 +95,8 @@ export const mockResourceBrowserContext = ({ sources, resources, pluginProps }:
|
|
80
95
|
onRequestSources: onRequestSources,
|
81
96
|
onRequestChildren: onRequestChildren,
|
82
97
|
onRequestResource: onRequestResource,
|
83
|
-
|
98
|
+
onSearchRequest,
|
99
|
+
} as unknown as MatrixResourceBrowserPluginProps),
|
84
100
|
],
|
85
101
|
}}
|
86
102
|
>
|
@@ -45,12 +45,14 @@ export const renderWithContext = (ui: ReactElement | null, options?: ContextRend
|
|
45
45
|
const onRequestSources = jest.fn().mockResolvedValue(sources);
|
46
46
|
const onRequestChildren = jest.fn().mockResolvedValue(resources);
|
47
47
|
const onRequestResource = jest.fn(() => Promise.resolve(resources[0]));
|
48
|
+
const onSearchRequest = jest.fn();
|
48
49
|
editorContext.resolveNodeToUrl = jest.fn(() => Promise.resolve(resources[0].url));
|
49
50
|
|
50
51
|
return render(
|
51
52
|
<EditorContext.Provider value={editorContext}>
|
52
53
|
<ResourceBrowserContextProvider
|
53
54
|
value={{
|
55
|
+
searchEnabled: false,
|
54
56
|
onRequestSources: (): Promise<ResourceBrowserSource[]> =>
|
55
57
|
Promise.resolve([
|
56
58
|
{
|
@@ -64,6 +66,7 @@ export const renderWithContext = (ui: ReactElement | null, options?: ContextRend
|
|
64
66
|
onRequestSources: onRequestSources,
|
65
67
|
onRequestChildren: onRequestChildren,
|
66
68
|
onRequestResource: onRequestResource,
|
69
|
+
onSearchRequest,
|
67
70
|
}),
|
68
71
|
],
|
69
72
|
}}
|