@wordpress/edit-site 3.0.24 → 4.0.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 +12 -0
- package/LICENSE.md +1 -1
- package/README.md +7 -1
- package/build/components/block-editor/resizable-editor.js +1 -0
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/code-editor/code-editor-text-area.js +95 -0
- package/build/components/code-editor/code-editor-text-area.js.map +1 -0
- package/build/components/code-editor/index.js +79 -0
- package/build/components/code-editor/index.js.map +1 -0
- package/build/components/editor/index.js +39 -9
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +81 -22
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +4 -6
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +1 -0
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/header.js +2 -7
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/navigation-button.js +35 -12
- package/build/components/global-styles/navigation-button.js.map +1 -1
- package/build/components/global-styles/palette.js +3 -3
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/preview.js +46 -15
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +9 -12
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +2 -3
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-block.js +0 -1
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-color-palette.js +0 -2
- package/build/components/global-styles/screen-color-palette.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +5 -6
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +0 -2
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +6 -12
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-root.js +22 -3
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +138 -0
- package/build/components/global-styles/screen-style-variations.js.map +1 -0
- package/build/components/global-styles/screen-text-color.js +6 -12
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography-element.js +0 -2
- package/build/components/global-styles/screen-typography-element.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +2 -3
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/ui.js +31 -14
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/header/index.js +12 -4
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/mode-switcher/index.js +78 -0
- package/build/components/header/mode-switcher/index.js.map +1 -0
- package/build/components/header/more-menu/copy-content-menu-item.js +74 -0
- package/build/components/header/more-menu/copy-content-menu-item.js.map +1 -0
- package/build/components/header/more-menu/index.js +72 -39
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/{plugins → components/header/more-menu}/site-export.js +0 -0
- package/build/components/header/more-menu/site-export.js.map +1 -0
- package/build/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
- package/build/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build/components/header/tools-more-menu-group/index.js +1 -5
- package/build/components/header/tools-more-menu-group/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +45 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -0
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +56 -0
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
- package/build/components/keyboard-shortcut-help-modal/index.js +137 -0
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -0
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +65 -0
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
- package/build/components/keyboard-shortcuts/index.js +26 -1
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/list/actions/index.js +5 -4
- package/build/components/list/actions/index.js.map +1 -1
- package/build/components/list/actions/rename-menu-item.js +3 -3
- package/build/components/list/actions/rename-menu-item.js.map +1 -1
- package/build/components/list/added-by.js +51 -50
- package/build/components/list/added-by.js.map +1 -1
- package/build/components/routes/redirect-to-homepage.js +87 -0
- package/build/components/routes/redirect-to-homepage.js.map +1 -0
- package/build/components/secondary-sidebar/inserter-sidebar.js +13 -3
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +7 -5
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/default-sidebar.js +4 -2
- package/build/components/sidebar/default-sidebar.js.map +1 -1
- package/build/components/sidebar/global-styles-sidebar.js +1 -0
- package/build/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build/components/url-query-controller/index.js +1 -38
- package/build/components/url-query-controller/index.js.map +1 -1
- package/build/index.js +10 -5
- package/build/index.js.map +1 -1
- package/build/store/actions.js +29 -27
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +2 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/reducer.js +11 -0
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +13 -0
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-editor/resizable-editor.js +1 -0
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/code-editor/code-editor-text-area.js +83 -0
- package/build-module/components/code-editor/code-editor-text-area.js.map +1 -0
- package/build-module/components/code-editor/index.js +62 -0
- package/build-module/components/code-editor/index.js.map +1 -0
- package/build-module/components/editor/index.js +38 -10
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +82 -23
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +1 -1
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +1 -1
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/header.js +2 -5
- package/build-module/components/global-styles/header.js.map +1 -1
- package/build-module/components/global-styles/navigation-button.js +35 -10
- package/build-module/components/global-styles/navigation-button.js.map +1 -1
- package/build-module/components/global-styles/palette.js +2 -2
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/preview.js +45 -15
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +9 -13
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +1 -2
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +0 -1
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-color-palette.js +0 -2
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +2 -3
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +0 -2
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +7 -13
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +21 -4
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +119 -0
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -0
- package/build-module/components/global-styles/screen-text-color.js +7 -13
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography-element.js +0 -2
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +1 -2
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/ui.js +29 -14
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/header/index.js +13 -5
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/mode-switcher/index.js +65 -0
- package/build-module/components/header/mode-switcher/index.js.map +1 -0
- package/build-module/components/header/more-menu/copy-content-menu-item.js +59 -0
- package/build-module/components/header/more-menu/copy-content-menu-item.js.map +1 -0
- package/build-module/components/header/more-menu/index.js +67 -40
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/{plugins → components/header/more-menu}/site-export.js +0 -0
- package/build-module/components/header/more-menu/site-export.js.map +1 -0
- package/build-module/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
- package/build-module/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build-module/components/header/tools-more-menu-group/index.js +2 -5
- package/build-module/components/header/tools-more-menu-group/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +36 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -0
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +44 -0
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
- package/build-module/components/keyboard-shortcut-help-modal/index.js +120 -0
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -0
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +58 -0
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
- package/build-module/components/keyboard-shortcuts/index.js +26 -1
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/list/actions/index.js +5 -4
- package/build-module/components/list/actions/index.js.map +1 -1
- package/build-module/components/list/actions/rename-menu-item.js +3 -3
- package/build-module/components/list/actions/rename-menu-item.js.map +1 -1
- package/build-module/components/list/added-by.js +52 -51
- package/build-module/components/list/added-by.js.map +1 -1
- package/build-module/components/routes/redirect-to-homepage.js +75 -0
- package/build-module/components/routes/redirect-to-homepage.js.map +1 -0
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +14 -4
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +7 -5
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/default-sidebar.js +4 -2
- package/build-module/components/sidebar/default-sidebar.js.map +1 -1
- package/build-module/components/sidebar/global-styles-sidebar.js +1 -0
- package/build-module/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build-module/components/url-query-controller/index.js +3 -40
- package/build-module/components/url-query-controller/index.js.map +1 -1
- package/build-module/index.js +9 -4
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +25 -25
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +2 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/reducer.js +11 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +11 -0
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +202 -72
- package/build-style/style.css +202 -72
- package/package.json +28 -30
- package/src/components/block-editor/resizable-editor.js +1 -0
- package/src/components/block-editor/style.scss +15 -23
- package/src/components/code-editor/code-editor-text-area.js +79 -0
- package/src/components/code-editor/index.js +65 -0
- package/src/components/code-editor/style.scss +100 -0
- package/src/components/editor/index.js +55 -10
- package/src/components/global-styles/border-panel.js +106 -42
- package/src/components/global-styles/context-menu.js +1 -1
- package/src/components/global-styles/global-styles-provider.js +1 -2
- package/src/components/global-styles/header.js +3 -5
- package/src/components/global-styles/navigation-button.js +31 -10
- package/src/components/global-styles/palette.js +6 -2
- package/src/components/global-styles/preview.js +46 -18
- package/src/components/global-styles/screen-background-color.js +7 -12
- package/src/components/global-styles/screen-block-list.js +1 -2
- package/src/components/global-styles/screen-block.js +1 -1
- package/src/components/global-styles/screen-color-palette.js +0 -2
- package/src/components/global-styles/screen-colors.js +2 -3
- package/src/components/global-styles/screen-layout.js +1 -5
- package/src/components/global-styles/screen-link-color.js +6 -16
- package/src/components/global-styles/screen-root.js +32 -3
- package/src/components/global-styles/screen-style-variations.js +130 -0
- package/src/components/global-styles/screen-text-color.js +6 -16
- package/src/components/global-styles/screen-typography-element.js +0 -4
- package/src/components/global-styles/screen-typography.js +2 -3
- package/src/components/global-styles/style.scss +24 -25
- package/src/components/global-styles/ui.js +55 -25
- package/src/components/header/document-actions/style.scss +1 -9
- package/src/components/header/index.js +10 -2
- package/src/components/header/mode-switcher/index.js +67 -0
- package/src/components/header/more-menu/copy-content-menu-item.js +53 -0
- package/src/components/header/more-menu/index.js +107 -44
- package/src/{plugins → components/header/more-menu}/site-export.js +0 -0
- package/src/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
- package/src/components/header/style.scss +2 -1
- package/src/components/header/tools-more-menu-group/index.js +2 -7
- package/src/components/keyboard-shortcut-help-modal/config.js +27 -0
- package/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +41 -0
- package/src/components/keyboard-shortcut-help-modal/index.js +135 -0
- package/src/components/keyboard-shortcut-help-modal/shortcut.js +73 -0
- package/src/components/keyboard-shortcut-help-modal/style.scss +66 -0
- package/src/components/keyboard-shortcuts/index.js +27 -1
- package/src/components/list/actions/index.js +5 -4
- package/src/components/list/actions/rename-menu-item.js +3 -3
- package/src/components/list/added-by.js +57 -63
- package/src/components/routes/redirect-to-homepage.js +71 -0
- package/src/components/secondary-sidebar/inserter-sidebar.js +14 -3
- package/src/components/secondary-sidebar/list-view-sidebar.js +12 -5
- package/src/components/secondary-sidebar/style.scss +0 -4
- package/src/components/sidebar/default-sidebar.js +2 -0
- package/src/components/sidebar/global-styles-sidebar.js +1 -0
- package/src/components/sidebar/style.scss +21 -14
- package/src/components/url-query-controller/index.js +3 -35
- package/src/index.js +10 -3
- package/src/store/actions.js +24 -37
- package/src/store/defaults.js +1 -0
- package/src/store/reducer.js +6 -0
- package/src/store/selectors.js +11 -0
- package/src/store/test/actions.js +2 -92
- package/src/style.scss +2 -0
- package/build/plugins/index.js +0 -28
- package/build/plugins/index.js.map +0 -1
- package/build/plugins/site-export.js.map +0 -1
- package/build/plugins/welcome-guide-menu-item.js.map +0 -1
- package/build-module/plugins/index.js +0 -20
- package/build-module/plugins/index.js.map +0 -1
- package/build-module/plugins/site-export.js.map +0 -1
- package/build-module/plugins/welcome-guide-menu-item.js.map +0 -1
- package/src/plugins/index.js +0 -24
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { MenuItemsChoice, MenuGroup } from '@wordpress/components';
|
|
8
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
9
|
+
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Internal dependencies
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { store as editSiteStore } from '../../../store';
|
|
19
|
+
/**
|
|
20
|
+
* Set of available mode options.
|
|
21
|
+
*
|
|
22
|
+
* @type {Array}
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const MODES = [{
|
|
26
|
+
value: 'visual',
|
|
27
|
+
label: __('Visual editor')
|
|
28
|
+
}, {
|
|
29
|
+
value: 'text',
|
|
30
|
+
label: __('Code editor')
|
|
31
|
+
}];
|
|
32
|
+
|
|
33
|
+
function ModeSwitcher() {
|
|
34
|
+
const {
|
|
35
|
+
shortcut,
|
|
36
|
+
mode
|
|
37
|
+
} = useSelect(select => ({
|
|
38
|
+
shortcut: select(keyboardShortcutsStore).getShortcutRepresentation('core/edit-site/toggle-mode'),
|
|
39
|
+
isRichEditingEnabled: select(editSiteStore).getSettings().richEditingEnabled,
|
|
40
|
+
isCodeEditingEnabled: select(editSiteStore).getSettings().codeEditingEnabled,
|
|
41
|
+
mode: select(editSiteStore).getEditorMode()
|
|
42
|
+
}), []);
|
|
43
|
+
const {
|
|
44
|
+
switchEditorMode
|
|
45
|
+
} = useDispatch(editSiteStore);
|
|
46
|
+
const choices = MODES.map(choice => {
|
|
47
|
+
if (choice.value !== mode) {
|
|
48
|
+
return { ...choice,
|
|
49
|
+
shortcut
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return choice;
|
|
54
|
+
});
|
|
55
|
+
return createElement(MenuGroup, {
|
|
56
|
+
label: __('Editor')
|
|
57
|
+
}, createElement(MenuItemsChoice, {
|
|
58
|
+
choices: choices,
|
|
59
|
+
value: mode,
|
|
60
|
+
onSelect: switchEditorMode
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export default ModeSwitcher;
|
|
65
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/header/mode-switcher/index.js"],"names":["__","MenuItemsChoice","MenuGroup","useSelect","useDispatch","store","keyboardShortcutsStore","editSiteStore","MODES","value","label","ModeSwitcher","shortcut","mode","select","getShortcutRepresentation","isRichEditingEnabled","getSettings","richEditingEnabled","isCodeEditingEnabled","codeEditingEnabled","getEditorMode","switchEditorMode","choices","map","choice"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,EAA0BC,SAA1B,QAA2C,uBAA3C;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,sBAAlB,QAAgD,+BAAhD;AAEA;AACA;AACA;;AACA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,aAAlB,QAAuC,gBAAvC;AAEA;AACA;AACA;AACA;AACA;;AACA,MAAMC,KAAK,GAAG,CACb;AACCC,EAAAA,KAAK,EAAE,QADR;AAECC,EAAAA,KAAK,EAAEV,EAAE,CAAE,eAAF;AAFV,CADa,EAKb;AACCS,EAAAA,KAAK,EAAE,MADR;AAECC,EAAAA,KAAK,EAAEV,EAAE,CAAE,aAAF;AAFV,CALa,CAAd;;AAWA,SAASW,YAAT,GAAwB;AACvB,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAqBV,SAAS,CACjCW,MAAF,KAAgB;AACfF,IAAAA,QAAQ,EAAEE,MAAM,CACfR,sBADe,CAAN,CAERS,yBAFQ,CAEmB,4BAFnB,CADK;AAIfC,IAAAA,oBAAoB,EAAEF,MAAM,CAAEP,aAAF,CAAN,CAAwBU,WAAxB,GACpBC,kBALa;AAMfC,IAAAA,oBAAoB,EAAEL,MAAM,CAAEP,aAAF,CAAN,CAAwBU,WAAxB,GACpBG,kBAPa;AAQfP,IAAAA,IAAI,EAAEC,MAAM,CAAEP,aAAF,CAAN,CAAwBc,aAAxB;AARS,GAAhB,CADmC,EAWnC,EAXmC,CAApC;AAaA,QAAM;AAAEC,IAAAA;AAAF,MAAuBlB,WAAW,CAAEG,aAAF,CAAxC;AAEA,QAAMgB,OAAO,GAAGf,KAAK,CAACgB,GAAN,CAAaC,MAAF,IAAc;AACxC,QAAKA,MAAM,CAAChB,KAAP,KAAiBI,IAAtB,EAA6B;AAC5B,aAAO,EAAE,GAAGY,MAAL;AAAab,QAAAA;AAAb,OAAP;AACA;;AACD,WAAOa,MAAP;AACA,GALe,CAAhB;AAOA,SACC,cAAC,SAAD;AAAW,IAAA,KAAK,EAAGzB,EAAE,CAAE,QAAF;AAArB,KACC,cAAC,eAAD;AACC,IAAA,OAAO,EAAGuB,OADX;AAEC,IAAA,KAAK,EAAGV,IAFT;AAGC,IAAA,QAAQ,EAAGS;AAHZ,IADD,CADD;AASA;;AAED,eAAeX,YAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuItemsChoice, MenuGroup } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\n\n/**\n * Set of available mode options.\n *\n * @type {Array}\n */\nconst MODES = [\n\t{\n\t\tvalue: 'visual',\n\t\tlabel: __( 'Visual editor' ),\n\t},\n\t{\n\t\tvalue: 'text',\n\t\tlabel: __( 'Code editor' ),\n\t},\n];\n\nfunction ModeSwitcher() {\n\tconst { shortcut, mode } = useSelect(\n\t\t( select ) => ( {\n\t\t\tshortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getShortcutRepresentation( 'core/edit-site/toggle-mode' ),\n\t\t\tisRichEditingEnabled: select( editSiteStore ).getSettings()\n\t\t\t\t.richEditingEnabled,\n\t\t\tisCodeEditingEnabled: select( editSiteStore ).getSettings()\n\t\t\t\t.codeEditingEnabled,\n\t\t\tmode: select( editSiteStore ).getEditorMode(),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { switchEditorMode } = useDispatch( editSiteStore );\n\n\tconst choices = MODES.map( ( choice ) => {\n\t\tif ( choice.value !== mode ) {\n\t\t\treturn { ...choice, shortcut };\n\t\t}\n\t\treturn choice;\n\t} );\n\n\treturn (\n\t\t<MenuGroup label={ __( 'Editor' ) }>\n\t\t\t<MenuItemsChoice\n\t\t\t\tchoices={ choices }\n\t\t\t\tvalue={ mode }\n\t\t\t\tonSelect={ switchEditorMode }\n\t\t\t/>\n\t\t</MenuGroup>\n\t);\n}\n\nexport default ModeSwitcher;\n"]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { MenuItem } from '@wordpress/components';
|
|
7
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
8
|
+
import { __ } from '@wordpress/i18n';
|
|
9
|
+
import { useCopyToClipboard } from '@wordpress/compose';
|
|
10
|
+
import { store as noticesStore } from '@wordpress/notices';
|
|
11
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
12
|
+
import { __unstableSerializeAndClean } from '@wordpress/blocks';
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { store as editSiteStore } from '../../../store';
|
|
18
|
+
export default function CopyContentMenuItem() {
|
|
19
|
+
const {
|
|
20
|
+
createNotice
|
|
21
|
+
} = useDispatch(noticesStore);
|
|
22
|
+
const getText = useSelect(select => {
|
|
23
|
+
return () => {
|
|
24
|
+
const {
|
|
25
|
+
getEditedPostId,
|
|
26
|
+
getEditedPostType
|
|
27
|
+
} = select(editSiteStore);
|
|
28
|
+
const {
|
|
29
|
+
getEditedEntityRecord
|
|
30
|
+
} = select(coreStore);
|
|
31
|
+
const record = getEditedEntityRecord('postType', getEditedPostType(), getEditedPostId());
|
|
32
|
+
|
|
33
|
+
if (record) {
|
|
34
|
+
if (typeof record.content === 'function') {
|
|
35
|
+
return record.content(record);
|
|
36
|
+
} else if (record.blocks) {
|
|
37
|
+
return __unstableSerializeAndClean(record.blocks);
|
|
38
|
+
} else if (record.content) {
|
|
39
|
+
return record.content;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return '';
|
|
44
|
+
};
|
|
45
|
+
}, []);
|
|
46
|
+
|
|
47
|
+
function onSuccess() {
|
|
48
|
+
createNotice('info', __('All content copied.'), {
|
|
49
|
+
isDismissible: true,
|
|
50
|
+
type: 'snackbar'
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const ref = useCopyToClipboard(getText, onSuccess);
|
|
55
|
+
return createElement(MenuItem, {
|
|
56
|
+
ref: ref
|
|
57
|
+
}, __('Copy all content'));
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=copy-content-menu-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/header/more-menu/copy-content-menu-item.js"],"names":["MenuItem","useSelect","useDispatch","__","useCopyToClipboard","store","noticesStore","coreStore","__unstableSerializeAndClean","editSiteStore","CopyContentMenuItem","createNotice","getText","select","getEditedPostId","getEditedPostType","getEditedEntityRecord","record","content","blocks","onSuccess","isDismissible","type","ref"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,uBAAzB;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,kBAAT,QAAmC,oBAAnC;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AACA,SAASC,2BAAT,QAA4C,mBAA5C;AAEA;AACA;AACA;;AACA,SAASH,KAAK,IAAII,aAAlB,QAAuC,gBAAvC;AAEA,eAAe,SAASC,mBAAT,GAA+B;AAC7C,QAAM;AAAEC,IAAAA;AAAF,MAAmBT,WAAW,CAAEI,YAAF,CAApC;AACA,QAAMM,OAAO,GAAGX,SAAS,CAAIY,MAAF,IAAc;AACxC,WAAO,MAAM;AACZ,YAAM;AAAEC,QAAAA,eAAF;AAAmBC,QAAAA;AAAnB,UAAyCF,MAAM,CACpDJ,aADoD,CAArD;AAGA,YAAM;AAAEO,QAAAA;AAAF,UAA4BH,MAAM,CAAEN,SAAF,CAAxC;AACA,YAAMU,MAAM,GAAGD,qBAAqB,CACnC,UADmC,EAEnCD,iBAAiB,EAFkB,EAGnCD,eAAe,EAHoB,CAApC;;AAKA,UAAKG,MAAL,EAAc;AACb,YAAK,OAAOA,MAAM,CAACC,OAAd,KAA0B,UAA/B,EAA4C;AAC3C,iBAAOD,MAAM,CAACC,OAAP,CAAgBD,MAAhB,CAAP;AACA,SAFD,MAEO,IAAKA,MAAM,CAACE,MAAZ,EAAqB;AAC3B,iBAAOX,2BAA2B,CAAES,MAAM,CAACE,MAAT,CAAlC;AACA,SAFM,MAEA,IAAKF,MAAM,CAACC,OAAZ,EAAsB;AAC5B,iBAAOD,MAAM,CAACC,OAAd;AACA;AACD;;AACD,aAAO,EAAP;AACA,KApBD;AAqBA,GAtBwB,EAsBtB,EAtBsB,CAAzB;;AAwBA,WAASE,SAAT,GAAqB;AACpBT,IAAAA,YAAY,CAAE,MAAF,EAAUR,EAAE,CAAE,qBAAF,CAAZ,EAAuC;AAClDkB,MAAAA,aAAa,EAAE,IADmC;AAElDC,MAAAA,IAAI,EAAE;AAF4C,KAAvC,CAAZ;AAIA;;AAED,QAAMC,GAAG,GAAGnB,kBAAkB,CAAEQ,OAAF,EAAWQ,SAAX,CAA9B;AAEA,SAAO,cAAC,QAAD;AAAU,IAAA,GAAG,EAAGG;AAAhB,KAAwBpB,EAAE,CAAE,kBAAF,CAA1B,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __unstableSerializeAndClean } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\n\nexport default function CopyContentMenuItem() {\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst getText = useSelect( ( select ) => {\n\t\treturn () => {\n\t\t\tconst { getEditedPostId, getEditedPostType } = select(\n\t\t\t\teditSiteStore\n\t\t\t);\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\tconst record = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tgetEditedPostType(),\n\t\t\t\tgetEditedPostId()\n\t\t\t);\n\t\t\tif ( record ) {\n\t\t\t\tif ( typeof record.content === 'function' ) {\n\t\t\t\t\treturn record.content( record );\n\t\t\t\t} else if ( record.blocks ) {\n\t\t\t\t\treturn __unstableSerializeAndClean( record.blocks );\n\t\t\t\t} else if ( record.content ) {\n\t\t\t\t\treturn record.content;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn '';\n\t\t};\n\t}, [] );\n\n\tfunction onSuccess() {\n\t\tcreateNotice( 'info', __( 'All content copied.' ), {\n\t\t\tisDismissible: true,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t}\n\n\tconst ref = useCopyToClipboard( getText, onSuccess );\n\n\treturn <MenuItem ref={ ref }>{ __( 'Copy all content' ) }</MenuItem>;\n}\n"]}
|
|
@@ -4,15 +4,23 @@ import { createElement, Fragment } from "@wordpress/element";
|
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
6
|
import { __, _x } from '@wordpress/i18n';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { useReducer } from '@wordpress/element';
|
|
8
|
+
import { useShortcut } from '@wordpress/keyboard-shortcuts';
|
|
9
|
+
import { displayShortcut } from '@wordpress/keycodes';
|
|
10
|
+
import { external, moreVertical } from '@wordpress/icons';
|
|
11
|
+
import { DropdownMenu, MenuGroup, MenuItem, VisuallyHidden } from '@wordpress/components';
|
|
9
12
|
import { ActionItem } from '@wordpress/interface';
|
|
10
13
|
/**
|
|
11
14
|
* Internal dependencies
|
|
12
15
|
*/
|
|
13
16
|
|
|
17
|
+
import KeyboardShortcutHelpModal from '../../keyboard-shortcut-help-modal';
|
|
14
18
|
import FeatureToggle from '../feature-toggle';
|
|
15
19
|
import ToolsMoreMenuGroup from '../tools-more-menu-group';
|
|
20
|
+
import SiteExport from './site-export';
|
|
21
|
+
import WelcomeGuideMenuItem from './welcome-guide-menu-item';
|
|
22
|
+
import CopyContentMenuItem from './copy-content-menu-item';
|
|
23
|
+
import ModeSwitcher from '../mode-switcher';
|
|
16
24
|
const POPOVER_PROPS = {
|
|
17
25
|
className: 'edit-site-more-menu__content',
|
|
18
26
|
position: 'bottom left'
|
|
@@ -20,44 +28,63 @@ const POPOVER_PROPS = {
|
|
|
20
28
|
const TOGGLE_PROPS = {
|
|
21
29
|
tooltipPosition: 'bottom'
|
|
22
30
|
};
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return createElement(Fragment, null, createElement(MenuGroup, {
|
|
35
|
-
label: _x('View', 'noun')
|
|
36
|
-
}, createElement(FeatureToggle, {
|
|
37
|
-
feature: "fixedToolbar",
|
|
38
|
-
label: __('Top toolbar'),
|
|
39
|
-
info: __('Access all block and document tools in a single place'),
|
|
40
|
-
messageActivated: __('Top toolbar activated'),
|
|
41
|
-
messageDeactivated: __('Top toolbar deactivated')
|
|
42
|
-
}), createElement(FeatureToggle, {
|
|
43
|
-
feature: "focusMode",
|
|
44
|
-
label: __('Spotlight mode'),
|
|
45
|
-
info: __('Focus on one block at a time'),
|
|
46
|
-
messageActivated: __('Spotlight mode activated'),
|
|
47
|
-
messageDeactivated: __('Spotlight mode deactivated')
|
|
48
|
-
}), createElement(ActionItem.Slot, {
|
|
49
|
-
name: "core/edit-site/plugin-more-menu",
|
|
50
|
-
label: __('Plugins'),
|
|
51
|
-
as: MenuGroup,
|
|
52
|
-
fillProps: {
|
|
53
|
-
onClick: onClose
|
|
54
|
-
}
|
|
55
|
-
})), createElement(ToolsMoreMenuGroup.Slot, {
|
|
56
|
-
fillProps: {
|
|
31
|
+
export default function MoreMenu() {
|
|
32
|
+
const [isModalActive, toggleModal] = useReducer(isActive => !isActive, false);
|
|
33
|
+
useShortcut('core/edit-site/keyboard-shortcuts', toggleModal);
|
|
34
|
+
return createElement(Fragment, null, createElement(DropdownMenu, {
|
|
35
|
+
className: "edit-site-more-menu",
|
|
36
|
+
icon: moreVertical,
|
|
37
|
+
label: __('More tools & options'),
|
|
38
|
+
popoverProps: POPOVER_PROPS,
|
|
39
|
+
toggleProps: TOGGLE_PROPS
|
|
40
|
+
}, _ref => {
|
|
41
|
+
let {
|
|
57
42
|
onClose
|
|
58
|
-
}
|
|
43
|
+
} = _ref;
|
|
44
|
+
return createElement(Fragment, null, createElement(MenuGroup, {
|
|
45
|
+
label: _x('View', 'noun')
|
|
46
|
+
}, createElement(FeatureToggle, {
|
|
47
|
+
feature: "fixedToolbar",
|
|
48
|
+
label: __('Top toolbar'),
|
|
49
|
+
info: __('Access all block and document tools in a single place'),
|
|
50
|
+
messageActivated: __('Top toolbar activated'),
|
|
51
|
+
messageDeactivated: __('Top toolbar deactivated')
|
|
52
|
+
}), createElement(FeatureToggle, {
|
|
53
|
+
feature: "focusMode",
|
|
54
|
+
label: __('Spotlight mode'),
|
|
55
|
+
info: __('Focus on one block at a time'),
|
|
56
|
+
messageActivated: __('Spotlight mode activated'),
|
|
57
|
+
messageDeactivated: __('Spotlight mode deactivated')
|
|
58
|
+
}), createElement(ModeSwitcher, null), createElement(ActionItem.Slot, {
|
|
59
|
+
name: "core/edit-site/plugin-more-menu",
|
|
60
|
+
label: __('Plugins'),
|
|
61
|
+
as: MenuGroup,
|
|
62
|
+
fillProps: {
|
|
63
|
+
onClick: onClose
|
|
64
|
+
}
|
|
65
|
+
})), createElement(MenuGroup, {
|
|
66
|
+
label: __('Tools')
|
|
67
|
+
}, createElement(SiteExport, null), createElement(MenuItem, {
|
|
68
|
+
onClick: toggleModal,
|
|
69
|
+
shortcut: displayShortcut.access('h')
|
|
70
|
+
}, __('Keyboard shortcuts')), createElement(WelcomeGuideMenuItem, null), createElement(CopyContentMenuItem, null), createElement(MenuItem, {
|
|
71
|
+
icon: external,
|
|
72
|
+
role: "menuitem",
|
|
73
|
+
href: __('https://wordpress.org/support/article/site-editor/'),
|
|
74
|
+
target: "_blank",
|
|
75
|
+
rel: "noopener noreferrer"
|
|
76
|
+
}, __('Help'), createElement(VisuallyHidden, {
|
|
77
|
+
as: "span"
|
|
78
|
+
},
|
|
79
|
+
/* translators: accessibility text */
|
|
80
|
+
__('(opens in a new tab)'))), createElement(ToolsMoreMenuGroup.Slot, {
|
|
81
|
+
fillProps: {
|
|
82
|
+
onClose
|
|
83
|
+
}
|
|
84
|
+
})));
|
|
85
|
+
}), createElement(KeyboardShortcutHelpModal, {
|
|
86
|
+
isModalActive: isModalActive,
|
|
87
|
+
toggleModal: toggleModal
|
|
59
88
|
}));
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export default MoreMenu;
|
|
89
|
+
}
|
|
63
90
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/header/more-menu/index.js"],"names":["__","_x","moreVertical","DropdownMenu","MenuGroup","ActionItem","FeatureToggle","ToolsMoreMenuGroup","POPOVER_PROPS","className","position","TOGGLE_PROPS","tooltipPosition","MoreMenu","onClose","onClick"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SAASC,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/header/more-menu/index.js"],"names":["__","_x","useReducer","useShortcut","displayShortcut","external","moreVertical","DropdownMenu","MenuGroup","MenuItem","VisuallyHidden","ActionItem","KeyboardShortcutHelpModal","FeatureToggle","ToolsMoreMenuGroup","SiteExport","WelcomeGuideMenuItem","CopyContentMenuItem","ModeSwitcher","POPOVER_PROPS","className","position","TOGGLE_PROPS","tooltipPosition","MoreMenu","isModalActive","toggleModal","isActive","onClose","onClick","access"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SAASC,UAAT,QAA2B,oBAA3B;AACA,SAASC,WAAT,QAA4B,+BAA5B;AACA,SAASC,eAAT,QAAgC,qBAAhC;AACA,SAASC,QAAT,EAAmBC,YAAnB,QAAuC,kBAAvC;AACA,SACCC,YADD,EAECC,SAFD,EAGCC,QAHD,EAICC,cAJD,QAKO,uBALP;AAMA,SAASC,UAAT,QAA2B,sBAA3B;AAEA;AACA;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BAAD;AACC,IAAA,aAAa,EAAGH,aADjB;AAEC,IAAA,WAAW,EAAGC;AAFf,IA7ED,CADD;AAoFA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { useReducer } from '@wordpress/element';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { external, moreVertical } from '@wordpress/icons';\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { ActionItem } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport KeyboardShortcutHelpModal from '../../keyboard-shortcut-help-modal';\nimport FeatureToggle from '../feature-toggle';\nimport ToolsMoreMenuGroup from '../tools-more-menu-group';\nimport SiteExport from './site-export';\nimport WelcomeGuideMenuItem from './welcome-guide-menu-item';\nimport CopyContentMenuItem from './copy-content-menu-item';\nimport ModeSwitcher from '../mode-switcher';\n\nconst POPOVER_PROPS = {\n\tclassName: 'edit-site-more-menu__content',\n\tposition: 'bottom left',\n};\nconst TOGGLE_PROPS = {\n\ttooltipPosition: 'bottom',\n};\n\nexport default function MoreMenu() {\n\tconst [ isModalActive, toggleModal ] = useReducer(\n\t\t( isActive ) => ! isActive,\n\t\tfalse\n\t);\n\n\tuseShortcut( 'core/edit-site/keyboard-shortcuts', toggleModal );\n\n\treturn (\n\t\t<>\n\t\t\t<DropdownMenu\n\t\t\t\tclassName=\"edit-site-more-menu\"\n\t\t\t\ticon={ moreVertical }\n\t\t\t\tlabel={ __( 'More tools & options' ) }\n\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\ttoggleProps={ TOGGLE_PROPS }\n\t\t\t>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<MenuGroup label={ _x( 'View', 'noun' ) }>\n\t\t\t\t\t\t\t<FeatureToggle\n\t\t\t\t\t\t\t\tfeature=\"fixedToolbar\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Access all block and document tools in a single place'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar activated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar deactivated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<FeatureToggle\n\t\t\t\t\t\t\t\tfeature=\"focusMode\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Spotlight mode' ) }\n\t\t\t\t\t\t\t\tinfo={ __( 'Focus on one block at a time' ) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Spotlight mode activated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Spotlight mode deactivated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ModeSwitcher />\n\t\t\t\t\t\t\t<ActionItem.Slot\n\t\t\t\t\t\t\t\tname=\"core/edit-site/plugin-more-menu\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Plugins' ) }\n\t\t\t\t\t\t\t\tas={ MenuGroup }\n\t\t\t\t\t\t\t\tfillProps={ { onClick: onClose } }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<MenuGroup label={ __( 'Tools' ) }>\n\t\t\t\t\t\t\t<SiteExport />\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ toggleModal }\n\t\t\t\t\t\t\t\tshortcut={ displayShortcut.access( 'h' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Keyboard shortcuts' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<WelcomeGuideMenuItem />\n\t\t\t\t\t\t\t<CopyContentMenuItem />\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/support/article/site-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Help' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<ToolsMoreMenuGroup.Slot\n\t\t\t\t\t\t\t\tfillProps={ { onClose } }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</DropdownMenu>\n\t\t\t<KeyboardShortcutHelpModal\n\t\t\t\tisModalActive={ isModalActive }\n\t\t\t\ttoggleModal={ toggleModal }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/header/more-menu/site-export.js"],"names":["downloadjs","__","_x","MenuItem","apiFetch","download","useDispatch","store","noticesStore","SiteExport","createErrorNotice","handleExport","response","path","parse","blob","errorResponse","error","json","e","errorMessage","message","code","type"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,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,KAMGC,EAAE,CAAE,QAAF,EAAY,yBAAZ,CANL,CADD;AAUA","sourcesContent":["/**\n * External dependencies\n */\nimport downloadjs from 'downloadjs';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { MenuItem } from '@wordpress/components';\nimport apiFetch from '@wordpress/api-fetch';\nimport { download } from '@wordpress/icons';\nimport { useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\nexport default function SiteExport() {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tasync function handleExport() {\n\t\ttry {\n\t\t\tconst response = await apiFetch( {\n\t\t\t\tpath: '/wp-block-editor/v1/export',\n\t\t\t\tparse: false,\n\t\t\t} );\n\t\t\tconst blob = await response.blob();\n\n\t\t\tdownloadjs( blob, 'edit-site-export.zip', 'application/zip' );\n\t\t} catch ( errorResponse ) {\n\t\t\tlet error = {};\n\t\t\ttry {\n\t\t\t\terror = await errorResponse.json();\n\t\t\t} catch ( e ) {}\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while creating the site export.' );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t}\n\n\treturn (\n\t\t<MenuItem\n\t\t\trole=\"menuitem\"\n\t\t\ticon={ download }\n\t\t\tonClick={ handleExport }\n\t\t\tinfo={ __( 'Download your templates and template parts.' ) }\n\t\t>\n\t\t\t{ _x( 'Export', 'site exporter menu item' ) }\n\t\t</MenuItem>\n\t);\n}\n"]}
|
|
@@ -10,7 +10,7 @@ import { MenuItem } from '@wordpress/components';
|
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import { store as editSiteStore } from '
|
|
13
|
+
import { store as editSiteStore } from '../../../store';
|
|
14
14
|
export default function WelcomeGuideMenuItem() {
|
|
15
15
|
const {
|
|
16
16
|
toggleFeature
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/header/more-menu/welcome-guide-menu-item.js"],"names":["__","useDispatch","MenuItem","store","editSiteStore","WelcomeGuideMenuItem","toggleFeature"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,QAAT,QAAyB,uBAAzB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,gBAAvC;AAEA,eAAe,SAASC,oBAAT,GAAgC;AAC9C,QAAM;AAAEC,IAAAA;AAAF,MAAoBL,WAAW,CAAEG,aAAF,CAArC;AAEA,SACC,cAAC,QAAD;AAAU,IAAA,OAAO,EAAG,MAAME,aAAa,CAAE,cAAF;AAAvC,KACGN,EAAE,CAAE,eAAF,CADL,CADD;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { MenuItem } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\n\nexport default function WelcomeGuideMenuItem() {\n\tconst { toggleFeature } = useDispatch( editSiteStore );\n\n\treturn (\n\t\t<MenuItem onClick={ () => toggleFeature( 'welcomeGuide' ) }>\n\t\t\t{ __( 'Welcome Guide' ) }\n\t\t</MenuItem>\n\t);\n}\n"]}
|
|
@@ -8,8 +8,7 @@ import { isEmpty } from 'lodash';
|
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { createSlotFill
|
|
12
|
-
import { __ } from '@wordpress/i18n';
|
|
11
|
+
import { createSlotFill } from '@wordpress/components';
|
|
13
12
|
const {
|
|
14
13
|
Fill: ToolsMoreMenuGroup,
|
|
15
14
|
Slot
|
|
@@ -21,9 +20,7 @@ ToolsMoreMenuGroup.Slot = _ref => {
|
|
|
21
20
|
} = _ref;
|
|
22
21
|
return createElement(Slot, {
|
|
23
22
|
fillProps: fillProps
|
|
24
|
-
}, fills => !isEmpty(fills) &&
|
|
25
|
-
label: __('Tools')
|
|
26
|
-
}, fills));
|
|
23
|
+
}, fills => !isEmpty(fills) && fills);
|
|
27
24
|
};
|
|
28
25
|
|
|
29
26
|
export default ToolsMoreMenuGroup;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/header/tools-more-menu-group/index.js"],"names":["isEmpty","createSlotFill","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/header/tools-more-menu-group/index.js"],"names":["isEmpty","createSlotFill","Fill","ToolsMoreMenuGroup","Slot","fillProps","fills"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,QAAxB;AAEA;AACA;AACA;;AACA,SAASC,cAAT,QAA+B,uBAA/B;AAEA,MAAM;AAAEC,EAAAA,IAAI,EAAEC,kBAAR;AAA4BC,EAAAA;AAA5B,IAAqCH,cAAc,CACxD,4BADwD,CAAzD;;AAIAE,kBAAkB,CAACC,IAAnB,GAA0B;AAAA,MAAE;AAAEC,IAAAA;AAAF,GAAF;AAAA,SACzB,cAAC,IAAD;AAAM,IAAA,SAAS,EAAGA;AAAlB,KACKC,KAAF,IAAa,CAAEN,OAAO,CAAEM,KAAF,CAAT,IAAsBA,KADtC,CADyB;AAAA,CAA1B;;AAMA,eAAeH,kBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\n\nconst { Fill: ToolsMoreMenuGroup, Slot } = createSlotFill(\n\t'EditSiteToolsMoreMenuGroup'\n);\n\nToolsMoreMenuGroup.Slot = ( { fillProps } ) => (\n\t<Slot fillProps={ fillProps }>\n\t\t{ ( fills ) => ! isEmpty( fills ) && fills }\n\t</Slot>\n);\n\nexport default ToolsMoreMenuGroup;\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
export const textFormattingShortcuts = [{
|
|
6
|
+
keyCombination: {
|
|
7
|
+
modifier: 'primary',
|
|
8
|
+
character: 'b'
|
|
9
|
+
},
|
|
10
|
+
description: __('Make the selected text bold.')
|
|
11
|
+
}, {
|
|
12
|
+
keyCombination: {
|
|
13
|
+
modifier: 'primary',
|
|
14
|
+
character: 'i'
|
|
15
|
+
},
|
|
16
|
+
description: __('Make the selected text italic.')
|
|
17
|
+
}, {
|
|
18
|
+
keyCombination: {
|
|
19
|
+
modifier: 'primary',
|
|
20
|
+
character: 'k'
|
|
21
|
+
},
|
|
22
|
+
description: __('Convert the selected text into a link.')
|
|
23
|
+
}, {
|
|
24
|
+
keyCombination: {
|
|
25
|
+
modifier: 'primaryShift',
|
|
26
|
+
character: 'k'
|
|
27
|
+
},
|
|
28
|
+
description: __('Remove a link.')
|
|
29
|
+
}, {
|
|
30
|
+
keyCombination: {
|
|
31
|
+
modifier: 'primary',
|
|
32
|
+
character: 'u'
|
|
33
|
+
},
|
|
34
|
+
description: __('Underline the selected text.')
|
|
35
|
+
}];
|
|
36
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/keyboard-shortcut-help-modal/config.js"],"names":["__","textFormattingShortcuts","keyCombination","modifier","character","description"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA,OAAO,MAAMC,uBAAuB,GAAG,CACtC;AACCC,EAAAA,cAAc,EAAE;AAAEC,IAAAA,QAAQ,EAAE,SAAZ;AAAuBC,IAAAA,SAAS,EAAE;AAAlC,GADjB;AAECC,EAAAA,WAAW,EAAEL,EAAE,CAAE,8BAAF;AAFhB,CADsC,EAKtC;AACCE,EAAAA,cAAc,EAAE;AAAEC,IAAAA,QAAQ,EAAE,SAAZ;AAAuBC,IAAAA,SAAS,EAAE;AAAlC,GADjB;AAECC,EAAAA,WAAW,EAAEL,EAAE,CAAE,gCAAF;AAFhB,CALsC,EAStC;AACCE,EAAAA,cAAc,EAAE;AAAEC,IAAAA,QAAQ,EAAE,SAAZ;AAAuBC,IAAAA,SAAS,EAAE;AAAlC,GADjB;AAECC,EAAAA,WAAW,EAAEL,EAAE,CAAE,wCAAF;AAFhB,CATsC,EAatC;AACCE,EAAAA,cAAc,EAAE;AAAEC,IAAAA,QAAQ,EAAE,cAAZ;AAA4BC,IAAAA,SAAS,EAAE;AAAvC,GADjB;AAECC,EAAAA,WAAW,EAAEL,EAAE,CAAE,gBAAF;AAFhB,CAbsC,EAiBtC;AACCE,EAAAA,cAAc,EAAE;AAAEC,IAAAA,QAAQ,EAAE,SAAZ;AAAuBC,IAAAA,SAAS,EAAE;AAAlC,GADjB;AAECC,EAAAA,WAAW,EAAEL,EAAE,CAAE,8BAAF;AAFhB,CAjBsC,CAAhC","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nexport const textFormattingShortcuts = [\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'b' },\n\t\tdescription: __( 'Make the selected text bold.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'i' },\n\t\tdescription: __( 'Make the selected text italic.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'k' },\n\t\tdescription: __( 'Convert the selected text into a link.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primaryShift', character: 'k' },\n\t\tdescription: __( 'Remove a link.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'u' },\n\t\tdescription: __( 'Underline the selected text.' ),\n\t},\n];\n"]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { useSelect } from '@wordpress/data';
|
|
7
|
+
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import Shortcut from './shortcut';
|
|
13
|
+
export default function DynamicShortcut(_ref) {
|
|
14
|
+
let {
|
|
15
|
+
name
|
|
16
|
+
} = _ref;
|
|
17
|
+
const {
|
|
18
|
+
keyCombination,
|
|
19
|
+
description,
|
|
20
|
+
aliases
|
|
21
|
+
} = useSelect(select => {
|
|
22
|
+
const {
|
|
23
|
+
getShortcutKeyCombination,
|
|
24
|
+
getShortcutDescription,
|
|
25
|
+
getShortcutAliases
|
|
26
|
+
} = select(keyboardShortcutsStore);
|
|
27
|
+
return {
|
|
28
|
+
keyCombination: getShortcutKeyCombination(name),
|
|
29
|
+
aliases: getShortcutAliases(name),
|
|
30
|
+
description: getShortcutDescription(name)
|
|
31
|
+
};
|
|
32
|
+
}, [name]);
|
|
33
|
+
|
|
34
|
+
if (!keyCombination) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return createElement(Shortcut, {
|
|
39
|
+
keyCombination: keyCombination,
|
|
40
|
+
description: description,
|
|
41
|
+
aliases: aliases
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=dynamic-shortcut.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js"],"names":["useSelect","store","keyboardShortcutsStore","Shortcut","DynamicShortcut","name","keyCombination","description","aliases","select","getShortcutKeyCombination","getShortcutDescription","getShortcutAliases"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,sBAAlB,QAAgD,+BAAhD;AAEA;AACA;AACA;;AACA,OAAOC,QAAP,MAAqB,YAArB;AAEA,eAAe,SAASC,eAAT,OAAqC;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AACnD,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,WAAlB;AAA+BC,IAAAA;AAA/B,MAA2CR,SAAS,CACvDS,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,yBADK;AAELC,MAAAA,sBAFK;AAGLC,MAAAA;AAHK,QAIFH,MAAM,CAAEP,sBAAF,CAJV;AAMA,WAAO;AACNI,MAAAA,cAAc,EAAEI,yBAAyB,CAAEL,IAAF,CADnC;AAENG,MAAAA,OAAO,EAAEI,kBAAkB,CAAEP,IAAF,CAFrB;AAGNE,MAAAA,WAAW,EAAEI,sBAAsB,CAAEN,IAAF;AAH7B,KAAP;AAKA,GAbwD,EAczD,CAAEA,IAAF,CAdyD,CAA1D;;AAiBA,MAAK,CAAEC,cAAP,EAAwB;AACvB,WAAO,IAAP;AACA;;AAED,SACC,cAAC,QAAD;AACC,IAAA,cAAc,EAAGA,cADlB;AAEC,IAAA,WAAW,EAAGC,WAFf;AAGC,IAAA,OAAO,EAAGC;AAHX,IADD;AAOA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport Shortcut from './shortcut';\n\nexport default function DynamicShortcut( { name } ) {\n\tconst { keyCombination, description, aliases } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetShortcutKeyCombination,\n\t\t\t\tgetShortcutDescription,\n\t\t\t\tgetShortcutAliases,\n\t\t\t} = select( keyboardShortcutsStore );\n\n\t\t\treturn {\n\t\t\t\tkeyCombination: getShortcutKeyCombination( name ),\n\t\t\t\taliases: getShortcutAliases( name ),\n\t\t\t\tdescription: getShortcutDescription( name ),\n\t\t\t};\n\t\t},\n\t\t[ name ]\n\t);\n\n\tif ( ! keyCombination ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Shortcut\n\t\t\tkeyCombination={ keyCombination }\n\t\t\tdescription={ description }\n\t\t\taliases={ aliases }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* External dependencies
|
|
5
|
+
*/
|
|
6
|
+
import classnames from 'classnames';
|
|
7
|
+
import { isString } from 'lodash';
|
|
8
|
+
/**
|
|
9
|
+
* WordPress dependencies
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { Modal } from '@wordpress/components';
|
|
13
|
+
import { __ } from '@wordpress/i18n';
|
|
14
|
+
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
15
|
+
import { useSelect } from '@wordpress/data';
|
|
16
|
+
/**
|
|
17
|
+
* Internal dependencies
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { textFormattingShortcuts } from './config';
|
|
21
|
+
import Shortcut from './shortcut';
|
|
22
|
+
import DynamicShortcut from './dynamic-shortcut';
|
|
23
|
+
|
|
24
|
+
const ShortcutList = _ref => {
|
|
25
|
+
let {
|
|
26
|
+
shortcuts
|
|
27
|
+
} = _ref;
|
|
28
|
+
return (
|
|
29
|
+
/*
|
|
30
|
+
* Disable reason: The `list` ARIA role is redundant but
|
|
31
|
+
* Safari+VoiceOver won't announce the list otherwise.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/* eslint-disable jsx-a11y/no-redundant-roles */
|
|
35
|
+
createElement("ul", {
|
|
36
|
+
className: "edit-site-keyboard-shortcut-help-modal__shortcut-list",
|
|
37
|
+
role: "list"
|
|
38
|
+
}, shortcuts.map((shortcut, index) => createElement("li", {
|
|
39
|
+
className: "edit-site-keyboard-shortcut-help-modal__shortcut",
|
|
40
|
+
key: index
|
|
41
|
+
}, isString(shortcut) ? createElement(DynamicShortcut, {
|
|
42
|
+
name: shortcut
|
|
43
|
+
}) : createElement(Shortcut, shortcut))))
|
|
44
|
+
/* eslint-enable jsx-a11y/no-redundant-roles */
|
|
45
|
+
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const ShortcutSection = _ref2 => {
|
|
50
|
+
let {
|
|
51
|
+
title,
|
|
52
|
+
shortcuts,
|
|
53
|
+
className
|
|
54
|
+
} = _ref2;
|
|
55
|
+
return createElement("section", {
|
|
56
|
+
className: classnames('edit-site-keyboard-shortcut-help-modal__section', className)
|
|
57
|
+
}, !!title && createElement("h2", {
|
|
58
|
+
className: "edit-site-keyboard-shortcut-help-modal__section-title"
|
|
59
|
+
}, title), createElement(ShortcutList, {
|
|
60
|
+
shortcuts: shortcuts
|
|
61
|
+
}));
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const ShortcutCategorySection = _ref3 => {
|
|
65
|
+
let {
|
|
66
|
+
title,
|
|
67
|
+
categoryName,
|
|
68
|
+
additionalShortcuts = []
|
|
69
|
+
} = _ref3;
|
|
70
|
+
const categoryShortcuts = useSelect(select => {
|
|
71
|
+
return select(keyboardShortcutsStore).getCategoryShortcuts(categoryName);
|
|
72
|
+
}, [categoryName]);
|
|
73
|
+
return createElement(ShortcutSection, {
|
|
74
|
+
title: title,
|
|
75
|
+
shortcuts: categoryShortcuts.concat(additionalShortcuts)
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export default function KeyboardShortcutHelpModal(_ref4) {
|
|
80
|
+
let {
|
|
81
|
+
isModalActive,
|
|
82
|
+
toggleModal
|
|
83
|
+
} = _ref4;
|
|
84
|
+
|
|
85
|
+
if (!isModalActive) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return createElement(Modal, {
|
|
90
|
+
className: "edit-site-keyboard-shortcut-help-modal",
|
|
91
|
+
title: __('Keyboard shortcuts'),
|
|
92
|
+
closeLabel: __('Close'),
|
|
93
|
+
onRequestClose: toggleModal
|
|
94
|
+
}, createElement(ShortcutSection, {
|
|
95
|
+
className: "edit-site-keyboard-shortcut-help-modal__main-shortcuts",
|
|
96
|
+
shortcuts: ['core/edit-site/keyboard-shortcuts']
|
|
97
|
+
}), createElement(ShortcutCategorySection, {
|
|
98
|
+
title: __('Global shortcuts'),
|
|
99
|
+
categoryName: "global"
|
|
100
|
+
}), createElement(ShortcutCategorySection, {
|
|
101
|
+
title: __('Selection shortcuts'),
|
|
102
|
+
categoryName: "selection"
|
|
103
|
+
}), createElement(ShortcutCategorySection, {
|
|
104
|
+
title: __('Block shortcuts'),
|
|
105
|
+
categoryName: "block",
|
|
106
|
+
additionalShortcuts: [{
|
|
107
|
+
keyCombination: {
|
|
108
|
+
character: '/'
|
|
109
|
+
},
|
|
110
|
+
description: __('Change the block type after adding a new paragraph.'),
|
|
111
|
+
|
|
112
|
+
/* translators: The forward-slash character. e.g. '/'. */
|
|
113
|
+
ariaLabel: __('Forward-slash')
|
|
114
|
+
}]
|
|
115
|
+
}), createElement(ShortcutSection, {
|
|
116
|
+
title: __('Text formatting'),
|
|
117
|
+
shortcuts: textFormattingShortcuts
|
|
118
|
+
}));
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/keyboard-shortcut-help-modal/index.js"],"names":["classnames","isString","Modal","__","store","keyboardShortcutsStore","useSelect","textFormattingShortcuts","Shortcut","DynamicShortcut","ShortcutList","shortcuts","map","shortcut","index","ShortcutSection","title","className","ShortcutCategorySection","categoryName","additionalShortcuts","categoryShortcuts","select","getCategoryShortcuts","concat","KeyboardShortcutHelpModal","isModalActive","toggleModal","keyCombination","character","description","ariaLabel"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,QAAT,QAAyB,QAAzB;AAEA;AACA;AACA;;AACA,SAASC,KAAT,QAAsB,uBAAtB;AACA,SAASC,EAAT,QAAmB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AE,iBAAF,CADX;AAEC,IAAA,SAAS,EAAGI;AAFb,IAlCD,CADD;AAyCA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { isString } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { textFormattingShortcuts } from './config';\nimport Shortcut from './shortcut';\nimport DynamicShortcut from './dynamic-shortcut';\n\nconst ShortcutList = ( { shortcuts } ) => (\n\t/*\n\t * Disable reason: The `list` ARIA role is redundant but\n\t * Safari+VoiceOver won't announce the list otherwise.\n\t */\n\t/* eslint-disable jsx-a11y/no-redundant-roles */\n\t<ul\n\t\tclassName=\"edit-site-keyboard-shortcut-help-modal__shortcut-list\"\n\t\trole=\"list\"\n\t>\n\t\t{ shortcuts.map( ( shortcut, index ) => (\n\t\t\t<li\n\t\t\t\tclassName=\"edit-site-keyboard-shortcut-help-modal__shortcut\"\n\t\t\t\tkey={ index }\n\t\t\t>\n\t\t\t\t{ isString( shortcut ) ? (\n\t\t\t\t\t<DynamicShortcut name={ shortcut } />\n\t\t\t\t) : (\n\t\t\t\t\t<Shortcut { ...shortcut } />\n\t\t\t\t) }\n\t\t\t</li>\n\t\t) ) }\n\t</ul>\n\t/* eslint-enable jsx-a11y/no-redundant-roles */\n);\n\nconst ShortcutSection = ( { title, shortcuts, className } ) => (\n\t<section\n\t\tclassName={ classnames(\n\t\t\t'edit-site-keyboard-shortcut-help-modal__section',\n\t\t\tclassName\n\t\t) }\n\t>\n\t\t{ !! title && (\n\t\t\t<h2 className=\"edit-site-keyboard-shortcut-help-modal__section-title\">\n\t\t\t\t{ title }\n\t\t\t</h2>\n\t\t) }\n\t\t<ShortcutList shortcuts={ shortcuts } />\n\t</section>\n);\n\nconst ShortcutCategorySection = ( {\n\ttitle,\n\tcategoryName,\n\tadditionalShortcuts = [],\n} ) => {\n\tconst categoryShortcuts = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( keyboardShortcutsStore ).getCategoryShortcuts(\n\t\t\t\tcategoryName\n\t\t\t);\n\t\t},\n\t\t[ categoryName ]\n\t);\n\n\treturn (\n\t\t<ShortcutSection\n\t\t\ttitle={ title }\n\t\t\tshortcuts={ categoryShortcuts.concat( additionalShortcuts ) }\n\t\t/>\n\t);\n};\n\nexport default function KeyboardShortcutHelpModal( {\n\tisModalActive,\n\ttoggleModal,\n} ) {\n\tif ( ! isModalActive ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"edit-site-keyboard-shortcut-help-modal\"\n\t\t\ttitle={ __( 'Keyboard shortcuts' ) }\n\t\t\tcloseLabel={ __( 'Close' ) }\n\t\t\tonRequestClose={ toggleModal }\n\t\t>\n\t\t\t<ShortcutSection\n\t\t\t\tclassName=\"edit-site-keyboard-shortcut-help-modal__main-shortcuts\"\n\t\t\t\tshortcuts={ [ 'core/edit-site/keyboard-shortcuts' ] }\n\t\t\t/>\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Global shortcuts' ) }\n\t\t\t\tcategoryName=\"global\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Selection shortcuts' ) }\n\t\t\t\tcategoryName=\"selection\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Block shortcuts' ) }\n\t\t\t\tcategoryName=\"block\"\n\t\t\t\tadditionalShortcuts={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tkeyCombination: { character: '/' },\n\t\t\t\t\t\tdescription: __(\n\t\t\t\t\t\t\t'Change the block type after adding a new paragraph.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t/* translators: The forward-slash character. e.g. '/'. */\n\t\t\t\t\t\tariaLabel: __( 'Forward-slash' ),\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t/>\n\t\t\t<ShortcutSection\n\t\t\t\ttitle={ __( 'Text formatting' ) }\n\t\t\t\tshortcuts={ textFormattingShortcuts }\n\t\t\t/>\n\t\t</Modal>\n\t);\n}\n"]}
|