@wordpress/edit-post 7.35.0 → 8.0.1
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 -0
- package/build/commands/use-commands.js +56 -0
- package/build/commands/use-commands.js.map +1 -0
- package/build/components/{header/fullscreen-mode-close/index.js → back-button/fullscreen-mode-close.js} +16 -14
- package/build/components/back-button/fullscreen-mode-close.js.map +1 -0
- package/build/components/back-button/index.js +59 -0
- package/build/components/back-button/index.js.map +1 -0
- package/build/components/header/header-toolbar/index.native.js +63 -62
- package/build/components/header/header-toolbar/index.native.js.map +1 -1
- package/build/components/header/index.native.js +2 -2
- package/build/components/header/index.native.js.map +1 -1
- package/build/components/init-pattern-modal/index.js +50 -43
- package/build/components/init-pattern-modal/index.js.map +1 -1
- package/build/components/layout/index.js +93 -155
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/index.native.js +28 -21
- package/build/components/layout/index.native.js.map +1 -1
- package/build/components/layout/use-padding-appender.js.map +1 -0
- package/build/components/layout/use-should-iframe.js +46 -0
- package/build/components/layout/use-should-iframe.js.map +1 -0
- package/build/components/meta-boxes/index.js +10 -9
- package/build/components/meta-boxes/index.js.map +1 -1
- package/build/components/meta-boxes/meta-boxes-area/index.js +11 -11
- package/build/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
- package/build/components/more-menu/index.js +49 -0
- package/build/components/more-menu/index.js.map +1 -0
- package/build/components/{header/more-menu → more-menu}/manage-patterns-menu-item.js +5 -4
- package/build/components/more-menu/manage-patterns-menu-item.js.map +1 -0
- package/build/components/{header/more-menu → more-menu}/welcome-guide-menu-item.js +2 -2
- package/build/components/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build/components/preferences-modal/enable-custom-fields.js +24 -18
- package/build/components/preferences-modal/enable-custom-fields.js.map +1 -1
- package/build/components/preferences-modal/index.js +4 -4
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preferences-modal/meta-boxes-section.js +13 -13
- package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build/components/visual-editor/header.native.js +11 -10
- package/build/components/visual-editor/header.native.js.map +1 -1
- package/build/components/visual-editor/index.native.js +3 -3
- package/build/components/visual-editor/index.native.js.map +1 -1
- package/build/components/welcome-guide/default.js +50 -33
- package/build/components/welcome-guide/default.js.map +1 -1
- package/build/components/welcome-guide/image.js +13 -12
- package/build/components/welcome-guide/image.js.map +1 -1
- package/build/components/welcome-guide/index.js +2 -2
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/welcome-guide/template.js +12 -8
- package/build/components/welcome-guide/template.js.map +1 -1
- package/build/deprecated.js +9 -9
- package/build/deprecated.js.map +1 -1
- package/build/editor.js +16 -11
- package/build/editor.js.map +1 -1
- package/build/editor.native.js +18 -12
- package/build/editor.native.js.map +1 -1
- package/build/index.js +12 -13
- package/build/index.js.map +1 -1
- package/build/index.native.js +2 -2
- package/build/index.native.js.map +1 -1
- package/build/store/selectors.js +1 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/commands/use-commands.js +49 -0
- package/build-module/commands/use-commands.js.map +1 -0
- package/build-module/components/{header/fullscreen-mode-close/index.js → back-button/fullscreen-mode-close.js} +16 -14
- package/build-module/components/back-button/fullscreen-mode-close.js.map +1 -0
- package/build-module/components/back-button/index.js +51 -0
- package/build-module/components/back-button/index.js.map +1 -0
- package/build-module/components/header/header-toolbar/index.native.js +64 -62
- package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
- package/build-module/components/header/index.native.js +2 -2
- package/build-module/components/header/index.native.js.map +1 -1
- package/build-module/components/init-pattern-modal/index.js +52 -43
- package/build-module/components/init-pattern-modal/index.js.map +1 -1
- package/build-module/components/layout/index.js +98 -158
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/index.native.js +30 -21
- package/build-module/components/layout/index.native.js.map +1 -1
- package/build-module/components/layout/use-padding-appender.js.map +1 -0
- package/build-module/components/layout/use-should-iframe.js +39 -0
- package/build-module/components/layout/use-should-iframe.js.map +1 -0
- package/build-module/components/meta-boxes/index.js +12 -9
- package/build-module/components/meta-boxes/index.js.map +1 -1
- package/build-module/components/meta-boxes/meta-boxes-area/index.js +11 -9
- package/build-module/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
- package/build-module/components/more-menu/index.js +43 -0
- package/build-module/components/more-menu/index.js.map +1 -0
- package/build-module/components/{header/more-menu → more-menu}/manage-patterns-menu-item.js +5 -4
- package/build-module/components/more-menu/manage-patterns-menu-item.js.map +1 -0
- package/build-module/components/{header/more-menu → more-menu}/welcome-guide-menu-item.js +2 -2
- package/build-module/components/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build-module/components/preferences-modal/enable-custom-fields.js +26 -18
- package/build-module/components/preferences-modal/enable-custom-fields.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/preferences-modal/meta-boxes-section.js +14 -13
- package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build-module/components/visual-editor/header.native.js +11 -10
- package/build-module/components/visual-editor/header.native.js.map +1 -1
- package/build-module/components/visual-editor/index.native.js +3 -3
- package/build-module/components/visual-editor/index.native.js.map +1 -1
- package/build-module/components/welcome-guide/default.js +52 -33
- package/build-module/components/welcome-guide/default.js.map +1 -1
- package/build-module/components/welcome-guide/image.js +14 -12
- package/build-module/components/welcome-guide/image.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +2 -2
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/welcome-guide/template.js +14 -8
- package/build-module/components/welcome-guide/template.js.map +1 -1
- package/build-module/deprecated.js +9 -9
- package/build-module/deprecated.js.map +1 -1
- package/build-module/editor.js +17 -11
- package/build-module/editor.js.map +1 -1
- package/build-module/editor.native.js +18 -12
- package/build-module/editor.native.js.map +1 -1
- package/build-module/index.js +10 -7
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +2 -2
- package/build-module/index.native.js.map +1 -1
- package/build-module/store/selectors.js +1 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +27 -128
- package/build-style/style.css +27 -128
- package/package.json +32 -32
- package/src/commands/use-commands.js +48 -0
- package/src/components/{header/fullscreen-mode-close/index.js → back-button/fullscreen-mode-close.js} +1 -1
- package/src/components/back-button/index.js +41 -0
- package/src/components/{header/fullscreen-mode-close → back-button}/style.scss +16 -2
- package/src/components/{header/fullscreen-mode-close/test/index.js → back-button/test/fullscreen-mode-close.js} +1 -1
- package/src/components/init-pattern-modal/index.js +1 -4
- package/src/components/layout/index.js +88 -202
- package/src/components/layout/style.scss +9 -17
- package/src/components/layout/use-should-iframe.js +40 -0
- package/src/components/{header/more-menu → more-menu}/index.js +2 -2
- package/src/components/preferences-modal/enable-custom-fields.js +1 -0
- package/src/index.js +11 -6
- package/src/store/selectors.js +8 -5
- package/src/style.scss +2 -5
- package/src/test/__snapshots__/editor.native.js.snap +72 -0
- package/src/test/editor.native.js +77 -0
- package/build/components/header/fullscreen-mode-close/index.js.map +0 -1
- package/build/components/header/index.js +0 -69
- package/build/components/header/index.js.map +0 -1
- package/build/components/header/main-dashboard-button/index.js +0 -33
- package/build/components/header/main-dashboard-button/index.js.map +0 -1
- package/build/components/header/more-menu/index.js +0 -43
- package/build/components/header/more-menu/index.js.map +0 -1
- package/build/components/header/more-menu/manage-patterns-menu-item.js.map +0 -1
- package/build/components/header/more-menu/welcome-guide-menu-item.js.map +0 -1
- package/build/components/text-editor/index.js +0 -61
- package/build/components/text-editor/index.js.map +0 -1
- package/build/components/visual-editor/block-inspector-button.js +0 -55
- package/build/components/visual-editor/block-inspector-button.js.map +0 -1
- package/build/components/visual-editor/index.js +0 -98
- package/build/components/visual-editor/index.js.map +0 -1
- package/build/components/visual-editor/use-padding-appender.js.map +0 -1
- package/build/hooks/commands/use-common-commands.js +0 -119
- package/build/hooks/commands/use-common-commands.js.map +0 -1
- package/build/hooks/components/index.js +0 -11
- package/build/hooks/components/index.js.map +0 -1
- package/build/hooks/index.js +0 -5
- package/build/hooks/index.js.map +0 -1
- package/build/hooks/validate-multiple-use/index.js +0 -134
- package/build/hooks/validate-multiple-use/index.js.map +0 -1
- package/build-module/components/header/fullscreen-mode-close/index.js.map +0 -1
- package/build-module/components/header/index.js +0 -61
- package/build-module/components/header/index.js.map +0 -1
- package/build-module/components/header/main-dashboard-button/index.js +0 -26
- package/build-module/components/header/main-dashboard-button/index.js.map +0 -1
- package/build-module/components/header/more-menu/index.js +0 -35
- package/build-module/components/header/more-menu/index.js.map +0 -1
- package/build-module/components/header/more-menu/manage-patterns-menu-item.js.map +0 -1
- package/build-module/components/header/more-menu/welcome-guide-menu-item.js.map +0 -1
- package/build-module/components/text-editor/index.js +0 -54
- package/build-module/components/text-editor/index.js.map +0 -1
- package/build-module/components/visual-editor/block-inspector-button.js +0 -47
- package/build-module/components/visual-editor/block-inspector-button.js.map +0 -1
- package/build-module/components/visual-editor/index.js +0 -90
- package/build-module/components/visual-editor/index.js.map +0 -1
- package/build-module/components/visual-editor/use-padding-appender.js.map +0 -1
- package/build-module/hooks/commands/use-common-commands.js +0 -112
- package/build-module/hooks/commands/use-common-commands.js.map +0 -1
- package/build-module/hooks/components/index.js +0 -8
- package/build-module/hooks/components/index.js.map +0 -1
- package/build-module/hooks/index.js +0 -6
- package/build-module/hooks/index.js.map +0 -1
- package/build-module/hooks/validate-multiple-use/index.js +0 -132
- package/build-module/hooks/validate-multiple-use/index.js.map +0 -1
- package/src/components/header/index.js +0 -53
- package/src/components/header/main-dashboard-button/index.js +0 -28
- package/src/components/header/style.scss +0 -14
- package/src/components/text-editor/index.js +0 -63
- package/src/components/text-editor/style.scss +0 -71
- package/src/components/visual-editor/block-inspector-button.js +0 -59
- package/src/components/visual-editor/index.js +0 -108
- package/src/components/visual-editor/style.scss +0 -53
- package/src/hooks/commands/use-common-commands.js +0 -126
- package/src/hooks/components/index.js +0 -13
- package/src/hooks/index.js +0 -5
- package/src/hooks/validate-multiple-use/index.js +0 -163
- /package/build/components/{visual-editor → layout}/use-padding-appender.js +0 -0
- /package/build-module/components/{visual-editor → layout}/use-padding-appender.js +0 -0
- /package/src/components/{header/fullscreen-mode-close/test/__snapshots__/index.js.snap → back-button/test/__snapshots__/fullscreen-mode-close.js.snap} +0 -0
- /package/src/components/{visual-editor → layout}/use-padding-appender.js +0 -0
- /package/src/components/{header/more-menu → more-menu}/manage-patterns-menu-item.js +0 -0
- /package/src/components/{header/more-menu → more-menu}/welcome-guide-menu-item.js +0 -0
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = useCommonCommands;
|
|
7
|
-
var _data = require("@wordpress/data");
|
|
8
|
-
var _i18n = require("@wordpress/i18n");
|
|
9
|
-
var _icons = require("@wordpress/icons");
|
|
10
|
-
var _commands = require("@wordpress/commands");
|
|
11
|
-
var _preferences = require("@wordpress/preferences");
|
|
12
|
-
var _editor = require("@wordpress/editor");
|
|
13
|
-
var _notices = require("@wordpress/notices");
|
|
14
|
-
var _store = require("../../store");
|
|
15
|
-
var _lockUnlock = require("../../lock-unlock");
|
|
16
|
-
/**
|
|
17
|
-
* WordPress dependencies
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Internal dependencies
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
const {
|
|
25
|
-
interfaceStore
|
|
26
|
-
} = (0, _lockUnlock.unlock)(_editor.privateApis);
|
|
27
|
-
function useCommonCommands() {
|
|
28
|
-
const {
|
|
29
|
-
openGeneralSidebar,
|
|
30
|
-
closeGeneralSidebar
|
|
31
|
-
} = (0, _data.useDispatch)(_store.store);
|
|
32
|
-
const {
|
|
33
|
-
activeSidebar,
|
|
34
|
-
isFullscreen,
|
|
35
|
-
isPublishSidebarEnabled
|
|
36
|
-
} = (0, _data.useSelect)(select => {
|
|
37
|
-
const {
|
|
38
|
-
get
|
|
39
|
-
} = select(_preferences.store);
|
|
40
|
-
return {
|
|
41
|
-
activeSidebar: select(interfaceStore).getActiveComplementaryArea('core'),
|
|
42
|
-
isPublishSidebarEnabled: select(_editor.store).isPublishSidebarEnabled(),
|
|
43
|
-
isFullscreen: get('core/edit-post', 'fullscreenMode')
|
|
44
|
-
};
|
|
45
|
-
}, []);
|
|
46
|
-
const {
|
|
47
|
-
toggle
|
|
48
|
-
} = (0, _data.useDispatch)(_preferences.store);
|
|
49
|
-
const {
|
|
50
|
-
createInfoNotice
|
|
51
|
-
} = (0, _data.useDispatch)(_notices.store);
|
|
52
|
-
(0, _commands.useCommand)({
|
|
53
|
-
name: 'core/open-settings-sidebar',
|
|
54
|
-
label: (0, _i18n.__)('Toggle settings sidebar'),
|
|
55
|
-
icon: (0, _i18n.isRTL)() ? _icons.drawerLeft : _icons.drawerRight,
|
|
56
|
-
callback: ({
|
|
57
|
-
close
|
|
58
|
-
}) => {
|
|
59
|
-
close();
|
|
60
|
-
if (activeSidebar === 'edit-post/document') {
|
|
61
|
-
closeGeneralSidebar();
|
|
62
|
-
} else {
|
|
63
|
-
openGeneralSidebar('edit-post/document');
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
(0, _commands.useCommand)({
|
|
68
|
-
name: 'core/open-block-inspector',
|
|
69
|
-
label: (0, _i18n.__)('Toggle block inspector'),
|
|
70
|
-
icon: _icons.blockDefault,
|
|
71
|
-
callback: ({
|
|
72
|
-
close
|
|
73
|
-
}) => {
|
|
74
|
-
close();
|
|
75
|
-
if (activeSidebar === 'edit-post/block') {
|
|
76
|
-
closeGeneralSidebar();
|
|
77
|
-
} else {
|
|
78
|
-
openGeneralSidebar('edit-post/block');
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
(0, _commands.useCommand)({
|
|
83
|
-
name: 'core/toggle-fullscreen-mode',
|
|
84
|
-
label: isFullscreen ? (0, _i18n.__)('Exit fullscreen') : (0, _i18n.__)('Enter fullscreen'),
|
|
85
|
-
icon: _icons.fullscreen,
|
|
86
|
-
callback: ({
|
|
87
|
-
close
|
|
88
|
-
}) => {
|
|
89
|
-
toggle('core/edit-post', 'fullscreenMode');
|
|
90
|
-
close();
|
|
91
|
-
createInfoNotice(isFullscreen ? (0, _i18n.__)('Fullscreen off.') : (0, _i18n.__)('Fullscreen on.'), {
|
|
92
|
-
id: 'core/edit-post/toggle-fullscreen-mode/notice',
|
|
93
|
-
type: 'snackbar',
|
|
94
|
-
actions: [{
|
|
95
|
-
label: (0, _i18n.__)('Undo'),
|
|
96
|
-
onClick: () => {
|
|
97
|
-
toggle('core/edit-post', 'fullscreenMode');
|
|
98
|
-
}
|
|
99
|
-
}]
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
(0, _commands.useCommand)({
|
|
104
|
-
name: 'core/toggle-publish-sidebar',
|
|
105
|
-
label: isPublishSidebarEnabled ? (0, _i18n.__)('Disable pre-publish checks') : (0, _i18n.__)('Enable pre-publish checks'),
|
|
106
|
-
icon: _icons.formatListBullets,
|
|
107
|
-
callback: ({
|
|
108
|
-
close
|
|
109
|
-
}) => {
|
|
110
|
-
close();
|
|
111
|
-
toggle('core', 'isPublishSidebarEnabled');
|
|
112
|
-
createInfoNotice(isPublishSidebarEnabled ? (0, _i18n.__)('Pre-publish checks disabled.') : (0, _i18n.__)('Pre-publish checks enabled.'), {
|
|
113
|
-
id: 'core/editor/publish-sidebar/notice',
|
|
114
|
-
type: 'snackbar'
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
//# sourceMappingURL=use-common-commands.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_i18n","_icons","_commands","_preferences","_editor","_notices","_store","_lockUnlock","interfaceStore","unlock","editorPrivateApis","useCommonCommands","openGeneralSidebar","closeGeneralSidebar","useDispatch","editPostStore","activeSidebar","isFullscreen","isPublishSidebarEnabled","useSelect","select","get","preferencesStore","getActiveComplementaryArea","editorStore","toggle","createInfoNotice","noticesStore","useCommand","name","label","__","icon","isRTL","drawerLeft","drawerRight","callback","close","blockDefault","fullscreen","id","type","actions","onClick","formatListBullets"],"sources":["@wordpress/edit-post/src/hooks/commands/use-common-commands.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\tdrawerLeft,\n\tdrawerRight,\n\tblockDefault,\n\tfullscreen,\n\tformatListBullets,\n} from '@wordpress/icons';\nimport { useCommand } from '@wordpress/commands';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { interfaceStore } = unlock( editorPrivateApis );\n\nexport default function useCommonCommands() {\n\tconst { openGeneralSidebar, closeGeneralSidebar } =\n\t\tuseDispatch( editPostStore );\n\tconst { activeSidebar, isFullscreen, isPublishSidebarEnabled } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { get } = select( preferencesStore );\n\n\t\t\treturn {\n\t\t\t\tactiveSidebar:\n\t\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\t\t\t'core'\n\t\t\t\t\t),\n\t\t\t\tisPublishSidebarEnabled:\n\t\t\t\t\tselect( editorStore ).isPublishSidebarEnabled(),\n\t\t\t\tisFullscreen: get( 'core/edit-post', 'fullscreenMode' ),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst { createInfoNotice } = useDispatch( noticesStore );\n\n\tuseCommand( {\n\t\tname: 'core/open-settings-sidebar',\n\t\tlabel: __( 'Toggle settings sidebar' ),\n\t\ticon: isRTL() ? drawerLeft : drawerRight,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/document' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-post/document' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-block-inspector',\n\t\tlabel: __( 'Toggle block inspector' ),\n\t\ticon: blockDefault,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/block' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-post/block' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-fullscreen-mode',\n\t\tlabel: isFullscreen\n\t\t\t? __( 'Exit fullscreen' )\n\t\t\t: __( 'Enter fullscreen' ),\n\t\ticon: fullscreen,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'fullscreenMode' );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisFullscreen ? __( 'Fullscreen off.' ) : __( 'Fullscreen on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-post/toggle-fullscreen-mode/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\ttoggle( 'core/edit-post', 'fullscreenMode' );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-publish-sidebar',\n\t\tlabel: isPublishSidebarEnabled\n\t\t\t? __( 'Disable pre-publish checks' )\n\t\t\t: __( 'Enable pre-publish checks' ),\n\t\ticon: formatListBullets,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\ttoggle( 'core', 'isPublishSidebarEnabled' );\n\t\t\tcreateInfoNotice(\n\t\t\t\tisPublishSidebarEnabled\n\t\t\t\t\t? __( 'Pre-publish checks disabled.' )\n\t\t\t\t\t: __( 'Pre-publish checks enabled.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/editor/publish-sidebar/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAOA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAIA,IAAAM,QAAA,GAAAN,OAAA;AAKA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AAxBA;AACA;AACA;;AAkBA;AACA;AACA;;AAIA,MAAM;EAAES;AAAe,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAEvC,SAASC,iBAAiBA,CAAA,EAAG;EAC3C,MAAM;IAAEC,kBAAkB;IAAEC;EAAoB,CAAC,GAChD,IAAAC,iBAAW,EAAEC,YAAc,CAAC;EAC7B,MAAM;IAAEC,aAAa;IAAEC,YAAY;IAAEC;EAAwB,CAAC,GAAG,IAAAC,eAAS,EACvEC,MAAM,IAAM;IACb,MAAM;MAAEC;IAAI,CAAC,GAAGD,MAAM,CAAEE,kBAAiB,CAAC;IAE1C,OAAO;MACNN,aAAa,EACZI,MAAM,CAAEZ,cAAe,CAAC,CAACe,0BAA0B,CAClD,MACD,CAAC;MACFL,uBAAuB,EACtBE,MAAM,CAAEI,aAAY,CAAC,CAACN,uBAAuB,CAAC,CAAC;MAChDD,YA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AAC,KAAM;MAC1BZ,MAAM,CAAE,gBAAgB,EAAE,gBAAiB,CAAC;MAC5CY,KAAK,CAAC,CAAC;MACPX,gBAAgB,CACfT,YAAY,GAAG,IAAAc,QAAE,EAAE,iBAAkB,CAAC,GAAG,IAAAA,QAAE,EAAE,gBAAiB,CAAC,EAC/D;QACCS,EAAE,EAAE,8CAA8C;QAClDC,IAAI,EAAE,UAAU;QAChBC,OAAO,EAAE,CACR;UACCZ,KAAK,EAAE,IAAAC,QAAE,EAAE,MAAO,CAAC;UACnBY,OAAO,EAAEA,CAAA,KAAM;YACdlB,MAAM,CAAE,gBAAgB,EAAE,gBAAiB,CAAC;UAC7C;QACD,CAAC;MAEH,CACD,CAAC;IACF;EACD,CAAE,CAAC;EAEH,IAAAG,oBAAU,EAAE;IACXC,IAAI,EAAE,6BAA6B;IACnCC,KAAK,EAAEZ,uBAAuB,GAC3B,IAAAa,QAAE,EAAE,4BAA6B,CAAC,GAClC,IAAAA,QAAE,EAAE,2BAA4B,CAAC;IACpCC,IAAI,EAAEY,wBAAiB;IACvBR,QAAQ,EAAEA,CAAE;MAAEC;IAAM,CAAC,KAAM;MAC1BA,KAAK,CAAC,CAAC;MACPZ,MAAM,CAAE,MAAM,EAAE,yBAA0B,CAAC;MAC3CC,gBAAgB,CACfR,uBAAuB,GACpB,IAAAa,QAAE,EAAE,8BAA+B,CAAC,GACpC,IAAAA,QAAE,EAAE,6BAA8B,CAAC,EACtC;QACCS,EAAE,EAAE,oCAAoC;QACxCC,IAAI,EAAE;MACP,CACD,CAAC;IACF;EACD,CAAE,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _hooks = require("@wordpress/hooks");
|
|
4
|
-
var _mediaUtils = require("@wordpress/media-utils");
|
|
5
|
-
/**
|
|
6
|
-
* WordPress dependencies
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
const replaceMediaUpload = () => _mediaUtils.MediaUpload;
|
|
10
|
-
(0, _hooks.addFilter)('editor.MediaUpload', 'core/edit-post/replace-media-upload', replaceMediaUpload);
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_hooks","require","_mediaUtils","replaceMediaUpload","MediaUpload","addFilter"],"sources":["@wordpress/edit-post/src/hooks/components/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { MediaUpload } from '@wordpress/media-utils';\n\nconst replaceMediaUpload = () => MediaUpload;\n\naddFilter(\n\t'editor.MediaUpload',\n\t'core/edit-post/replace-media-upload',\n\treplaceMediaUpload\n);\n"],"mappings":";;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA,MAAME,kBAAkB,GAAGA,CAAA,KAAMC,uBAAW;AAE5C,IAAAC,gBAAS,EACR,oBAAoB,EACpB,qCAAqC,EACrCF,kBACD,CAAC","ignoreList":[]}
|
package/build/hooks/index.js
DELETED
package/build/hooks/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["require"],"sources":["@wordpress/edit-post/src/hooks/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport './components';\nimport './validate-multiple-use';\n"],"mappings":";;AAGAA,OAAA;AACAA,OAAA","ignoreList":[]}
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _react = require("react");
|
|
4
|
-
var _blocks = require("@wordpress/blocks");
|
|
5
|
-
var _components = require("@wordpress/components");
|
|
6
|
-
var _data = require("@wordpress/data");
|
|
7
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
8
|
-
var _hooks = require("@wordpress/hooks");
|
|
9
|
-
var _i18n = require("@wordpress/i18n");
|
|
10
|
-
var _compose = require("@wordpress/compose");
|
|
11
|
-
/**
|
|
12
|
-
* WordPress dependencies
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Recursively find very first block of an specific block type.
|
|
17
|
-
*
|
|
18
|
-
* @param {Object[]} blocks List of blocks.
|
|
19
|
-
* @param {string} name Block name to search.
|
|
20
|
-
*
|
|
21
|
-
* @return {Object|undefined} Return block object or undefined.
|
|
22
|
-
*/
|
|
23
|
-
function findFirstOfSameType(blocks, name) {
|
|
24
|
-
if (!Array.isArray(blocks) || !blocks.length) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
for (const block of blocks) {
|
|
28
|
-
if (block.name === name) {
|
|
29
|
-
return block;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Search inside innerBlocks.
|
|
33
|
-
const firstBlock = findFirstOfSameType(block.innerBlocks, name);
|
|
34
|
-
if (firstBlock) {
|
|
35
|
-
return firstBlock;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
const enhance = (0, _compose.compose)(
|
|
40
|
-
/**
|
|
41
|
-
* For blocks whose block type doesn't support `multiple`, provides the
|
|
42
|
-
* wrapped component with `originalBlockClientId` -- a reference to the
|
|
43
|
-
* first block of the same type in the content -- if and only if that
|
|
44
|
-
* "original" block is not the current one. Thus, an inexisting
|
|
45
|
-
* `originalBlockClientId` prop signals that the block is valid.
|
|
46
|
-
*
|
|
47
|
-
* @param {Component} WrappedBlockEdit A filtered BlockEdit instance.
|
|
48
|
-
*
|
|
49
|
-
* @return {Component} Enhanced component with merged state data props.
|
|
50
|
-
*/
|
|
51
|
-
(0, _data.withSelect)((select, block) => {
|
|
52
|
-
const multiple = (0, _blocks.hasBlockSupport)(block.name, 'multiple', true);
|
|
53
|
-
|
|
54
|
-
// For block types with `multiple` support, there is no "original
|
|
55
|
-
// block" to be found in the content, as the block itself is valid.
|
|
56
|
-
if (multiple) {
|
|
57
|
-
return {};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Otherwise, only pass `originalBlockClientId` if it refers to a different
|
|
61
|
-
// block from the current one.
|
|
62
|
-
const blocks = select(_blockEditor.store).getBlocks();
|
|
63
|
-
const firstOfSameType = findFirstOfSameType(blocks, block.name);
|
|
64
|
-
const isInvalid = firstOfSameType && firstOfSameType.clientId !== block.clientId;
|
|
65
|
-
return {
|
|
66
|
-
originalBlockClientId: isInvalid && firstOfSameType.clientId
|
|
67
|
-
};
|
|
68
|
-
}), (0, _data.withDispatch)((dispatch, {
|
|
69
|
-
originalBlockClientId
|
|
70
|
-
}) => ({
|
|
71
|
-
selectFirst: () => dispatch(_blockEditor.store).selectBlock(originalBlockClientId)
|
|
72
|
-
})));
|
|
73
|
-
const withMultipleValidation = (0, _compose.createHigherOrderComponent)(BlockEdit => {
|
|
74
|
-
return enhance(({
|
|
75
|
-
originalBlockClientId,
|
|
76
|
-
selectFirst,
|
|
77
|
-
...props
|
|
78
|
-
}) => {
|
|
79
|
-
if (!originalBlockClientId) {
|
|
80
|
-
return (0, _react.createElement)(BlockEdit, {
|
|
81
|
-
...props
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
const blockType = (0, _blocks.getBlockType)(props.name);
|
|
85
|
-
const outboundType = getOutboundType(props.name);
|
|
86
|
-
return [(0, _react.createElement)("div", {
|
|
87
|
-
key: "invalid-preview",
|
|
88
|
-
style: {
|
|
89
|
-
minHeight: '60px'
|
|
90
|
-
}
|
|
91
|
-
}, (0, _react.createElement)(BlockEdit, {
|
|
92
|
-
key: "block-edit",
|
|
93
|
-
...props
|
|
94
|
-
})), (0, _react.createElement)(_blockEditor.Warning, {
|
|
95
|
-
key: "multiple-use-warning",
|
|
96
|
-
actions: [(0, _react.createElement)(_components.Button, {
|
|
97
|
-
key: "find-original",
|
|
98
|
-
variant: "secondary",
|
|
99
|
-
onClick: selectFirst
|
|
100
|
-
}, (0, _i18n.__)('Find original')), (0, _react.createElement)(_components.Button, {
|
|
101
|
-
key: "remove",
|
|
102
|
-
variant: "secondary",
|
|
103
|
-
onClick: () => props.onReplace([])
|
|
104
|
-
}, (0, _i18n.__)('Remove')), outboundType && (0, _react.createElement)(_components.Button, {
|
|
105
|
-
key: "transform",
|
|
106
|
-
variant: "secondary",
|
|
107
|
-
onClick: () => props.onReplace((0, _blocks.createBlock)(outboundType.name, props.attributes))
|
|
108
|
-
}, (0, _i18n.__)('Transform into:'), " ", outboundType.title)]
|
|
109
|
-
}, (0, _react.createElement)("strong", null, blockType?.title, ": "), (0, _i18n.__)('This block can only be used once.'))];
|
|
110
|
-
});
|
|
111
|
-
}, 'withMultipleValidation');
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Given a base block name, returns the default block type to which to offer
|
|
115
|
-
* transforms.
|
|
116
|
-
*
|
|
117
|
-
* @param {string} blockName Base block name.
|
|
118
|
-
*
|
|
119
|
-
* @return {?Object} The chosen default block type.
|
|
120
|
-
*/
|
|
121
|
-
function getOutboundType(blockName) {
|
|
122
|
-
// Grab the first outbound transform.
|
|
123
|
-
const transform = (0, _blocks.findTransform)((0, _blocks.getBlockTransforms)('to', blockName), ({
|
|
124
|
-
type,
|
|
125
|
-
blocks
|
|
126
|
-
}) => type === 'block' && blocks.length === 1 // What about when .length > 1?
|
|
127
|
-
);
|
|
128
|
-
if (!transform) {
|
|
129
|
-
return null;
|
|
130
|
-
}
|
|
131
|
-
return (0, _blocks.getBlockType)(transform.blocks[0]);
|
|
132
|
-
}
|
|
133
|
-
(0, _hooks.addFilter)('editor.BlockEdit', 'core/edit-post/validate-multiple-use/with-multiple-validation', withMultipleValidation);
|
|
134
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_blocks","require","_components","_data","_blockEditor","_hooks","_i18n","_compose","findFirstOfSameType","blocks","name","Array","isArray","length","block","firstBlock","innerBlocks","enhance","compose","withSelect","select","multiple","hasBlockSupport","blockEditorStore","getBlocks","firstOfSameType","isInvalid","clientId","originalBlockClientId","withDispatch","dispatch","selectFirst","selectBlock","withMultipleValidation","createHigherOrderComponent","BlockEdit","props","_react","createElement","blockType","getBlockType","outboundType","getOutboundType","key","style","minHeight","Warning","actions","Button","variant","onClick","__","onReplace","createBlock","attributes","title","blockName","transform","findTransform","getBlockTransforms","type","addFilter"],"sources":["@wordpress/edit-post/src/hooks/validate-multiple-use/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateBlock,\n\tfindTransform,\n\tgetBlockTransforms,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { Button } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { Warning, store as blockEditorStore } from '@wordpress/block-editor';\nimport { addFilter } from '@wordpress/hooks';\nimport { __ } from '@wordpress/i18n';\nimport { compose, createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Recursively find very first block of an specific block type.\n *\n * @param {Object[]} blocks List of blocks.\n * @param {string} name Block name to search.\n *\n * @return {Object|undefined} Return block object or undefined.\n */\nfunction findFirstOfSameType( blocks, name ) {\n\tif ( ! Array.isArray( blocks ) || ! blocks.length ) {\n\t\treturn;\n\t}\n\n\tfor ( const block of blocks ) {\n\t\tif ( block.name === name ) {\n\t\t\treturn block;\n\t\t}\n\n\t\t// Search inside innerBlocks.\n\t\tconst firstBlock = findFirstOfSameType( block.innerBlocks, name );\n\n\t\tif ( firstBlock ) {\n\t\t\treturn firstBlock;\n\t\t}\n\t}\n}\n\nconst enhance = compose(\n\t/**\n\t * For blocks whose block type doesn't support `multiple`, provides the\n\t * wrapped component with `originalBlockClientId` -- a reference to the\n\t * first block of the same type in the content -- if and only if that\n\t * \"original\" block is not the current one. Thus, an inexisting\n\t * `originalBlockClientId` prop signals that the block is valid.\n\t *\n\t * @param {Component} WrappedBlockEdit A filtered BlockEdit instance.\n\t *\n\t * @return {Component} Enhanced component with merged state data props.\n\t */\n\twithSelect( ( select, block ) => {\n\t\tconst multiple = hasBlockSupport( block.name, 'multiple', true );\n\n\t\t// For block types with `multiple` support, there is no \"original\n\t\t// block\" to be found in the content, as the block itself is valid.\n\t\tif ( multiple ) {\n\t\t\treturn {};\n\t\t}\n\n\t\t// Otherwise, only pass `originalBlockClientId` if it refers to a different\n\t\t// block from the current one.\n\t\tconst blocks = select( blockEditorStore ).getBlocks();\n\t\tconst firstOfSameType = findFirstOfSameType( blocks, block.name );\n\t\tconst isInvalid =\n\t\t\tfirstOfSameType && firstOfSameType.clientId !== block.clientId;\n\t\treturn {\n\t\t\toriginalBlockClientId: isInvalid && firstOfSameType.clientId,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, { originalBlockClientId } ) => ( {\n\t\tselectFirst: () =>\n\t\t\tdispatch( blockEditorStore ).selectBlock( originalBlockClientId ),\n\t} ) )\n);\n\nconst withMultipleValidation = createHigherOrderComponent( ( BlockEdit ) => {\n\treturn enhance( ( { originalBlockClientId, selectFirst, ...props } ) => {\n\t\tif ( ! originalBlockClientId ) {\n\t\t\treturn <BlockEdit { ...props } />;\n\t\t}\n\n\t\tconst blockType = getBlockType( props.name );\n\t\tconst outboundType = getOutboundType( props.name );\n\n\t\treturn [\n\t\t\t<div key=\"invalid-preview\" style={ { minHeight: '60px' } }>\n\t\t\t\t<BlockEdit key=\"block-edit\" { ...props } />\n\t\t\t</div>,\n\t\t\t<Warning\n\t\t\t\tkey=\"multiple-use-warning\"\n\t\t\t\tactions={ [\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey=\"find-original\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tonClick={ selectFirst }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Find original' ) }\n\t\t\t\t\t</Button>,\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey=\"remove\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tonClick={ () => props.onReplace( [] ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Remove' ) }\n\t\t\t\t\t</Button>,\n\t\t\t\t\toutboundType && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tkey=\"transform\"\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\tprops.onReplace(\n\t\t\t\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t\t\t\toutboundType.name,\n\t\t\t\t\t\t\t\t\t\tprops.attributes\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Transform into:' ) } { outboundType.title }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t),\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t<strong>{ blockType?.title }: </strong>\n\t\t\t\t{ __( 'This block can only be used once.' ) }\n\t\t\t</Warning>,\n\t\t];\n\t} );\n}, 'withMultipleValidation' );\n\n/**\n * Given a base block name, returns the default block type to which to offer\n * transforms.\n *\n * @param {string} blockName Base block name.\n *\n * @return {?Object} The chosen default block type.\n */\nfunction getOutboundType( blockName ) {\n\t// Grab the first outbound transform.\n\tconst transform = findTransform(\n\t\tgetBlockTransforms( 'to', blockName ),\n\t\t( { type, blocks } ) => type === 'block' && blocks.length === 1 // What about when .length > 1?\n\t);\n\n\tif ( ! transform ) {\n\t\treturn null;\n\t}\n\n\treturn getBlockType( transform.blocks[ 0 ] );\n}\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-post/validate-multiple-use/with-multiple-validation',\n\twithMultipleValidation\n);\n"],"mappings":";;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAOA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAfA;AACA;AACA;;AAeA;AACA;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,EACTV,YAAY,IACX,IAAAJ,MAAA,CAAAC,aAAA,EAACpC,WAAA,CAAA8C,MAAM;QACNL,GAAG,EAAC,WAAW;QACfM,OAAO,EAAC,WAAW;QACnBC,OAAO,EAAGA,CAAA,KACTd,KAAK,CAACgB,SAAS,CACd,IAAAC,mBAAW,EACVZ,YAAY,CAAC/B,IAAI,EACjB0B,KAAK,CAACkB,UACP,CACD;MACA,GAEC,IAAAH,QAAE,EAAE,iBAAkB,CAAC,EAAE,GAAC,EAAEV,YAAY,CAACc,KACpC,CACR;IACC,GAEH,IAAAlB,MAAA,CAAAC,aAAA,kBAAUC,SAAS,EAAEgB,KAAK,EAAE,IAAU,CAAC,EACrC,IAAAJ,QAAE,EAAE,mCAAoC,CAClC,CAAC,CACV;EACF,CAAE,CAAC;AACJ,CAAC,EAAE,wBAAyB,CAAC;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAST,eAAeA,CAAEc,SAAS,EAAG;EACrC;EACA,MAAMC,SAAS,GAAG,IAAAC,qBAAa,EAC9B,IAAAC,0BAAkB,EAAE,IAAI,EAAEH,SAAU,CAAC,EACrC,CAAE;IAAEI,IAAI;IAAEnD;EAAO,CAAC,KAAMmD,IAAI,KAAK,OAAO,IAAInD,MAAM,CAACI,MAAM,KAAK,CAAC,CAAC;EACjE,CAAC;EAED,IAAK,CAAE4C,SAAS,EAAG;IAClB,OAAO,IAAI;EACZ;EAEA,OAAO,IAAAjB,oBAAY,EAAEiB,SAAS,CAAChD,MAAM,CAAE,CAAC,CAAG,CAAC;AAC7C;AAEA,IAAAoD,gBAAS,EACR,kBAAkB,EAClB,+DAA+D,EAC/D5B,sBACD,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","useSelect","Button","Icon","__unstableMotion","motion","__","addQueryArgs","wordpress","store","editorStore","coreStore","useReducedMotion","editPostStore","FullscreenModeClose","showTooltip","icon","href","initialPost","_postType$labels$view","isActive","isRequestingSiteIcon","postType","siteIconUrl","select","getCurrentPostType","isFeatureActive","getEntityRecord","getPostType","isResolving","siteData","undefined","_postType","type","site_icon_url","disableMotion","buttonIcon","createElement","size","effect","expand","scale","transition","duration","img","variants","alt","className","src","classes","buttonHref","post_type","slug","buttonLabel","labels","view_items","div","whileHover","label"],"sources":["@wordpress/edit-post/src/components/header/fullscreen-mode-close/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tButton,\n\tIcon,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { addQueryArgs } from '@wordpress/url';\nimport { wordpress } from '@wordpress/icons';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useReducedMotion } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nfunction FullscreenModeClose( { showTooltip, icon, href, initialPost } ) {\n\tconst { isActive, isRequestingSiteIcon, postType, siteIconUrl } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPostType } = select( editorStore );\n\t\t\tconst { isFeatureActive } = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, isResolving } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst siteData =\n\t\t\t\tgetEntityRecord( 'root', '__unstableBase', undefined ) || {};\n\t\t\tconst _postType = initialPost?.type || getCurrentPostType();\n\t\t\treturn {\n\t\t\t\tisActive: isFeatureActive( 'fullscreenMode' ),\n\t\t\t\tisRequestingSiteIcon: isResolving( 'getEntityRecord', [\n\t\t\t\t\t'root',\n\t\t\t\t\t'__unstableBase',\n\t\t\t\t\tundefined,\n\t\t\t\t] ),\n\t\t\t\tpostType: getPostType( _postType ),\n\t\t\t\tsiteIconUrl: siteData.site_icon_url,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst disableMotion = useReducedMotion();\n\n\tif ( ! isActive || ! postType ) {\n\t\treturn null;\n\t}\n\n\tlet buttonIcon = <Icon size=\"36px\" icon={ wordpress } />;\n\n\tconst effect = {\n\t\texpand: {\n\t\t\tscale: 1.25,\n\t\t\ttransition: { type: 'tween', duration: '0.3' },\n\t\t},\n\t};\n\n\tif ( siteIconUrl ) {\n\t\tbuttonIcon = (\n\t\t\t<motion.img\n\t\t\t\tvariants={ ! disableMotion && effect }\n\t\t\t\talt={ __( 'Site Icon' ) }\n\t\t\t\tclassName=\"edit-post-fullscreen-mode-close_site-icon\"\n\t\t\t\tsrc={ siteIconUrl }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( isRequestingSiteIcon ) {\n\t\tbuttonIcon = null;\n\t}\n\n\t// Override default icon if custom icon is provided via props.\n\tif ( icon ) {\n\t\tbuttonIcon = <Icon size=\"36px\" icon={ icon } />;\n\t}\n\n\tconst classes = clsx( {\n\t\t'edit-post-fullscreen-mode-close': true,\n\t\t'has-icon': siteIconUrl,\n\t} );\n\n\tconst buttonHref =\n\t\thref ??\n\t\taddQueryArgs( 'edit.php', {\n\t\t\tpost_type: postType.slug,\n\t\t} );\n\n\tconst buttonLabel = postType?.labels?.view_items ?? __( 'Back' );\n\n\treturn (\n\t\t<motion.div whileHover=\"expand\">\n\t\t\t<Button\n\t\t\t\tclassName={ classes }\n\t\t\t\thref={ buttonHref }\n\t\t\t\tlabel={ buttonLabel }\n\t\t\t\tshowTooltip={ showTooltip }\n\t\t\t>\n\t\t\t\t{ buttonIcon }\n\t\t\t</Button>\n\t\t</motion.div>\n\t);\n}\n\nexport default FullscreenModeClose;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SACCC,MAAM,EACNC,IAAI,EACJC,gBAAgB,IAAIC,MAAM,QACpB,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACp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CAACnC,MAAM;IACN6C,SAAS,EAAGE,OAAS;IACrBhC,IAAI,EAAGiC,UAAY;IACnBQ,KAAK,EAAGL,WAAa;IACrBtC,WAAW,EAAGA;EAAa,GAEzBqB,UACK,CACG,CAAC;AAEf;AAEA,eAAetB,mBAAmB","ignoreList":[]}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
6
|
-
import { useSelect } from '@wordpress/data';
|
|
7
|
-
import { __unstableMotion as motion } from '@wordpress/components';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Internal dependencies
|
|
11
|
-
*/
|
|
12
|
-
import FullscreenModeClose from './fullscreen-mode-close';
|
|
13
|
-
import PostEditorMoreMenu from './more-menu';
|
|
14
|
-
import MainDashboardButton from './main-dashboard-button';
|
|
15
|
-
import { store as editPostStore } from '../../store';
|
|
16
|
-
import { unlock } from '../../lock-unlock';
|
|
17
|
-
const {
|
|
18
|
-
Header: EditorHeader
|
|
19
|
-
} = unlock(editorPrivateApis);
|
|
20
|
-
const slideX = {
|
|
21
|
-
hidden: {
|
|
22
|
-
x: '-100%'
|
|
23
|
-
},
|
|
24
|
-
distractionFreeInactive: {
|
|
25
|
-
x: 0
|
|
26
|
-
},
|
|
27
|
-
hover: {
|
|
28
|
-
x: 0,
|
|
29
|
-
transition: {
|
|
30
|
-
type: 'tween',
|
|
31
|
-
delay: 0.2
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
function Header({
|
|
36
|
-
setEntitiesSavedStatesCallback,
|
|
37
|
-
initialPost
|
|
38
|
-
}) {
|
|
39
|
-
const {
|
|
40
|
-
hasActiveMetaboxes
|
|
41
|
-
} = useSelect(select => {
|
|
42
|
-
return {
|
|
43
|
-
hasActiveMetaboxes: select(editPostStore).hasMetaBoxes()
|
|
44
|
-
};
|
|
45
|
-
}, []);
|
|
46
|
-
return createElement(EditorHeader, {
|
|
47
|
-
forceIsDirty: hasActiveMetaboxes,
|
|
48
|
-
setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
|
|
49
|
-
}, createElement(MainDashboardButton.Slot, null, createElement(motion.div, {
|
|
50
|
-
variants: slideX,
|
|
51
|
-
transition: {
|
|
52
|
-
type: 'tween',
|
|
53
|
-
delay: 0.8
|
|
54
|
-
}
|
|
55
|
-
}, createElement(FullscreenModeClose, {
|
|
56
|
-
showTooltip: true,
|
|
57
|
-
initialPost: initialPost
|
|
58
|
-
}))), createElement(PostEditorMoreMenu, null));
|
|
59
|
-
}
|
|
60
|
-
export default Header;
|
|
61
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["privateApis","editorPrivateApis","useSelect","__unstableMotion","motion","FullscreenModeClose","PostEditorMoreMenu","MainDashboardButton","store","editPostStore","unlock","Header","EditorHeader","slideX","hidden","x","distractionFreeInactive","hover","transition","type","delay","setEntitiesSavedStatesCallback","initialPost","hasActiveMetaboxes","select","hasMetaBoxes","createElement","forceIsDirty","Slot","div","variants","showTooltip"],"sources":["@wordpress/edit-post/src/components/header/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\nimport { __unstableMotion as motion } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport FullscreenModeClose from './fullscreen-mode-close';\nimport PostEditorMoreMenu from './more-menu';\nimport MainDashboardButton from './main-dashboard-button';\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Header: EditorHeader } = unlock( editorPrivateApis );\n\nconst slideX = {\n\thidden: { x: '-100%' },\n\tdistractionFreeInactive: { x: 0 },\n\thover: { x: 0, transition: { type: 'tween', delay: 0.2 } },\n};\n\nfunction Header( { setEntitiesSavedStatesCallback, initialPost } ) {\n\tconst { hasActiveMetaboxes } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<EditorHeader\n\t\t\tforceIsDirty={ hasActiveMetaboxes }\n\t\t\tsetEntitiesSavedStatesCallback={ setEntitiesSavedStatesCallback }\n\t\t>\n\t\t\t<MainDashboardButton.Slot>\n\t\t\t\t<motion.div\n\t\t\t\t\tvariants={ slideX }\n\t\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\t>\n\t\t\t\t\t<FullscreenModeClose\n\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\tinitialPost={ initialPost }\n\t\t\t\t\t/>\n\t\t\t\t</motion.div>\n\t\t\t</MainDashboardButton.Slot>\n\t\t\t<PostEditorMoreMenu />\n\t\t</EditorHeader>\n\t);\n}\n\nexport default Header;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,gBAAgB,IAAIC,MAAM,QAAQ,uBAAuB;;AAElE;AACA;AACA;AACA,OAAOC,mBAAmB,MAAM,yBAAyB;AACzD,OAAOC,kBAAkB,MAAM,aAAa;AAC5C,OAAOC,mBAAmB,MAAM,yBAAyB;AACzD,SAASC,KAAK,IAAIC,aAAa,QAAQ,aAAa;AACpD,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC,MAAM,EAAEC;AAAa,CAAC,GAAGF,MAAM,CAAET,iBAAkB,CAAC;AAE5D,MAAMY,MAAM,GAAG;EACdC,MAAM,EAAE;IAAEC,CAAC,EAAE;EAAQ,CAAC;EACtBC,uBAAuB,EAAE;IAAED,CAAC,EAAE;EAAE,CAAC;EACjCE,KAAK,EAAE;IAAEF,CAAC,EAAE,CAAC;IAAEG,UAAU,EAAE;MAAEC,IAAI,EAAE,OAAO;MAAEC,KAAK,EAAE;IAAI;EAAE;AAC1D,CAAC;AAED,SAAST,MAAMA,CAAE;EAAEU,8BAA8B;EAAEC;AAAY,CAAC,EAAG;EAClE,MAAM;IAAEC;EAAmB,CAAC,GAAGrB,SAAS,CAAIsB,MAAM,IAAM;IACvD,OAAO;MACND,kBAAkB,EAAEC,MAAM,CAAEf,aAAc,CAAC,CAACgB,YAAY,CAAC;IAC1D,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,OACCC,aAAA,CAACd,YAAY;IACZe,YAAY,EAAGJ,kBAAoB;IACnCF,8BAA8B,EAAGA;EAAgC,GAEjEK,aAAA,CAACnB,mBAAmB,CAACqB,IAAI,QACxBF,aAAA,CAACtB,MAAM,CAACyB,GAAG;IACVC,QAAQ,EAAGjB,MAAQ;IACnBK,UAAU,EAAG;MAAEC,IAAI,EAAE,OAAO;MAAEC,KAAK,EAAE;IAAI;EAAG,GAE5CM,aAAA,CAACrB,mBAAmB;IACnB0B,WAAW;IACXT,WAAW,EAAGA;EAAa,CAC3B,CACU,CACa,CAAC,EAC3BI,aAAA,CAACpB,kBAAkB,MAAE,CACR,CAAC;AAEjB;AAEA,eAAeK,MAAM","ignoreList":[]}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { __experimentalUseSlotFills as useSlotFills, createSlotFill } from '@wordpress/components';
|
|
6
|
-
const slotName = '__experimentalMainDashboardButton';
|
|
7
|
-
const {
|
|
8
|
-
Fill,
|
|
9
|
-
Slot: MainDashboardButtonSlot
|
|
10
|
-
} = createSlotFill(slotName);
|
|
11
|
-
const MainDashboardButton = Fill;
|
|
12
|
-
const Slot = ({
|
|
13
|
-
children
|
|
14
|
-
}) => {
|
|
15
|
-
const fills = useSlotFills(slotName);
|
|
16
|
-
const hasFills = Boolean(fills && fills.length);
|
|
17
|
-
if (!hasFills) {
|
|
18
|
-
return children;
|
|
19
|
-
}
|
|
20
|
-
return createElement(MainDashboardButtonSlot, {
|
|
21
|
-
bubblesVirtually: true
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
MainDashboardButton.Slot = Slot;
|
|
25
|
-
export default MainDashboardButton;
|
|
26
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__experimentalUseSlotFills","useSlotFills","createSlotFill","slotName","Fill","Slot","MainDashboardButtonSlot","MainDashboardButton","children","fills","hasFills","Boolean","length","createElement","bubblesVirtually"],"sources":["@wordpress/edit-post/src/components/header/main-dashboard-button/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUseSlotFills as useSlotFills,\n\tcreateSlotFill,\n} from '@wordpress/components';\n\nconst slotName = '__experimentalMainDashboardButton';\n\nconst { Fill, Slot: MainDashboardButtonSlot } = createSlotFill( slotName );\n\nconst MainDashboardButton = Fill;\n\nconst Slot = ( { children } ) => {\n\tconst fills = useSlotFills( slotName );\n\tconst hasFills = Boolean( fills && fills.length );\n\n\tif ( ! hasFills ) {\n\t\treturn children;\n\t}\n\n\treturn <MainDashboardButtonSlot bubblesVirtually />;\n};\n\nMainDashboardButton.Slot = Slot;\n\nexport default MainDashboardButton;\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,0BAA0B,IAAIC,YAAY,EAC1CC,cAAc,QACR,uBAAuB;AAE9B,MAAMC,QAAQ,GAAG,mCAAmC;AAEpD,MAAM;EAAEC,IAAI;EAAEC,IAAI,EAAEC;AAAwB,CAAC,GAAGJ,cAAc,CAAEC,QAAS,CAAC;AAE1E,MAAMI,mBAAmB,GAAGH,IAAI;AAEhC,MAAMC,IAAI,GAAGA,CAAE;EAAEG;AAAS,CAAC,KAAM;EAChC,MAAMC,KAAK,GAAGR,YAAY,CAAEE,QAAS,CAAC;EACtC,MAAMO,QAAQ,GAAGC,OAAO,CAAEF,KAAK,IAAIA,KAAK,CAACG,MAAO,CAAC;EAEjD,IAAK,CAAEF,QAAQ,EAAG;IACjB,OAAOF,QAAQ;EAChB;EAEA,OAAOK,aAAA,CAACP,uBAAuB;IAACQ,gBAAgB;EAAA,CAAE,CAAC;AACpD,CAAC;AAEDP,mBAAmB,CAACF,IAAI,GAAGA,IAAI;AAE/B,eAAeE,mBAAmB","ignoreList":[]}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { createElement, Fragment } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { useViewportMatch } from '@wordpress/compose';
|
|
7
|
-
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
8
|
-
import { PreferenceToggleMenuItem } from '@wordpress/preferences';
|
|
9
|
-
import { displayShortcut } from '@wordpress/keycodes';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import { unlock } from '../../../lock-unlock';
|
|
15
|
-
import ManagePatternsMenuItem from './manage-patterns-menu-item';
|
|
16
|
-
import WelcomeGuideMenuItem from './welcome-guide-menu-item';
|
|
17
|
-
import EditPostPreferencesModal from '../../preferences-modal';
|
|
18
|
-
const {
|
|
19
|
-
ToolsMoreMenuGroup,
|
|
20
|
-
ViewMoreMenuGroup
|
|
21
|
-
} = unlock(editorPrivateApis);
|
|
22
|
-
const MoreMenu = () => {
|
|
23
|
-
const isLargeViewport = useViewportMatch('large');
|
|
24
|
-
return createElement(Fragment, null, isLargeViewport && createElement(ViewMoreMenuGroup, null, createElement(PreferenceToggleMenuItem, {
|
|
25
|
-
scope: "core/edit-post",
|
|
26
|
-
name: "fullscreenMode",
|
|
27
|
-
label: __('Fullscreen mode'),
|
|
28
|
-
info: __('Show and hide the admin user interface'),
|
|
29
|
-
messageActivated: __('Fullscreen mode activated'),
|
|
30
|
-
messageDeactivated: __('Fullscreen mode deactivated'),
|
|
31
|
-
shortcut: displayShortcut.secondary('f')
|
|
32
|
-
})), createElement(ToolsMoreMenuGroup, null, createElement(ManagePatternsMenuItem, null), createElement(WelcomeGuideMenuItem, null)), createElement(EditPostPreferencesModal, null));
|
|
33
|
-
};
|
|
34
|
-
export default MoreMenu;
|
|
35
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__","useViewportMatch","privateApis","editorPrivateApis","PreferenceToggleMenuItem","displayShortcut","unlock","ManagePatternsMenuItem","WelcomeGuideMenuItem","EditPostPreferencesModal","ToolsMoreMenuGroup","ViewMoreMenuGroup","MoreMenu","isLargeViewport","createElement","Fragment","scope","name","label","info","messageActivated","messageDeactivated","shortcut","secondary"],"sources":["@wordpress/edit-post/src/components/header/more-menu/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { PreferenceToggleMenuItem } from '@wordpress/preferences';\nimport { displayShortcut } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../../lock-unlock';\nimport ManagePatternsMenuItem from './manage-patterns-menu-item';\nimport WelcomeGuideMenuItem from './welcome-guide-menu-item';\nimport EditPostPreferencesModal from '../../preferences-modal';\n\nconst { ToolsMoreMenuGroup, ViewMoreMenuGroup } = unlock( editorPrivateApis );\n\nconst MoreMenu = () => {\n\tconst isLargeViewport = useViewportMatch( 'large' );\n\n\treturn (\n\t\t<>\n\t\t\t{ isLargeViewport && (\n\t\t\t\t<ViewMoreMenuGroup>\n\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\tscope=\"core/edit-post\"\n\t\t\t\t\t\tname=\"fullscreenMode\"\n\t\t\t\t\t\tlabel={ __( 'Fullscreen mode' ) }\n\t\t\t\t\t\tinfo={ __( 'Show and hide the admin user interface' ) }\n\t\t\t\t\t\tmessageActivated={ __( 'Fullscreen mode activated' ) }\n\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t'Fullscreen mode deactivated'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tshortcut={ displayShortcut.secondary( 'f' ) }\n\t\t\t\t\t/>\n\t\t\t\t</ViewMoreMenuGroup>\n\t\t\t) }\n\t\t\t<ToolsMoreMenuGroup>\n\t\t\t\t<ManagePatternsMenuItem />\n\t\t\t\t<WelcomeGuideMenuItem />\n\t\t\t</ToolsMoreMenuGroup>\n\t\t\t<EditPostPreferencesModal />\n\t\t</>\n\t);\n};\n\nexport default MoreMenu;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,wBAAwB,QAAQ,wBAAwB;AACjE,SAASC,eAAe,QAAQ,qBAAqB;;AAErD;AACA;AACA;AACA,SAASC,MAAM,QAAQ,sBAAsB;AAC7C,OAAOC,sBAAsB,MAAM,6BAA6B;AAChE,OAAOC,oBAAoB,MAAM,2BAA2B;AAC5D,OAAOC,wBAAwB,MAAM,yBAAyB;AAE9D,MAAM;EAAEC,kBAAkB;EAAEC;AAAkB,CAAC,GAAGL,MAAM,CAAEH,iBAAkB,CAAC;AAE7E,MAAMS,QAAQ,GAAGA,CAAA,KAAM;EACtB,MAAMC,eAAe,GAAGZ,gBAAgB,CAAE,OAAQ,CAAC;EAEnD,OACCa,aAAA,CAAAC,QAAA,QACGF,eAAe,IAChBC,aAAA,CAACH,iBAAiB,QACjBG,aAAA,CAACV,wBAAwB;IACxBY,KAAK,EAAC,gBAAgB;IACtBC,IAAI,EAAC,gBAAgB;IACrBC,KAAK,EAAGlB,EAAE,CAAE,iBAAkB,CAAG;IACjCmB,IAAI,EAAGnB,EAAE,CAAE,wCAAyC,CAAG;IACvDoB,gBAAgB,EAAGpB,EAAE,CAAE,2BAA4B,CAAG;IACtDqB,kBAAkB,EAAGrB,EAAE,CACtB,6BACD,CAAG;IACHsB,QAAQ,EAAGjB,eAAe,CAACkB,SAAS,CAAE,GAAI;EAAG,CAC7C,CACiB,CACnB,EACDT,aAAA,CAACJ,kBAAkB,QAClBI,aAAA,CAACP,sBAAsB,MAAE,CAAC,EAC1BO,aAAA,CAACN,oBAAoB,MAAE,CACJ,CAAC,EACrBM,aAAA,CAACL,wBAAwB,MAAE,CAC1B,CAAC;AAEL,CAAC;AAED,eAAeG,QAAQ","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["MenuItem","store","coreStore","useSelect","__","addQueryArgs","ManagePatternsMenuItem","url","select","canUser","defaultUrl","post_type","patternsUrl","path","createElement","role","href"],"sources":["@wordpress/edit-post/src/components/header/more-menu/manage-patterns-menu-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { addQueryArgs } from '@wordpress/url';\n\nfunction ManagePatternsMenuItem() {\n\tconst url = useSelect( ( select ) => {\n\t\tconst { canUser } = select( coreStore );\n\t\tconst defaultUrl = addQueryArgs( 'edit.php', {\n\t\t\tpost_type: 'wp_block',\n\t\t} );\n\t\tconst patternsUrl = addQueryArgs( 'site-editor.php', {\n\t\t\tpath: '/patterns',\n\t\t} );\n\n\t\t// The site editor and templates both check whether the user has\n\t\t// edit_theme_options capabilities. We can leverage that here and not\n\t\t// display the manage patterns link if the user can't access it.\n\t\treturn canUser( 'create', 'templates' ) ? patternsUrl : defaultUrl;\n\t}, [] );\n\n\treturn (\n\t\t<MenuItem role=\"menuitem\" href={ url }>\n\t\t\t{ __( 'Manage patterns' ) }\n\t\t</MenuItem>\n\t);\n}\n\nexport default ManagePatternsMenuItem;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,YAAY,QAAQ,gBAAgB;AAE7C,SAASC,sBAAsBA,CAAA,EAAG;EACjC,MAAMC,GAAG,GAAGJ,SAAS,CAAIK,MAAM,IAAM;IACpC,MAAM;MAAEC;IAAQ,CAAC,GAAGD,MAAM,CAAEN,SAAU,CAAC;IACvC,MAAMQ,UAAU,GAAGL,YAAY,CAAE,UAAU,EAAE;MAC5CM,SAAS,EAAE;IACZ,CAAE,CAAC;IACH,MAAMC,WAAW,GAAGP,YAAY,CAAE,iBAAiB,EAAE;MACpDQ,IAAI,EAAE;IACP,CAAE,CAAC;;IAEH;IACA;IACA;IACA,OAAOJ,OAAO,CAAE,QAAQ,EAAE,WAAY,CAAC,GAAGG,WAAW,GAAGF,UAAU;EACnE,CAAC,EAAE,EAAG,CAAC;EAEP,OACCI,aAAA,CAACd,QAAQ;IAACe,IAAI,EAAC,UAAU;IAACC,IAAI,EAAGT;EAAK,GACnCH,EAAE,CAAE,iBAAkB,CACf,CAAC;AAEb;AAEA,eAAeE,sBAAsB","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","PreferenceToggleMenuItem","__","store","editorStore","WelcomeGuideMenuItem","isEditingTemplate","select","getCurrentPostType","createElement","scope","name","label"],"sources":["@wordpress/edit-post/src/components/header/more-menu/welcome-guide-menu-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { PreferenceToggleMenuItem } from '@wordpress/preferences';\nimport { __ } from '@wordpress/i18n';\nimport { store as editorStore } from '@wordpress/editor';\n\nexport default function WelcomeGuideMenuItem() {\n\tconst isEditingTemplate = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getCurrentPostType() === 'wp_template',\n\t\t[]\n\t);\n\n\treturn (\n\t\t<PreferenceToggleMenuItem\n\t\t\tscope=\"core/edit-post\"\n\t\t\tname={ isEditingTemplate ? 'welcomeGuideTemplate' : 'welcomeGuide' }\n\t\t\tlabel={ __( 'Welcome Guide' ) }\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,wBAAwB,QAAQ,wBAAwB;AACjE,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AAExD,eAAe,SAASC,oBAAoBA,CAAA,EAAG;EAC9C,MAAMC,iBAAiB,GAAGN,SAAS,CAChCO,MAAM,IACPA,MAAM,CAAEH,WAAY,CAAC,CAACI,kBAAkB,CAAC,CAAC,KAAK,aAAa,EAC7D,EACD,CAAC;EAED,OACCC,aAAA,CAACR,wBAAwB;IACxBS,KAAK,EAAC,gBAAgB;IACtBC,IAAI,EAAGL,iBAAiB,GAAG,sBAAsB,GAAG,cAAgB;IACpEM,KAAK,EAAGV,EAAE,CAAE,eAAgB;EAAG,CAC/B,CAAC;AAEJ","ignoreList":[]}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { PostTextEditor, PostTitleRaw, store as editorStore } from '@wordpress/editor';
|
|
6
|
-
import { Button } from '@wordpress/components';
|
|
7
|
-
import { useDispatch, useSelect } from '@wordpress/data';
|
|
8
|
-
import { __ } from '@wordpress/i18n';
|
|
9
|
-
import { displayShortcut } from '@wordpress/keycodes';
|
|
10
|
-
import { useEffect, useRef } from '@wordpress/element';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Internal dependencies
|
|
14
|
-
*/
|
|
15
|
-
import { store as editPostStore } from '../../store';
|
|
16
|
-
export default function TextEditor() {
|
|
17
|
-
const isRichEditingEnabled = useSelect(select => {
|
|
18
|
-
return select(editorStore).getEditorSettings().richEditingEnabled;
|
|
19
|
-
}, []);
|
|
20
|
-
const {
|
|
21
|
-
switchEditorMode
|
|
22
|
-
} = useDispatch(editorStore);
|
|
23
|
-
const {
|
|
24
|
-
isWelcomeGuideVisible
|
|
25
|
-
} = useSelect(select => {
|
|
26
|
-
const {
|
|
27
|
-
isFeatureActive
|
|
28
|
-
} = select(editPostStore);
|
|
29
|
-
return {
|
|
30
|
-
isWelcomeGuideVisible: isFeatureActive('welcomeGuide')
|
|
31
|
-
};
|
|
32
|
-
}, []);
|
|
33
|
-
const titleRef = useRef();
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
if (isWelcomeGuideVisible) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
titleRef?.current?.focus();
|
|
39
|
-
}, [isWelcomeGuideVisible]);
|
|
40
|
-
return createElement("div", {
|
|
41
|
-
className: "edit-post-text-editor"
|
|
42
|
-
}, isRichEditingEnabled && createElement("div", {
|
|
43
|
-
className: "edit-post-text-editor__toolbar"
|
|
44
|
-
}, createElement("h2", null, __('Editing code')), createElement(Button, {
|
|
45
|
-
variant: "tertiary",
|
|
46
|
-
onClick: () => switchEditorMode('visual'),
|
|
47
|
-
shortcut: displayShortcut.secondary('m')
|
|
48
|
-
}, __('Exit code editor'))), createElement("div", {
|
|
49
|
-
className: "edit-post-text-editor__body"
|
|
50
|
-
}, createElement(PostTitleRaw, {
|
|
51
|
-
ref: titleRef
|
|
52
|
-
}), createElement(PostTextEditor, null)));
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["PostTextEditor","PostTitleRaw","store","editorStore","Button","useDispatch","useSelect","__","displayShortcut","useEffect","useRef","editPostStore","TextEditor","isRichEditingEnabled","select","getEditorSettings","richEditingEnabled","switchEditorMode","isWelcomeGuideVisible","isFeatureActive","titleRef","current","focus","createElement","className","variant","onClick","shortcut","secondary","ref"],"sources":["@wordpress/edit-post/src/components/text-editor/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tPostTextEditor,\n\tPostTitleRaw,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { Button } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nexport default function TextEditor() {\n\tconst isRichEditingEnabled = useSelect( ( select ) => {\n\t\treturn select( editorStore ).getEditorSettings().richEditingEnabled;\n\t}, [] );\n\tconst { switchEditorMode } = useDispatch( editorStore );\n\n\tconst { isWelcomeGuideVisible } = useSelect( ( select ) => {\n\t\tconst { isFeatureActive } = select( editPostStore );\n\n\t\treturn {\n\t\t\tisWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),\n\t\t};\n\t}, [] );\n\n\tconst titleRef = useRef();\n\n\tuseEffect( () => {\n\t\tif ( isWelcomeGuideVisible ) {\n\t\t\treturn;\n\t\t}\n\t\ttitleRef?.current?.focus();\n\t}, [ isWelcomeGuideVisible ] );\n\n\treturn (\n\t\t<div className=\"edit-post-text-editor\">\n\t\t\t{ isRichEditingEnabled && (\n\t\t\t\t<div className=\"edit-post-text-editor__toolbar\">\n\t\t\t\t\t<h2>{ __( 'Editing code' ) }</h2>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => switchEditorMode( 'visual' ) }\n\t\t\t\t\t\tshortcut={ displayShortcut.secondary( 'm' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Exit code editor' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<div className=\"edit-post-text-editor__body\">\n\t\t\t\t<PostTitleRaw ref={ titleRef } />\n\t\t\t\t<PostT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CAAE,cAAe,CAAO,CAAC,EACjCgB,aAAA,CAACnB,MAAM;IACNqB,OAAO,EAAC,UAAU;IAClBC,OAAO,EAAGA,CAAA,KAAMT,gBAAgB,CAAE,QAAS,CAAG;IAC9CU,QAAQ,EAAGnB,eAAe,CAACoB,SAAS,CAAE,GAAI;EAAG,GAE3CrB,EAAE,CAAE,kBAAmB,CAClB,CACJ,CACL,EACDgB,aAAA;IAAKC,SAAS,EAAC;EAA6B,GAC3CD,aAAA,CAACtB,YAAY;IAAC4B,GAAG,EAAGT;EAAU,CAAE,CAAC,EACjCG,aAAA,CAACvB,cAAc,MAAE,CACb,CACD,CAAC;AAER","ignoreList":[]}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { MenuItem } from '@wordpress/components';
|
|
7
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
8
|
-
import { speak } from '@wordpress/a11y';
|
|
9
|
-
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import { store as editPostStore } from '../../store';
|
|
15
|
-
const noop = () => {};
|
|
16
|
-
export function BlockInspectorButton({
|
|
17
|
-
onClick = noop,
|
|
18
|
-
small = false
|
|
19
|
-
}) {
|
|
20
|
-
const {
|
|
21
|
-
shortcut,
|
|
22
|
-
areAdvancedSettingsOpened
|
|
23
|
-
} = useSelect(select => ({
|
|
24
|
-
shortcut: select(keyboardShortcutsStore).getShortcutRepresentation('core/editor/toggle-sidebar'),
|
|
25
|
-
areAdvancedSettingsOpened: select(editPostStore).getActiveGeneralSidebarName() === 'edit-post/block'
|
|
26
|
-
}), []);
|
|
27
|
-
const {
|
|
28
|
-
openGeneralSidebar,
|
|
29
|
-
closeGeneralSidebar
|
|
30
|
-
} = useDispatch(editPostStore);
|
|
31
|
-
const label = areAdvancedSettingsOpened ? __('Hide more settings') : __('Show more settings');
|
|
32
|
-
return createElement(MenuItem, {
|
|
33
|
-
onClick: () => {
|
|
34
|
-
if (areAdvancedSettingsOpened) {
|
|
35
|
-
closeGeneralSidebar();
|
|
36
|
-
speak(__('Block settings closed'));
|
|
37
|
-
} else {
|
|
38
|
-
openGeneralSidebar('edit-post/block');
|
|
39
|
-
speak(__('Additional settings are now available in the Editor block settings sidebar'));
|
|
40
|
-
}
|
|
41
|
-
onClick();
|
|
42
|
-
},
|
|
43
|
-
shortcut: shortcut
|
|
44
|
-
}, !small && label);
|
|
45
|
-
}
|
|
46
|
-
export default BlockInspectorButton;
|
|
47
|
-
//# sourceMappingURL=block-inspector-button.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__","MenuItem","useSelect","useDispatch","speak","store","keyboardShortcutsStore","editPostStore","noop","BlockInspectorButton","onClick","small","shortcut","areAdvancedSettingsOpened","select","getShortcutRepresentation","getActiveGeneralSidebarName","openGeneralSidebar","closeGeneralSidebar","label","createElement"],"sources":["@wordpress/edit-post/src/components/visual-editor/block-inspector-button.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuItem } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { speak } from '@wordpress/a11y';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nconst noop = () => {};\n\nexport function BlockInspectorButton( { onClick = noop, small = false } ) {\n\tconst { shortcut, areAdvancedSettingsOpened } = useSelect(\n\t\t( select ) => ( {\n\t\t\tshortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getShortcutRepresentation( 'core/editor/toggle-sidebar' ),\n\t\t\tareAdvancedSettingsOpened:\n\t\t\t\tselect( editPostStore ).getActiveGeneralSidebarName() ===\n\t\t\t\t'edit-post/block',\n\t\t} ),\n\t\t[]\n\t);\n\tconst { openGeneralSidebar, closeGeneralSidebar } =\n\t\tuseDispatch( editPostStore );\n\n\tconst label = areAdvancedSettingsOpened\n\t\t? __( 'Hide more settings' )\n\t\t: __( 'Show more settings' );\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\tif ( areAdvancedSettingsOpened ) {\n\t\t\t\t\tcloseGeneralSidebar();\n\t\t\t\t\tspeak( __( 'Block settings closed' ) );\n\t\t\t\t} else {\n\t\t\t\t\topenGeneralSidebar( 'edit-post/block' );\n\t\t\t\t\tspeak(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Additional settings are now available in the Editor block settings sidebar'\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tonClick();\n\t\t\t} }\n\t\t\tshortcut={ shortcut }\n\t\t>\n\t\t\t{ ! small && label }\n\t\t</MenuItem>\n\t);\n}\n\nexport default BlockInspectorButton;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,QAAQ,iBAAiB;AACvC,SAASC,KAAK,IAAIC,sBAAsB,QAAQ,+BAA+B;;AAE/E;AACA;AACA;AACA,SAASD,KAAK,IAAIE,aAAa,QAAQ,aAAa;AAEpD,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,OAAO,SAASC,oBAAoBA,CAAE;EAAEC,OAAO,GAAGF,IAAI;EAAEG,KAAK,GAAG;AAAM,CAAC,EAAG;EACzE,MAAM;IAAEC,QAAQ;IAAEC;EAA0B,CAAC,GAAGX,SAAS,CACtDY,MAAM,KAAQ;IACfF,QAAQ,EAAEE,MAAM,CACfR,sBACD,CAAC,CAACS,yBAAyB,CAA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