@wordpress/block-editor 12.19.0 → 12.19.2
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/build/components/global-styles/border-panel.js +4 -3
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/get-global-styles-changes.js +61 -24
- package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +8 -6
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/iframe/index.js +4 -1
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +1 -0
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/use-enter.js +1 -0
- package/build/components/rich-text/use-enter.js.map +1 -1
- package/build/components/rich-text/use-input-rules.js +1 -30
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/hooks/use-bindings-attributes.js +1 -18
- package/build/hooks/use-bindings-attributes.js.map +1 -1
- package/build/hooks/utils.js +8 -4
- package/build/hooks/utils.js.map +1 -1
- package/build/store/get-block-settings.js +17 -4
- package/build/store/get-block-settings.js.map +1 -1
- package/build/store/private-actions.js +5 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/reducer.js +2 -1
- package/build/store/reducer.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +5 -4
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/get-global-styles-changes.js +61 -25
- package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +9 -7
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/iframe/index.js +4 -1
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +1 -0
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-enter.js +1 -0
- package/build-module/components/rich-text/use-enter.js.map +1 -1
- package/build-module/components/rich-text/use-input-rules.js +2 -31
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +1 -18
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/hooks/utils.js +8 -4
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/store/get-block-settings.js +16 -4
- package/build-module/store/get-block-settings.js.map +1 -1
- package/build-module/store/private-actions.js +5 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/reducer.js +2 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-style/style-rtl.css +0 -12
- package/build-style/style.css +0 -12
- package/package.json +31 -31
- package/src/components/global-styles/border-panel.js +4 -6
- package/src/components/global-styles/get-global-styles-changes.js +68 -28
- package/src/components/global-styles/test/get-global-styles-changes.js +114 -75
- package/src/components/global-styles/typography-panel.js +11 -7
- package/src/components/iframe/index.js +4 -1
- package/src/components/link-control/style.scss +0 -7
- package/src/components/rich-text/index.native.js +1 -0
- package/src/components/rich-text/use-enter.js +1 -0
- package/src/components/rich-text/use-input-rules.js +2 -30
- package/src/components/url-input/style.scss +0 -4
- package/src/hooks/use-bindings-attributes.js +1 -22
- package/src/hooks/utils.js +24 -8
- package/src/store/get-block-settings.js +15 -4
- package/src/store/private-actions.js +9 -0
- package/src/store/reducer.js +1 -1
|
@@ -46,7 +46,7 @@ const createEditFunctionWithBindingsAttribute = () =>
|
|
|
46
46
|
settings.source
|
|
47
47
|
);
|
|
48
48
|
|
|
49
|
-
if ( source ) {
|
|
49
|
+
if ( source && source.useSource ) {
|
|
50
50
|
// Second argument (`updateMetaValue`) will be used to update the value in the future.
|
|
51
51
|
const {
|
|
52
52
|
placeholder,
|
|
@@ -112,24 +112,3 @@ addFilter(
|
|
|
112
112
|
'core/editor/custom-sources-backwards-compatibility/shim-attribute-source',
|
|
113
113
|
shimAttributeSource
|
|
114
114
|
);
|
|
115
|
-
|
|
116
|
-
// Add the context to all blocks.
|
|
117
|
-
addFilter(
|
|
118
|
-
'blocks.registerBlockType',
|
|
119
|
-
'core/block-bindings-ui',
|
|
120
|
-
( settings, name ) => {
|
|
121
|
-
if ( ! ( name in BLOCK_BINDINGS_ALLOWED_BLOCKS ) ) {
|
|
122
|
-
return settings;
|
|
123
|
-
}
|
|
124
|
-
const contextItems = [ 'postId', 'postType', 'queryId' ];
|
|
125
|
-
const usesContextArray = settings.usesContext;
|
|
126
|
-
const oldUsesContextArray = new Set( usesContextArray );
|
|
127
|
-
contextItems.forEach( ( item ) => {
|
|
128
|
-
if ( ! oldUsesContextArray.has( item ) ) {
|
|
129
|
-
usesContextArray.push( item );
|
|
130
|
-
}
|
|
131
|
-
} );
|
|
132
|
-
settings.usesContext = usesContextArray;
|
|
133
|
-
return settings;
|
|
134
|
-
}
|
|
135
|
-
);
|
package/src/hooks/utils.js
CHANGED
|
@@ -176,8 +176,12 @@ export function useBlockSettings( name, parentLayout ) {
|
|
|
176
176
|
const [
|
|
177
177
|
backgroundImage,
|
|
178
178
|
backgroundSize,
|
|
179
|
-
|
|
180
|
-
|
|
179
|
+
customFontFamilies,
|
|
180
|
+
defaultFontFamilies,
|
|
181
|
+
themeFontFamilies,
|
|
182
|
+
customFontSizes,
|
|
183
|
+
defaultFontSizes,
|
|
184
|
+
themeFontSizes,
|
|
181
185
|
customFontSize,
|
|
182
186
|
fontStyle,
|
|
183
187
|
fontWeight,
|
|
@@ -223,8 +227,12 @@ export function useBlockSettings( name, parentLayout ) {
|
|
|
223
227
|
] = useSettings(
|
|
224
228
|
'background.backgroundImage',
|
|
225
229
|
'background.backgroundSize',
|
|
226
|
-
'typography.fontFamilies',
|
|
227
|
-
'typography.
|
|
230
|
+
'typography.fontFamilies.custom',
|
|
231
|
+
'typography.fontFamilies.default',
|
|
232
|
+
'typography.fontFamilies.theme',
|
|
233
|
+
'typography.fontSizes.custom',
|
|
234
|
+
'typography.fontSizes.default',
|
|
235
|
+
'typography.fontSizes.theme',
|
|
228
236
|
'typography.customFontSize',
|
|
229
237
|
'typography.fontStyle',
|
|
230
238
|
'typography.fontWeight',
|
|
@@ -305,10 +313,14 @@ export function useBlockSettings( name, parentLayout ) {
|
|
|
305
313
|
},
|
|
306
314
|
typography: {
|
|
307
315
|
fontFamilies: {
|
|
308
|
-
custom:
|
|
316
|
+
custom: customFontFamilies,
|
|
317
|
+
default: defaultFontFamilies,
|
|
318
|
+
theme: themeFontFamilies,
|
|
309
319
|
},
|
|
310
320
|
fontSizes: {
|
|
311
|
-
custom:
|
|
321
|
+
custom: customFontSizes,
|
|
322
|
+
default: defaultFontSizes,
|
|
323
|
+
theme: themeFontSizes,
|
|
312
324
|
},
|
|
313
325
|
customFontSize,
|
|
314
326
|
fontStyle,
|
|
@@ -346,8 +358,12 @@ export function useBlockSettings( name, parentLayout ) {
|
|
|
346
358
|
}, [
|
|
347
359
|
backgroundImage,
|
|
348
360
|
backgroundSize,
|
|
349
|
-
|
|
350
|
-
|
|
361
|
+
customFontFamilies,
|
|
362
|
+
defaultFontFamilies,
|
|
363
|
+
themeFontFamilies,
|
|
364
|
+
customFontSizes,
|
|
365
|
+
defaultFontSizes,
|
|
366
|
+
themeFontSizes,
|
|
351
367
|
customFontSize,
|
|
352
368
|
fontStyle,
|
|
353
369
|
fontWeight,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
|
-
|
|
5
|
+
__EXPERIMENTAL_PATHS_WITH_OVERRIDE as PATHS_WITH_OVERRIDE,
|
|
6
6
|
hasBlockSupport,
|
|
7
7
|
} from '@wordpress/blocks';
|
|
8
8
|
import { applyFilters } from '@wordpress/hooks';
|
|
@@ -111,6 +111,17 @@ export function mergeOrigins( value ) {
|
|
|
111
111
|
}
|
|
112
112
|
const mergeCache = new WeakMap();
|
|
113
113
|
|
|
114
|
+
/**
|
|
115
|
+
* For settings like `color.palette`, which have a value that is an object
|
|
116
|
+
* with `default`, `theme`, `custom`, with field values that are arrays of
|
|
117
|
+
* items, returns the one with the highest priority among these three arrays.
|
|
118
|
+
* @param {Object} value Object to extract from
|
|
119
|
+
* @return {Array} Array of items extracted from the three origins
|
|
120
|
+
*/
|
|
121
|
+
export function overrideOrigins( value ) {
|
|
122
|
+
return value.custom ?? value.theme ?? value.default;
|
|
123
|
+
}
|
|
124
|
+
|
|
114
125
|
/**
|
|
115
126
|
* For settings like `color.palette`, which have a value that is an object
|
|
116
127
|
* with `default`, `theme`, `custom`, with field values that are arrays of
|
|
@@ -119,7 +130,7 @@ const mergeCache = new WeakMap();
|
|
|
119
130
|
* @param {Object} value Object to check
|
|
120
131
|
* @return {boolean} Whether the object has values in any of the three origins
|
|
121
132
|
*/
|
|
122
|
-
export function
|
|
133
|
+
export function hasOriginValue( value ) {
|
|
123
134
|
return [ 'default', 'theme', 'custom' ].some(
|
|
124
135
|
( key ) => value?.[ key ]?.length
|
|
125
136
|
);
|
|
@@ -203,8 +214,8 @@ export function getBlockSettings( state, clientId, ...paths ) {
|
|
|
203
214
|
|
|
204
215
|
// Return if the setting was found in either the block instance or the store.
|
|
205
216
|
if ( result !== undefined ) {
|
|
206
|
-
if (
|
|
207
|
-
return
|
|
217
|
+
if ( PATHS_WITH_OVERRIDE[ normalizedPath ] ) {
|
|
218
|
+
return overrideOrigins( result );
|
|
208
219
|
}
|
|
209
220
|
return result;
|
|
210
221
|
}
|
|
@@ -140,6 +140,15 @@ export const privateRemoveBlocks =
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
if ( rules[ 'bindings/core/pattern-overrides' ] ) {
|
|
143
|
+
const parentPatternBlocks =
|
|
144
|
+
select.getBlockParentsByBlockName(
|
|
145
|
+
clientId,
|
|
146
|
+
'core/block'
|
|
147
|
+
);
|
|
148
|
+
// We only need to run this check when editing the original pattern, not pattern instances.
|
|
149
|
+
if ( parentPatternBlocks?.length > 0 ) {
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
143
152
|
const blockAttributes =
|
|
144
153
|
select.getBlockAttributes( clientId );
|
|
145
154
|
if (
|
package/src/store/reducer.js
CHANGED
|
@@ -2057,7 +2057,7 @@ function blockBindingsSources( state = {}, action ) {
|
|
|
2057
2057
|
[ action.sourceName ]: {
|
|
2058
2058
|
label: action.sourceLabel,
|
|
2059
2059
|
useSource: action.useSource,
|
|
2060
|
-
lockAttributesEditing: action.lockAttributesEditing,
|
|
2060
|
+
lockAttributesEditing: action.lockAttributesEditing ?? true,
|
|
2061
2061
|
},
|
|
2062
2062
|
};
|
|
2063
2063
|
}
|