@wordpress/edit-post 7.13.0 → 7.15.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 +4 -0
- package/build/components/device-preview/index.js +6 -6
- package/build/components/device-preview/index.js.map +1 -1
- package/build/components/header/header-toolbar/index.js +10 -3
- package/build/components/header/header-toolbar/index.js.map +1 -1
- package/build/components/header/header-toolbar/index.native.js +91 -49
- package/build/components/header/header-toolbar/index.native.js.map +1 -1
- package/build/components/header/index.js +26 -30
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/post-publish-button-or-toggle.js +0 -2
- package/build/components/header/post-publish-button-or-toggle.js.map +1 -1
- package/build/components/header/preferences-menu-item/index.js +5 -3
- package/build/components/header/preferences-menu-item/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +8 -6
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +0 -2
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/actions-panel.js +5 -10
- package/build/components/layout/actions-panel.js.map +1 -1
- package/build/components/layout/index.js +2 -2
- package/build/components/layout/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +5 -3
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/sidebar/post-status/index.js +2 -1
- package/build/components/sidebar/post-status/index.js.map +1 -1
- package/build/components/sidebar/post-trash/index.js +1 -5
- package/build/components/sidebar/post-trash/index.js.map +1 -1
- package/build/components/text-editor/index.js +1 -1
- package/build/components/text-editor/index.js.map +1 -1
- package/build/components/visual-editor/header.native.js +1 -13
- package/build/components/visual-editor/header.native.js.map +1 -1
- package/build/components/visual-editor/index.js +1 -1
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/editor.js +3 -0
- package/build/editor.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +176 -0
- package/build/hooks/commands/use-common-commands.js.map +1 -0
- package/build/plugins/index.js +35 -6
- package/build/plugins/index.js.map +1 -1
- package/build/plugins/keyboard-shortcuts-help-menu-item/index.js +5 -3
- package/build/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
- package/build/store/actions.js +43 -29
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +0 -23
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +11 -7
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/device-preview/index.js +6 -6
- package/build-module/components/device-preview/index.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.js +9 -3
- package/build-module/components/header/header-toolbar/index.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.native.js +92 -53
- package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
- package/build-module/components/header/index.js +25 -30
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/post-publish-button-or-toggle.js +0 -2
- package/build-module/components/header/post-publish-button-or-toggle.js.map +1 -1
- package/build-module/components/header/preferences-menu-item/index.js +4 -3
- package/build-module/components/header/preferences-menu-item/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +5 -5
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +0 -2
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/actions-panel.js +5 -10
- package/build-module/components/layout/actions-panel.js.map +1 -1
- package/build-module/components/layout/index.js +3 -3
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +4 -4
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/sidebar/post-status/index.js +2 -1
- package/build-module/components/sidebar/post-status/index.js.map +1 -1
- package/build-module/components/sidebar/post-trash/index.js +1 -4
- package/build-module/components/sidebar/post-trash/index.js.map +1 -1
- package/build-module/components/text-editor/index.js +2 -2
- package/build-module/components/text-editor/index.js.map +1 -1
- package/build-module/components/visual-editor/header.native.js +1 -10
- package/build-module/components/visual-editor/header.native.js.map +1 -1
- package/build-module/components/visual-editor/index.js +2 -2
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/editor.js +2 -0
- package/build-module/editor.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +160 -0
- package/build-module/hooks/commands/use-common-commands.js.map +1 -0
- package/build-module/plugins/index.js +33 -6
- package/build-module/plugins/index.js.map +1 -1
- package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js +4 -3
- package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
- package/build-module/store/actions.js +35 -25
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +0 -21
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +9 -3
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +10 -15
- package/build-style/style.css +10 -15
- package/package.json +32 -32
- package/src/components/block-manager/style.scss +1 -1
- package/src/components/device-preview/index.js +35 -39
- package/src/components/header/header-toolbar/index.js +5 -1
- package/src/components/header/header-toolbar/index.native.js +124 -68
- package/src/components/header/header-toolbar/style.native.scss +23 -4
- package/src/components/header/index.js +22 -32
- package/src/components/header/post-publish-button-or-toggle.js +0 -2
- package/src/components/header/preferences-menu-item/index.js +4 -3
- package/src/components/keyboard-shortcut-help-modal/index.js +10 -5
- package/src/components/keyboard-shortcuts/index.js +0 -2
- package/src/components/layout/actions-panel.js +5 -7
- package/src/components/layout/index.js +4 -0
- package/src/components/layout/style.native.scss +1 -1
- package/src/components/preferences-modal/index.js +6 -4
- package/src/components/preferences-modal/test/__snapshots__/index.js.snap +11 -3
- package/src/components/sidebar/post-status/index.js +1 -0
- package/src/components/sidebar/post-trash/index.js +1 -4
- package/src/components/start-page-options/style.scss +0 -3
- package/src/components/text-editor/index.js +0 -2
- package/src/components/visual-editor/header.native.js +1 -17
- package/src/components/visual-editor/index.js +1 -6
- package/src/components/visual-editor/test/__snapshots__/index.native.js.snap +15 -0
- package/src/components/visual-editor/test/index.native.js +118 -1
- package/src/editor.js +2 -0
- package/src/hooks/commands/use-common-commands.js +155 -0
- package/src/plugins/index.js +32 -8
- package/src/plugins/keyboard-shortcuts-help-menu-item/index.js +4 -3
- package/src/store/actions.js +40 -36
- package/src/store/reducer.js +0 -20
- package/src/store/selectors.js +11 -3
- package/src/store/test/reducer.js +0 -25
- package/src/store/test/selectors.js +0 -27
- package/src/style.scss +1 -7
- package/src/components/visual-editor/style.native.scss +0 -18
|
@@ -5,17 +5,18 @@ import { MenuItem } from '@wordpress/components';
|
|
|
5
5
|
import { withDispatch } from '@wordpress/data';
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
7
|
import { displayShortcut } from '@wordpress/keycodes';
|
|
8
|
+
import { store as interfaceStore } from '@wordpress/interface';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Internal dependencies
|
|
11
12
|
*/
|
|
12
|
-
import {
|
|
13
|
+
import { KEYBOARD_SHORTCUT_HELP_MODAL_NAME } from '../../components/keyboard-shortcut-help-modal';
|
|
13
14
|
|
|
14
15
|
export function KeyboardShortcutsHelpMenuItem( { openModal } ) {
|
|
15
16
|
return (
|
|
16
17
|
<MenuItem
|
|
17
18
|
onClick={ () => {
|
|
18
|
-
openModal(
|
|
19
|
+
openModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );
|
|
19
20
|
} }
|
|
20
21
|
shortcut={ displayShortcut.access( 'h' ) }
|
|
21
22
|
>
|
|
@@ -25,7 +26,7 @@ export function KeyboardShortcutsHelpMenuItem( { openModal } ) {
|
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
export default withDispatch( ( dispatch ) => {
|
|
28
|
-
const { openModal } = dispatch(
|
|
29
|
+
const { openModal } = dispatch( interfaceStore );
|
|
29
30
|
|
|
30
31
|
return {
|
|
31
32
|
openModal,
|
package/src/store/actions.js
CHANGED
|
@@ -10,6 +10,8 @@ import { store as noticesStore } from '@wordpress/notices';
|
|
|
10
10
|
import { store as coreStore } from '@wordpress/core-data';
|
|
11
11
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
12
12
|
import { store as editorStore } from '@wordpress/editor';
|
|
13
|
+
import deprecated from '@wordpress/deprecated';
|
|
14
|
+
import { addFilter } from '@wordpress/hooks';
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
17
|
* Internal dependencies
|
|
@@ -42,27 +44,39 @@ export const closeGeneralSidebar =
|
|
|
42
44
|
/**
|
|
43
45
|
* Returns an action object used in signalling that the user opened a modal.
|
|
44
46
|
*
|
|
47
|
+
* @deprecated since WP 6.3 use `core/interface` store's action with the same name instead.
|
|
48
|
+
*
|
|
49
|
+
*
|
|
45
50
|
* @param {string} name A string that uniquely identifies the modal.
|
|
46
51
|
*
|
|
47
52
|
* @return {Object} Action object.
|
|
48
53
|
*/
|
|
49
|
-
export
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
name,
|
|
54
|
+
export const openModal =
|
|
55
|
+
( name ) =>
|
|
56
|
+
( { registry } ) => {
|
|
57
|
+
deprecated( "select( 'core/edit-post' ).openModal( name )", {
|
|
58
|
+
since: '6.3',
|
|
59
|
+
alternative: "select( 'core/interface').openModal( name )",
|
|
60
|
+
} );
|
|
61
|
+
return registry.dispatch( interfaceStore ).openModal( name );
|
|
53
62
|
};
|
|
54
|
-
}
|
|
55
63
|
|
|
56
64
|
/**
|
|
57
65
|
* Returns an action object signalling that the user closed a modal.
|
|
58
66
|
*
|
|
67
|
+
* @deprecated since WP 6.3 use `core/interface` store's action with the same name instead.
|
|
68
|
+
*
|
|
59
69
|
* @return {Object} Action object.
|
|
60
70
|
*/
|
|
61
|
-
export
|
|
62
|
-
|
|
63
|
-
|
|
71
|
+
export const closeModal =
|
|
72
|
+
() =>
|
|
73
|
+
( { registry } ) => {
|
|
74
|
+
deprecated( "select( 'core/edit-post' ).closeModal()", {
|
|
75
|
+
since: '6.3',
|
|
76
|
+
alternative: "select( 'core/interface').closeModal()",
|
|
77
|
+
} );
|
|
78
|
+
return registry.dispatch( interfaceStore ).closeModal();
|
|
64
79
|
};
|
|
65
|
-
}
|
|
66
80
|
|
|
67
81
|
/**
|
|
68
82
|
* Returns an action object used in signalling that the user opened the publish
|
|
@@ -554,33 +568,23 @@ export const initializeMetaBoxes =
|
|
|
554
568
|
|
|
555
569
|
metaBoxesInitialized = true;
|
|
556
570
|
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
.
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
select.hasMetaBoxes();
|
|
575
|
-
|
|
576
|
-
// Save current state for next inspection.
|
|
577
|
-
wasSavingPost = isSavingPost;
|
|
578
|
-
wasAutosavingPost = isAutosavingPost;
|
|
579
|
-
|
|
580
|
-
if ( shouldTriggerMetaboxesSave ) {
|
|
581
|
-
await dispatch.requestMetaBoxUpdates();
|
|
582
|
-
}
|
|
583
|
-
} );
|
|
571
|
+
// Save metaboxes on save completion, except for autosaves.
|
|
572
|
+
addFilter(
|
|
573
|
+
'editor.__unstableSavePost',
|
|
574
|
+
'core/edit-post/save-metaboxes',
|
|
575
|
+
( previous, options ) =>
|
|
576
|
+
previous.then( () => {
|
|
577
|
+
if ( options.isAutosave ) {
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
if ( ! select.hasMetaBoxes() ) {
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
return dispatch.requestMetaBoxUpdates();
|
|
586
|
+
} )
|
|
587
|
+
);
|
|
584
588
|
|
|
585
589
|
dispatch( {
|
|
586
590
|
type: 'META_BOXES_INITIALIZED',
|
package/src/store/reducer.js
CHANGED
|
@@ -22,25 +22,6 @@ export function removedPanels( state = [], action ) {
|
|
|
22
22
|
return state;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
/**
|
|
26
|
-
* Reducer for storing the name of the open modal, or null if no modal is open.
|
|
27
|
-
*
|
|
28
|
-
* @param {Object} state Previous state.
|
|
29
|
-
* @param {Object} action Action object containing the `name` of the modal
|
|
30
|
-
*
|
|
31
|
-
* @return {Object} Updated state
|
|
32
|
-
*/
|
|
33
|
-
export function activeModal( state = null, action ) {
|
|
34
|
-
switch ( action.type ) {
|
|
35
|
-
case 'OPEN_MODAL':
|
|
36
|
-
return action.name;
|
|
37
|
-
case 'CLOSE_MODAL':
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return state;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
25
|
export function publishSidebarActive( state = false, action ) {
|
|
45
26
|
switch ( action.type ) {
|
|
46
27
|
case 'OPEN_PUBLISH_SIDEBAR':
|
|
@@ -209,7 +190,6 @@ const metaBoxes = combineReducers( {
|
|
|
209
190
|
} );
|
|
210
191
|
|
|
211
192
|
export default combineReducers( {
|
|
212
|
-
activeModal,
|
|
213
193
|
metaBoxes,
|
|
214
194
|
publishSidebarActive,
|
|
215
195
|
removedPanels,
|
package/src/store/selectors.js
CHANGED
|
@@ -298,14 +298,22 @@ export const isEditorPanelOpened = createRegistrySelector(
|
|
|
298
298
|
/**
|
|
299
299
|
* Returns true if a modal is active, or false otherwise.
|
|
300
300
|
*
|
|
301
|
+
* @deprecated since WP 6.3 use `core/interface` store's selector with the same name instead.
|
|
302
|
+
*
|
|
301
303
|
* @param {Object} state Global application state.
|
|
302
304
|
* @param {string} modalName A string that uniquely identifies the modal.
|
|
303
305
|
*
|
|
304
306
|
* @return {boolean} Whether the modal is active.
|
|
305
307
|
*/
|
|
306
|
-
export
|
|
307
|
-
|
|
308
|
-
|
|
308
|
+
export const isModalActive = createRegistrySelector(
|
|
309
|
+
( select ) => ( state, modalName ) => {
|
|
310
|
+
deprecated( `select( 'core/edit-post' ).isModalActive`, {
|
|
311
|
+
since: '6.3',
|
|
312
|
+
alternative: `select( 'core/interface' ).isModalActive`,
|
|
313
|
+
} );
|
|
314
|
+
return !! select( interfaceStore ).isModalActive( modalName );
|
|
315
|
+
}
|
|
316
|
+
);
|
|
309
317
|
|
|
310
318
|
/**
|
|
311
319
|
* Returns whether the given feature is enabled or not.
|
|
@@ -7,7 +7,6 @@ import deepFreeze from 'deep-freeze';
|
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
9
|
import {
|
|
10
|
-
activeModal,
|
|
11
10
|
isSavingMetaBoxes,
|
|
12
11
|
metaBoxLocations,
|
|
13
12
|
removedPanels,
|
|
@@ -18,30 +17,6 @@ import {
|
|
|
18
17
|
import { setIsInserterOpened, setIsListViewOpened } from '../actions';
|
|
19
18
|
|
|
20
19
|
describe( 'state', () => {
|
|
21
|
-
describe( 'activeModal', () => {
|
|
22
|
-
it( 'should default to null', () => {
|
|
23
|
-
const state = activeModal( undefined, {} );
|
|
24
|
-
expect( state ).toBeNull();
|
|
25
|
-
} );
|
|
26
|
-
|
|
27
|
-
it( 'should set the activeModal to the provided name', () => {
|
|
28
|
-
const state = activeModal( null, {
|
|
29
|
-
type: 'OPEN_MODAL',
|
|
30
|
-
name: 'test-modal',
|
|
31
|
-
} );
|
|
32
|
-
|
|
33
|
-
expect( state ).toEqual( 'test-modal' );
|
|
34
|
-
} );
|
|
35
|
-
|
|
36
|
-
it( 'should set the activeModal to null', () => {
|
|
37
|
-
const state = activeModal( 'test-modal', {
|
|
38
|
-
type: 'CLOSE_MODAL',
|
|
39
|
-
} );
|
|
40
|
-
|
|
41
|
-
expect( state ).toBeNull();
|
|
42
|
-
} );
|
|
43
|
-
} );
|
|
44
|
-
|
|
45
20
|
describe( 'isSavingMetaBoxes', () => {
|
|
46
21
|
it( 'should return default state', () => {
|
|
47
22
|
const actual = isSavingMetaBoxes( undefined, {} );
|
|
@@ -7,7 +7,6 @@ import deepFreeze from 'deep-freeze';
|
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
9
|
import {
|
|
10
|
-
isModalActive,
|
|
11
10
|
hasMetaBoxes,
|
|
12
11
|
isSavingMetaBoxes,
|
|
13
12
|
getActiveMetaBoxLocations,
|
|
@@ -18,32 +17,6 @@ import {
|
|
|
18
17
|
} from '../selectors';
|
|
19
18
|
|
|
20
19
|
describe( 'selectors', () => {
|
|
21
|
-
describe( 'isModalActive', () => {
|
|
22
|
-
it( 'returns true if the provided name matches the value in the preferences activeModal property', () => {
|
|
23
|
-
const state = {
|
|
24
|
-
activeModal: 'test-modal',
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
expect( isModalActive( state, 'test-modal' ) ).toBe( true );
|
|
28
|
-
} );
|
|
29
|
-
|
|
30
|
-
it( 'returns false if the provided name does not match the preferences activeModal property', () => {
|
|
31
|
-
const state = {
|
|
32
|
-
activeModal: 'something-else',
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
expect( isModalActive( state, 'test-modal' ) ).toBe( false );
|
|
36
|
-
} );
|
|
37
|
-
|
|
38
|
-
it( 'returns false if the preferences activeModal property is null', () => {
|
|
39
|
-
const state = {
|
|
40
|
-
activeModal: null,
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
expect( isModalActive( state, 'test-modal' ) ).toBe( false );
|
|
44
|
-
} );
|
|
45
|
-
} );
|
|
46
|
-
|
|
47
20
|
describe( 'isEditorPanelRemoved', () => {
|
|
48
21
|
it( 'should return false by default', () => {
|
|
49
22
|
const state = deepFreeze( {
|
package/src/style.scss
CHANGED
|
@@ -41,13 +41,7 @@
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
// We scope it to .wp-toolbar to be wp-admin only, to prevent bleed into other implementations
|
|
46
|
-
html.wp-toolbar {
|
|
47
|
-
background: $white;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
body.block-editor-page {
|
|
44
|
+
body.js.block-editor-page {
|
|
51
45
|
@include wp-admin-reset( ".block-editor" );
|
|
52
46
|
}
|
|
53
47
|
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
.blockHolderFullBordered {
|
|
2
|
-
border-top-width: $block-selected-border-width;
|
|
3
|
-
border-bottom-width: $block-selected-border-width;
|
|
4
|
-
border-left-width: $block-selected-border-width;
|
|
5
|
-
border-right-width: $block-selected-border-width;
|
|
6
|
-
border-radius: 4px;
|
|
7
|
-
border-style: solid;
|
|
8
|
-
margin-left: 4px;
|
|
9
|
-
margin-right: 4px;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.blockHolderFocused {
|
|
13
|
-
border-color: $blue-wordpress;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.blockHolderFocusedDark {
|
|
17
|
-
border-color: $blue-30;
|
|
18
|
-
}
|