@wordpress/block-library 7.3.2 → 7.4.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/archives/edit.js +1 -1
- package/build/archives/edit.js.map +1 -1
- package/build/audio/edit.js +1 -1
- package/build/audio/edit.js.map +1 -1
- package/build/audio/edit.native.js +1 -1
- package/build/audio/edit.native.js.map +1 -1
- package/build/categories/edit.js +8 -3
- package/build/categories/edit.js.map +1 -1
- package/build/categories/index.js +4 -0
- package/build/categories/index.js.map +1 -1
- package/build/column/index.js +10 -0
- package/build/column/index.js.map +1 -1
- package/build/comment-template/hooks.js +11 -3
- package/build/comment-template/hooks.js.map +1 -1
- package/build/comments-pagination/edit.js +18 -1
- package/build/comments-pagination/edit.js.map +1 -1
- package/build/comments-query-loop/edit.js +1 -1
- package/build/comments-query-loop/edit.js.map +1 -1
- package/build/comments-title/edit.js +149 -0
- package/build/comments-title/edit.js.map +1 -0
- package/build/comments-title/index.js +101 -0
- package/build/comments-title/index.js.map +1 -0
- package/build/embed/edit.js +12 -18
- package/build/embed/edit.js.map +1 -1
- package/build/embed/edit.native.js +1 -7
- package/build/embed/edit.native.js.map +1 -1
- package/build/embed/util.js +29 -4
- package/build/embed/util.js.map +1 -1
- package/build/file/inspector.js +2 -4
- package/build/file/inspector.js.map +1 -1
- package/build/gallery/edit.js +1 -1
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/v1/edit.js +1 -1
- package/build/gallery/v1/edit.js.map +1 -1
- package/build/html/edit.js +2 -2
- package/build/html/edit.js.map +1 -1
- package/build/image/edit.js +4 -6
- package/build/image/edit.js.map +1 -1
- package/build/image/edit.native.js +1 -1
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +1 -1
- package/build/image/image.js.map +1 -1
- package/build/index.js +3 -1
- package/build/index.js.map +1 -1
- package/build/index.native.js +14 -3
- package/build/index.native.js.map +1 -1
- package/build/latest-comments/edit.js +1 -1
- package/build/latest-comments/edit.js.map +1 -1
- package/build/loginout/edit.js +1 -1
- package/build/loginout/edit.js.map +1 -1
- package/build/media-text/edit.js +1 -2
- package/build/media-text/edit.js.map +1 -1
- package/build/media-text/edit.native.js +1 -1
- package/build/media-text/edit.native.js.map +1 -1
- package/build/navigation/edit/index.js +17 -1
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/navigation-menu-selector.js +7 -2
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation/edit/unsaved-inner-blocks.js +5 -4
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build/navigation/index.js +1 -1
- package/build/navigation/view-modal.js +37 -0
- package/build/navigation/view-modal.js.map +1 -0
- package/build/navigation/view.js +1 -34
- package/build/navigation/view.js.map +1 -1
- package/build/paragraph/edit.native.js +6 -2
- package/build/paragraph/edit.native.js.map +1 -1
- package/build/post-author/edit.js +1 -1
- package/build/post-author/edit.js.map +1 -1
- package/build/post-excerpt/edit.js +1 -1
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/quote/index.js +6 -0
- package/build/quote/index.js.map +1 -1
- package/build/quote/v2/edit.js +11 -3
- package/build/quote/v2/edit.js.map +1 -1
- package/build/rss/edit.js +1 -1
- package/build/rss/edit.js.map +1 -1
- package/build/search/edit.js +11 -9
- package/build/search/edit.js.map +1 -1
- package/build/spacer/constants.js +9 -0
- package/build/spacer/constants.js.map +1 -0
- package/build/spacer/controls.js +3 -3
- package/build/spacer/controls.js.map +1 -1
- package/build/spacer/controls.native.js +2 -2
- package/build/spacer/controls.native.js.map +1 -1
- package/build/spacer/edit.js +5 -6
- package/build/spacer/edit.js.map +1 -1
- package/build/table/edit.js +8 -2
- package/build/table/edit.js.map +1 -1
- package/build/tag-cloud/edit.js +1 -1
- package/build/tag-cloud/edit.js.map +1 -1
- package/build/video/edit.js +1 -1
- package/build/video/edit.js.map +1 -1
- package/build/video/edit.native.js +1 -1
- package/build/video/edit.native.js.map +1 -1
- package/build-module/archives/edit.js +1 -1
- package/build-module/archives/edit.js.map +1 -1
- package/build-module/audio/edit.js +1 -1
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/audio/edit.native.js +1 -1
- package/build-module/audio/edit.native.js.map +1 -1
- package/build-module/categories/edit.js +8 -3
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/categories/index.js +4 -0
- package/build-module/categories/index.js.map +1 -1
- package/build-module/column/index.js +10 -0
- package/build-module/column/index.js.map +1 -1
- package/build-module/comment-template/hooks.js +11 -3
- package/build-module/comment-template/hooks.js.map +1 -1
- package/build-module/comments-pagination/edit.js +19 -2
- package/build-module/comments-pagination/edit.js.map +1 -1
- package/build-module/comments-query-loop/edit.js +1 -1
- package/build-module/comments-query-loop/edit.js.map +1 -1
- package/build-module/comments-title/edit.js +133 -0
- package/build-module/comments-title/edit.js.map +1 -0
- package/build-module/comments-title/index.js +88 -0
- package/build-module/comments-title/index.js.map +1 -0
- package/build-module/embed/edit.js +13 -19
- package/build-module/embed/edit.js.map +1 -1
- package/build-module/embed/edit.native.js +2 -8
- package/build-module/embed/edit.native.js.map +1 -1
- package/build-module/embed/util.js +25 -3
- package/build-module/embed/util.js.map +1 -1
- package/build-module/file/inspector.js +2 -4
- package/build-module/file/inspector.js.map +1 -1
- package/build-module/gallery/edit.js +1 -1
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/v1/edit.js +1 -1
- package/build-module/gallery/v1/edit.js.map +1 -1
- package/build-module/html/edit.js +2 -2
- package/build-module/html/edit.js.map +1 -1
- package/build-module/image/edit.js +4 -6
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/edit.native.js +1 -1
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +1 -1
- package/build-module/image/image.js.map +1 -1
- package/build-module/index.js +2 -1
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +14 -3
- package/build-module/index.native.js.map +1 -1
- package/build-module/latest-comments/edit.js +1 -1
- package/build-module/latest-comments/edit.js.map +1 -1
- package/build-module/loginout/edit.js +1 -1
- package/build-module/loginout/edit.js.map +1 -1
- package/build-module/media-text/edit.js +1 -2
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/media-text/edit.native.js +1 -1
- package/build-module/media-text/edit.native.js.map +1 -1
- package/build-module/navigation/edit/index.js +17 -1
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js +6 -2
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js +5 -4
- package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build-module/navigation/index.js +1 -1
- package/build-module/navigation/view-modal.js +32 -0
- package/build-module/navigation/view-modal.js.map +1 -0
- package/build-module/navigation/view.js +1 -30
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/paragraph/edit.native.js +6 -2
- package/build-module/paragraph/edit.native.js.map +1 -1
- package/build-module/post-author/edit.js +1 -1
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-excerpt/edit.js +1 -1
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/quote/index.js +1 -1
- package/build-module/quote/index.js.map +1 -1
- package/build-module/quote/v2/edit.js +10 -3
- package/build-module/quote/v2/edit.js.map +1 -1
- package/build-module/rss/edit.js +1 -1
- package/build-module/rss/edit.js.map +1 -1
- package/build-module/search/edit.js +11 -9
- package/build-module/search/edit.js.map +1 -1
- package/build-module/spacer/constants.js +2 -0
- package/build-module/spacer/constants.js.map +1 -0
- package/build-module/spacer/controls.js +2 -2
- package/build-module/spacer/controls.js.map +1 -1
- package/build-module/spacer/controls.native.js +1 -1
- package/build-module/spacer/controls.native.js.map +1 -1
- package/build-module/spacer/edit.js +1 -1
- package/build-module/spacer/edit.js.map +1 -1
- package/build-module/table/edit.js +9 -3
- package/build-module/table/edit.js.map +1 -1
- package/build-module/tag-cloud/edit.js +1 -1
- package/build-module/tag-cloud/edit.js.map +1 -1
- package/build-module/video/edit.js +1 -1
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/edit.native.js +1 -1
- package/build-module/video/edit.native.js.map +1 -1
- package/build-style/comments-title/editor-rtl.css +79 -0
- package/build-style/comments-title/editor.css +79 -0
- package/build-style/common-rtl.css +32 -0
- package/build-style/common.css +32 -0
- package/build-style/editor-rtl.css +12 -0
- package/build-style/editor.css +12 -0
- package/build-style/post-comments-form/style-rtl.css +9 -0
- package/build-style/post-comments-form/style.css +9 -0
- package/build-style/style-rtl.css +79 -0
- package/build-style/style.css +79 -0
- package/build-style/table/editor-rtl.css +8 -0
- package/build-style/table/editor.css +8 -0
- package/build-style/table/style-rtl.css +38 -0
- package/build-style/table/style.css +38 -0
- package/package.json +28 -28
- package/src/archives/edit.js +1 -1
- package/src/audio/edit.js +1 -1
- package/src/audio/edit.native.js +1 -1
- package/src/categories/block.json +4 -0
- package/src/categories/edit.js +8 -2
- package/src/categories/index.php +1 -0
- package/src/column/block.json +10 -0
- package/src/comment-template/hooks.js +13 -1
- package/src/comment-template/index.php +13 -4
- package/src/comments-pagination/edit.js +23 -0
- package/src/comments-query-loop/edit.js +1 -0
- package/src/comments-title/block.json +70 -0
- package/src/comments-title/edit.js +197 -0
- package/src/comments-title/editor.scss +4 -0
- package/src/comments-title/index.js +18 -0
- package/src/comments-title/index.php +68 -0
- package/src/common.scss +24 -1
- package/src/editor.scss +1 -0
- package/src/embed/edit.js +19 -24
- package/src/embed/edit.native.js +9 -14
- package/src/embed/util.js +34 -2
- package/src/file/inspector.js +1 -3
- package/src/gallery/edit.js +1 -1
- package/src/gallery/v1/edit.js +1 -1
- package/src/html/edit.js +2 -2
- package/src/image/edit.js +2 -4
- package/src/image/edit.native.js +1 -1
- package/src/image/image.js +1 -1
- package/src/index.js +3 -0
- package/src/index.native.js +12 -2
- package/src/latest-comments/edit.js +1 -1
- package/src/loginout/edit.js +1 -1
- package/src/media-text/edit.js +1 -2
- package/src/media-text/edit.native.js +1 -1
- package/src/navigation/block.json +1 -1
- package/src/navigation/edit/index.js +24 -0
- package/src/navigation/edit/navigation-menu-selector.js +15 -9
- package/src/navigation/edit/unsaved-inner-blocks.js +5 -4
- package/src/navigation/index.php +5 -0
- package/src/navigation/view-modal.js +36 -0
- package/src/navigation/view.js +0 -35
- package/src/paragraph/edit.native.js +13 -1
- package/src/post-author/edit.js +1 -1
- package/src/post-comments-form/style.scss +11 -0
- package/src/post-excerpt/edit.js +1 -1
- package/src/quote/index.js +1 -1
- package/src/quote/v2/edit.js +3 -0
- package/src/rss/edit.js +1 -1
- package/src/search/edit.js +13 -7
- package/src/search/index.php +84 -33
- package/src/spacer/constants.js +1 -0
- package/src/spacer/controls.js +2 -2
- package/src/spacer/controls.native.js +1 -1
- package/src/spacer/edit.js +1 -2
- package/src/table/edit.js +11 -2
- package/src/table/editor.scss +13 -0
- package/src/table/style.scss +52 -0
- package/src/tag-cloud/edit.js +1 -1
- package/src/video/edit.js +1 -1
- package/src/video/edit.native.js +1 -1
package/src/common.scss
CHANGED
|
@@ -116,11 +116,34 @@
|
|
|
116
116
|
html :where(.has-border-color) {
|
|
117
117
|
border-style: solid;
|
|
118
118
|
}
|
|
119
|
+
html :where([style*="border-top-color"]) {
|
|
120
|
+
border-top-style: solid;
|
|
121
|
+
}
|
|
122
|
+
html :where([style*="border-right-color"]) {
|
|
123
|
+
border-right-style: solid;
|
|
124
|
+
}
|
|
125
|
+
html :where([style*="border-bottom-color"]) {
|
|
126
|
+
border-bottom-style: solid;
|
|
127
|
+
}
|
|
128
|
+
html :where([style*="border-left-color"]) {
|
|
129
|
+
border-left-style: solid;
|
|
130
|
+
}
|
|
119
131
|
|
|
120
132
|
html :where([style*="border-width"]) {
|
|
121
133
|
border-style: solid;
|
|
122
134
|
}
|
|
123
|
-
|
|
135
|
+
html :where([style*="border-top-width"]) {
|
|
136
|
+
border-top-style: solid;
|
|
137
|
+
}
|
|
138
|
+
html :where([style*="border-right-width"]) {
|
|
139
|
+
border-right-style: solid;
|
|
140
|
+
}
|
|
141
|
+
html :where([style*="border-bottom-width"]) {
|
|
142
|
+
border-bottom-style: solid;
|
|
143
|
+
}
|
|
144
|
+
html :where([style*="border-left-width"]) {
|
|
145
|
+
border-left-style: solid;
|
|
146
|
+
}
|
|
124
147
|
|
|
125
148
|
/**
|
|
126
149
|
* Provide baseline responsiveness for images.
|
package/src/editor.scss
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
@import "./comments-query-loop/editor.scss";
|
|
11
11
|
@import "./comments-pagination/editor.scss";
|
|
12
12
|
@import "./comments-pagination-numbers/editor.scss";
|
|
13
|
+
@import "./comments-title/editor.scss";
|
|
13
14
|
@import "./cover/editor.scss";
|
|
14
15
|
@import "./embed/editor.scss";
|
|
15
16
|
@import "./file/editor.scss";
|
package/src/embed/edit.js
CHANGED
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
createUpgradedEmbedBlock,
|
|
6
6
|
getClassNames,
|
|
7
7
|
fallback,
|
|
8
|
-
getAttributesFromPreview,
|
|
9
8
|
getEmbedInfoByProvider,
|
|
9
|
+
getMergedAttributesWithPreview,
|
|
10
10
|
} from './util';
|
|
11
11
|
import EmbedControls from './embed-controls';
|
|
12
12
|
import { embedContentIcon } from './icons';
|
|
@@ -99,21 +99,19 @@ const EmbedEdit = ( props ) => {
|
|
|
99
99
|
);
|
|
100
100
|
|
|
101
101
|
/**
|
|
102
|
-
*
|
|
102
|
+
* Returns the attributes derived from the preview, merged with the current attributes.
|
|
103
|
+
*
|
|
104
|
+
* @param {boolean} ignorePreviousClassName Determines if the previous className attribute should be ignored when merging.
|
|
105
|
+
* @return {Object} Merged attributes.
|
|
103
106
|
*/
|
|
104
|
-
const getMergedAttributes = () =>
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
responsive,
|
|
113
|
-
allowResponsive
|
|
114
|
-
),
|
|
115
|
-
};
|
|
116
|
-
};
|
|
107
|
+
const getMergedAttributes = ( ignorePreviousClassName = false ) =>
|
|
108
|
+
getMergedAttributesWithPreview(
|
|
109
|
+
attributes,
|
|
110
|
+
preview,
|
|
111
|
+
title,
|
|
112
|
+
responsive,
|
|
113
|
+
ignorePreviousClassName
|
|
114
|
+
);
|
|
117
115
|
|
|
118
116
|
const toggleResponsive = () => {
|
|
119
117
|
const { allowResponsive, className } = attributes;
|
|
@@ -145,15 +143,12 @@ const EmbedEdit = ( props ) => {
|
|
|
145
143
|
// Handle incoming preview.
|
|
146
144
|
useEffect( () => {
|
|
147
145
|
if ( preview && ! isEditingURL ) {
|
|
148
|
-
//
|
|
149
|
-
//
|
|
150
|
-
// the
|
|
151
|
-
//
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
// that `getMergedAttributes` uses is memoized so that we're not
|
|
155
|
-
// calculating them on every render.
|
|
156
|
-
setAttributes( getMergedAttributes() );
|
|
146
|
+
// When obtaining an incoming preview, we set the attributes derived from
|
|
147
|
+
// the preview data. In this case when getting the merged attributes,
|
|
148
|
+
// we ignore the previous classname because it might not match the expected
|
|
149
|
+
// classes by the new preview.
|
|
150
|
+
setAttributes( getMergedAttributes( true ) );
|
|
151
|
+
|
|
157
152
|
if ( onReplace ) {
|
|
158
153
|
const upgradedBlock = createUpgradedEmbedBlock(
|
|
159
154
|
props,
|
package/src/embed/edit.native.js
CHANGED
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
createUpgradedEmbedBlock,
|
|
6
6
|
getClassNames,
|
|
7
7
|
fallback,
|
|
8
|
-
getAttributesFromPreview,
|
|
9
8
|
getEmbedInfoByProvider,
|
|
9
|
+
getMergedAttributesWithPreview,
|
|
10
10
|
} from './util';
|
|
11
11
|
import EmbedControls from './embed-controls';
|
|
12
12
|
import { embedContentIcon } from './icons';
|
|
@@ -130,19 +130,14 @@ const EmbedEdit = ( props ) => {
|
|
|
130
130
|
* @param {boolean} ignorePreviousClassName Determines if the previous className attribute should be ignored when merging.
|
|
131
131
|
* @return {Object} Merged attributes.
|
|
132
132
|
*/
|
|
133
|
-
const getMergedAttributes = ( ignorePreviousClassName = false ) =>
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
responsive,
|
|
142
|
-
allowResponsive
|
|
143
|
-
),
|
|
144
|
-
};
|
|
145
|
-
};
|
|
133
|
+
const getMergedAttributes = ( ignorePreviousClassName = false ) =>
|
|
134
|
+
getMergedAttributesWithPreview(
|
|
135
|
+
attributes,
|
|
136
|
+
preview,
|
|
137
|
+
title,
|
|
138
|
+
responsive,
|
|
139
|
+
ignorePreviousClassName
|
|
140
|
+
);
|
|
146
141
|
|
|
147
142
|
const toggleResponsive = () => {
|
|
148
143
|
const { allowResponsive, className } = attributes;
|
package/src/embed/util.js
CHANGED
|
@@ -66,9 +66,11 @@ export const isFromWordPress = ( html ) =>
|
|
|
66
66
|
html && html.includes( 'class="wp-embedded-content"' );
|
|
67
67
|
|
|
68
68
|
export const getPhotoHtml = ( photo ) => {
|
|
69
|
+
// If full image url not found use thumbnail.
|
|
70
|
+
const imageUrl = photo.url || photo.thumbnail_url;
|
|
71
|
+
|
|
69
72
|
// 100% width for the preview so it fits nicely into the document, some "thumbnails" are
|
|
70
|
-
// actually the full size photo.
|
|
71
|
-
const imageUrl = photo.thumbnail_url || photo.url;
|
|
73
|
+
// actually the full size photo.
|
|
72
74
|
const photoPreview = (
|
|
73
75
|
<p>
|
|
74
76
|
<img src={ imageUrl } alt={ photo.title } width="100%" />
|
|
@@ -290,3 +292,33 @@ export const getAttributesFromPreview = memoize(
|
|
|
290
292
|
return attributes;
|
|
291
293
|
}
|
|
292
294
|
);
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Returns the attributes derived from the preview, merged with the current attributes.
|
|
298
|
+
*
|
|
299
|
+
* @param {Object} currentAttributes The current attributes of the block.
|
|
300
|
+
* @param {Object} preview The preview data.
|
|
301
|
+
* @param {string} title The block's title, e.g. Twitter.
|
|
302
|
+
* @param {boolean} isResponsive Boolean indicating if the block supports responsive content.
|
|
303
|
+
* @param {boolean} ignorePreviousClassName Determines if the previous className attribute should be ignored when merging.
|
|
304
|
+
* @return {Object} Merged attributes.
|
|
305
|
+
*/
|
|
306
|
+
export const getMergedAttributesWithPreview = (
|
|
307
|
+
currentAttributes,
|
|
308
|
+
preview,
|
|
309
|
+
title,
|
|
310
|
+
isResponsive,
|
|
311
|
+
ignorePreviousClassName = false
|
|
312
|
+
) => {
|
|
313
|
+
const { allowResponsive, className } = currentAttributes;
|
|
314
|
+
return {
|
|
315
|
+
...currentAttributes,
|
|
316
|
+
...getAttributesFromPreview(
|
|
317
|
+
preview,
|
|
318
|
+
title,
|
|
319
|
+
ignorePreviousClassName ? undefined : className,
|
|
320
|
+
isResponsive,
|
|
321
|
+
allowResponsive
|
|
322
|
+
),
|
|
323
|
+
};
|
|
324
|
+
};
|
package/src/file/inspector.js
CHANGED
|
@@ -68,7 +68,7 @@ export default function FileBlockInspector( {
|
|
|
68
68
|
) }
|
|
69
69
|
</PanelBody>
|
|
70
70
|
) }
|
|
71
|
-
<PanelBody title={ __( '
|
|
71
|
+
<PanelBody title={ __( 'Settings' ) }>
|
|
72
72
|
<SelectControl
|
|
73
73
|
label={ __( 'Link to' ) }
|
|
74
74
|
value={ textLinkHref }
|
|
@@ -80,8 +80,6 @@ export default function FileBlockInspector( {
|
|
|
80
80
|
checked={ openInNewWindow }
|
|
81
81
|
onChange={ changeOpenInNewWindow }
|
|
82
82
|
/>
|
|
83
|
-
</PanelBody>
|
|
84
|
-
<PanelBody title={ __( 'Download button settings' ) }>
|
|
85
83
|
<ToggleControl
|
|
86
84
|
label={ __( 'Show download button' ) }
|
|
87
85
|
checked={ showDownloadButton }
|
package/src/gallery/edit.js
CHANGED
package/src/gallery/v1/edit.js
CHANGED
package/src/html/edit.js
CHANGED
|
@@ -59,14 +59,14 @@ export default function HTMLEdit( { attributes, setAttributes, isSelected } ) {
|
|
|
59
59
|
isPressed={ ! isPreview }
|
|
60
60
|
onClick={ switchToHTML }
|
|
61
61
|
>
|
|
62
|
-
|
|
62
|
+
HTML
|
|
63
63
|
</ToolbarButton>
|
|
64
64
|
<ToolbarButton
|
|
65
65
|
className="components-tab-button"
|
|
66
66
|
isPressed={ isPreview }
|
|
67
67
|
onClick={ switchToPreview }
|
|
68
68
|
>
|
|
69
|
-
|
|
69
|
+
{ __( 'Preview' ) }
|
|
70
70
|
</ToolbarButton>
|
|
71
71
|
</ToolbarGroup>
|
|
72
72
|
</BlockControls>
|
package/src/image/edit.js
CHANGED
|
@@ -22,8 +22,6 @@ import { useEffect, useRef, useState } from '@wordpress/element';
|
|
|
22
22
|
import { __ } from '@wordpress/i18n';
|
|
23
23
|
import { image as icon } from '@wordpress/icons';
|
|
24
24
|
|
|
25
|
-
/* global wp */
|
|
26
|
-
|
|
27
25
|
/**
|
|
28
26
|
* Internal dependencies
|
|
29
27
|
*/
|
|
@@ -97,7 +95,7 @@ function hasDefaultSize( image, defaultSize ) {
|
|
|
97
95
|
* @return {boolean} Whether the image has been destroyed.
|
|
98
96
|
*/
|
|
99
97
|
export function isMediaDestroyed( id ) {
|
|
100
|
-
const attachment = wp?.media?.attachment( id ) || {};
|
|
98
|
+
const attachment = window?.wp?.media?.attachment( id ) || {};
|
|
101
99
|
return attachment.destroyed;
|
|
102
100
|
}
|
|
103
101
|
|
|
@@ -232,7 +230,7 @@ export function ImageEdit( {
|
|
|
232
230
|
// The constants used in Gutenberg do not match WP options so a little more complicated than ideal.
|
|
233
231
|
// TODO: fix this in a follow up PR, requires updating media-text and ui component.
|
|
234
232
|
switch (
|
|
235
|
-
wp?.media?.view?.settings?.defaultProps?.link ||
|
|
233
|
+
window?.wp?.media?.view?.settings?.defaultProps?.link ||
|
|
236
234
|
LINK_DESTINATION_NONE
|
|
237
235
|
) {
|
|
238
236
|
case 'file':
|
package/src/image/edit.native.js
CHANGED
|
@@ -670,7 +670,7 @@ export class ImageEdit extends Component {
|
|
|
670
670
|
|
|
671
671
|
const getInspectorControls = () => (
|
|
672
672
|
<InspectorControls>
|
|
673
|
-
<PanelBody title={ __( '
|
|
673
|
+
<PanelBody title={ __( 'Settings' ) } />
|
|
674
674
|
<PanelBody style={ styles.panelBody }>
|
|
675
675
|
<BlockStyles clientId={ clientId } url={ url } />
|
|
676
676
|
</PanelBody>
|
package/src/image/image.js
CHANGED
|
@@ -370,7 +370,7 @@ export default function Image( {
|
|
|
370
370
|
</BlockControls>
|
|
371
371
|
) }
|
|
372
372
|
<InspectorControls>
|
|
373
|
-
<PanelBody title={ __( '
|
|
373
|
+
<PanelBody title={ __( 'Settings' ) }>
|
|
374
374
|
{ ! multiImageSelection && (
|
|
375
375
|
<TextareaControl
|
|
376
376
|
label={ __( 'Alt text (alternative text)' ) }
|
package/src/index.js
CHANGED
|
@@ -35,6 +35,7 @@ import * as commentsQueryLoop from './comments-query-loop';
|
|
|
35
35
|
import * as commentsPagination from './comments-pagination';
|
|
36
36
|
import * as commentsPaginationNext from './comments-pagination-next';
|
|
37
37
|
import * as commentsPaginationNumbers from './comments-pagination-numbers';
|
|
38
|
+
import * as commentsTitle from './comments-title';
|
|
38
39
|
import * as cover from './cover';
|
|
39
40
|
import * as embed from './embed';
|
|
40
41
|
import * as file from './file';
|
|
@@ -212,11 +213,13 @@ export const __experimentalGetCoreBlocks = () => [
|
|
|
212
213
|
commentEditLink,
|
|
213
214
|
commentReplyLink,
|
|
214
215
|
commentTemplate,
|
|
216
|
+
commentsTitle,
|
|
215
217
|
commentsQueryLoop,
|
|
216
218
|
commentsPagination,
|
|
217
219
|
commentsPaginationNext,
|
|
218
220
|
commentsPaginationNumbers,
|
|
219
221
|
commentsPaginationPrevious,
|
|
222
|
+
|
|
220
223
|
postComments,
|
|
221
224
|
homeLink,
|
|
222
225
|
logInOut,
|
package/src/index.native.js
CHANGED
|
@@ -179,6 +179,14 @@ const devOnly = ( block ) => ( !! __DEV__ ? block : null );
|
|
|
179
179
|
const iOSOnly = ( block ) =>
|
|
180
180
|
Platform.OS === 'ios' ? block : devOnly( block );
|
|
181
181
|
|
|
182
|
+
// To be removed once Quote V2 is released on the web editor.
|
|
183
|
+
function quoteCheck( quoteBlock, blocksFlags ) {
|
|
184
|
+
if ( blocksFlags?.__experimentalEnableQuoteBlockV2 ) {
|
|
185
|
+
quoteBlock.settings = quoteBlock?.settingsV2;
|
|
186
|
+
}
|
|
187
|
+
return quoteBlock;
|
|
188
|
+
}
|
|
189
|
+
|
|
182
190
|
// Hide the Classic block and SocialLink block
|
|
183
191
|
addFilter(
|
|
184
192
|
'blocks.registerBlockType',
|
|
@@ -230,8 +238,10 @@ addFilter(
|
|
|
230
238
|
*
|
|
231
239
|
* registerCoreBlocks();
|
|
232
240
|
* ```
|
|
241
|
+
* @param {Object} [blocksFlags] Experimental flags
|
|
242
|
+
*
|
|
233
243
|
*/
|
|
234
|
-
export const registerCoreBlocks = () => {
|
|
244
|
+
export const registerCoreBlocks = ( blocksFlags ) => {
|
|
235
245
|
// When adding new blocks to this list please also consider updating /src/block-support/supported-blocks.json in the Gutenberg-Mobile repo
|
|
236
246
|
[
|
|
237
247
|
paragraph,
|
|
@@ -244,7 +254,7 @@ export const registerCoreBlocks = () => {
|
|
|
244
254
|
nextpage,
|
|
245
255
|
separator,
|
|
246
256
|
list,
|
|
247
|
-
quote,
|
|
257
|
+
quoteCheck( quote, blocksFlags ),
|
|
248
258
|
mediaText,
|
|
249
259
|
preformatted,
|
|
250
260
|
gallery,
|
|
@@ -35,7 +35,7 @@ export default function LatestComments( { attributes, setAttributes } ) {
|
|
|
35
35
|
return (
|
|
36
36
|
<div { ...useBlockProps() }>
|
|
37
37
|
<InspectorControls>
|
|
38
|
-
<PanelBody title={ __( '
|
|
38
|
+
<PanelBody title={ __( 'Settings' ) }>
|
|
39
39
|
<ToggleControl
|
|
40
40
|
label={ __( 'Display avatar' ) }
|
|
41
41
|
checked={ displayAvatar }
|
package/src/loginout/edit.js
CHANGED
|
@@ -11,7 +11,7 @@ export default function LoginOutEdit( { attributes, setAttributes } ) {
|
|
|
11
11
|
return (
|
|
12
12
|
<>
|
|
13
13
|
<InspectorControls>
|
|
14
|
-
<PanelBody title={ __( '
|
|
14
|
+
<PanelBody title={ __( 'Settings' ) }>
|
|
15
15
|
<ToggleControl
|
|
16
16
|
label={ __( 'Display login as form' ) }
|
|
17
17
|
checked={ displayLoginAsForm }
|
package/src/media-text/edit.js
CHANGED
|
@@ -46,7 +46,6 @@ const TEMPLATE = [
|
|
|
46
46
|
[
|
|
47
47
|
'core/paragraph',
|
|
48
48
|
{
|
|
49
|
-
fontSize: 'large',
|
|
50
49
|
placeholder: _x( 'Content…', 'content placeholder' ),
|
|
51
50
|
},
|
|
52
51
|
],
|
|
@@ -238,7 +237,7 @@ function MediaTextEdit( { attributes, isSelected, setAttributes } ) {
|
|
|
238
237
|
};
|
|
239
238
|
|
|
240
239
|
const mediaTextGeneralSettings = (
|
|
241
|
-
<PanelBody title={ __( '
|
|
240
|
+
<PanelBody title={ __( 'Settings' ) }>
|
|
242
241
|
<ToggleControl
|
|
243
242
|
label={ __( 'Stack on mobile' ) }
|
|
244
243
|
checked={ isStackedOnMobile }
|
|
@@ -186,7 +186,7 @@ class MediaTextEdit extends Component {
|
|
|
186
186
|
|
|
187
187
|
return (
|
|
188
188
|
<InspectorControls>
|
|
189
|
-
<PanelBody title={ __( '
|
|
189
|
+
<PanelBody title={ __( 'Settings' ) }>
|
|
190
190
|
<ToggleControl
|
|
191
191
|
label={ __( 'Crop image to fill entire column' ) }
|
|
192
192
|
checked={ imageFill }
|
|
@@ -523,6 +523,11 @@ function Navigation( {
|
|
|
523
523
|
ref,
|
|
524
524
|
] );
|
|
525
525
|
|
|
526
|
+
const navigationSelectorRef = useRef();
|
|
527
|
+
const [
|
|
528
|
+
shouldFocusNavigationSelector,
|
|
529
|
+
setShouldFocusNavigationSelector,
|
|
530
|
+
] = useState( false );
|
|
526
531
|
const handleSelectNavigation = useCallback(
|
|
527
532
|
( navPostOrClassicMenu ) => {
|
|
528
533
|
if ( ! navPostOrClassicMenu ) {
|
|
@@ -538,10 +543,28 @@ function Navigation( {
|
|
|
538
543
|
} else {
|
|
539
544
|
handleUpdateMenu( navPostOrClassicMenu.id );
|
|
540
545
|
}
|
|
546
|
+
setShouldFocusNavigationSelector( true );
|
|
541
547
|
},
|
|
542
548
|
[ convert, handleUpdateMenu ]
|
|
543
549
|
);
|
|
544
550
|
|
|
551
|
+
// Focus support after menu selection.
|
|
552
|
+
useEffect( () => {
|
|
553
|
+
if (
|
|
554
|
+
isDraftNavigationMenu ||
|
|
555
|
+
! isEntityAvailable ||
|
|
556
|
+
! shouldFocusNavigationSelector
|
|
557
|
+
) {
|
|
558
|
+
return;
|
|
559
|
+
}
|
|
560
|
+
navigationSelectorRef?.current?.focus();
|
|
561
|
+
setShouldFocusNavigationSelector( false );
|
|
562
|
+
}, [
|
|
563
|
+
isDraftNavigationMenu,
|
|
564
|
+
isEntityAvailable,
|
|
565
|
+
shouldFocusNavigationSelector,
|
|
566
|
+
] );
|
|
567
|
+
|
|
545
568
|
const resetToEmptyBlock = useCallback( () => {
|
|
546
569
|
registry.batch( () => {
|
|
547
570
|
if ( navigationArea ) {
|
|
@@ -663,6 +686,7 @@ function Navigation( {
|
|
|
663
686
|
{ ! isDraftNavigationMenu && isEntityAvailable && (
|
|
664
687
|
<ToolbarGroup className="wp-block-navigation__toolbar-menu-selector">
|
|
665
688
|
<NavigationMenuSelector
|
|
689
|
+
ref={ navigationSelectorRef }
|
|
666
690
|
currentMenuId={ ref }
|
|
667
691
|
clientId={ clientId }
|
|
668
692
|
onSelect={ handleSelectNavigation }
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import { __, sprintf } from '@wordpress/i18n';
|
|
11
11
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
12
12
|
import { addQueryArgs } from '@wordpress/url';
|
|
13
|
-
import { useCallback, useMemo } from '@wordpress/element';
|
|
13
|
+
import { forwardRef, useCallback, useMemo } from '@wordpress/element';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Internal dependencies
|
|
@@ -18,14 +18,17 @@ import { useCallback, useMemo } from '@wordpress/element';
|
|
|
18
18
|
import useNavigationMenu from '../use-navigation-menu';
|
|
19
19
|
import useNavigationEntities from '../use-navigation-entities';
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
function NavigationMenuSelector(
|
|
22
|
+
{
|
|
23
|
+
currentMenuId,
|
|
24
|
+
onSelect,
|
|
25
|
+
onCreateNew,
|
|
26
|
+
showManageActions = false,
|
|
27
|
+
actionLabel,
|
|
28
|
+
toggleProps = {},
|
|
29
|
+
},
|
|
30
|
+
forwardedRef
|
|
31
|
+
) {
|
|
29
32
|
/* translators: %s: The name of a menu. */
|
|
30
33
|
const createActionLabel = __( "Create from '%s'" );
|
|
31
34
|
|
|
@@ -92,6 +95,7 @@ export default function NavigationMenuSelector( {
|
|
|
92
95
|
|
|
93
96
|
return (
|
|
94
97
|
<ToolbarDropdownMenu
|
|
98
|
+
ref={ forwardedRef }
|
|
95
99
|
label={ __( 'Select Menu' ) }
|
|
96
100
|
text={ __( 'Select Menu' ) }
|
|
97
101
|
icon={ null }
|
|
@@ -152,3 +156,5 @@ export default function NavigationMenuSelector( {
|
|
|
152
156
|
</ToolbarDropdownMenu>
|
|
153
157
|
);
|
|
154
158
|
}
|
|
159
|
+
|
|
160
|
+
export default forwardRef( NavigationMenuSelector );
|
|
@@ -123,7 +123,7 @@ export default function UnsavedInnerBlocks( {
|
|
|
123
123
|
);
|
|
124
124
|
|
|
125
125
|
// Automatically save the uncontrolled blocks.
|
|
126
|
-
useEffect(
|
|
126
|
+
useEffect( () => {
|
|
127
127
|
// The block will be disabled when used in a BlockPreview.
|
|
128
128
|
// In this case avoid automatic creation of a wp_navigation post.
|
|
129
129
|
// Otherwise the user will be spammed with lots of menus!
|
|
@@ -150,9 +150,10 @@ export default function UnsavedInnerBlocks( {
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
savingLock.current = true;
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
153
|
+
createNavigationMenu( null, blocks ).then( ( menu ) => {
|
|
154
|
+
onSave( menu );
|
|
155
|
+
savingLock.current = false;
|
|
156
|
+
} );
|
|
156
157
|
}, [
|
|
157
158
|
isDisabled,
|
|
158
159
|
isSaving,
|
package/src/navigation/index.php
CHANGED
|
@@ -396,6 +396,11 @@ function render_block_core_navigation( $attributes, $content, $block ) {
|
|
|
396
396
|
wp_enqueue_script( 'wp-block-navigation-view' );
|
|
397
397
|
}
|
|
398
398
|
|
|
399
|
+
$should_load_modal_view_script = isset( $attributes['overlayMenu'] ) && 'never' !== $attributes['overlayMenu'];
|
|
400
|
+
if ( $should_load_modal_view_script ) {
|
|
401
|
+
wp_enqueue_script( 'wp-block-navigation-view-modal' );
|
|
402
|
+
}
|
|
403
|
+
|
|
399
404
|
$inner_blocks = $block->inner_blocks;
|
|
400
405
|
|
|
401
406
|
// Ensure that blocks saved with the legacy ref attribute name (navigationMenuId) continue to render.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import MicroModal from 'micromodal';
|
|
5
|
+
|
|
6
|
+
// Responsive navigation toggle.
|
|
7
|
+
function navigationToggleModal( modal ) {
|
|
8
|
+
const dialogContainer = modal.querySelector(
|
|
9
|
+
`.wp-block-navigation__responsive-dialog`
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
const isHidden = 'true' === modal.getAttribute( 'aria-hidden' );
|
|
13
|
+
|
|
14
|
+
modal.classList.toggle( 'has-modal-open', ! isHidden );
|
|
15
|
+
dialogContainer.toggleAttribute( 'aria-modal', ! isHidden );
|
|
16
|
+
|
|
17
|
+
if ( isHidden ) {
|
|
18
|
+
dialogContainer.removeAttribute( 'role' );
|
|
19
|
+
dialogContainer.removeAttribute( 'aria-modal' );
|
|
20
|
+
} else {
|
|
21
|
+
dialogContainer.setAttribute( 'role', 'dialog' );
|
|
22
|
+
dialogContainer.setAttribute( 'aria-modal', 'true' );
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Add a class to indicate the modal is open.
|
|
26
|
+
const htmlElement = document.documentElement;
|
|
27
|
+
htmlElement.classList.toggle( 'has-modal-open' );
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
window.addEventListener( 'load', () => {
|
|
31
|
+
MicroModal.init( {
|
|
32
|
+
onShow: navigationToggleModal,
|
|
33
|
+
onClose: navigationToggleModal,
|
|
34
|
+
openClass: 'is-menu-open',
|
|
35
|
+
} );
|
|
36
|
+
} );
|
package/src/navigation/view.js
CHANGED
|
@@ -1,32 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import MicroModal from 'micromodal';
|
|
5
|
-
|
|
6
|
-
// Responsive navigation toggle.
|
|
7
|
-
function navigationToggleModal( modal ) {
|
|
8
|
-
const dialogContainer = modal.querySelector(
|
|
9
|
-
`.wp-block-navigation__responsive-dialog`
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
const isHidden = 'true' === modal.getAttribute( 'aria-hidden' );
|
|
13
|
-
|
|
14
|
-
modal.classList.toggle( 'has-modal-open', ! isHidden );
|
|
15
|
-
dialogContainer.toggleAttribute( 'aria-modal', ! isHidden );
|
|
16
|
-
|
|
17
|
-
if ( isHidden ) {
|
|
18
|
-
dialogContainer.removeAttribute( 'role' );
|
|
19
|
-
dialogContainer.removeAttribute( 'aria-modal' );
|
|
20
|
-
} else {
|
|
21
|
-
dialogContainer.setAttribute( 'role', 'dialog' );
|
|
22
|
-
dialogContainer.setAttribute( 'aria-modal', 'true' );
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Add a class to indicate the modal is open.
|
|
26
|
-
const htmlElement = document.documentElement;
|
|
27
|
-
htmlElement.classList.toggle( 'has-modal-open' );
|
|
28
|
-
}
|
|
29
|
-
|
|
30
1
|
// Open on click functionality.
|
|
31
2
|
function closeSubmenus( element ) {
|
|
32
3
|
element
|
|
@@ -65,12 +36,6 @@ function toggleSubmenuOnClick( event ) {
|
|
|
65
36
|
// Necessary for some themes such as TT1 Blocks, where
|
|
66
37
|
// scripts could be loaded before the body.
|
|
67
38
|
window.addEventListener( 'load', () => {
|
|
68
|
-
MicroModal.init( {
|
|
69
|
-
onShow: navigationToggleModal,
|
|
70
|
-
onClose: navigationToggleModal,
|
|
71
|
-
openClass: 'is-menu-open',
|
|
72
|
-
} );
|
|
73
|
-
|
|
74
39
|
const submenuButtons = document.querySelectorAll(
|
|
75
40
|
'.wp-block-navigation-submenu__toggle'
|
|
76
41
|
);
|