Skip to content

Commit 63f0cf2

Browse files
authored
Framework: Remove deprecations slated for 3.6 removal (#8993)
* Shared Blocks: Add deprecation notices for deprecated shared blocks * Framework: Remove deprecations slated for 3.6 removal
1 parent 3b33874 commit 63f0cf2

File tree

18 files changed

+33
-451
lines changed

18 files changed

+33
-451
lines changed

.eslintrc.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,6 @@ module.exports = {
9292
selector: 'ImportDeclaration[source.value=/^nux(\\u002F|$)/]',
9393
message: 'Use @wordpress/nux as import path instead.',
9494
},
95-
{
96-
selector: 'ImportDeclaration[source.value=/^utils(\\u002F|$)/]',
97-
message: 'Use @wordpress/utils as import path instead.',
98-
},
9995
{
10096
selector: 'ImportDeclaration[source.value=/^edit-post(\\u002F|$)/]',
10197
message: 'Use @wordpress/edit-post as import path instead.',

docs/reference/deprecated.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@ Gutenberg's deprecation policy is intended to support backwards-compatibility fo
2121
- `wp.utils.mediaUpload` has been removed. Please use `wp.editor.mediaUpload` instead.
2222
- `wp.utils.preloadImage` has been removed.
2323
- `supports.wideAlign` has been removed from the Block API. Please use `supports.alignWide` instead.
24+
- `wp.blocks.isSharedBlock` has been removed. Use `wp.blocks.isReusableBlock` instead.
25+
- `fetchSharedBlocks` action (`core/editor`) has been removed. Use `fetchReusableBlocks` instead.
26+
- `receiveSharedBlocks` action (`core/editor`) has been removed. Use `receiveReusableBlocks` instead.
27+
- `saveSharedBlock` action (`core/editor`) has been removed. Use `saveReusableBlock` instead.
28+
- `deleteSharedBlock` action (`core/editor`) has been removed. Use `deleteReusableBlock` instead.
29+
- `updateSharedBlockTitle` action (`core/editor`) has been removed. Use `updateReusableBlockTitle` instead.
30+
- `convertBlockToSaved` action (`core/editor`) has been removed. Use `convertBlockToReusable` instead.
31+
- `getSharedBlock` selector (`core/editor`) has been removed. Use `getReusableBlock` instead.
32+
- `isSavingSharedBlock` selector (`core/editor`) has been removed. Use `isSavingReusableBlock` instead.
33+
- `isFetchingSharedBlock` selector (`core/editor`) has been removed. Use `isFetchingReusableBlock` instead.
34+
- `getSharedBlocks` selector (`core/editor`) has been removed. Use `getReusableBlocks` instead.
2435

2536
## 3.5.0
2637

edit-post/index.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import { registerCoreBlocks } from '@wordpress/block-library';
55
import { render, unmountComponentAtNode } from '@wordpress/element';
66
import { dispatch } from '@wordpress/data';
7-
import deprecated from '@wordpress/deprecated';
87

98
/**
109
* Internal dependencies
@@ -54,14 +53,6 @@ export function initializeEditor( id, postType, postId, settings, overridePost )
5453
const target = document.getElementById( id );
5554
const reboot = reinitializeEditor.bind( null, postType, postId, target, settings, overridePost );
5655

57-
// Global deprecations which cannot otherwise be injected into known usage.
58-
deprecated( 'paragraphs block class set is-small-text, ..., is-large-text', {
59-
version: '3.6',
60-
alternative: 'has-small-font-size, ..., has-large-font-size class set',
61-
plugin: 'Gutenberg',
62-
hint: 'If paragraphs using this classes are opened in the editor new classes are automatically applied the post just needs to be saved. This is a global warning, shown regardless of whether the classes are used in the current post.',
63-
} );
64-
6556
registerCoreBlocks();
6657

6758
dispatch( 'core/nux' ).triggerGuide( [

lib/client-assets.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -263,13 +263,6 @@ function gutenberg_register_scripts_and_styles() {
263263
) ),
264264
'before'
265265
);
266-
wp_register_script(
267-
'wp-utils',
268-
gutenberg_url( 'build/utils/index.js' ),
269-
array( 'lodash', 'wp-api-fetch', 'wp-data', 'wp-deprecated', 'wp-i18n', 'wp-editor' ),
270-
filemtime( gutenberg_dir_path() . 'build/utils/index.js' ),
271-
true
272-
);
273266
wp_register_script(
274267
'wp-shortcode',
275268
gutenberg_url( 'build/shortcode/index.js' ),
@@ -284,8 +277,6 @@ function gutenberg_register_scripts_and_styles() {
284277
filemtime( gutenberg_dir_path() . 'build/redux-routine/index.js' ),
285278
true
286279
);
287-
wp_add_inline_script( 'wp-utils', 'var originalUtils = window.wp && window.wp.utils ? window.wp.utils : {};', 'before' );
288-
wp_add_inline_script( 'wp-utils', 'for ( var key in originalUtils ) wp.utils[ key ] = originalUtils[ key ];' );
289280
wp_register_script(
290281
'wp-date',
291282
gutenberg_url( 'build/date/index.js' ),
@@ -1166,7 +1157,6 @@ function gutenberg_editor_scripts_and_styles( $hook ) {
11661157
// https://github.com/WordPress/gutenberg/issues/5667.
11671158
add_filter( 'user_can_richedit', '__return_true' );
11681159

1169-
wp_enqueue_script( 'wp-utils' );
11701160
wp_enqueue_script( 'wp-edit-post' );
11711161

11721162
global $post;

packages/blocks/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## v3.0.0 (Unreleased)
2+
3+
- Breaking: The `isSharedBlock` function is removed. Use `isReusableBlock` instead.

packages/blocks/src/api/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ export {
3838
getBlockSupport,
3939
hasBlockSupport,
4040
isReusableBlock,
41-
isSharedBlock,
4241
getChildBlockNames,
4342
hasChildBlocks,
4443
unstable__bootstrapServerSideBlockDefinitions, // eslint-disable-line camelcase

packages/blocks/src/api/registration.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { get, isFunction, some } from 'lodash';
1010
*/
1111
import { applyFilters, addFilter } from '@wordpress/hooks';
1212
import { select, dispatch } from '@wordpress/data';
13-
import deprecated from '@wordpress/deprecated';
1413

1514
/**
1615
* Internal dependencies
@@ -310,16 +309,6 @@ export function isReusableBlock( blockOrType ) {
310309
return blockOrType.name === 'core/block';
311310
}
312311

313-
export function isSharedBlock( blockOrType ) {
314-
deprecated( 'isSharedBlock', {
315-
alternative: 'isReusableBlock',
316-
version: '3.6',
317-
plugin: 'Gutenberg',
318-
} );
319-
320-
return isReusableBlock( blockOrType );
321-
}
322-
323312
/**
324313
* Returns an array with the child blocks of a given block.
325314
*

packages/data/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
## v2.0.0 (Unreleased)
2+
3+
- Breaking: The `withRehdyration` function is removed. Use the persistence plugin instead.
4+
- Breaking: The `loadAndPersist` function is removed. Use the persistence plugin instead.

packages/data/src/deprecated.js

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
/**
2-
* External dependencies
3-
*/
4-
import { get } from 'lodash';
5-
61
/**
72
* WordPress dependencies
83
*/
@@ -13,85 +8,6 @@ import deprecated from '@wordpress/deprecated';
138
*/
149
import * as persistence from './plugins/persistence';
1510

16-
/**
17-
* Adds the rehydration behavior to redux reducers.
18-
*
19-
* @param {Function} reducer The reducer to enhance.
20-
* @param {string} reducerKey The reducer key to persist.
21-
* @param {string} storageKey The storage key to use.
22-
*
23-
* @return {Function} Enhanced reducer.
24-
*/
25-
export function withRehydration( reducer, reducerKey, storageKey ) {
26-
deprecated( 'wp.data.withRehydration', {
27-
version: '3.6',
28-
plugin: 'Gutenberg',
29-
hint: 'See https://github.com/WordPress/gutenberg/pull/8146 for more details',
30-
} );
31-
32-
// EnhancedReducer with auto-rehydration
33-
const enhancedReducer = ( state, action ) => {
34-
const nextState = reducer( state, action );
35-
36-
if ( action.type === 'REDUX_REHYDRATE' && action.storageKey === storageKey ) {
37-
return {
38-
...nextState,
39-
[ reducerKey ]: action.payload,
40-
};
41-
}
42-
43-
return nextState;
44-
};
45-
46-
return enhancedReducer;
47-
}
48-
49-
/**
50-
* Loads the initial state and persist on changes.
51-
*
52-
* This should be executed after the reducer's registration.
53-
*
54-
* @param {Object} store Store to enhance.
55-
* @param {Function} reducer The reducer function. Used to get default values and to allow custom serialization by the reducers.
56-
* @param {string} reducerKey The reducer key to persist (example: reducerKey.subReducerKey).
57-
* @param {string} storageKey The storage key to use.
58-
*/
59-
export function loadAndPersist( store, reducer, reducerKey, storageKey ) {
60-
deprecated( 'wp.data.loadAndPersist', {
61-
version: '3.6',
62-
plugin: 'Gutenberg',
63-
hint: 'See https://github.com/WordPress/gutenberg/pull/8146 for more details',
64-
} );
65-
66-
const persist = persistence.createPersistenceInterface( { storageKey } );
67-
68-
// Load initially persisted value
69-
const persisted = persist.get();
70-
if ( persisted ) {
71-
const persistedState = {
72-
...get( reducer( undefined, { type: '@@gutenberg/init' } ), reducerKey ),
73-
...JSON.parse( persisted ),
74-
};
75-
76-
store.dispatch( {
77-
type: 'REDUX_REHYDRATE',
78-
payload: persistedState,
79-
storageKey,
80-
} );
81-
}
82-
83-
// Persist updated preferences
84-
let currentStateValue = get( store.getState(), reducerKey );
85-
store.subscribe( () => {
86-
const newStateValue = get( store.getState(), reducerKey );
87-
if ( newStateValue !== currentStateValue ) {
88-
currentStateValue = newStateValue;
89-
const stateToSave = get( reducer( store.getState(), { type: 'SERIALIZE' } ), reducerKey );
90-
persist.set( stateToSave );
91-
}
92-
} );
93-
}
94-
9511
/**
9612
* Higher-order reducer used to persist just one key from the reducer state.
9713
*

packages/data/src/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ export { default as withDispatch } from './components/with-dispatch';
1414
export { default as RegistryProvider, RegistryConsumer } from './components/registry-provider';
1515
export { createRegistry } from './registry';
1616
export {
17-
withRehydration,
18-
loadAndPersist,
1917
restrictPersistence,
2018
setPersistenceStorage,
2119
} from './deprecated';

0 commit comments

Comments
 (0)