@wordpress/editor 12.2.1-next.f435e9e01b.0 → 12.3.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 +7 -1
- package/build/components/deprecated.js +1 -1
- package/build/components/deprecated.js.map +1 -1
- package/build/components/deprecated.native.js.map +1 -1
- package/build/components/editor-help/index.native.js +3 -3
- package/build/components/editor-help/index.native.js.map +1 -1
- package/build/components/entities-saved-states/entity-record-item.js +1 -1
- package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js.map +1 -1
- package/build/components/local-autosave-monitor/index.js +5 -5
- package/build/components/local-autosave-monitor/index.js.map +1 -1
- package/build/components/post-featured-image/index.js +4 -4
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-last-revision/index.js +3 -3
- package/build/components/post-last-revision/index.js.map +1 -1
- package/build/components/post-locked-modal/index.js +1 -3
- package/build/components/post-locked-modal/index.js.map +1 -1
- package/build/components/post-saved-state/index.js +1 -1
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-schedule/index.js +3 -3
- package/build/components/post-schedule/index.js.map +1 -1
- package/build/components/post-slug/index.js +2 -4
- package/build/components/post-slug/index.js.map +1 -1
- package/build/components/post-switch-to-draft-button/index.js +19 -14
- package/build/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +2 -2
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-title/index.native.js +2 -2
- package/build/components/post-title/index.native.js.map +1 -1
- package/build/components/post-trash/index.js +15 -29
- package/build/components/post-trash/index.js.map +1 -1
- package/build/components/provider/index.js +1 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/index.native.js +24 -15
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +3 -8
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/store/actions.js +231 -225
- package/build/store/actions.js.map +1 -1
- package/build/store/actions.native.js +6 -4
- package/build/store/actions.native.js.map +1 -1
- package/build/store/index.js +1 -8
- package/build/store/index.js.map +1 -1
- package/build/store/{controls.js → local-autosave.js} +1 -18
- package/build/store/local-autosave.js.map +1 -0
- package/build/store/reducer.js +0 -2
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +8 -10
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils/notice-builder.js +9 -4
- package/build/store/utils/notice-builder.js.map +1 -1
- package/build/utils/url.js +9 -26
- package/build/utils/url.js.map +1 -1
- package/build-module/components/deprecated.js +1 -1
- package/build-module/components/deprecated.js.map +1 -1
- package/build-module/components/deprecated.native.js +1 -1
- package/build-module/components/deprecated.native.js.map +1 -1
- package/build-module/components/editor-help/index.native.js +4 -4
- package/build-module/components/editor-help/index.native.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-record-item.js +1 -1
- package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +1 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build-module/components/index.js +3 -3
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +3 -3
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/local-autosave-monitor/index.js +1 -1
- package/build-module/components/local-autosave-monitor/index.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +4 -4
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-last-revision/index.js +2 -2
- package/build-module/components/post-last-revision/index.js.map +1 -1
- package/build-module/components/post-locked-modal/index.js +1 -2
- package/build-module/components/post-locked-modal/index.js.map +1 -1
- package/build-module/components/post-saved-state/index.js +1 -1
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-schedule/index.js +3 -3
- package/build-module/components/post-schedule/index.js.map +1 -1
- package/build-module/components/post-slug/index.js +1 -2
- package/build-module/components/post-slug/index.js.map +1 -1
- package/build-module/components/post-switch-to-draft-button/index.js +22 -16
- package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +2 -2
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-title/index.native.js +2 -2
- package/build-module/components/post-title/index.native.js.map +1 -1
- package/build-module/components/post-trash/index.js +15 -27
- package/build-module/components/post-trash/index.js.map +1 -1
- package/build-module/components/provider/index.js +1 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/index.native.js +26 -17
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +3 -8
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/store/actions.js +208 -207
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/actions.native.js +3 -3
- package/build-module/store/actions.native.js.map +1 -1
- package/build-module/store/index.js +1 -6
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/{controls.js → local-autosave.js} +1 -15
- package/build-module/store/local-autosave.js.map +1 -0
- package/build-module/store/reducer.js +0 -2
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +8 -9
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils/notice-builder.js +9 -4
- package/build-module/store/utils/notice-builder.js.map +1 -1
- package/build-module/utils/url.js +8 -25
- package/build-module/utils/url.js.map +1 -1
- package/package.json +26 -27
- package/src/components/deprecated.js +1 -1
- package/src/components/deprecated.native.js +1 -1
- package/src/components/document-outline/test/index.js +1 -1
- package/src/components/editor-help/index.native.js +8 -8
- package/src/components/entities-saved-states/entity-record-item.js +1 -1
- package/src/components/global-keyboard-shortcuts/register-shortcuts.js +1 -1
- package/src/components/index.js +3 -3
- package/src/components/index.native.js +3 -3
- package/src/components/local-autosave-monitor/index.js +4 -1
- package/src/components/post-author/test/check.js +1 -1
- package/src/components/post-featured-image/index.js +4 -4
- package/src/components/post-last-revision/index.js +2 -2
- package/src/components/post-locked-modal/index.js +1 -2
- package/src/components/post-saved-state/index.js +1 -1
- package/src/components/post-saved-state/test/index.js +2 -2
- package/src/components/post-schedule/index.js +3 -3
- package/src/components/post-slug/index.js +1 -2
- package/src/components/post-switch-to-draft-button/index.js +35 -24
- package/src/components/post-taxonomies/hierarchical-term-selector.js +2 -2
- package/src/components/post-text-editor/test/index.js +1 -1
- package/src/components/post-title/index.native.js +2 -2
- package/src/components/post-trash/index.js +12 -24
- package/src/components/provider/index.js +1 -1
- package/src/components/provider/index.native.js +27 -23
- package/src/components/provider/use-block-editor-settings.js +3 -14
- package/src/store/actions.js +137 -249
- package/src/store/actions.native.js +3 -3
- package/src/store/index.js +0 -6
- package/src/store/{controls.js → local-autosave.js} +0 -8
- package/src/store/reducer.js +0 -2
- package/src/store/selectors.js +8 -9
- package/src/store/test/actions.js +244 -416
- package/src/store/test/selectors.js +1 -1
- package/src/store/utils/notice-builder.js +9 -4
- package/src/store/utils/test/notice-builder.js +1 -0
- package/src/utils/url.js +8 -30
- package/build/store/controls.js.map +0 -1
- package/build-module/store/controls.js.map +0 -1
- package/src/utils/test/url.js +0 -22
|
@@ -31,12 +31,8 @@ import {
|
|
|
31
31
|
import { withDispatch, withSelect } from '@wordpress/data';
|
|
32
32
|
import { compose } from '@wordpress/compose';
|
|
33
33
|
import { applyFilters } from '@wordpress/hooks';
|
|
34
|
-
import {
|
|
35
|
-
|
|
36
|
-
validateThemeGradients,
|
|
37
|
-
store as blockEditorStore,
|
|
38
|
-
} from '@wordpress/block-editor';
|
|
39
|
-
import { getGlobalStyles } from '@wordpress/components';
|
|
34
|
+
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
35
|
+
import { getGlobalStyles, getColorsAndGradients } from '@wordpress/components';
|
|
40
36
|
import { NEW_BLOCK_TYPES } from '@wordpress/block-library';
|
|
41
37
|
|
|
42
38
|
const postTypeEntities = [
|
|
@@ -70,7 +66,7 @@ class NativeEditorProvider extends Component {
|
|
|
70
66
|
constructor() {
|
|
71
67
|
super( ...arguments );
|
|
72
68
|
|
|
73
|
-
// Keep a local reference to `post` to detect changes
|
|
69
|
+
// Keep a local reference to `post` to detect changes.
|
|
74
70
|
this.post = this.props.post;
|
|
75
71
|
this.props.addEntities( postTypeEntities );
|
|
76
72
|
this.props.receiveEntityRecords(
|
|
@@ -171,15 +167,15 @@ class NativeEditorProvider extends Component {
|
|
|
171
167
|
this.setState( { isHelpVisible: true } );
|
|
172
168
|
} );
|
|
173
169
|
|
|
174
|
-
// Request current block impressions from native app
|
|
170
|
+
// Request current block impressions from native app.
|
|
175
171
|
requestBlockTypeImpressions( ( storedImpressions ) => {
|
|
176
172
|
const impressions = { ...NEW_BLOCK_TYPES, ...storedImpressions };
|
|
177
173
|
|
|
178
|
-
// Persist impressions to JavaScript store
|
|
174
|
+
// Persist impressions to JavaScript store.
|
|
179
175
|
updateSettings( { impressions } );
|
|
180
176
|
|
|
181
177
|
// Persist impressions to native store if they do not include latest
|
|
182
|
-
// `NEW_BLOCK_TYPES` configuration
|
|
178
|
+
// `NEW_BLOCK_TYPES` configuration.
|
|
183
179
|
const storedImpressionKeys = Object.keys( storedImpressions );
|
|
184
180
|
const storedImpressionsCurrent = Object.keys(
|
|
185
181
|
NEW_BLOCK_TYPES
|
|
@@ -232,15 +228,18 @@ class NativeEditorProvider extends Component {
|
|
|
232
228
|
}
|
|
233
229
|
}
|
|
234
230
|
|
|
235
|
-
getThemeColors( {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
231
|
+
getThemeColors( { rawStyles, rawFeatures } ) {
|
|
232
|
+
const { defaultEditorColors, defaultEditorGradients } = this.props;
|
|
233
|
+
|
|
234
|
+
if ( rawStyles && rawFeatures ) {
|
|
235
|
+
return getGlobalStyles( rawStyles, rawFeatures );
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
return getColorsAndGradients(
|
|
239
|
+
defaultEditorColors,
|
|
240
|
+
defaultEditorGradients,
|
|
241
|
+
rawFeatures
|
|
242
|
+
);
|
|
244
243
|
}
|
|
245
244
|
|
|
246
245
|
componentDidUpdate( prevProps ) {
|
|
@@ -263,7 +262,7 @@ class NativeEditorProvider extends Component {
|
|
|
263
262
|
|
|
264
263
|
if ( this.props.mode === 'text' ) {
|
|
265
264
|
// The HTMLTextInput component does not update the store when user is doing changes
|
|
266
|
-
// Let's request the HTML from the component's state directly
|
|
265
|
+
// Let's request the HTML from the component's state directly.
|
|
267
266
|
html = applyFilters( 'native.persist-html' );
|
|
268
267
|
} else {
|
|
269
268
|
html = serialize( this.props.blocks );
|
|
@@ -306,9 +305,9 @@ class NativeEditorProvider extends Component {
|
|
|
306
305
|
|
|
307
306
|
toggleMode() {
|
|
308
307
|
const { mode, switchMode } = this.props;
|
|
309
|
-
//
|
|
308
|
+
// Refresh html content first.
|
|
310
309
|
this.serializeToNativeAction();
|
|
311
|
-
//
|
|
310
|
+
// Make sure to blur the selected block and dismiss the keyboard.
|
|
312
311
|
this.props.clearSelectedBlock();
|
|
313
312
|
switchMode( mode === 'visual' ? 'text' : 'visual' );
|
|
314
313
|
}
|
|
@@ -363,6 +362,10 @@ export default compose( [
|
|
|
363
362
|
getSettings: getBlockEditorSettings,
|
|
364
363
|
} = select( blockEditorStore );
|
|
365
364
|
|
|
365
|
+
const settings = getBlockEditorSettings();
|
|
366
|
+
const defaultEditorColors = settings?.colors ?? [];
|
|
367
|
+
const defaultEditorGradients = settings?.gradients ?? [];
|
|
368
|
+
|
|
366
369
|
const selectedBlockClientId = getSelectedBlockClientId();
|
|
367
370
|
return {
|
|
368
371
|
mode: getEditorMode(),
|
|
@@ -370,7 +373,8 @@ export default compose( [
|
|
|
370
373
|
blocks: getEditorBlocks(),
|
|
371
374
|
title: getEditedPostAttribute( 'title' ),
|
|
372
375
|
getEditedPostContent,
|
|
373
|
-
|
|
376
|
+
defaultEditorColors,
|
|
377
|
+
defaultEditorGradients,
|
|
374
378
|
selectedBlockIndex: getBlockIndex( selectedBlockClientId ),
|
|
375
379
|
blockCount: getGlobalBlockCount(),
|
|
376
380
|
paragraphCount: getGlobalBlockCount( 'core/paragraph' ),
|
|
@@ -39,21 +39,10 @@ function useBlockEditorSettings( settings, hasTemplate ) {
|
|
|
39
39
|
} = useSelect( ( select ) => {
|
|
40
40
|
const { canUserUseUnfilteredHTML } = select( editorStore );
|
|
41
41
|
const isWeb = Platform.OS === 'web';
|
|
42
|
-
const {
|
|
43
|
-
canUser,
|
|
44
|
-
getUnstableBase,
|
|
45
|
-
hasFinishedResolution,
|
|
46
|
-
getEntityRecord,
|
|
47
|
-
} = select( coreStore );
|
|
42
|
+
const { canUser, getEntityRecord } = select( coreStore );
|
|
48
43
|
|
|
49
44
|
const siteSettings = getEntityRecord( 'root', 'site' );
|
|
50
45
|
|
|
51
|
-
const siteData = getUnstableBase();
|
|
52
|
-
|
|
53
|
-
const hasFinishedResolvingSiteData = hasFinishedResolution(
|
|
54
|
-
'getUnstableBase'
|
|
55
|
-
);
|
|
56
|
-
|
|
57
46
|
return {
|
|
58
47
|
canUseUnfilteredHTML: canUserUseUnfilteredHTML(),
|
|
59
48
|
reusableBlocks: isWeb
|
|
@@ -67,8 +56,6 @@ function useBlockEditorSettings( settings, hasTemplate ) {
|
|
|
67
56
|
canUser( 'create', 'media' ),
|
|
68
57
|
true
|
|
69
58
|
),
|
|
70
|
-
hasResolvedLocalSiteData: hasFinishedResolvingSiteData,
|
|
71
|
-
baseUrl: siteData?.url || '',
|
|
72
59
|
userCanCreatePages: canUser( 'create', 'pages' ),
|
|
73
60
|
pageOnFront: siteSettings?.page_on_front,
|
|
74
61
|
};
|
|
@@ -104,6 +91,7 @@ function useBlockEditorSettings( settings, hasTemplate ) {
|
|
|
104
91
|
'__experimentalFeatures',
|
|
105
92
|
'__experimentalPreferredStyleVariations',
|
|
106
93
|
'__experimentalSetIsInserterOpened',
|
|
94
|
+
'__experimentalGenerateAnchors',
|
|
107
95
|
'__unstableGalleryWithImageBlocks',
|
|
108
96
|
'alignWide',
|
|
109
97
|
'allowedBlockTypes',
|
|
@@ -148,6 +136,7 @@ function useBlockEditorSettings( settings, hasTemplate ) {
|
|
|
148
136
|
__experimentalCreatePageEntity: createPageEntity,
|
|
149
137
|
__experimentalUserCanCreatePages: userCanCreatePages,
|
|
150
138
|
pageOnFront,
|
|
139
|
+
__experimentalPreferPatternsOnRoot: hasTemplate,
|
|
151
140
|
} ),
|
|
152
141
|
[
|
|
153
142
|
settings,
|