@wordpress/block-library 8.7.0 → 8.8.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/column/index.js +2 -1
- package/build/column/index.js.map +1 -1
- package/build/columns/edit.js +24 -6
- package/build/columns/edit.js.map +1 -1
- package/build/columns/index.js +2 -1
- package/build/columns/index.js.map +1 -1
- package/build/columns/utils.js +4 -9
- package/build/columns/utils.js.map +1 -1
- package/build/cover/edit/index.js +46 -50
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit/{resizable-cover.js → resizable-cover-popover.js} +32 -6
- package/build/cover/edit/resizable-cover-popover.js.map +1 -0
- package/build/cover/index.js +12 -0
- package/build/cover/index.js.map +1 -1
- package/build/details/edit.js +67 -0
- package/build/details/edit.js.map +1 -0
- package/build/details/index.js +110 -0
- package/build/details/index.js.map +1 -0
- package/build/details/save.js +33 -0
- package/build/details/save.js.map +1 -0
- package/build/details-content/edit.js +34 -0
- package/build/details-content/edit.js.map +1 -0
- package/build/details-content/index.js +94 -0
- package/build/details-content/index.js.map +1 -0
- package/build/details-content/save.js +20 -0
- package/build/details-content/save.js.map +1 -0
- package/build/details-summary/edit.js +42 -0
- package/build/details-summary/edit.js.map +1 -0
- package/build/details-summary/index.js +97 -0
- package/build/details-summary/index.js.map +1 -0
- package/build/details-summary/save.js +24 -0
- package/build/details-summary/save.js.map +1 -0
- package/build/embed/deprecated.js +4 -1
- package/build/embed/deprecated.js.map +1 -1
- package/build/embed/embed-link-settings.native.js +1 -1
- package/build/embed/embed-link-settings.native.js.map +1 -1
- package/build/embed/embed-placeholder.js +1 -1
- package/build/embed/embed-placeholder.js.map +1 -1
- package/build/embed/index.js +4 -1
- package/build/embed/index.js.map +1 -1
- package/build/embed/transforms.js +4 -1
- package/build/embed/transforms.js.map +1 -1
- package/build/embed/util.js +4 -1
- package/build/embed/util.js.map +1 -1
- package/build/file/edit.native.js +0 -2
- package/build/file/edit.native.js.map +1 -1
- package/build/gallery/use-get-media.native.js +2 -1
- package/build/gallery/use-get-media.native.js.map +1 -1
- package/build/image/index.js +4 -2
- package/build/image/index.js.map +1 -1
- package/build/index.js +24 -6
- package/build/index.js.map +1 -1
- package/build/media-text/media-container.js +2 -6
- package/build/media-text/media-container.js.map +1 -1
- package/build/media-text/media-container.native.js +3 -3
- package/build/media-text/media-container.native.js.map +1 -1
- package/build/navigation/deprecated.js +8 -11
- package/build/navigation/deprecated.js.map +1 -1
- package/build/navigation/edit/unsaved-inner-blocks.js +1 -14
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build/post-author/index.js +0 -1
- package/build/post-author/index.js.map +1 -1
- package/build/post-featured-image/dimension-controls.js +2 -1
- package/build/post-featured-image/dimension-controls.js.map +1 -1
- package/build/post-featured-image/edit.js +8 -22
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-time-to-read/edit.js +1 -1
- package/build/post-time-to-read/edit.js.map +1 -1
- package/build/post-time-to-read/index.js +7 -0
- package/build/post-time-to-read/index.js.map +1 -1
- package/build/spacer/controls.js +25 -6
- package/build/spacer/controls.js.map +1 -1
- package/build/spacer/edit.js +14 -4
- package/build/spacer/edit.js.map +1 -1
- package/build/spacer/save.js +2 -2
- package/build/spacer/save.js.map +1 -1
- package/build/table/state.js +35 -35
- package/build/table/state.js.map +1 -1
- package/build/term-description/index.js +1 -2
- package/build/term-description/index.js.map +1 -1
- package/build/utils/clean-empty-object.js +5 -2
- package/build/utils/clean-empty-object.js.map +1 -1
- package/build-module/column/index.js +2 -1
- package/build-module/column/index.js.map +1 -1
- package/build-module/columns/edit.js +24 -6
- package/build-module/columns/edit.js.map +1 -1
- package/build-module/columns/index.js +2 -1
- package/build-module/columns/index.js.map +1 -1
- package/build-module/columns/utils.js +4 -8
- package/build-module/columns/utils.js.map +1 -1
- package/build-module/cover/edit/index.js +48 -52
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/edit/{resizable-cover.js → resizable-cover-popover.js} +31 -6
- package/build-module/cover/edit/resizable-cover-popover.js.map +1 -0
- package/build-module/cover/index.js +12 -0
- package/build-module/cover/index.js.map +1 -1
- package/build-module/details/edit.js +52 -0
- package/build-module/details/edit.js.map +1 -0
- package/build-module/details/index.js +91 -0
- package/build-module/details/index.js.map +1 -0
- package/build-module/details/save.js +20 -0
- package/build-module/details/save.js.map +1 -0
- package/build-module/details-content/edit.js +23 -0
- package/build-module/details-content/edit.js.map +1 -0
- package/build-module/details-content/index.js +76 -0
- package/build-module/details-content/index.js.map +1 -0
- package/build-module/details-content/save.js +11 -0
- package/build-module/details-content/save.js.map +1 -0
- package/build-module/details-summary/edit.js +30 -0
- package/build-module/details-summary/edit.js.map +1 -0
- package/build-module/details-summary/index.js +79 -0
- package/build-module/details-summary/index.js.map +1 -0
- package/build-module/details-summary/save.js +16 -0
- package/build-module/details-summary/save.js.map +1 -0
- package/build-module/embed/deprecated.js +4 -1
- package/build-module/embed/deprecated.js.map +1 -1
- package/build-module/embed/embed-link-settings.native.js +1 -1
- package/build-module/embed/embed-link-settings.native.js.map +1 -1
- package/build-module/embed/embed-placeholder.js +1 -1
- package/build-module/embed/embed-placeholder.js.map +1 -1
- package/build-module/embed/index.js +4 -1
- package/build-module/embed/index.js.map +1 -1
- package/build-module/embed/transforms.js +4 -1
- package/build-module/embed/transforms.js.map +1 -1
- package/build-module/embed/util.js +4 -1
- package/build-module/embed/util.js.map +1 -1
- package/build-module/file/edit.native.js +0 -2
- package/build-module/file/edit.native.js.map +1 -1
- package/build-module/gallery/use-get-media.native.js +2 -1
- package/build-module/gallery/use-get-media.native.js.map +1 -1
- package/build-module/image/index.js +4 -2
- package/build-module/image/index.js.map +1 -1
- package/build-module/index.js +21 -6
- package/build-module/index.js.map +1 -1
- package/build-module/media-text/media-container.js +1 -5
- package/build-module/media-text/media-container.js.map +1 -1
- package/build-module/media-text/media-container.native.js +1 -1
- package/build-module/media-text/media-container.native.js.map +1 -1
- package/build-module/navigation/deprecated.js +8 -10
- package/build-module/navigation/deprecated.js.map +1 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js +1 -14
- package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build-module/post-author/index.js +0 -1
- package/build-module/post-author/index.js.map +1 -1
- package/build-module/post-featured-image/dimension-controls.js +2 -1
- package/build-module/post-featured-image/dimension-controls.js.map +1 -1
- package/build-module/post-featured-image/edit.js +8 -22
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-time-to-read/edit.js +1 -1
- package/build-module/post-time-to-read/edit.js.map +1 -1
- package/build-module/post-time-to-read/index.js +7 -0
- package/build-module/post-time-to-read/index.js.map +1 -1
- package/build-module/spacer/controls.js +27 -9
- package/build-module/spacer/controls.js.map +1 -1
- package/build-module/spacer/edit.js +14 -5
- package/build-module/spacer/edit.js.map +1 -1
- package/build-module/spacer/save.js +3 -3
- package/build-module/spacer/save.js.map +1 -1
- package/build-module/table/state.js +35 -33
- package/build-module/table/state.js.map +1 -1
- package/build-module/term-description/index.js +1 -2
- package/build-module/term-description/index.js.map +1 -1
- package/build-module/utils/clean-empty-object.js +6 -3
- package/build-module/utils/clean-empty-object.js.map +1 -1
- package/build-style/columns/style-rtl.css +4 -1
- package/build-style/columns/style.css +4 -1
- package/build-style/common-rtl.css +1 -1
- package/build-style/common.css +1 -1
- package/build-style/cover/editor-rtl.css +11 -12
- package/build-style/cover/editor.css +11 -12
- package/build-style/cover/style-rtl.css +3 -2
- package/build-style/cover/style.css +3 -2
- package/build-style/details/style-rtl.css +91 -0
- package/build-style/details/style.css +91 -0
- package/build-style/details-summary/editor-rtl.css +91 -0
- package/build-style/details-summary/editor.css +91 -0
- package/build-style/details-summary/style-rtl.css +91 -0
- package/build-style/details-summary/style.css +91 -0
- package/build-style/editor-rtl.css +34 -48
- package/build-style/editor.css +34 -48
- package/build-style/file/style-rtl.css +4 -3
- package/build-style/file/style.css +4 -3
- package/build-style/post-excerpt/style-rtl.css +1 -1
- package/build-style/post-excerpt/style.css +1 -1
- package/build-style/pullquote/style-rtl.css +4 -1
- package/build-style/pullquote/style.css +4 -1
- package/build-style/shortcode/editor-rtl.css +15 -34
- package/build-style/shortcode/editor.css +15 -34
- package/build-style/spacer/editor-rtl.css +4 -2
- package/build-style/spacer/editor.css +4 -2
- package/build-style/style-rtl.css +25 -9
- package/build-style/style.css +25 -9
- package/package.json +31 -31
- package/src/column/block.json +2 -1
- package/src/columns/block.json +2 -1
- package/src/columns/edit.js +33 -9
- package/src/columns/style.scss +5 -1
- package/src/columns/utils.js +8 -9
- package/src/common.scss +1 -1
- package/src/cover/block.json +12 -0
- package/src/cover/edit/index.js +44 -37
- package/src/cover/edit/resizable-cover-popover.js +82 -0
- package/src/cover/editor.scss +20 -13
- package/src/cover/index.php +9 -10
- package/src/cover/style.scss +2 -1
- package/src/cover/test/edit.js +1 -1
- package/src/details/block.json +54 -0
- package/src/details/edit.js +59 -0
- package/src/details/index.js +35 -0
- package/src/details/save.js +15 -0
- package/src/details/style.scss +3 -0
- package/src/details-content/block.json +50 -0
- package/src/details-content/edit.js +29 -0
- package/src/details-content/index.js +23 -0
- package/src/details-content/save.js +12 -0
- package/src/details-summary/block.json +53 -0
- package/src/details-summary/edit.js +27 -0
- package/src/details-summary/editor.scss +3 -0
- package/src/details-summary/index.js +23 -0
- package/src/details-summary/save.js +13 -0
- package/src/details-summary/style.scss +3 -0
- package/src/editor.scss +1 -0
- package/src/embed/block.json +4 -1
- package/src/embed/embed-link-settings.native.js +1 -1
- package/src/embed/embed-placeholder.js +1 -1
- package/src/file/edit.native.js +0 -2
- package/src/file/style.scss +5 -2
- package/src/gallery/test/use-get-media.native.js +24 -0
- package/src/gallery/use-get-media.native.js +1 -1
- package/src/image/block.json +4 -2
- package/src/index.js +13 -3
- package/src/media-text/media-container.js +1 -5
- package/src/media-text/media-container.native.js +1 -1
- package/src/navigation/deprecated.js +15 -19
- package/src/navigation/edit/unsaved-inner-blocks.js +34 -46
- package/src/navigation/index.php +0 -4
- package/src/paragraph/test/edit.native.js +356 -1
- package/src/post-author/block.json +0 -1
- package/src/post-excerpt/index.php +3 -3
- package/src/post-excerpt/style.scss +2 -1
- package/src/post-featured-image/dimension-controls.js +5 -1
- package/src/post-featured-image/edit.js +8 -29
- package/src/post-time-to-read/block.json +7 -0
- package/src/post-time-to-read/edit.js +1 -1
- package/src/post-time-to-read/index.php +3 -3
- package/src/preformatted/test/__snapshots__/edit.native.js.snap +2 -2
- package/src/preformatted/test/edit.native.js +45 -2
- package/src/pullquote/style.scss +5 -1
- package/src/pullquote/test/edit.native.js +70 -0
- package/src/quote/test/edit.native.js +92 -0
- package/src/search/index.php +1 -1
- package/src/shortcode/editor.scss +26 -5
- package/src/spacer/controls.js +42 -17
- package/src/spacer/edit.js +23 -4
- package/src/spacer/editor.scss +2 -1
- package/src/spacer/save.js +3 -3
- package/src/style.scss +2 -0
- package/src/table/state.js +83 -66
- package/src/term-description/block.json +1 -2
- package/src/utils/clean-empty-object.js +4 -4
- package/src/verse/test/edit.native.js +33 -0
- package/build/cover/edit/resizable-cover.js.map +0 -1
- package/build/media-text/media-container-icon.js +0 -27
- package/build/media-text/media-container-icon.js.map +0 -1
- package/build-module/cover/edit/resizable-cover.js.map +0 -1
- package/build-module/media-text/media-container-icon.js +0 -17
- package/build-module/media-text/media-container-icon.js.map +0 -1
- package/src/cover/edit/resizable-cover.js +0 -61
- package/src/media-text/media-container-icon.js +0 -12
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`
|
|
3
|
+
exports[`Preformatted should match snapshot when content is empty 1`] = `
|
|
4
4
|
<View
|
|
5
5
|
style={
|
|
6
6
|
[
|
|
@@ -46,7 +46,7 @@ exports[`core/more/edit/native should match snapshot when content is empty 1`] =
|
|
|
46
46
|
</View>
|
|
47
47
|
`;
|
|
48
48
|
|
|
49
|
-
exports[`
|
|
49
|
+
exports[`Preformatted should match snapshot when content is not empty 1`] = `
|
|
50
50
|
<View
|
|
51
51
|
style={
|
|
52
52
|
[
|
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
addBlock,
|
|
6
|
+
changeAndSelectTextOfRichText,
|
|
7
|
+
fireEvent,
|
|
8
|
+
getEditorHtml,
|
|
9
|
+
initializeEditor,
|
|
10
|
+
render,
|
|
11
|
+
setupCoreBlocks,
|
|
12
|
+
} from 'test/helpers';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* WordPress dependencies
|
|
16
|
+
*/
|
|
17
|
+
import { ENTER } from '@wordpress/keycodes';
|
|
5
18
|
|
|
6
19
|
/**
|
|
7
20
|
* Internal dependencies
|
|
8
21
|
*/
|
|
9
22
|
import PreformattedEdit from '../edit';
|
|
10
23
|
|
|
11
|
-
|
|
24
|
+
setupCoreBlocks();
|
|
25
|
+
|
|
26
|
+
describe( 'Preformatted', () => {
|
|
12
27
|
it( 'renders without crashing', () => {
|
|
13
28
|
const screen = render(
|
|
14
29
|
<PreformattedEdit
|
|
@@ -42,4 +57,32 @@ describe( 'core/more/edit/native', () => {
|
|
|
42
57
|
);
|
|
43
58
|
expect( screen.toJSON() ).toMatchSnapshot();
|
|
44
59
|
} );
|
|
60
|
+
|
|
61
|
+
it( 'should produce expected markup for multiline text', async () => {
|
|
62
|
+
// Arrange
|
|
63
|
+
const screen = await initializeEditor();
|
|
64
|
+
|
|
65
|
+
// Act
|
|
66
|
+
await addBlock( screen, 'Preformatted' );
|
|
67
|
+
const verseTextInput = await screen.findByPlaceholderText(
|
|
68
|
+
'Write preformatted text…'
|
|
69
|
+
);
|
|
70
|
+
const string = 'A great statement.';
|
|
71
|
+
changeAndSelectTextOfRichText( verseTextInput, string, {
|
|
72
|
+
selectionStart: string.length,
|
|
73
|
+
selectionEnd: string.length,
|
|
74
|
+
} );
|
|
75
|
+
fireEvent( verseTextInput, 'onKeyDown', {
|
|
76
|
+
nativeEvent: {},
|
|
77
|
+
preventDefault() {},
|
|
78
|
+
keyCode: ENTER,
|
|
79
|
+
} );
|
|
80
|
+
|
|
81
|
+
// Assert
|
|
82
|
+
expect( getEditorHtml() ).toMatchInlineSnapshot( `
|
|
83
|
+
"<!-- wp:preformatted -->
|
|
84
|
+
<pre class="wp-block-preformatted">A great statement.<br></pre>
|
|
85
|
+
<!-- /wp:preformatted -->"
|
|
86
|
+
` );
|
|
87
|
+
} );
|
|
45
88
|
} );
|
package/src/pullquote/style.scss
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
.wp-block-pullquote {
|
|
2
|
-
margin: 0 0 1em 0;
|
|
3
2
|
padding: 3em 0;
|
|
4
3
|
text-align: center; // Default text-alignment where the `textAlign` attribute value isn't specified.
|
|
5
4
|
overflow-wrap: break-word; // Break long strings of text without spaces so they don't overflow the block.
|
|
@@ -25,6 +24,11 @@
|
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
26
|
|
|
27
|
+
// Lowest specificity to avoid overriding layout styles.
|
|
28
|
+
:where(.wp-block-pullquote) {
|
|
29
|
+
margin: 0 0 1em 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
28
32
|
// Ensure that we are reasonably specific to override theme defaults.
|
|
29
33
|
.wp-block-pullquote.has-text-align-left blockquote {
|
|
30
34
|
text-align: left;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
addBlock,
|
|
6
|
+
getBlock,
|
|
7
|
+
initializeEditor,
|
|
8
|
+
setupCoreBlocks,
|
|
9
|
+
getEditorHtml,
|
|
10
|
+
fireEvent,
|
|
11
|
+
within,
|
|
12
|
+
waitFor,
|
|
13
|
+
changeAndSelectTextOfRichText,
|
|
14
|
+
} from 'test/helpers';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* WordPress dependencies
|
|
18
|
+
*/
|
|
19
|
+
import { ENTER } from '@wordpress/keycodes';
|
|
20
|
+
|
|
21
|
+
setupCoreBlocks();
|
|
22
|
+
|
|
23
|
+
describe( 'Pullquote', () => {
|
|
24
|
+
it( 'should produce expected markup for multiline text', async () => {
|
|
25
|
+
// Arrange
|
|
26
|
+
const screen = await initializeEditor();
|
|
27
|
+
await addBlock( screen, 'Pullquote' );
|
|
28
|
+
// Await inner blocks to be rendered
|
|
29
|
+
const citationBlock = await waitFor( () =>
|
|
30
|
+
screen.getByPlaceholderText( 'Add citation' )
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
// Act
|
|
34
|
+
const pullquoteBlock = getBlock( screen, 'Pullquote' );
|
|
35
|
+
fireEvent.press( pullquoteBlock );
|
|
36
|
+
const pullquoteTextInput =
|
|
37
|
+
within( pullquoteBlock ).getByPlaceholderText( 'Add quote' );
|
|
38
|
+
const string = 'A great statement.';
|
|
39
|
+
changeAndSelectTextOfRichText( pullquoteTextInput, string, {
|
|
40
|
+
selectionStart: string.length,
|
|
41
|
+
selectionEnd: string.length,
|
|
42
|
+
} );
|
|
43
|
+
fireEvent( pullquoteTextInput, 'onKeyDown', {
|
|
44
|
+
nativeEvent: {},
|
|
45
|
+
preventDefault() {},
|
|
46
|
+
keyCode: ENTER,
|
|
47
|
+
} );
|
|
48
|
+
|
|
49
|
+
// TODO: Determine a way to type after pressing ENTER within the block.
|
|
50
|
+
|
|
51
|
+
const citationTextInput =
|
|
52
|
+
within( citationBlock ).getByPlaceholderText( 'Add citation' );
|
|
53
|
+
changeAndSelectTextOfRichText( citationTextInput, 'A person', {
|
|
54
|
+
selectionStart: 2,
|
|
55
|
+
selectionEnd: 2,
|
|
56
|
+
} );
|
|
57
|
+
fireEvent( citationTextInput, 'onKeyDown', {
|
|
58
|
+
nativeEvent: {},
|
|
59
|
+
preventDefault() {},
|
|
60
|
+
keyCode: ENTER,
|
|
61
|
+
} );
|
|
62
|
+
|
|
63
|
+
// Assert
|
|
64
|
+
expect( getEditorHtml() ).toMatchInlineSnapshot( `
|
|
65
|
+
"<!-- wp:pullquote -->
|
|
66
|
+
<figure class="wp-block-pullquote"><blockquote><p>A great statement.<br></p><cite>A <br>person</cite></blockquote></figure>
|
|
67
|
+
<!-- /wp:pullquote -->"
|
|
68
|
+
` );
|
|
69
|
+
} );
|
|
70
|
+
} );
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
addBlock,
|
|
6
|
+
getBlock,
|
|
7
|
+
initializeEditor,
|
|
8
|
+
setupCoreBlocks,
|
|
9
|
+
getEditorHtml,
|
|
10
|
+
fireEvent,
|
|
11
|
+
within,
|
|
12
|
+
waitFor,
|
|
13
|
+
changeAndSelectTextOfRichText,
|
|
14
|
+
} from 'test/helpers';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* WordPress dependencies
|
|
18
|
+
*/
|
|
19
|
+
import { ENTER } from '@wordpress/keycodes';
|
|
20
|
+
|
|
21
|
+
setupCoreBlocks();
|
|
22
|
+
|
|
23
|
+
describe( 'Quote', () => {
|
|
24
|
+
it( 'should produce expected markup for multiline text', async () => {
|
|
25
|
+
// Arrange
|
|
26
|
+
const screen = await initializeEditor();
|
|
27
|
+
await addBlock( screen, 'Quote' );
|
|
28
|
+
const quoteBlock = getBlock( screen, 'Quote' );
|
|
29
|
+
// A layout event must be explicitly dispatched in BlockList component,
|
|
30
|
+
// otherwise the inner blocks are not rendered.
|
|
31
|
+
fireEvent(
|
|
32
|
+
within( quoteBlock ).getByTestId( 'block-list-wrapper' ),
|
|
33
|
+
'layout',
|
|
34
|
+
{
|
|
35
|
+
nativeEvent: {
|
|
36
|
+
layout: {
|
|
37
|
+
width: 320,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
// Await inner blocks to be rendered
|
|
43
|
+
const citationBlock = await waitFor( () =>
|
|
44
|
+
screen.getByPlaceholderText( 'Add citation' )
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
// Act
|
|
48
|
+
fireEvent.press( quoteBlock );
|
|
49
|
+
// screen.debug();
|
|
50
|
+
let quoteTextInput =
|
|
51
|
+
within( quoteBlock ).getByPlaceholderText( 'Start writing…' );
|
|
52
|
+
const string = 'A great statement.';
|
|
53
|
+
changeAndSelectTextOfRichText( quoteTextInput, string, {
|
|
54
|
+
selectionStart: string.length,
|
|
55
|
+
selectionEnd: string.length,
|
|
56
|
+
} );
|
|
57
|
+
fireEvent( quoteTextInput, 'onKeyDown', {
|
|
58
|
+
nativeEvent: {},
|
|
59
|
+
preventDefault() {},
|
|
60
|
+
keyCode: ENTER,
|
|
61
|
+
} );
|
|
62
|
+
quoteTextInput =
|
|
63
|
+
within( quoteBlock ).getAllByPlaceholderText(
|
|
64
|
+
'Start writing…'
|
|
65
|
+
)[ 1 ];
|
|
66
|
+
changeAndSelectTextOfRichText( quoteTextInput, 'Again.' );
|
|
67
|
+
const citationTextInput =
|
|
68
|
+
within( citationBlock ).getByPlaceholderText( 'Add citation' );
|
|
69
|
+
changeAndSelectTextOfRichText( citationTextInput, 'A person', {
|
|
70
|
+
selectionStart: 2,
|
|
71
|
+
selectionEnd: 2,
|
|
72
|
+
} );
|
|
73
|
+
fireEvent( citationTextInput, 'onKeyDown', {
|
|
74
|
+
nativeEvent: {},
|
|
75
|
+
preventDefault() {},
|
|
76
|
+
keyCode: ENTER,
|
|
77
|
+
} );
|
|
78
|
+
|
|
79
|
+
// Assert
|
|
80
|
+
expect( getEditorHtml() ).toMatchInlineSnapshot( `
|
|
81
|
+
"<!-- wp:quote -->
|
|
82
|
+
<blockquote class="wp-block-quote"><!-- wp:paragraph -->
|
|
83
|
+
<p>A great statement.</p>
|
|
84
|
+
<!-- /wp:paragraph -->
|
|
85
|
+
|
|
86
|
+
<!-- wp:paragraph -->
|
|
87
|
+
<p>Again.</p>
|
|
88
|
+
<!-- /wp:paragraph --><cite>A <br>person</cite></blockquote>
|
|
89
|
+
<!-- /wp:quote -->"
|
|
90
|
+
` );
|
|
91
|
+
} );
|
|
92
|
+
} );
|
package/src/search/index.php
CHANGED
|
@@ -116,7 +116,7 @@ function render_block_core_search( $attributes ) {
|
|
|
116
116
|
|
|
117
117
|
$button_internal_markup =
|
|
118
118
|
'<svg class="search-icon" viewBox="0 0 24 24" width="24" height="24">
|
|
119
|
-
<path d="M13
|
|
119
|
+
<path d="M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z"></path>
|
|
120
120
|
</svg>';
|
|
121
121
|
}
|
|
122
122
|
|
|
@@ -1,13 +1,34 @@
|
|
|
1
1
|
[data-type="core/shortcode"] {
|
|
2
|
-
.block-editor-plain-text {
|
|
3
|
-
max-height: 250px;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
2
|
&.components-placeholder {
|
|
7
3
|
min-height: 0;
|
|
8
4
|
}
|
|
9
5
|
}
|
|
10
6
|
|
|
7
|
+
// The editing view for the Shortcode block is equivalent to block UI.
|
|
8
|
+
// Therefore we increase specificity to avoid theme styles bleeding in.
|
|
11
9
|
.blocks-shortcode__textarea {
|
|
12
|
-
|
|
10
|
+
font-family: $editor-html-font !important;
|
|
11
|
+
color: $gray-900 !important;
|
|
12
|
+
background: $white !important;
|
|
13
|
+
padding: $grid-unit-15 !important;
|
|
14
|
+
border: $border-width solid $gray-900 !important;
|
|
15
|
+
box-shadow: none !important;
|
|
16
|
+
border-radius: $radius-block-ui !important;
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
max-height: 250px;
|
|
19
|
+
resize: none;
|
|
20
|
+
|
|
21
|
+
/* Fonts smaller than 16px causes mobile safari to zoom. */
|
|
22
|
+
font-size: $mobile-text-min-font-size !important;
|
|
23
|
+
@include break-small {
|
|
24
|
+
font-size: $default-font-size !important;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&:focus {
|
|
28
|
+
border-color: var(--wp-admin-theme-color) !important;
|
|
29
|
+
box-shadow: 0 0 0 ($border-width-focus - $border-width) var(--wp-admin-theme-color) !important;
|
|
30
|
+
|
|
31
|
+
// Windows High Contrast mode will show this outline, but not the box-shadow.
|
|
32
|
+
outline: 2px solid transparent !important;
|
|
33
|
+
}
|
|
13
34
|
}
|
package/src/spacer/controls.js
CHANGED
|
@@ -2,14 +2,21 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { InspectorControls, useSetting } from '@wordpress/block-editor';
|
|
6
5
|
import {
|
|
6
|
+
InspectorControls,
|
|
7
|
+
useSetting,
|
|
8
|
+
__experimentalSpacingSizesControl as SpacingSizesControl,
|
|
9
|
+
isValueSpacingPreset,
|
|
10
|
+
} from '@wordpress/block-editor';
|
|
11
|
+
import {
|
|
12
|
+
BaseControl,
|
|
7
13
|
PanelBody,
|
|
8
14
|
__experimentalUseCustomUnits as useCustomUnits,
|
|
9
15
|
__experimentalUnitControl as UnitControl,
|
|
10
16
|
__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,
|
|
11
17
|
} from '@wordpress/components';
|
|
12
18
|
import { useInstanceId } from '@wordpress/compose';
|
|
19
|
+
import { View } from '@wordpress/primitives';
|
|
13
20
|
|
|
14
21
|
/**
|
|
15
22
|
* Internal dependencies
|
|
@@ -18,7 +25,7 @@ import { MIN_SPACER_SIZE } from './constants';
|
|
|
18
25
|
|
|
19
26
|
function DimensionInput( { label, onChange, isResizing, value = '' } ) {
|
|
20
27
|
const inputId = useInstanceId( UnitControl, 'block-spacer-height-input' );
|
|
21
|
-
|
|
28
|
+
const spacingSizes = useSetting( 'spacing.spacingSizes' );
|
|
22
29
|
// In most contexts the spacer size cannot meaningfully be set to a
|
|
23
30
|
// percentage, since this is relative to the parent container. This
|
|
24
31
|
// unit is disabled from the UI.
|
|
@@ -38,28 +45,46 @@ function DimensionInput( { label, onChange, isResizing, value = '' } ) {
|
|
|
38
45
|
} );
|
|
39
46
|
|
|
40
47
|
const handleOnChange = ( unprocessedValue ) => {
|
|
41
|
-
onChange( unprocessedValue );
|
|
48
|
+
onChange( unprocessedValue.all );
|
|
42
49
|
};
|
|
43
50
|
|
|
44
51
|
// Force the unit to update to `px` when the Spacer is being resized.
|
|
45
52
|
const [ parsedQuantity, parsedUnit ] =
|
|
46
53
|
parseQuantityAndUnitFromRawValue( value );
|
|
47
|
-
const computedValue =
|
|
48
|
-
|
|
49
|
-
isResizing ? 'px' : parsedUnit
|
|
50
|
-
].join( '' );
|
|
54
|
+
const computedValue = isValueSpacingPreset( value )
|
|
55
|
+
? value
|
|
56
|
+
: [ parsedQuantity, isResizing ? 'px' : parsedUnit ].join( '' );
|
|
51
57
|
|
|
52
58
|
return (
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
<>
|
|
60
|
+
{ ( ! spacingSizes || spacingSizes?.length === 0 ) && (
|
|
61
|
+
<BaseControl label={ label } id={ inputId }>
|
|
62
|
+
<UnitControl
|
|
63
|
+
id={ inputId }
|
|
64
|
+
isResetValueOnUnitChange
|
|
65
|
+
min={ MIN_SPACER_SIZE }
|
|
66
|
+
onChange={ handleOnChange }
|
|
67
|
+
style={ { maxWidth: 80 } }
|
|
68
|
+
value={ computedValue }
|
|
69
|
+
units={ units }
|
|
70
|
+
/>
|
|
71
|
+
</BaseControl>
|
|
72
|
+
) }
|
|
73
|
+
|
|
74
|
+
{ spacingSizes?.length > 0 && (
|
|
75
|
+
<View className="tools-panel-item-spacing">
|
|
76
|
+
<SpacingSizesControl
|
|
77
|
+
values={ { all: computedValue } }
|
|
78
|
+
onChange={ handleOnChange }
|
|
79
|
+
label={ label }
|
|
80
|
+
sides={ [ 'all' ] }
|
|
81
|
+
units={ units }
|
|
82
|
+
allowReset={ false }
|
|
83
|
+
splitOnAxis={ false }
|
|
84
|
+
/>
|
|
85
|
+
</View>
|
|
86
|
+
) }
|
|
87
|
+
</>
|
|
63
88
|
);
|
|
64
89
|
}
|
|
65
90
|
|
package/src/spacer/edit.js
CHANGED
|
@@ -6,10 +6,15 @@ import classnames from 'classnames';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
useBlockProps,
|
|
11
|
+
getSpacingPresetCssVar,
|
|
12
|
+
store as blockEditorStore,
|
|
13
|
+
} from '@wordpress/block-editor';
|
|
10
14
|
import { ResizableBox } from '@wordpress/components';
|
|
11
15
|
import { useState, useEffect } from '@wordpress/element';
|
|
12
16
|
import { View } from '@wordpress/primitives';
|
|
17
|
+
import { useSelect } from '@wordpress/data';
|
|
13
18
|
|
|
14
19
|
/**
|
|
15
20
|
* Internal dependencies
|
|
@@ -79,7 +84,12 @@ const SpacerEdit = ( {
|
|
|
79
84
|
toggleSelection,
|
|
80
85
|
context,
|
|
81
86
|
__unstableParentLayout: parentLayout,
|
|
87
|
+
className,
|
|
82
88
|
} ) => {
|
|
89
|
+
const disableCustomSpacingSizes = useSelect( ( select ) => {
|
|
90
|
+
const editorSettings = select( blockEditorStore ).getSettings();
|
|
91
|
+
return editorSettings?.disableCustomSpacingSizes;
|
|
92
|
+
} );
|
|
83
93
|
const { orientation } = context;
|
|
84
94
|
const { orientation: parentOrientation, type } = parentLayout || {};
|
|
85
95
|
// If the spacer is inside a flex container, it should either inherit the orientation
|
|
@@ -114,10 +124,12 @@ const SpacerEdit = ( {
|
|
|
114
124
|
height:
|
|
115
125
|
inheritedOrientation === 'horizontal'
|
|
116
126
|
? 24
|
|
117
|
-
: temporaryHeight ||
|
|
127
|
+
: temporaryHeight ||
|
|
128
|
+
getSpacingPresetCssVar( height ) ||
|
|
129
|
+
undefined,
|
|
118
130
|
width:
|
|
119
131
|
inheritedOrientation === 'horizontal'
|
|
120
|
-
? temporaryWidth || width || undefined
|
|
132
|
+
? temporaryWidth || getSpacingPresetCssVar( width ) || undefined
|
|
121
133
|
: undefined,
|
|
122
134
|
// In vertical flex containers, the spacer shrinks to nothing without a minimum width.
|
|
123
135
|
minWidth:
|
|
@@ -189,7 +201,14 @@ const SpacerEdit = ( {
|
|
|
189
201
|
|
|
190
202
|
return (
|
|
191
203
|
<>
|
|
192
|
-
<View
|
|
204
|
+
<View
|
|
205
|
+
{ ...useBlockProps( {
|
|
206
|
+
style,
|
|
207
|
+
className: classnames( className, {
|
|
208
|
+
'custom-sizes-disabled': disableCustomSpacingSizes,
|
|
209
|
+
} ),
|
|
210
|
+
} ) }
|
|
211
|
+
>
|
|
193
212
|
{ resizableBoxWithOrientation( inheritedOrientation ) }
|
|
194
213
|
</View>
|
|
195
214
|
<SpacerControls
|
package/src/spacer/editor.scss
CHANGED
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
.wp-block-spacer.is-hovered .block-library-spacer__resize-container,
|
|
20
|
-
.block-library-spacer__resize-container.has-show-handle
|
|
20
|
+
.block-library-spacer__resize-container.has-show-handle,
|
|
21
|
+
.wp-block-spacer.is-selected.custom-sizes-disabled {
|
|
21
22
|
background: rgba($black, 0.1);
|
|
22
23
|
|
|
23
24
|
.is-dark-theme & {
|
package/src/spacer/save.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { useBlockProps } from '@wordpress/block-editor';
|
|
4
|
+
import { useBlockProps, getSpacingPresetCssVar } from '@wordpress/block-editor';
|
|
5
5
|
|
|
6
6
|
export default function save( { attributes: { height, width } } ) {
|
|
7
7
|
return (
|
|
8
8
|
<div
|
|
9
9
|
{ ...useBlockProps.save( {
|
|
10
10
|
style: {
|
|
11
|
-
height,
|
|
12
|
-
width,
|
|
11
|
+
height: getSpacingPresetCssVar( height ),
|
|
12
|
+
width: getSpacingPresetCssVar( width ),
|
|
13
13
|
},
|
|
14
14
|
'aria-hidden': true,
|
|
15
15
|
} ) }
|
package/src/style.scss
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
@import "./comments-pagination/style.scss";
|
|
12
12
|
@import "./comment-template/style.scss";
|
|
13
13
|
@import "./cover/style.scss";
|
|
14
|
+
@import "./details/style.scss";
|
|
15
|
+
@import "./details-summary/style.scss";
|
|
14
16
|
@import "./embed/style.scss";
|
|
15
17
|
@import "./file/style.scss";
|
|
16
18
|
@import "./gallery/style.scss";
|