@wordpress/edit-post 7.28.5 → 7.30.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/editor-initialization/index.js +3 -6
- package/build/components/editor-initialization/index.js.map +1 -1
- package/build/components/editor-initialization/listener-hooks.js +6 -10
- package/build/components/editor-initialization/listener-hooks.js.map +1 -1
- package/build/components/header/header-toolbar/index.native.js.map +1 -1
- package/build/components/header/index.js +13 -7
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/more-menu/index.js +16 -4
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/header/writing-menu/index.js +2 -6
- package/build/components/header/writing-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +1 -38
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +2 -3
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/index.native.js +2 -5
- package/build/components/layout/index.native.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/editor.js +3 -31
- package/build/editor.js.map +1 -1
- package/build/editor.native.js +2 -3
- package/build/editor.native.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +2 -135
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/index.js +0 -30
- package/build/index.js.map +1 -1
- package/build/index.native.js +0 -1
- package/build/index.native.js.map +1 -1
- package/build/store/actions.js +24 -77
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js +0 -12
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/editor-initialization/index.js +3 -6
- package/build-module/components/editor-initialization/index.js.map +1 -1
- package/build-module/components/editor-initialization/listener-hooks.js +6 -10
- package/build-module/components/editor-initialization/listener-hooks.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
- package/build-module/components/header/index.js +14 -8
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/more-menu/index.js +17 -5
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/components/header/writing-menu/index.js +2 -6
- package/build-module/components/header/writing-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +1 -38
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js +3 -4
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/index.native.js +2 -5
- package/build-module/components/layout/index.native.js.map +1 -1
- package/build-module/components/text-editor/index.js +1 -1
- package/build-module/components/text-editor/index.js.map +1 -1
- package/build-module/editor.js +4 -32
- package/build-module/editor.js.map +1 -1
- package/build-module/editor.native.js +3 -4
- package/build-module/editor.native.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +3 -136
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/index.js +0 -30
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +0 -1
- package/build-module/index.native.js.map +1 -1
- package/build-module/store/actions.js +23 -75
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js +0 -12
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +10 -38
- package/build-style/style.css +10 -38
- package/package.json +32 -32
- package/src/components/editor-initialization/index.js +3 -4
- package/src/components/editor-initialization/listener-hooks.js +20 -22
- package/src/components/editor-initialization/test/listener-hooks.js +8 -8
- package/src/components/header/header-toolbar/index.native.js +1 -1
- package/src/components/header/index.js +23 -23
- package/src/components/header/more-menu/index.js +17 -10
- package/src/components/header/style.scss +4 -0
- package/src/components/header/test/index.js +4 -14
- package/src/components/header/writing-menu/index.js +2 -6
- package/src/components/keyboard-shortcuts/index.js +3 -50
- package/src/components/layout/index.js +3 -4
- package/src/components/layout/index.native.js +1 -3
- package/src/components/sidebar/plugin-post-publish-panel/test/index.js +1 -1
- package/src/components/text-editor/index.js +1 -1
- package/src/editor.js +32 -65
- package/src/editor.native.js +3 -4
- package/src/hooks/commands/use-common-commands.js +17 -170
- package/src/index.js +0 -44
- package/src/index.native.js +0 -1
- package/src/store/actions.js +24 -126
- package/src/store/selectors.js +0 -18
- package/src/store/test/actions.js +0 -146
- package/src/style.scss +1 -2
- package/build/components/header/mode-switcher/index.js +0 -87
- package/build/components/header/mode-switcher/index.js.map +0 -1
- package/build-module/components/header/mode-switcher/index.js +0 -81
- package/build-module/components/header/mode-switcher/index.js.map +0 -1
- package/src/components/header/mode-switcher/index.js +0 -91
|
@@ -26,42 +26,22 @@ var _store = require("../../store");
|
|
|
26
26
|
function useCommonCommands() {
|
|
27
27
|
const {
|
|
28
28
|
openGeneralSidebar,
|
|
29
|
-
closeGeneralSidebar
|
|
30
|
-
switchEditorMode,
|
|
31
|
-
toggleDistractionFree
|
|
29
|
+
closeGeneralSidebar
|
|
32
30
|
} = (0, _data.useDispatch)(_store.store);
|
|
33
31
|
const {
|
|
34
32
|
openModal
|
|
35
33
|
} = (0, _data.useDispatch)(_interface.store);
|
|
36
34
|
const {
|
|
37
|
-
editorMode,
|
|
38
35
|
activeSidebar,
|
|
39
|
-
isListViewOpen,
|
|
40
36
|
isFullscreen,
|
|
41
|
-
isPublishSidebarEnabled
|
|
42
|
-
showBlockBreadcrumbs,
|
|
43
|
-
isDistractionFree,
|
|
44
|
-
isTopToolbar,
|
|
45
|
-
isFocusMode
|
|
37
|
+
isPublishSidebarEnabled
|
|
46
38
|
} = (0, _data.useSelect)(select => {
|
|
47
39
|
const {
|
|
48
40
|
get
|
|
49
41
|
} = select(_preferences.store);
|
|
50
|
-
const {
|
|
51
|
-
getEditorMode
|
|
52
|
-
} = select(_store.store);
|
|
53
|
-
const {
|
|
54
|
-
isListViewOpened
|
|
55
|
-
} = select(_editor.store);
|
|
56
42
|
return {
|
|
57
43
|
activeSidebar: select(_interface.store).getActiveComplementaryArea(_store.store.name),
|
|
58
|
-
editorMode: getEditorMode(),
|
|
59
|
-
isListViewOpen: isListViewOpened(),
|
|
60
44
|
isPublishSidebarEnabled: select(_editor.store).isPublishSidebarEnabled(),
|
|
61
|
-
showBlockBreadcrumbs: get('core', 'showBlockBreadcrumbs'),
|
|
62
|
-
isDistractionFree: get('core', 'distractionFree'),
|
|
63
|
-
isFocusMode: get('core', 'focusMode'),
|
|
64
|
-
isTopToolbar: get('core', 'fixedToolbar'),
|
|
65
45
|
isFullscreen: get('core/edit-post', 'fullscreenMode')
|
|
66
46
|
};
|
|
67
47
|
}, []);
|
|
@@ -71,13 +51,6 @@ function useCommonCommands() {
|
|
|
71
51
|
const {
|
|
72
52
|
createInfoNotice
|
|
73
53
|
} = (0, _data.useDispatch)(_notices.store);
|
|
74
|
-
const {
|
|
75
|
-
__unstableSaveForPreview,
|
|
76
|
-
setIsListViewOpened
|
|
77
|
-
} = (0, _data.useDispatch)(_editor.store);
|
|
78
|
-
const {
|
|
79
|
-
getCurrentPostId
|
|
80
|
-
} = (0, _data.useSelect)(_editor.store);
|
|
81
54
|
(0, _commands.useCommand)({
|
|
82
55
|
name: 'core/open-settings-sidebar',
|
|
83
56
|
label: (0, _i18n.__)('Toggle settings sidebar'),
|
|
@@ -108,36 +81,6 @@ function useCommonCommands() {
|
|
|
108
81
|
}
|
|
109
82
|
}
|
|
110
83
|
});
|
|
111
|
-
(0, _commands.useCommand)({
|
|
112
|
-
name: 'core/toggle-distraction-free',
|
|
113
|
-
label: isDistractionFree ? (0, _i18n.__)('Exit Distraction Free') : (0, _i18n.__)('Enter Distraction Free '),
|
|
114
|
-
callback: ({
|
|
115
|
-
close
|
|
116
|
-
}) => {
|
|
117
|
-
toggleDistractionFree();
|
|
118
|
-
close();
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
(0, _commands.useCommand)({
|
|
122
|
-
name: 'core/toggle-spotlight-mode',
|
|
123
|
-
label: (0, _i18n.__)('Toggle spotlight'),
|
|
124
|
-
callback: ({
|
|
125
|
-
close
|
|
126
|
-
}) => {
|
|
127
|
-
toggle('core', 'focusMode');
|
|
128
|
-
close();
|
|
129
|
-
createInfoNotice(isFocusMode ? (0, _i18n.__)('Spotlight off.') : (0, _i18n.__)('Spotlight on.'), {
|
|
130
|
-
id: 'core/edit-post/toggle-spotlight-mode/notice',
|
|
131
|
-
type: 'snackbar',
|
|
132
|
-
actions: [{
|
|
133
|
-
label: (0, _i18n.__)('Undo'),
|
|
134
|
-
onClick: () => {
|
|
135
|
-
toggle('core', 'focusMode');
|
|
136
|
-
}
|
|
137
|
-
}]
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
84
|
(0, _commands.useCommand)({
|
|
142
85
|
name: 'core/toggle-fullscreen-mode',
|
|
143
86
|
label: isFullscreen ? (0, _i18n.__)('Exit fullscreen') : (0, _i18n.__)('Enter fullscreen'),
|
|
@@ -159,55 +102,6 @@ function useCommonCommands() {
|
|
|
159
102
|
});
|
|
160
103
|
}
|
|
161
104
|
});
|
|
162
|
-
(0, _commands.useCommand)({
|
|
163
|
-
name: 'core/toggle-list-view',
|
|
164
|
-
label: isListViewOpen ? (0, _i18n.__)('Close List View') : (0, _i18n.__)('Open List View'),
|
|
165
|
-
icon: _icons.listView,
|
|
166
|
-
callback: ({
|
|
167
|
-
close
|
|
168
|
-
}) => {
|
|
169
|
-
setIsListViewOpened(!isListViewOpen);
|
|
170
|
-
close();
|
|
171
|
-
createInfoNotice(isListViewOpen ? (0, _i18n.__)('List View off.') : (0, _i18n.__)('List View on.'), {
|
|
172
|
-
id: 'core/edit-post/toggle-list-view/notice',
|
|
173
|
-
type: 'snackbar'
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
(0, _commands.useCommand)({
|
|
178
|
-
name: 'core/toggle-top-toolbar',
|
|
179
|
-
label: (0, _i18n.__)('Toggle top toolbar'),
|
|
180
|
-
callback: ({
|
|
181
|
-
close
|
|
182
|
-
}) => {
|
|
183
|
-
toggle('core', 'fixedToolbar');
|
|
184
|
-
if (isDistractionFree) {
|
|
185
|
-
toggleDistractionFree();
|
|
186
|
-
}
|
|
187
|
-
close();
|
|
188
|
-
createInfoNotice(isTopToolbar ? (0, _i18n.__)('Top toolbar off.') : (0, _i18n.__)('Top toolbar on.'), {
|
|
189
|
-
id: 'core/edit-post/toggle-top-toolbar/notice',
|
|
190
|
-
type: 'snackbar',
|
|
191
|
-
actions: [{
|
|
192
|
-
label: (0, _i18n.__)('Undo'),
|
|
193
|
-
onClick: () => {
|
|
194
|
-
toggle('core', 'fixedToolbar');
|
|
195
|
-
}
|
|
196
|
-
}]
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
(0, _commands.useCommand)({
|
|
201
|
-
name: 'core/toggle-code-editor',
|
|
202
|
-
label: editorMode === 'visual' ? (0, _i18n.__)('Open code editor') : (0, _i18n.__)('Exit code editor'),
|
|
203
|
-
icon: _icons.code,
|
|
204
|
-
callback: ({
|
|
205
|
-
close
|
|
206
|
-
}) => {
|
|
207
|
-
switchEditorMode(editorMode === 'visual' ? 'text' : 'visual');
|
|
208
|
-
close();
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
105
|
(0, _commands.useCommand)({
|
|
212
106
|
name: 'core/open-preferences',
|
|
213
107
|
label: (0, _i18n.__)('Editor preferences'),
|
|
@@ -223,20 +117,6 @@ function useCommonCommands() {
|
|
|
223
117
|
openModal(_keyboardShortcutHelpModal.KEYBOARD_SHORTCUT_HELP_MODAL_NAME);
|
|
224
118
|
}
|
|
225
119
|
});
|
|
226
|
-
(0, _commands.useCommand)({
|
|
227
|
-
name: 'core/toggle-breadcrumbs',
|
|
228
|
-
label: showBlockBreadcrumbs ? (0, _i18n.__)('Hide block breadcrumbs') : (0, _i18n.__)('Show block breadcrumbs'),
|
|
229
|
-
callback: ({
|
|
230
|
-
close
|
|
231
|
-
}) => {
|
|
232
|
-
toggle('core', 'showBlockBreadcrumbs');
|
|
233
|
-
close();
|
|
234
|
-
createInfoNotice(showBlockBreadcrumbs ? (0, _i18n.__)('Breadcrumbs hidden.') : (0, _i18n.__)('Breadcrumbs visible.'), {
|
|
235
|
-
id: 'core/edit-post/toggle-breadcrumbs/notice',
|
|
236
|
-
type: 'snackbar'
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
120
|
(0, _commands.useCommand)({
|
|
241
121
|
name: 'core/toggle-publish-sidebar',
|
|
242
122
|
label: isPublishSidebarEnabled ? (0, _i18n.__)('Disable pre-publish checks') : (0, _i18n.__)('Enable pre-publish checks'),
|
|
@@ -252,18 +132,5 @@ function useCommonCommands() {
|
|
|
252
132
|
});
|
|
253
133
|
}
|
|
254
134
|
});
|
|
255
|
-
(0, _commands.useCommand)({
|
|
256
|
-
name: 'core/preview-link',
|
|
257
|
-
label: (0, _i18n.__)('Preview in a new tab'),
|
|
258
|
-
icon: _icons.external,
|
|
259
|
-
callback: async ({
|
|
260
|
-
close
|
|
261
|
-
}) => {
|
|
262
|
-
close();
|
|
263
|
-
const postId = getCurrentPostId();
|
|
264
|
-
const link = await __unstableSaveForPreview();
|
|
265
|
-
window.open(link, `wp-preview-${postId}`);
|
|
266
|
-
}
|
|
267
|
-
});
|
|
268
135
|
}
|
|
269
136
|
//# sourceMappingURL=use-common-commands.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_i18n","_icons","_commands","_preferences","_interface","_editor","_notices","_keyboardShortcutHelpModal","_preferencesModal","_store","useCommonCommands","openGeneralSidebar","closeGeneralSidebar","switchEditorMode","toggleDistractionFree","useDispatch","editPostStore","openModal","interfaceStore","editorMode","activeSidebar","isListViewOpen","isFullscreen","isPublishSidebarEnabled","showBlockBreadcrumbs","isDistractionFree","isTopToolbar","isFocusMode","useSelect","select","get","preferencesStore","getEditorMode","isListViewOpened","editorStore","getActiveComplementaryArea","name","toggle","createInfoNotice","noticesStore","__unstableSaveForPreview","setIsListViewOpened","getCurrentPostId","useCommand","label","__","icon","isRTL","drawerLeft","drawerRight","callback","close","blockDefault","id","type","actions","onClick","fullscreen","listView","code","PREFERENCES_MODAL_NAME","keyboard","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","formatListBullets","external","postId","link","window","open"],"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\tcode,\n\tdrawerLeft,\n\tdrawerRight,\n\tblockDefault,\n\tkeyboard,\n\tfullscreen,\n\tlistView,\n\texternal,\n\tformatListBullets,\n} from '@wordpress/icons';\nimport { useCommand } from '@wordpress/commands';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { KEYBOARD_SHORTCUT_HELP_MODAL_NAME } from '../../components/keyboard-shortcut-help-modal';\nimport { PREFERENCES_MODAL_NAME } from '../../components/preferences-modal';\nimport { store as editPostStore } from '../../store';\n\nexport default function useCommonCommands() {\n\tconst {\n\t\topenGeneralSidebar,\n\t\tcloseGeneralSidebar,\n\t\tswitchEditorMode,\n\t\ttoggleDistractionFree,\n\t} = useDispatch( editPostStore );\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst {\n\t\teditorMode,\n\t\tactiveSidebar,\n\t\tisListViewOpen,\n\t\tisFullscreen,\n\t\tisPublishSidebarEnabled,\n\t\tshowBlockBreadcrumbs,\n\t\tisDistractionFree,\n\t\tisTopToolbar,\n\t\tisFocusMode,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getEditorMode } = select( editPostStore );\n\t\tconst { isListViewOpened } = select( editorStore );\n\n\t\treturn {\n\t\t\tactiveSidebar: select( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\teditPostStore.name\n\t\t\t),\n\t\t\teditorMode: getEditorMode(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tisPublishSidebarEnabled:\n\t\t\t\tselect( editorStore ).isPublishSidebarEnabled(),\n\t\t\tshowBlockBreadcrumbs: get( 'core', 'showBlockBreadcrumbs' ),\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\tisFocusMode: get( 'core', 'focusMode' ),\n\t\t\tisTopToolbar: get( 'core', 'fixedToolbar' ),\n\t\t\tisFullscreen: get( 'core/edit-post', 'fullscreenMode' ),\n\t\t};\n\t}, [] );\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst { createInfoNotice } = useDispatch( noticesStore );\n\tconst { __unstableSaveForPreview, setIsListViewOpened } =\n\t\tuseDispatch( editorStore );\n\tconst { getCurrentPostId } = useSelect( editorStore );\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-distraction-free',\n\t\tlabel: isDistractionFree\n\t\t\t? __( 'Exit Distraction Free' )\n\t\t\t: __( 'Enter Distraction Free ' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggleDistractionFree();\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-spotlight-mode',\n\t\tlabel: __( 'Toggle spotlight' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core', 'focusMode' );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisFocusMode ? __( 'Spotlight off.' ) : __( 'Spotlight on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-post/toggle-spotlight-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', 'focusMode' );\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-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-list-view',\n\t\tlabel: isListViewOpen\n\t\t\t? __( 'Close List View' )\n\t\t\t: __( 'Open List View' ),\n\t\ticon: listView,\n\t\tcallback: ( { close } ) => {\n\t\t\tsetIsListViewOpened( ! isListViewOpen );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisListViewOpen ? __( 'List View off.' ) : __( 'List View on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-post/toggle-list-view/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-top-toolbar',\n\t\tlabel: __( 'Toggle top toolbar' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core', 'fixedToolbar' );\n\t\t\tif ( isDistractionFree ) {\n\t\t\t\ttoggleDistractionFree();\n\t\t\t}\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisTopToolbar\n\t\t\t\t\t? __( 'Top toolbar off.' )\n\t\t\t\t\t: __( 'Top toolbar on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-post/toggle-top-toolbar/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', 'fixedToolbar' );\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-code-editor',\n\t\tlabel:\n\t\t\teditorMode === 'visual'\n\t\t\t\t? __( 'Open code editor' )\n\t\t\t\t: __( 'Exit code editor' ),\n\t\ticon: code,\n\t\tcallback: ( { close } ) => {\n\t\t\tswitchEditorMode( editorMode === 'visual' ? 'text' : 'visual' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-preferences',\n\t\tlabel: __( 'Editor preferences' ),\n\t\tcallback: () => {\n\t\t\topenModal( PREFERENCES_MODAL_NAME );\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-shortcut-help',\n\t\tlabel: __( 'Keyboard shortcuts' ),\n\t\ticon: keyboard,\n\t\tcallback: () => {\n\t\t\topenModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-breadcrumbs',\n\t\tlabel: showBlockBreadcrumbs\n\t\t\t? __( 'Hide block breadcrumbs' )\n\t\t\t: __( 'Show block breadcrumbs' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core', 'showBlockBreadcrumbs' );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tshowBlockBreadcrumbs\n\t\t\t\t\t? __( 'Breadcrumbs hidden.' )\n\t\t\t\t\t: __( 'Breadcrumbs visible.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-post/toggle-breadcrumbs/notice',\n\t\t\t\t\ttype: 'snackbar',\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/edit-post', '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/edit-post/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\tuseCommand( {\n\t\tname: 'core/preview-link',\n\t\tlabel: __( 'Preview in a new tab' ),\n\t\ticon: external,\n\t\tcallback: async ( { close } ) => {\n\t\t\tclose();\n\t\t\tconst postId = getCurrentPostId();\n\t\t\tconst link = await __unstableSaveForPreview();\n\t\t\twindow.open( link, `wp-preview-${ postId }` );\n\t\t},\n\t} );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAWA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAKA,IAAAQ,0BAAA,GAAAR,OAAA;AACA,IAAAS,iBAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AA3BA;AACA;AACA;;AAoBA;AACA;AACA;;AAKe,SAASW,iBAAiBA,CAAA,EAAG;EAC3C,MAAM;IACLC,kBAAkB;IAClBC,mBAAmB;IACnBC,gBAAgB;IAChBC;EACD,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAc,CAAC;EAChC,MAAM;IAAEC;EAAU,CAAC,GAAG,IAAAF,iBAAW,EAAEG,gBAAe,CAAC;EACnD,MAAM;IACLC,UAAU;IACVC,aAAa;IACbC,cAAc;IACdC,YAAY;IACZC,uBAAuB;IACvBC,oBAAoB;IACpBC,iBAAiB;IACjBC,YAAY;IACZC;EACD,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC5B,MAAM;MAAEC;IAAI,CAAC,GAAGD,MAAM,CAAEE,kBAAiB,CAAC;IAC1C,MAAM;MAAEC;IAAc,CAAC,GAAGH,MAAM,CAAEb,YAAc,CAAC;IACjD,MAAM;MAAEiB;IAAiB,CAAC,GAAGJ,MAAM,CAAEK,aAAY,CAAC;IAElD,OAAO;MACNd,aAAa,EAAES,MAAM,CAAEX,gBAAe,CAAC,CAACiB,0BAA0B,CACjEnB,YAAa,CAACoB,IAC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AAE;MACP,CACD,CAAC;IACF;EACD,CAAE,CAAC;EAEH,IAAAX,oBAAU,EAAE;IACXP,IAAI,EAAE,mBAAmB;IACzBQ,KAAK,EAAE,IAAAC,QAAE,EAAE,sBAAuB,CAAC;IACnCC,IAAI,EAAEkB,eAAQ;IACdd,QAAQ,EAAE,MAAAA,CAAQ;MAAEC;IAAM,CAAC,KAAM;MAChCA,KAAK,CAAC,CAAC;MACP,MAAMc,MAAM,GAAGvB,gBAAgB,CAAC,CAAC;MACjC,MAAMwB,IAAI,GAAG,MAAM1B,wBAAwB,CAAC,CAAC;MAC7C2B,MAAM,CAACC,IAAI,CAAEF,IAAI,EAAG,cAAcD,MAAQ,EAAE,CAAC;IAC9C;EACD,CAAE,CAAC;AACJ"}
|
|
1
|
+
{"version":3,"names":["_data","require","_i18n","_icons","_commands","_preferences","_interface","_editor","_notices","_keyboardShortcutHelpModal","_preferencesModal","_store","useCommonCommands","openGeneralSidebar","closeGeneralSidebar","useDispatch","editPostStore","openModal","interfaceStore","activeSidebar","isFullscreen","isPublishSidebarEnabled","useSelect","select","get","preferencesStore","getActiveComplementaryArea","name","editorStore","toggle","createInfoNotice","noticesStore","useCommand","label","__","icon","isRTL","drawerLeft","drawerRight","callback","close","blockDefault","fullscreen","id","type","actions","onClick","PREFERENCES_MODAL_NAME","keyboard","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","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\tkeyboard,\n\tfullscreen,\n\tformatListBullets,\n} from '@wordpress/icons';\nimport { useCommand } from '@wordpress/commands';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { KEYBOARD_SHORTCUT_HELP_MODAL_NAME } from '../../components/keyboard-shortcut-help-modal';\nimport { PREFERENCES_MODAL_NAME } from '../../components/preferences-modal';\nimport { store as editPostStore } from '../../store';\n\nexport default function useCommonCommands() {\n\tconst { openGeneralSidebar, closeGeneralSidebar } =\n\t\tuseDispatch( editPostStore );\n\tconst { openModal } = useDispatch( interfaceStore );\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: select(\n\t\t\t\t\tinterfaceStore\n\t\t\t\t).getActiveComplementaryArea( editPostStore.name ),\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/open-preferences',\n\t\tlabel: __( 'Editor preferences' ),\n\t\tcallback: () => {\n\t\t\topenModal( PREFERENCES_MODAL_NAME );\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-shortcut-help',\n\t\tlabel: __( 'Keyboard shortcuts' ),\n\t\ticon: keyboard,\n\t\tcallback: () => {\n\t\t\topenModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );\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/edit-post', '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/edit-post/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;AAQA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAKA,IAAAQ,0BAAA,GAAAR,OAAA;AACA,IAAAS,iBAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AAxBA;AACA;AACA;;AAiBA;AACA;AACA;;AAKe,SAASW,iBAAiBA,CAAA,EAAG;EAC3C,MAAM;IAAEC,kBAAkB;IAAEC;EAAoB,CAAC,GAChD,IAAAC,iBAAW,EAAEC,YAAc,CAAC;EAC7B,MAAM;IAAEC;EAAU,CAAC,GAAG,IAAAF,iBAAW,EAAEG,gBAAe,CAAC;EACnD,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,EAAEI,MAAM,CACpBL,gBACD,CAAC,CAACQ,0BAA0B,CAAEV,YAAa,CAACW,IAAK,CAAC;MAClDN,uBAAuB,EACtBE,MAAM,CAAEK,aAAY,CAAC,CAACP,uBAAuB,CAAC,CAAC;MAChDD,YAAY,EAAEI,GAAG,CAAE,gBAAgB,EAAE,gBAAiB;IACvD,CAAC;EACF,CAAC,EACD,EACD,CAAC;EACD,MAAM;IAAEK;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EAAE,uCAAuC;QAC3CC,IAAI,EAAE;MACP,CACD,CAAC;IACF;EACD,CAAE,CAAC;AACJ"}
|
package/build/index.js
CHANGED
|
@@ -79,7 +79,6 @@ var _blockLibrary = require("@wordpress/block-library");
|
|
|
79
79
|
var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
|
|
80
80
|
var _element = require("@wordpress/element");
|
|
81
81
|
var _data = require("@wordpress/data");
|
|
82
|
-
var _hooks = require("@wordpress/hooks");
|
|
83
82
|
var _preferences = require("@wordpress/preferences");
|
|
84
83
|
var _widgets = require("@wordpress/widgets");
|
|
85
84
|
var _editor = require("@wordpress/editor");
|
|
@@ -129,7 +128,6 @@ function initializeEditor(id, postType, postId, settings, initialEdits) {
|
|
|
129
128
|
(0, _data.dispatch)(_preferences.store).setDefaults('core/edit-post', {
|
|
130
129
|
fullscreenMode: true,
|
|
131
130
|
isPublishSidebarEnabled: true,
|
|
132
|
-
preferredStyleVariations: {},
|
|
133
131
|
themeStyles: true,
|
|
134
132
|
welcomeGuide: true,
|
|
135
133
|
welcomeGuideTemplate: true
|
|
@@ -166,34 +164,6 @@ function initializeEditor(id, postType, postId, settings, initialEdits) {
|
|
|
166
164
|
});
|
|
167
165
|
}
|
|
168
166
|
|
|
169
|
-
/*
|
|
170
|
-
* Prevent adding template part in the post editor.
|
|
171
|
-
* Only add the filter when the post editor is initialized, not imported.
|
|
172
|
-
* Also only add the filter(s) after registerCoreBlocks()
|
|
173
|
-
* so that common filters in the block library are not overwritten.
|
|
174
|
-
*/
|
|
175
|
-
(0, _hooks.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removeTemplatePartsFromInserter', (canInsert, blockType) => {
|
|
176
|
-
if (blockType.name === 'core/template-part') {
|
|
177
|
-
return false;
|
|
178
|
-
}
|
|
179
|
-
return canInsert;
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
/*
|
|
183
|
-
* Prevent adding post content block (except in query block) in the post editor.
|
|
184
|
-
* Only add the filter when the post editor is initialized, not imported.
|
|
185
|
-
* Also only add the filter(s) after registerCoreBlocks()
|
|
186
|
-
* so that common filters in the block library are not overwritten.
|
|
187
|
-
*/
|
|
188
|
-
(0, _hooks.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removePostContentFromInserter', (canInsert, blockType, rootClientId, {
|
|
189
|
-
getBlockParentsByBlockName
|
|
190
|
-
}) => {
|
|
191
|
-
if (blockType.name === 'core/post-content') {
|
|
192
|
-
return getBlockParentsByBlockName(rootClientId, 'core/query').length > 0;
|
|
193
|
-
}
|
|
194
|
-
return canInsert;
|
|
195
|
-
});
|
|
196
|
-
|
|
197
167
|
// Show a console log warning if the browser is not in Standards rendering mode.
|
|
198
168
|
const documentMode = document.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';
|
|
199
169
|
if (documentMode !== 'Standards') {
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blocks","require","_blockLibrary","_deprecated","_interopRequireDefault","_element","_data","_hooks","_preferences","_widgets","_editor","_editor2","_lockUnlock","_pluginBlockSettingsMenuItem","_pluginDocumentSettingPanel","_pluginMoreMenuItem","_pluginPostPublishPanel","_pluginPostStatusInfo","_pluginPrePublishPanel","_pluginSidebar","_pluginSidebarMoreMenuItem","_fullscreenModeClose","_mainDashboardButton","_store","PluginPostExcerpt","__experimentalPluginPostExcerpt","unlock","editorPrivateApis","exports","initializeEditor","id","postType","postId","settings","initialEdits","isMediumOrBigger","window","matchMedia","matches","target","document","getElementById","root","createRoot","dispatch","preferencesStore","setDefaults","fullscreenMode","isPublishSidebarEnabled","preferredStyleVariations","themeStyles","welcomeGuide","welcomeGuideTemplate","allowRightClickOverrides","editorMode","fixedToolbar","hiddenBlockTypes","inactivePanels","openPanels","showBlockBreadcrumbs","showIconLabels","showListViewByDefault","blocksStore","reapplyBlockTypeFilters","select","get","editorStore","setIsListViewOpened","registerCoreBlocks","registerLegacyWidgetBlock","inserter","registerWidgetGroupBlock","process","env","IS_GUTENBERG_PLUGIN","__experimentalRegisterExperimentalCoreBlocks","enableFSEBlocks","__unstableEnableFullSiteEditingBlocks","addFilter","canInsert","blockType","name","rootClientId","getBlockParentsByBlockName","length","documentMode","compatMode","console","warn","isIphone","navigator","userAgent","indexOf","addEventListener","event","editorScrollContainer","getElementsByClassName","scrollY","scrollTop","scrollTo","e","preventDefault","render","_react","createElement","default","reinitializeEditor","deprecated","since","version"],"sources":["@wordpress/edit-post/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport { dispatch, select } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\nimport {\n\tprivateApis as editorPrivateApis,\n\tstore as editorStore,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport './plugins';\nimport Editor from './editor';\nimport { unlock } from './lock-unlock';\n\nconst { PluginPostExcerpt: __experimentalPluginPostExcerpt } =\n\tunlock( editorPrivateApis );\n\n/**\n * Initializes and returns an instance of Editor.\n *\n * @param {string} id Unique identifier for editor instance.\n * @param {string} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit.\n * @param {?Object} settings Editor settings object.\n * @param {Object} initialEdits Programmatic edits to apply initially, to be\n * considered as non-user-initiated (bypass for\n * unsaved changes prompt).\n */\nexport function initializeEditor(\n\tid,\n\tpostType,\n\tpostId,\n\tsettings,\n\tinitialEdits\n) {\n\tconst isMediumOrBigger = window.matchMedia( '(min-width: 782px)' ).matches;\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-post', {\n\t\tfullscreenMode: true,\n\t\tisPublishSidebarEnabled: true,\n\t\tpreferredStyleVariations: {},\n\t\tthemeStyles: true,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tallowRightClickOverrides: true,\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\thiddenBlockTypes: [],\n\t\tinactivePanels: [],\n\t\topenPanels: [ 'post-status' ],\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowIconLabels: false,\n\t\tshowListViewByDefault: false,\n\t} );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\n\t// Check if the block list view should be open by default.\n\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\t// This behavior is disabled for small viewports.\n\tif (\n\t\tisMediumOrBigger &&\n\t\tselect( preferencesStore ).get( 'core', 'showListViewByDefault' ) &&\n\t\t! select( preferencesStore ).get( 'core', 'distractionFree' )\n\t) {\n\t\tdispatch( editorStore ).setIsListViewOpened( true );\n\t}\n\n\tregisterCoreBlocks();\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks,\n\t\t} );\n\t}\n\n\t/*\n\t * Prevent adding template part in the post editor.\n\t * Only add the filter when the post editor is initialized, not imported.\n\t * Also only add the filter(s) after registerCoreBlocks()\n\t * so that common filters in the block library are not overwritten.\n\t */\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'removeTemplatePartsFromInserter',\n\t\t( canInsert, blockType ) => {\n\t\t\tif ( blockType.name === 'core/template-part' ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn canInsert;\n\t\t}\n\t);\n\n\t/*\n\t * Prevent adding post content block (except in query block) in the post editor.\n\t * Only add the filter when the post editor is initialized, not imported.\n\t * Also only add the filter(s) after registerCoreBlocks()\n\t * so that common filters in the block library are not overwritten.\n\t */\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'removePostContentFromInserter',\n\t\t(\n\t\t\tcanInsert,\n\t\t\tblockType,\n\t\t\trootClientId,\n\t\t\t{ getBlockParentsByBlockName }\n\t\t) => {\n\t\t\tif ( blockType.name === 'core/post-content' ) {\n\t\t\t\treturn (\n\t\t\t\t\tgetBlockParentsByBlockName( rootClientId, 'core/query' )\n\t\t\t\t\t\t.length > 0\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn canInsert;\n\t\t}\n\t);\n\n\t// Show a console log warning if the browser is not in Standards rendering mode.\n\tconst documentMode =\n\t\tdocument.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';\n\tif ( documentMode !== 'Standards' ) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t\"Your browser is using Quirks Mode. \\nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins.\"\n\t\t);\n\t}\n\n\t// This is a temporary fix for a couple of issues specific to Webkit on iOS.\n\t// Without this hack the browser scrolls the mobile toolbar off-screen.\n\t// Once supported in Safari we can replace this in favor of preventScroll.\n\t// For details see issue #18632 and PR #18686\n\t// Specifically, we scroll `interface-interface-skeleton__body` to enable a fixed top toolbar.\n\t// But Mobile Safari forces the `html` element to scroll upwards, hiding the toolbar.\n\n\tconst isIphone = window.navigator.userAgent.indexOf( 'iPhone' ) !== -1;\n\tif ( isIphone ) {\n\t\twindow.addEventListener( 'scroll', ( event ) => {\n\t\t\tconst editorScrollContainer = document.getElementsByClassName(\n\t\t\t\t'interface-interface-skeleton__body'\n\t\t\t)[ 0 ];\n\t\t\tif ( event.target === document ) {\n\t\t\t\t// Scroll element into view by scrolling the editor container by the same amount\n\t\t\t\t// that Mobile Safari tried to scroll the html element upwards.\n\t\t\t\tif ( window.scrollY > 100 ) {\n\t\t\t\t\teditorScrollContainer.scrollTop =\n\t\t\t\t\t\teditorScrollContainer.scrollTop + window.scrollY;\n\t\t\t\t}\n\t\t\t\t// Undo unwanted scroll on html element, but only in the visual editor.\n\t\t\t\tif (\n\t\t\t\t\tdocument.getElementsByClassName( 'is-mode-visual' )[ 0 ]\n\t\t\t\t) {\n\t\t\t\t\twindow.scrollTo( 0, 0 );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t}\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(\n\t\t<Editor\n\t\t\tsettings={ settings }\n\t\t\tpostId={ postId }\n\t\t\tpostType={ postType }\n\t\t\tinitialEdits={ initialEdits }\n\t\t/>\n\t);\n\n\treturn root;\n}\n\n/**\n * Used to reinitialize the editor after an error. Now it's a deprecated noop function.\n */\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editPost.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginBlockSettingsMenuItem } from './components/block-settings-menu/plugin-block-settings-menu-item';\nexport { default as PluginDocumentSettingPanel } from './components/sidebar/plugin-document-setting-panel';\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\nexport { default as PluginPostPublishPanel } from './components/sidebar/plugin-post-publish-panel';\nexport { default as PluginPostStatusInfo } from './components/sidebar/plugin-post-status-info';\nexport { default as PluginPrePublishPanel } from './components/sidebar/plugin-pre-publish-panel';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as __experimentalFullscreenModeClose } from './components/header/fullscreen-mode-close';\nexport { default as __experimentalMainDashboardButton } from './components/header/main-dashboard-button';\nexport { __experimentalPluginPostExcerpt };\nexport { store } from './store';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAIA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AAIA,IAAAS,OAAA,GAAAT,OAAA;AAQAA,OAAA;AACAA,OAAA;AACA,IAAAU,QAAA,GAAAP,sBAAA,CAAAH,OAAA;AACA,IAAAW,WAAA,GAAAX,OAAA;AAkLA,IAAAY,4BAAA,GAAAT,sBAAA,CAAAH,OAAA;AACA,IAAAa,2BAAA,GAAAV,sBAAA,CAAAH,OAAA;AACA,IAAAc,mBAAA,GAAAX,sBAAA,CAAAH,OAAA;AACA,IAAAe,uBAAA,GAAAZ,sBAAA,CAAAH,OAAA;AACA,IAAAgB,qBAAA,GAAAb,sBAAA,CAAAH,OAAA;AACA,IAAAiB,sBAAA,GAAAd,sBAAA,CAAAH,OAAA;AACA,IAAAkB,cAAA,GAAAf,sBAAA,CAAAH,OAAA;AACA,IAAAmB,0BAAA,GAAAhB,sBAAA,CAAAH,OAAA;AACA,IAAAoB,oBAAA,GAAAjB,sBAAA,CAAAH,OAAA;AACA,IAAAqB,oBAAA,GAAAlB,sBAAA,CAAAH,OAAA;AAEA,IAAAsB,MAAA,GAAAtB,OAAA;AAzNA;AACA;AACA;;AAoBA;AACA;AACA;;AAMA,MAAM;EAAEuB,iBAAiB,EAAEC;AAAgC,CAAC,GAC3D,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;;AAE5B;A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C,OAAO,EAAE;EACV,CAAE,CAAC;AACJ"}
|
|
1
|
+
{"version":3,"names":["_blocks","require","_blockLibrary","_deprecated","_interopRequireDefault","_element","_data","_preferences","_widgets","_editor","_editor2","_lockUnlock","_pluginBlockSettingsMenuItem","_pluginDocumentSettingPanel","_pluginMoreMenuItem","_pluginPostPublishPanel","_pluginPostStatusInfo","_pluginPrePublishPanel","_pluginSidebar","_pluginSidebarMoreMenuItem","_fullscreenModeClose","_mainDashboardButton","_store","PluginPostExcerpt","__experimentalPluginPostExcerpt","unlock","editorPrivateApis","exports","initializeEditor","id","postType","postId","settings","initialEdits","isMediumOrBigger","window","matchMedia","matches","target","document","getElementById","root","createRoot","dispatch","preferencesStore","setDefaults","fullscreenMode","isPublishSidebarEnabled","themeStyles","welcomeGuide","welcomeGuideTemplate","allowRightClickOverrides","editorMode","fixedToolbar","hiddenBlockTypes","inactivePanels","openPanels","showBlockBreadcrumbs","showIconLabels","showListViewByDefault","blocksStore","reapplyBlockTypeFilters","select","get","editorStore","setIsListViewOpened","registerCoreBlocks","registerLegacyWidgetBlock","inserter","registerWidgetGroupBlock","process","env","IS_GUTENBERG_PLUGIN","__experimentalRegisterExperimentalCoreBlocks","enableFSEBlocks","__unstableEnableFullSiteEditingBlocks","documentMode","compatMode","console","warn","isIphone","navigator","userAgent","indexOf","addEventListener","event","editorScrollContainer","getElementsByClassName","scrollY","scrollTop","scrollTo","e","preventDefault","render","_react","createElement","default","reinitializeEditor","deprecated","since","version"],"sources":["@wordpress/edit-post/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport { dispatch, select } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\nimport {\n\tprivateApis as editorPrivateApis,\n\tstore as editorStore,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport './plugins';\nimport Editor from './editor';\nimport { unlock } from './lock-unlock';\n\nconst { PluginPostExcerpt: __experimentalPluginPostExcerpt } =\n\tunlock( editorPrivateApis );\n\n/**\n * Initializes and returns an instance of Editor.\n *\n * @param {string} id Unique identifier for editor instance.\n * @param {string} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit.\n * @param {?Object} settings Editor settings object.\n * @param {Object} initialEdits Programmatic edits to apply initially, to be\n * considered as non-user-initiated (bypass for\n * unsaved changes prompt).\n */\nexport function initializeEditor(\n\tid,\n\tpostType,\n\tpostId,\n\tsettings,\n\tinitialEdits\n) {\n\tconst isMediumOrBigger = window.matchMedia( '(min-width: 782px)' ).matches;\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-post', {\n\t\tfullscreenMode: true,\n\t\tisPublishSidebarEnabled: true,\n\t\tthemeStyles: true,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tallowRightClickOverrides: true,\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\thiddenBlockTypes: [],\n\t\tinactivePanels: [],\n\t\topenPanels: [ 'post-status' ],\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowIconLabels: false,\n\t\tshowListViewByDefault: false,\n\t} );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\n\t// Check if the block list view should be open by default.\n\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\t// This behavior is disabled for small viewports.\n\tif (\n\t\tisMediumOrBigger &&\n\t\tselect( preferencesStore ).get( 'core', 'showListViewByDefault' ) &&\n\t\t! select( preferencesStore ).get( 'core', 'distractionFree' )\n\t) {\n\t\tdispatch( editorStore ).setIsListViewOpened( true );\n\t}\n\n\tregisterCoreBlocks();\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks,\n\t\t} );\n\t}\n\n\t// Show a console log warning if the browser is not in Standards rendering mode.\n\tconst documentMode =\n\t\tdocument.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';\n\tif ( documentMode !== 'Standards' ) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t\"Your browser is using Quirks Mode. \\nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins.\"\n\t\t);\n\t}\n\n\t// This is a temporary fix for a couple of issues specific to Webkit on iOS.\n\t// Without this hack the browser scrolls the mobile toolbar off-screen.\n\t// Once supported in Safari we can replace this in favor of preventScroll.\n\t// For details see issue #18632 and PR #18686\n\t// Specifically, we scroll `interface-interface-skeleton__body` to enable a fixed top toolbar.\n\t// But Mobile Safari forces the `html` element to scroll upwards, hiding the toolbar.\n\n\tconst isIphone = window.navigator.userAgent.indexOf( 'iPhone' ) !== -1;\n\tif ( isIphone ) {\n\t\twindow.addEventListener( 'scroll', ( event ) => {\n\t\t\tconst editorScrollContainer = document.getElementsByClassName(\n\t\t\t\t'interface-interface-skeleton__body'\n\t\t\t)[ 0 ];\n\t\t\tif ( event.target === document ) {\n\t\t\t\t// Scroll element into view by scrolling the editor container by the same amount\n\t\t\t\t// that Mobile Safari tried to scroll the html element upwards.\n\t\t\t\tif ( window.scrollY > 100 ) {\n\t\t\t\t\teditorScrollContainer.scrollTop =\n\t\t\t\t\t\teditorScrollContainer.scrollTop + window.scrollY;\n\t\t\t\t}\n\t\t\t\t// Undo unwanted scroll on html element, but only in the visual editor.\n\t\t\t\tif (\n\t\t\t\t\tdocument.getElementsByClassName( 'is-mode-visual' )[ 0 ]\n\t\t\t\t) {\n\t\t\t\t\twindow.scrollTo( 0, 0 );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t}\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(\n\t\t<Editor\n\t\t\tsettings={ settings }\n\t\t\tpostId={ postId }\n\t\t\tpostType={ postType }\n\t\t\tinitialEdits={ initialEdits }\n\t\t/>\n\t);\n\n\treturn root;\n}\n\n/**\n * Used to reinitialize the editor after an error. Now it's a deprecated noop function.\n */\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editPost.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginBlockSettingsMenuItem } from './components/block-settings-menu/plugin-block-settings-menu-item';\nexport { default as PluginDocumentSettingPanel } from './components/sidebar/plugin-document-setting-panel';\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\nexport { default as PluginPostPublishPanel } from './components/sidebar/plugin-post-publish-panel';\nexport { default as PluginPostStatusInfo } from './components/sidebar/plugin-post-status-info';\nexport { default as PluginPrePublishPanel } from './components/sidebar/plugin-pre-publish-panel';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as __experimentalFullscreenModeClose } from './components/header/fullscreen-mode-close';\nexport { default as __experimentalMainDashboardButton } from './components/header/main-dashboard-button';\nexport { __experimentalPluginPostExcerpt };\nexport { store } from './store';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A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AAIO,CAAC,IAAMA,CAAC,CAACC,cAAc,CAAC,CAAC,EAAE,KAAM,CAAC;EAErEnD,IAAI,CAACoD,MAAM,CACV,IAAAC,MAAA,CAAAC,aAAA,EAACrF,QAAA,CAAAsF,OAAM;IACNhE,QAAQ,EAAGA,QAAU;IACrBD,MAAM,EAAGA,MAAQ;IACjBD,QAAQ,EAAGA,QAAU;IACrBG,YAAY,EAAGA;EAAc,CAC7B,CACF,CAAC;EAED,OAAOQ,IAAI;AACZ;;AAEA;AACA;AACA;AACO,SAASwD,kBAAkBA,CAAA,EAAG;EACpC,IAAAC,mBAAU,EAAE,gCAAgC,EAAE;IAC7CC,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;AACJ"}
|
package/build/index.native.js
CHANGED
|
@@ -41,7 +41,6 @@ function initializeEditor(id, postType, postId) {
|
|
|
41
41
|
inactivePanels: [],
|
|
42
42
|
isPublishSidebarEnabled: true,
|
|
43
43
|
openPanels: ['post-status'],
|
|
44
|
-
preferredStyleVariations: {},
|
|
45
44
|
welcomeGuide: true
|
|
46
45
|
});
|
|
47
46
|
(0, _data.dispatch)(_preferences.store).setDefaults('core', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["require","_data","_preferences","_store","_editor","_interopRequireDefault","initializeEditor","id","postType","postId","dispatch","preferencesStore","setDefaults","editorMode","fullscreenMode","inactivePanels","isPublishSidebarEnabled","openPanels","
|
|
1
|
+
{"version":3,"names":["require","_data","_preferences","_store","_editor","_interopRequireDefault","initializeEditor","id","postType","postId","dispatch","preferencesStore","setDefaults","editorMode","fullscreenMode","inactivePanels","isPublishSidebarEnabled","openPanels","welcomeGuide","hiddenBlockTypes","fixedToolbar","_react","createElement","default"],"sources":["@wordpress/edit-post/src/index.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport '@wordpress/core-data';\nimport '@wordpress/format-library';\nimport { dispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nexport { store } from './store';\nimport Editor from './editor';\n\n/**\n * Initializes the Editor and returns a componentProvider\n * that can be registered with `AppRegistry.registerComponent`\n *\n * @param {string} id Unique identifier for editor instance.\n * @param {Object} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit (unused right now)\n */\nexport function initializeEditor( id, postType, postId ) {\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-post', {\n\t\teditorMode: 'visual',\n\t\tfullscreenMode: true,\n\t\tinactivePanels: [],\n\t\tisPublishSidebarEnabled: true,\n\t\topenPanels: [ 'post-status' ],\n\t\twelcomeGuide: true,\n\t} );\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\thiddenBlockTypes: [],\n\t\tinactivePanels: [],\n\t\topenPanels: [ 'post-status' ],\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tfixedToolbar: false,\n\t} );\n\n\treturn <Editor postId={ postId } postType={ postType } />;\n}\n"],"mappings":";;;;;;;;;;;;;;AAGAA,OAAA;AACAA,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAC,sBAAA,CAAAL,OAAA;AAZA;AACA;AACA;;AAMA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASM,gBAAgBA,CAAEC,EAAE,EAAEC,QAAQ,EAAEC,MAAM,EAAG;EACxD,IAAAC,cAAQ,EAAEC,kBAAiB,CAAC,CAACC,WAAW,CAAE,gBAAgB,EAAE;IAC3DC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,IAAI;IACpBC,cAAc,EAAE,EAAE;IAClBC,uBAAuB,EAAE,IAAI;IAC7BC,UAAU,EAAE,CAAE,aAAa,CAAE;IAC7BC,YAAY,EAAE;EACf,CAAE,CAAC;EACH,IAAAR,cAAQ,EAAEC,kBAAiB,CAAC,CAACC,WAAW,CAAE,MAAM,EAAE;IACjDO,gBAAgB,EAAE,EAAE;IACpBJ,cAAc,EAAE,EAAE;IAClBE,UAAU,EAAE,CAAE,aAAa;EAC5B,CAAE,CAAC;EAEH,IAAAP,cAAQ,EAAEC,kBAAiB,CAAC,CAACC,WAAW,CAAE,MAAM,EAAE;IACjDQ,YAAY,EAAE;EACf,CAAE,CAAC;EAEH,OAAO,IAAAC,MAAA,CAAAC,aAAA,EAAClB,OAAA,CAAAmB,OAAM;IAACd,MAAM,EAAGA,MAAQ;IAACD,QAAQ,EAAGA;EAAU,CAAE,CAAC;AAC1D"}
|
package/build/store/actions.js
CHANGED
|
@@ -18,14 +18,10 @@ exports.setAvailableMetaBoxesPerLocation = setAvailableMetaBoxesPerLocation;
|
|
|
18
18
|
exports.setIsEditingTemplate = setIsEditingTemplate;
|
|
19
19
|
exports.togglePinnedPluginItem = exports.toggleFeature = exports.toggleEditorPanelOpened = exports.toggleEditorPanelEnabled = exports.toggleDistractionFree = exports.switchEditorMode = exports.showBlockTypes = exports.setIsListViewOpened = exports.setIsInserterOpened = void 0;
|
|
20
20
|
exports.togglePublishSidebar = togglePublishSidebar;
|
|
21
|
-
exports.updatePreferredStyleVariations =
|
|
22
|
-
var _i18n = require("@wordpress/i18n");
|
|
21
|
+
exports.updatePreferredStyleVariations = updatePreferredStyleVariations;
|
|
23
22
|
var _apiFetch = _interopRequireDefault(require("@wordpress/api-fetch"));
|
|
24
23
|
var _interface = require("@wordpress/interface");
|
|
25
24
|
var _preferences = require("@wordpress/preferences");
|
|
26
|
-
var _a11y = require("@wordpress/a11y");
|
|
27
|
-
var _notices = require("@wordpress/notices");
|
|
28
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
29
25
|
var _editor = require("@wordpress/editor");
|
|
30
26
|
var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
|
|
31
27
|
var _hooks = require("@wordpress/hooks");
|
|
@@ -46,13 +42,8 @@ var _lockUnlock = require("../lock-unlock");
|
|
|
46
42
|
* @param {?string} name Sidebar name to be opened.
|
|
47
43
|
*/
|
|
48
44
|
const openGeneralSidebar = name => ({
|
|
49
|
-
dispatch,
|
|
50
45
|
registry
|
|
51
46
|
}) => {
|
|
52
|
-
const isDistractionFree = registry.select(_preferences.store).get('core', 'distractionFree');
|
|
53
|
-
if (isDistractionFree) {
|
|
54
|
-
dispatch.toggleDistractionFree();
|
|
55
|
-
}
|
|
56
47
|
registry.dispatch(_interface.store).enableComplementaryArea(_.store.name, name);
|
|
57
48
|
};
|
|
58
49
|
|
|
@@ -209,24 +200,19 @@ const toggleFeature = feature => ({
|
|
|
209
200
|
/**
|
|
210
201
|
* Triggers an action used to switch editor mode.
|
|
211
202
|
*
|
|
203
|
+
* @deprecated
|
|
204
|
+
*
|
|
212
205
|
* @param {string} mode The editor mode.
|
|
213
206
|
*/
|
|
214
207
|
exports.toggleFeature = toggleFeature;
|
|
215
208
|
const switchEditorMode = mode => ({
|
|
216
|
-
dispatch,
|
|
217
209
|
registry
|
|
218
210
|
}) => {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
}
|
|
225
|
-
if (mode === 'text' && registry.select(_preferences.store).get('core', 'distractionFree')) {
|
|
226
|
-
dispatch.toggleDistractionFree();
|
|
227
|
-
}
|
|
228
|
-
const message = mode === 'visual' ? (0, _i18n.__)('Visual editor selected') : (0, _i18n.__)('Code editor selected');
|
|
229
|
-
(0, _a11y.speak)(message, 'assertive');
|
|
211
|
+
(0, _deprecated.default)("dispatch( 'core/edit-post' ).switchEditorMode", {
|
|
212
|
+
since: '6.6',
|
|
213
|
+
alternative: "dispatch( 'core/editor').switchEditorMode"
|
|
214
|
+
});
|
|
215
|
+
registry.dispatch(_editor.store).switchEditorMode(mode);
|
|
230
216
|
};
|
|
231
217
|
|
|
232
218
|
/**
|
|
@@ -245,41 +231,24 @@ const togglePinnedPluginItem = pluginName => ({
|
|
|
245
231
|
/**
|
|
246
232
|
* Returns an action object used in signaling that a style should be auto-applied when a block is created.
|
|
247
233
|
*
|
|
248
|
-
* @
|
|
249
|
-
* @param {?string} blockStyle Name of the style that should be auto applied. If undefined, the "auto apply" setting of the block is removed.
|
|
234
|
+
* @deprecated
|
|
250
235
|
*/
|
|
251
236
|
exports.togglePinnedPluginItem = togglePinnedPluginItem;
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
// When the blockStyle is omitted, remove the block's preferred variation.
|
|
262
|
-
if (!blockStyle) {
|
|
263
|
-
const updatedVariations = {
|
|
264
|
-
...existingVariations
|
|
265
|
-
};
|
|
266
|
-
delete updatedVariations[blockName];
|
|
267
|
-
registry.dispatch(_preferences.store).set('core/edit-post', 'preferredStyleVariations', updatedVariations);
|
|
268
|
-
} else {
|
|
269
|
-
// Else add the variation.
|
|
270
|
-
registry.dispatch(_preferences.store).set('core/edit-post', 'preferredStyleVariations', {
|
|
271
|
-
...existingVariations,
|
|
272
|
-
[blockName]: blockStyle
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
};
|
|
237
|
+
function updatePreferredStyleVariations() {
|
|
238
|
+
(0, _deprecated.default)("dispatch( 'core/edit-post' ).updatePreferredStyleVariations", {
|
|
239
|
+
since: '6.6',
|
|
240
|
+
hint: 'Preferred Style Variations are not supported anymore.'
|
|
241
|
+
});
|
|
242
|
+
return {
|
|
243
|
+
type: 'NOTHING'
|
|
244
|
+
};
|
|
245
|
+
}
|
|
276
246
|
|
|
277
247
|
/**
|
|
278
248
|
* Update the provided block types to be visible.
|
|
279
249
|
*
|
|
280
250
|
* @param {string[]} blockNames Names of block types to show.
|
|
281
251
|
*/
|
|
282
|
-
exports.updatePreferredStyleVariations = updatePreferredStyleVariations;
|
|
283
252
|
const showBlockTypes = blockNames => ({
|
|
284
253
|
registry
|
|
285
254
|
}) => {
|
|
@@ -509,40 +478,18 @@ const initializeMetaBoxes = () => ({
|
|
|
509
478
|
* Action that toggles Distraction free mode.
|
|
510
479
|
* Distraction free mode expects there are no sidebars, as due to the
|
|
511
480
|
* z-index values set, you can't close sidebars.
|
|
481
|
+
*
|
|
482
|
+
* @deprecated
|
|
512
483
|
*/
|
|
513
484
|
exports.initializeMetaBoxes = initializeMetaBoxes;
|
|
514
485
|
const toggleDistractionFree = () => ({
|
|
515
|
-
dispatch,
|
|
516
486
|
registry
|
|
517
487
|
}) => {
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
}
|
|
522
|
-
if (!isDistractionFree) {
|
|
523
|
-
registry.batch(() => {
|
|
524
|
-
registry.dispatch(_preferences.store).set('core', 'fixedToolbar', true);
|
|
525
|
-
registry.dispatch(_editor.store).setIsInserterOpened(false);
|
|
526
|
-
registry.dispatch(_editor.store).setIsListViewOpened(false);
|
|
527
|
-
dispatch.closeGeneralSidebar();
|
|
528
|
-
});
|
|
529
|
-
}
|
|
530
|
-
registry.batch(() => {
|
|
531
|
-
registry.dispatch(_preferences.store).set('core', 'distractionFree', !isDistractionFree);
|
|
532
|
-
registry.dispatch(_notices.store).createInfoNotice(isDistractionFree ? (0, _i18n.__)('Distraction free off.') : (0, _i18n.__)('Distraction free on.'), {
|
|
533
|
-
id: 'core/edit-post/distraction-free-mode/notice',
|
|
534
|
-
type: 'snackbar',
|
|
535
|
-
actions: [{
|
|
536
|
-
label: (0, _i18n.__)('Undo'),
|
|
537
|
-
onClick: () => {
|
|
538
|
-
registry.batch(() => {
|
|
539
|
-
registry.dispatch(_preferences.store).set('core', 'fixedToolbar', isDistractionFree ? true : false);
|
|
540
|
-
registry.dispatch(_preferences.store).toggle('core', 'distractionFree');
|
|
541
|
-
});
|
|
542
|
-
}
|
|
543
|
-
}]
|
|
544
|
-
});
|
|
488
|
+
(0, _deprecated.default)("dispatch( 'core/edit-post' ).toggleDistractionFree", {
|
|
489
|
+
since: '6.6',
|
|
490
|
+
alternative: "dispatch( 'core/editor').toggleDistractionFree"
|
|
545
491
|
});
|
|
492
|
+
registry.dispatch(_editor.store).toggleDistractionFree();
|
|
546
493
|
};
|
|
547
494
|
exports.toggleDistractionFree = toggleDistractionFree;
|
|
548
495
|
//# sourceMappingURL=actions.js.map
|