@wordpress/format-library 3.1.3 → 3.2.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 +2 -0
- package/build/link/index.js +1 -1
- package/build/link/index.js.map +1 -1
- package/build/link/index.native.js +4 -4
- package/build/link/index.native.js.map +1 -1
- package/build/link/inline.js +2 -2
- package/build/link/inline.js.map +1 -1
- package/build/link/modal-screens/link-settings-screen.native.js +4 -4
- package/build/link/modal-screens/link-settings-screen.native.js.map +1 -1
- package/build/link/use-link-instance-key.js +1 -1
- package/build/link/use-link-instance-key.js.map +1 -1
- package/build/link/utils.js +1 -1
- package/build/link/utils.js.map +1 -1
- package/build/text-color/index.js +2 -2
- package/build/text-color/index.js.map +1 -1
- package/build-module/link/index.js +1 -1
- package/build-module/link/index.js.map +1 -1
- package/build-module/link/index.native.js +4 -4
- package/build-module/link/index.native.js.map +1 -1
- package/build-module/link/inline.js +2 -2
- package/build-module/link/inline.js.map +1 -1
- package/build-module/link/modal-screens/link-settings-screen.native.js +4 -4
- package/build-module/link/modal-screens/link-settings-screen.native.js.map +1 -1
- package/build-module/link/use-link-instance-key.js +1 -1
- package/build-module/link/use-link-instance-key.js.map +1 -1
- package/build-module/link/utils.js +1 -1
- package/build-module/link/utils.js.map +1 -1
- package/build-module/text-color/index.js +2 -2
- package/build-module/text-color/index.js.map +1 -1
- package/package.json +17 -13
- package/src/link/index.js +1 -1
- package/src/link/index.native.js +4 -4
- package/src/link/inline.js +2 -2
- package/src/link/modal-screens/link-settings-screen.native.js +4 -4
- package/src/link/test/utils.js +25 -25
- package/src/link/use-link-instance-key.js +1 -1
- package/src/link/utils.js +1 -1
- package/src/text-color/index.js +2 -2
package/src/link/test/utils.js
CHANGED
|
@@ -118,7 +118,7 @@ describe( 'getFormatBoundary', () => {
|
|
|
118
118
|
describe( 'Invalid values', () => {
|
|
119
119
|
it( 'should return empty bounds if value contains no formats', () => {
|
|
120
120
|
const record = {
|
|
121
|
-
formats: [], //
|
|
121
|
+
formats: [], // No formats here!
|
|
122
122
|
text: 'Lorem ipsum dolor.',
|
|
123
123
|
start: 8,
|
|
124
124
|
end: 8,
|
|
@@ -145,14 +145,14 @@ describe( 'getFormatBoundary', () => {
|
|
|
145
145
|
[ italicFormat ],
|
|
146
146
|
[ italicFormat ],
|
|
147
147
|
null,
|
|
148
|
-
null, // 5
|
|
149
|
-
[ linkFormat, italicFormat ], // 6
|
|
148
|
+
null, // 5.
|
|
149
|
+
[ linkFormat, italicFormat ], // 6.
|
|
150
150
|
[ linkFormat ],
|
|
151
151
|
[ linkFormat, boldFormat ],
|
|
152
152
|
[ linkFormat, boldFormat ],
|
|
153
|
-
[ linkFormat, italicFormat ], // 10
|
|
154
|
-
null, // 11
|
|
155
|
-
[ boldFormat ], // 12
|
|
153
|
+
[ linkFormat, italicFormat ], // 10.
|
|
154
|
+
null, // 11.
|
|
155
|
+
[ boldFormat ], // 12.
|
|
156
156
|
[ boldFormat ],
|
|
157
157
|
[ boldFormat ],
|
|
158
158
|
[ boldFormat ],
|
|
@@ -161,8 +161,8 @@ describe( 'getFormatBoundary', () => {
|
|
|
161
161
|
],
|
|
162
162
|
|
|
163
163
|
text: 'Lorem ipsum dolor.',
|
|
164
|
-
start: 5, //
|
|
165
|
-
end: 12, //
|
|
164
|
+
start: 5, // No format here.
|
|
165
|
+
end: 12, // Format here but it doesn't match the target format.
|
|
166
166
|
};
|
|
167
167
|
|
|
168
168
|
expect(
|
|
@@ -190,19 +190,19 @@ describe( 'getFormatBoundary', () => {
|
|
|
190
190
|
[ italicFormat ],
|
|
191
191
|
[ italicFormat ],
|
|
192
192
|
null,
|
|
193
|
-
null, // 5
|
|
194
|
-
[ linkFormat, italicFormat ], // 6
|
|
193
|
+
null, // 5.
|
|
194
|
+
[ linkFormat, italicFormat ], // 6.
|
|
195
195
|
[ linkFormat ],
|
|
196
196
|
[ linkFormat, boldFormat ],
|
|
197
197
|
[ linkFormat, boldFormat ],
|
|
198
|
-
[ linkFormat, italicFormat ], // 10
|
|
199
|
-
null, // 11
|
|
200
|
-
[ boldFormat ], // 12
|
|
198
|
+
[ linkFormat, italicFormat ], // 10.
|
|
199
|
+
null, // 11.
|
|
200
|
+
[ boldFormat ], // 12.
|
|
201
201
|
[ boldFormat ],
|
|
202
202
|
[ boldFormat ],
|
|
203
203
|
[ boldFormat ],
|
|
204
204
|
null,
|
|
205
|
-
null, // 17
|
|
205
|
+
null, // 17.
|
|
206
206
|
],
|
|
207
207
|
|
|
208
208
|
text: 'Lorem ipsum dolor.',
|
|
@@ -238,11 +238,11 @@ describe( 'getFormatBoundary', () => {
|
|
|
238
238
|
[ italicFormat ],
|
|
239
239
|
null,
|
|
240
240
|
null,
|
|
241
|
-
[ linkFormat, italicFormat ], // 6
|
|
241
|
+
[ linkFormat, italicFormat ], // 6.
|
|
242
242
|
[ linkFormat ],
|
|
243
243
|
[ linkFormat, boldFormat ],
|
|
244
244
|
[ linkFormat, boldFormat ],
|
|
245
|
-
[ linkFormat, italicFormat ], // 10
|
|
245
|
+
[ linkFormat, italicFormat ], // 10.
|
|
246
246
|
],
|
|
247
247
|
|
|
248
248
|
text: 'Lorem ipsum dolor.',
|
|
@@ -273,16 +273,16 @@ describe( 'getFormatBoundary', () => {
|
|
|
273
273
|
[ italicFormat ],
|
|
274
274
|
null,
|
|
275
275
|
null,
|
|
276
|
-
[ linkFormat, italicFormat ], // 6
|
|
276
|
+
[ linkFormat, italicFormat ], // 6.
|
|
277
277
|
[ linkFormat ],
|
|
278
278
|
[ linkFormat, boldFormat ],
|
|
279
279
|
[ linkFormat, boldFormat ],
|
|
280
|
-
[ linkFormat, italicFormat ], // 10
|
|
280
|
+
[ linkFormat, italicFormat ], // 10.
|
|
281
281
|
],
|
|
282
282
|
|
|
283
283
|
text: 'Lorem ipsum dolor.',
|
|
284
|
-
start: 11, // +1 beyond the end of the formats
|
|
285
|
-
end: 11, // +1 beyond the end of the formats
|
|
284
|
+
start: 11, // +1 beyond the end of the formats.
|
|
285
|
+
end: 11, // +1 beyond the end of the formats.
|
|
286
286
|
};
|
|
287
287
|
|
|
288
288
|
expect(
|
|
@@ -309,11 +309,11 @@ describe( 'getFormatBoundary', () => {
|
|
|
309
309
|
[ italicFormat ],
|
|
310
310
|
null,
|
|
311
311
|
null,
|
|
312
|
-
[ linkFormat, italicFormat ], // 6
|
|
312
|
+
[ linkFormat, italicFormat ], // 6.
|
|
313
313
|
[ linkFormat ],
|
|
314
314
|
[ linkFormat, boldFormat ],
|
|
315
315
|
[ linkFormat, boldFormat ],
|
|
316
|
-
[ linkFormat, italicFormat ], // 10
|
|
316
|
+
[ linkFormat, italicFormat ], // 10.
|
|
317
317
|
null,
|
|
318
318
|
null,
|
|
319
319
|
[ boldFormat ],
|
|
@@ -346,7 +346,7 @@ describe( 'getFormatBoundary', () => {
|
|
|
346
346
|
[ linkFormat ],
|
|
347
347
|
[ linkFormat ],
|
|
348
348
|
[ linkFormat ],
|
|
349
|
-
[ linkFormat ], // 5
|
|
349
|
+
[ linkFormat ], // 5.
|
|
350
350
|
[ boldFormat ],
|
|
351
351
|
[ boldFormat ],
|
|
352
352
|
null,
|
|
@@ -402,9 +402,9 @@ describe( 'getFormatBoundary', () => {
|
|
|
402
402
|
[],
|
|
403
403
|
[],
|
|
404
404
|
[],
|
|
405
|
-
[ boldFormat ], // 4
|
|
405
|
+
[ boldFormat ], // 4.
|
|
406
406
|
[ boldFormat ],
|
|
407
|
-
[ boldFormat ], // 6
|
|
407
|
+
[ boldFormat ], // 6.
|
|
408
408
|
[],
|
|
409
409
|
[],
|
|
410
410
|
],
|
package/src/link/utils.js
CHANGED
|
@@ -186,7 +186,7 @@ export function getFormatBoundary(
|
|
|
186
186
|
// Walk the endIndex "forwards" until the trailing "edge" of the matching format.
|
|
187
187
|
endIndex = walkToEnd( ...walkingArgs );
|
|
188
188
|
|
|
189
|
-
// Safe guard: start index cannot be less than 0
|
|
189
|
+
// Safe guard: start index cannot be less than 0.
|
|
190
190
|
startIndex = startIndex < 0 ? 0 : startIndex;
|
|
191
191
|
|
|
192
192
|
// // Return the indicies of the "edges" as the boundaries.
|
package/src/text-color/index.js
CHANGED
|
@@ -97,7 +97,7 @@ function TextColorEdit( {
|
|
|
97
97
|
/>
|
|
98
98
|
}
|
|
99
99
|
title={ title }
|
|
100
|
-
// If has no colors to choose but a color is active remove the color onClick
|
|
100
|
+
// If has no colors to choose but a color is active remove the color onClick.
|
|
101
101
|
onClick={
|
|
102
102
|
hasColorsToChoose
|
|
103
103
|
? enableIsAddingColor
|
|
@@ -139,7 +139,7 @@ export const textColor = {
|
|
|
139
139
|
*/
|
|
140
140
|
__unstableFilterAttributeValue( key, value ) {
|
|
141
141
|
if ( key !== 'style' ) return value;
|
|
142
|
-
// We should not add a background-color if it's already set
|
|
142
|
+
// We should not add a background-color if it's already set.
|
|
143
143
|
if ( value && value.includes( 'background-color' ) ) return value;
|
|
144
144
|
const addedCSS = [ 'background-color', transparentValue ].join( ':' );
|
|
145
145
|
// Prepend `addedCSS` to avoid a double `;;` as any the existing CSS
|