@wordpress/format-library 4.14.0 → 4.16.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 +4 -0
- package/build/link/inline.js +7 -7
- package/build/link/inline.js.map +1 -1
- package/build/text-color/index.native.js +4 -2
- package/build/text-color/index.native.js.map +1 -1
- package/build-module/link/inline.js +3 -3
- package/build-module/link/inline.js.map +1 -1
- package/build-module/text-color/index.native.js +6 -4
- package/build-module/text-color/index.native.js.map +1 -1
- package/package.json +13 -13
- package/src/link/inline.js +3 -3
- package/src/link/test/__snapshots__/modal.native.js.snap +372 -295
- package/src/text-color/index.native.js +18 -7
- package/src/text-color/style.native.scss +2 -3
- package/src/text-color/test/index.native.js +4 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { View } from 'react-native';
|
|
4
|
+
import { StyleSheet, View } from 'react-native';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -14,7 +14,11 @@ import {
|
|
|
14
14
|
ToolbarButton,
|
|
15
15
|
useMobileGlobalStylesColors,
|
|
16
16
|
} from '@wordpress/components';
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
Icon,
|
|
19
|
+
color as colorIcon,
|
|
20
|
+
textColor as textColorIcon,
|
|
21
|
+
} from '@wordpress/icons';
|
|
18
22
|
import { removeFormat } from '@wordpress/rich-text';
|
|
19
23
|
import { usePreferredColorSchemeStyle } from '@wordpress/compose';
|
|
20
24
|
|
|
@@ -98,10 +102,13 @@ function TextColorEdit( {
|
|
|
98
102
|
}
|
|
99
103
|
}, [ hasColorsToChoose, value ] );
|
|
100
104
|
|
|
101
|
-
const outlineStyle =
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
+
const outlineStyle = [
|
|
106
|
+
usePreferredColorSchemeStyle(
|
|
107
|
+
styles[ 'components-inline-color__outline' ],
|
|
108
|
+
styles[ 'components-inline-color__outline--dark' ]
|
|
109
|
+
),
|
|
110
|
+
{ borderWidth: StyleSheet.hairlineWidth },
|
|
111
|
+
];
|
|
105
112
|
|
|
106
113
|
if ( ! hasColorsToChoose && ! isActive ) {
|
|
107
114
|
return null;
|
|
@@ -131,7 +138,11 @@ function TextColorEdit( {
|
|
|
131
138
|
isActive={ isActive }
|
|
132
139
|
icon={
|
|
133
140
|
<Icon
|
|
134
|
-
icon={
|
|
141
|
+
icon={
|
|
142
|
+
Object.keys( activeAttributes ).length
|
|
143
|
+
? textColorIcon
|
|
144
|
+
: colorIcon
|
|
145
|
+
}
|
|
135
146
|
style={
|
|
136
147
|
colorIndicatorStyle?.color && {
|
|
137
148
|
color: colorIndicatorStyle.color,
|
|
@@ -3,19 +3,18 @@
|
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
.components-inline-color__outline {
|
|
6
|
-
border-color: $light-
|
|
6
|
+
border-color: $light-quaternary;
|
|
7
7
|
top: 6px;
|
|
8
8
|
bottom: 6px;
|
|
9
9
|
left: 11px;
|
|
10
10
|
right: 11px;
|
|
11
11
|
border-radius: 24px;
|
|
12
|
-
border-width: $border-width;
|
|
13
12
|
position: absolute;
|
|
14
13
|
z-index: 2;
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
.components-inline-color__outline--dark {
|
|
18
|
-
border-color: $dark-
|
|
17
|
+
border-color: $dark-quaternary;
|
|
19
18
|
}
|
|
20
19
|
|
|
21
20
|
.components-inline-color__button-container {
|
|
@@ -83,6 +83,10 @@ describe( 'Text color', () => {
|
|
|
83
83
|
const pinkColorButton = await screen.findByA11yHint( COLOR_PINK );
|
|
84
84
|
expect( pinkColorButton ).toBeDefined();
|
|
85
85
|
fireEvent.press( pinkColorButton );
|
|
86
|
+
// TODO(jest-console): Fix the warning and remove the expect below.
|
|
87
|
+
expect( console ).toHaveWarnedWith(
|
|
88
|
+
`Non-serializable values were found in the navigation state. Check:\n\ntext-color > Palette > params.onColorChange (Function)\n\nThis can break usage such as persisting and restoring state. This might happen if you passed non-serializable values such as function, class instances etc. in params. If you need to use components with callbacks in your options, you can use 'navigation.setOptions' instead. See https://reactnavigation.org/docs/troubleshooting#i-get-the-warning-non-serializable-values-were-found-in-the-navigation-state for more details.`
|
|
89
|
+
);
|
|
86
90
|
|
|
87
91
|
expect( getEditorHtml() ).toMatchSnapshot();
|
|
88
92
|
} );
|