@wordpress/editor 13.24.1 → 13.26.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 +8 -0
- package/LICENSE.md +1 -1
- package/build/components/document-bar/index.js +164 -0
- package/build/components/document-bar/index.js.map +1 -0
- package/build/components/document-outline/index.js +82 -1
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/document-tools/index.js +160 -0
- package/build/components/document-tools/index.js.map +1 -0
- package/build/components/editor-canvas/edit-template-blocks-notification.js +106 -0
- package/build/components/editor-canvas/edit-template-blocks-notification.js.map +1 -0
- package/build/components/editor-canvas/index.js +298 -0
- package/build/components/editor-canvas/index.js.map +1 -0
- package/build/components/entities-saved-states/index.js +3 -1
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/index.js +12 -2
- package/build/components/global-keyboard-shortcuts/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js +9 -0
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build/components/index.js +72 -8
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +9 -1
- package/build/components/index.native.js.map +1 -1
- package/build/components/inserter-sidebar/index.js +77 -0
- package/build/components/inserter-sidebar/index.js.map +1 -0
- package/build/components/list-view-sidebar/index.js +150 -0
- package/build/components/list-view-sidebar/index.js.map +1 -0
- package/build/components/list-view-sidebar/list-view-outline.js +28 -0
- package/build/components/list-view-sidebar/list-view-outline.js.map +1 -0
- package/build/components/offline-status/index.native.js +85 -0
- package/build/components/offline-status/index.native.js.map +1 -0
- package/build/components/page-attributes/panel.js +63 -0
- package/build/components/page-attributes/panel.js.map +1 -0
- package/build/components/post-discussion/panel.js +59 -0
- package/build/components/post-discussion/panel.js.map +1 -0
- package/build/components/post-excerpt/check.js +19 -0
- package/build/components/post-excerpt/check.js.map +1 -1
- package/build/components/post-excerpt/panel.js +55 -0
- package/build/components/post-excerpt/panel.js.map +1 -0
- package/build/components/post-excerpt/plugin.js +72 -0
- package/build/components/post-excerpt/plugin.js.map +1 -0
- package/build/components/post-featured-image/index.js +5 -8
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-featured-image/panel.js +60 -0
- package/build/components/post-featured-image/panel.js.map +1 -0
- package/build/components/post-last-revision/panel.js +27 -0
- package/build/components/post-last-revision/panel.js.map +1 -0
- package/build/components/post-publish-button/index.js +1 -0
- package/build/components/post-publish-button/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-upload-media.js +2 -4
- package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build/components/post-saved-state/index.js +13 -8
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-schedule/panel.js +1 -1
- package/build/components/post-schedule/panel.js.map +1 -1
- package/build/components/post-taxonomies/panel.js +68 -0
- package/build/components/post-taxonomies/panel.js.map +1 -0
- package/build/components/post-template/block-theme.js +100 -0
- package/build/components/post-template/block-theme.js.map +1 -0
- package/build/components/post-template/classic-theme.js +171 -0
- package/build/components/post-template/classic-theme.js.map +1 -0
- package/build/components/post-template/create-new-template-modal.js +98 -0
- package/build/components/post-template/create-new-template-modal.js.map +1 -0
- package/build/components/post-template/create-new-template.js +55 -0
- package/build/components/post-template/create-new-template.js.map +1 -0
- package/build/components/post-template/hooks.js +88 -0
- package/build/components/post-template/hooks.js.map +1 -0
- package/build/components/post-template/panel.js +70 -0
- package/build/components/post-template/panel.js.map +1 -0
- package/build/components/post-template/reset-default-template.js +48 -0
- package/build/components/post-template/reset-default-template.js.map +1 -0
- package/build/components/post-template/swap-template-button.js +86 -0
- package/build/components/post-template/swap-template-button.js.map +1 -0
- package/build/components/post-title/index.native.js +25 -15
- package/build/components/post-title/index.native.js.map +1 -1
- package/build/components/post-view-link/index.js +58 -0
- package/build/components/post-view-link/index.js.map +1 -0
- package/build/components/post-visibility/check.js +5 -17
- package/build/components/post-visibility/check.js.map +1 -1
- package/build/components/preview-dropdown/index.js +118 -0
- package/build/components/preview-dropdown/index.js.map +1 -0
- package/build/components/provider/index.js +24 -82
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/index.native.js +36 -8
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/navigation-block-editing-mode.js +40 -0
- package/build/components/provider/navigation-block-editing-mode.js.map +1 -0
- package/build/components/provider/use-block-editor-settings.js +38 -15
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/hooks/index.js +1 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/pattern-partial-syncing.js +49 -0
- package/build/hooks/pattern-partial-syncing.js.map +1 -0
- package/build/private-apis.js +14 -0
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +161 -13
- 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/index.js +5 -0
- package/build/store/index.js.map +1 -1
- package/build/store/private-actions.js +52 -0
- package/build/store/private-actions.js.map +1 -0
- package/build/store/private-selectors.js +52 -0
- package/build/store/private-selectors.js.map +1 -0
- package/build/store/reducer.js +109 -27
- package/build/store/reducer.js.map +1 -1
- package/build/store/reducer.native.js +0 -1
- package/build/store/reducer.native.js.map +1 -1
- package/build/store/selectors.js +104 -9
- package/build/store/selectors.js.map +1 -1
- package/build/utils/media-upload/index.js +8 -2
- package/build/utils/media-upload/index.js.map +1 -1
- package/build-module/components/document-bar/index.js +156 -0
- package/build-module/components/document-bar/index.js.map +1 -0
- package/build-module/components/document-outline/index.js +82 -1
- package/build-module/components/document-outline/index.js.map +1 -1
- package/build-module/components/document-tools/index.js +151 -0
- package/build-module/components/document-tools/index.js.map +1 -0
- package/build-module/components/editor-canvas/edit-template-blocks-notification.js +100 -0
- package/build-module/components/editor-canvas/edit-template-blocks-notification.js.map +1 -0
- package/build-module/components/editor-canvas/index.js +289 -0
- package/build-module/components/editor-canvas/index.js.map +1 -0
- package/build-module/components/entities-saved-states/index.js +3 -1
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/index.js +12 -2
- package/build-module/components/global-keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +9 -0
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build-module/components/index.js +9 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +1 -0
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inserter-sidebar/index.js +70 -0
- package/build-module/components/inserter-sidebar/index.js.map +1 -0
- package/build-module/components/list-view-sidebar/index.js +142 -0
- package/build-module/components/list-view-sidebar/index.js.map +1 -0
- package/build-module/components/list-view-sidebar/list-view-outline.js +20 -0
- package/build-module/components/list-view-sidebar/list-view-outline.js.map +1 -0
- package/build-module/components/offline-status/index.native.js +77 -0
- package/build-module/components/offline-status/index.native.js.map +1 -0
- package/build-module/components/page-attributes/panel.js +53 -0
- package/build-module/components/page-attributes/panel.js.map +1 -0
- package/build-module/components/post-discussion/panel.js +50 -0
- package/build-module/components/post-discussion/panel.js.map +1 -0
- package/build-module/components/post-excerpt/check.js +19 -0
- package/build-module/components/post-excerpt/check.js.map +1 -1
- package/build-module/components/post-excerpt/panel.js +48 -0
- package/build-module/components/post-excerpt/panel.js.map +1 -0
- package/build-module/components/post-excerpt/plugin.js +64 -0
- package/build-module/components/post-excerpt/plugin.js.map +1 -0
- package/build-module/components/post-featured-image/index.js +5 -8
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-featured-image/panel.js +51 -0
- package/build-module/components/post-featured-image/panel.js.map +1 -0
- package/build-module/components/post-last-revision/panel.js +18 -0
- package/build-module/components/post-last-revision/panel.js.map +1 -0
- package/build-module/components/post-publish-button/index.js +1 -0
- package/build-module/components/post-publish-button/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-upload-media.js +2 -4
- package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build-module/components/post-saved-state/index.js +13 -8
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-schedule/panel.js +1 -1
- package/build-module/components/post-schedule/panel.js.map +1 -1
- package/build-module/components/post-taxonomies/panel.js +59 -0
- package/build-module/components/post-taxonomies/panel.js.map +1 -0
- package/build-module/components/post-template/block-theme.js +92 -0
- package/build-module/components/post-template/block-theme.js.map +1 -0
- package/build-module/components/post-template/classic-theme.js +162 -0
- package/build-module/components/post-template/classic-theme.js.map +1 -0
- package/build-module/components/post-template/create-new-template-modal.js +91 -0
- package/build-module/components/post-template/create-new-template-modal.js.map +1 -0
- package/build-module/components/post-template/create-new-template.js +47 -0
- package/build-module/components/post-template/create-new-template.js.map +1 -0
- package/build-module/components/post-template/hooks.js +78 -0
- package/build-module/components/post-template/hooks.js.map +1 -0
- package/build-module/components/post-template/panel.js +62 -0
- package/build-module/components/post-template/panel.js.map +1 -0
- package/build-module/components/post-template/reset-default-template.js +41 -0
- package/build-module/components/post-template/reset-default-template.js.map +1 -0
- package/build-module/components/post-template/swap-template-button.js +79 -0
- package/build-module/components/post-template/swap-template-button.js.map +1 -0
- package/build-module/components/post-title/index.native.js +26 -16
- package/build-module/components/post-title/index.native.js.map +1 -1
- package/build-module/components/post-view-link/index.js +51 -0
- package/build-module/components/post-view-link/index.js.map +1 -0
- package/build-module/components/post-visibility/check.js +6 -16
- package/build-module/components/post-visibility/check.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js +110 -0
- package/build-module/components/preview-dropdown/index.js.map +1 -0
- package/build-module/components/provider/index.js +25 -83
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/index.native.js +37 -9
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/navigation-block-editing-mode.js +34 -0
- package/build-module/components/provider/navigation-block-editing-mode.js.map +1 -0
- package/build-module/components/provider/use-block-editor-settings.js +38 -15
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/pattern-partial-syncing.js +46 -0
- package/build-module/hooks/pattern-partial-syncing.js.map +1 -0
- package/build-module/private-apis.js +14 -0
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +147 -9
- 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/index.js +5 -0
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/private-actions.js +44 -0
- package/build-module/store/private-actions.js.map +1 -0
- package/build-module/store/private-selectors.js +43 -0
- package/build-module/store/private-selectors.js.map +1 -0
- package/build-module/store/reducer.js +103 -26
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/reducer.native.js +1 -2
- package/build-module/store/reducer.native.js.map +1 -1
- package/build-module/store/selectors.js +93 -6
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/media-upload/index.js +8 -2
- package/build-module/utils/media-upload/index.js.map +1 -1
- package/build-style/style-rtl.css +433 -0
- package/build-style/style.css +433 -0
- package/package.json +32 -31
- package/src/components/document-bar/index.js +193 -0
- package/src/components/document-bar/style.scss +130 -0
- package/src/components/document-outline/index.js +48 -1
- package/src/components/document-outline/style.scss +12 -0
- package/src/components/document-tools/index.js +177 -0
- package/src/components/document-tools/style.scss +98 -0
- package/src/components/editor-canvas/edit-template-blocks-notification.js +108 -0
- package/src/components/editor-canvas/index.js +386 -0
- package/src/components/editor-canvas/style.scss +5 -0
- package/src/components/entities-saved-states/index.js +3 -1
- package/src/components/entities-saved-states/style.scss +4 -0
- package/src/components/global-keyboard-shortcuts/index.js +12 -2
- package/src/components/global-keyboard-shortcuts/register-shortcuts.js +10 -0
- package/src/components/index.js +9 -1
- package/src/components/index.native.js +1 -0
- package/src/components/inserter-sidebar/index.js +73 -0
- package/src/components/inserter-sidebar/style.scss +22 -0
- package/src/components/list-view-sidebar/index.js +169 -0
- package/src/components/list-view-sidebar/list-view-outline.js +37 -0
- package/src/components/list-view-sidebar/style.scss +84 -0
- package/src/components/offline-status/index.native.js +101 -0
- package/src/components/offline-status/style.native.scss +28 -0
- package/src/components/offline-status/test/index.native.js +108 -0
- package/src/components/page-attributes/panel.js +62 -0
- package/src/components/post-discussion/panel.js +57 -0
- package/src/components/post-excerpt/check.js +18 -0
- package/src/components/post-excerpt/panel.js +57 -0
- package/src/components/post-excerpt/plugin.js +61 -0
- package/src/components/post-excerpt/test/plugin.js +36 -0
- package/src/components/post-featured-image/index.js +3 -7
- package/src/components/post-featured-image/panel.js +55 -0
- package/src/components/post-last-revision/panel.js +22 -0
- package/src/components/post-last-revision/style.scss +10 -0
- package/src/components/post-publish-button/index.js +1 -0
- package/src/components/post-publish-panel/maybe-upload-media.js +3 -8
- package/src/components/post-saved-state/index.js +9 -8
- package/src/components/post-saved-state/test/__snapshots__/index.js.snap +2 -2
- package/src/components/post-schedule/panel.js +1 -1
- package/src/components/post-taxonomies/panel.js +66 -0
- package/src/components/post-template/block-theme.js +110 -0
- package/src/components/post-template/classic-theme.js +213 -0
- package/src/components/post-template/create-new-template-modal.js +139 -0
- package/src/components/post-template/create-new-template.js +50 -0
- package/src/components/post-template/hooks.js +95 -0
- package/src/components/post-template/panel.js +66 -0
- package/src/components/post-template/reset-default-template.js +43 -0
- package/src/components/post-template/style.scss +52 -0
- package/src/components/post-template/swap-template-button.js +86 -0
- package/src/components/post-title/index.native.js +32 -18
- package/src/components/post-title/style.scss +1 -0
- package/src/components/post-title/test/__snapshots__/index.native.js.snap +25 -0
- package/src/components/post-title/test/index.native.js +78 -0
- package/src/components/post-view-link/index.js +47 -0
- package/src/components/post-visibility/check.js +10 -15
- package/src/components/post-visibility/test/check.js +24 -13
- package/src/components/preview-dropdown/index.js +133 -0
- package/src/components/preview-dropdown/style.scss +5 -0
- package/src/components/provider/index.js +28 -118
- package/src/components/provider/index.native.js +55 -14
- package/src/components/provider/navigation-block-editing-mode.js +37 -0
- package/src/components/provider/use-block-editor-settings.js +42 -17
- package/src/hooks/index.js +1 -0
- package/src/hooks/pattern-partial-syncing.js +73 -0
- package/src/private-apis.js +14 -0
- package/src/store/actions.js +160 -9
- package/src/store/defaults.js +1 -0
- package/src/store/index.js +5 -0
- package/src/store/private-actions.js +61 -0
- package/src/store/private-selectors.js +51 -0
- package/src/store/reducer.js +103 -26
- package/src/store/reducer.native.js +0 -2
- package/src/store/selectors.js +144 -42
- package/src/store/test/actions.js +56 -0
- package/src/store/test/reducer.js +98 -0
- package/src/store/test/selectors.js +137 -147
- package/src/style.scss +7 -0
- package/src/utils/media-upload/index.js +9 -2
- package/build/components/post-template/index.js +0 -66
- package/build/components/post-template/index.js.map +0 -1
- package/build-module/components/post-template/index.js +0 -57
- package/build-module/components/post-template/index.js.map +0 -1
- package/src/components/post-template/index.js +0 -64
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["default","AutosaveMonitor","PostTitle","EditorHistoryRedo","EditorHistoryUndo","EditorProvider","EditorHelpTopics"],"sources":["@wordpress/editor/src/components/index.native.js"],"sourcesContent":["// Post Related Components.\nexport { default as AutosaveMonitor } from './autosave-monitor';\nexport { default as PostTitle } from './post-title';\nexport { default as EditorHistoryRedo } from './editor-history/redo';\nexport { default as EditorHistoryUndo } from './editor-history/undo';\n\n// State Related Components.\nexport { default as EditorProvider } from './provider';\n\n// Other Components.\nexport { default as EditorHelpTopics } from './editor-help';\n\nexport * from './deprecated';\n"],"mappings":"AAAA;AACA,SAASA,OAAO,IAAIC,eAAe,QAAQ,oBAAoB;AAC/D,SAASD,OAAO,IAAIE,SAAS,QAAQ,cAAc;AACnD,SAASF,OAAO,IAAIG,iBAAiB,QAAQ,uBAAuB;AACpE,SAASH,OAAO,IAAII,iBAAiB,QAAQ,uBAAuB;;AAEpE;AACA,SAASJ,OAAO,IAAIK,cAAc,QAAQ,YAAY;;AAEtD;AACA,SAASL,OAAO,IAAIM,gBAAgB,QAAQ,eAAe;AAE3D,cAAc,cAAc"}
|
|
1
|
+
{"version":3,"names":["default","AutosaveMonitor","PostTitle","EditorHistoryRedo","EditorHistoryUndo","EditorProvider","EditorHelpTopics","OfflineStatus"],"sources":["@wordpress/editor/src/components/index.native.js"],"sourcesContent":["// Post Related Components.\nexport { default as AutosaveMonitor } from './autosave-monitor';\nexport { default as PostTitle } from './post-title';\nexport { default as EditorHistoryRedo } from './editor-history/redo';\nexport { default as EditorHistoryUndo } from './editor-history/undo';\n\n// State Related Components.\nexport { default as EditorProvider } from './provider';\n\n// Other Components.\nexport { default as EditorHelpTopics } from './editor-help';\nexport { default as OfflineStatus } from './offline-status';\n\nexport * from './deprecated';\n"],"mappings":"AAAA;AACA,SAASA,OAAO,IAAIC,eAAe,QAAQ,oBAAoB;AAC/D,SAASD,OAAO,IAAIE,SAAS,QAAQ,cAAc;AACnD,SAASF,OAAO,IAAIG,iBAAiB,QAAQ,uBAAuB;AACpE,SAASH,OAAO,IAAII,iBAAiB,QAAQ,uBAAuB;;AAEpE;AACA,SAASJ,OAAO,IAAIK,cAAc,QAAQ,YAAY;;AAEtD;AACA,SAASL,OAAO,IAAIM,gBAAgB,QAAQ,eAAe;AAC3D,SAASN,OAAO,IAAIO,aAAa,QAAQ,kBAAkB;AAE3D,cAAc,cAAc"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* WordPress dependencies
|
|
4
|
+
*/
|
|
5
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
6
|
+
import { Button, VisuallyHidden } from '@wordpress/components';
|
|
7
|
+
import { __experimentalLibrary as Library } from '@wordpress/block-editor';
|
|
8
|
+
import { close } from '@wordpress/icons';
|
|
9
|
+
import { useViewportMatch, __experimentalUseDialog as useDialog } from '@wordpress/compose';
|
|
10
|
+
import { __ } from '@wordpress/i18n';
|
|
11
|
+
import { useEffect, useRef } from '@wordpress/element';
|
|
12
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Internal dependencies
|
|
16
|
+
*/
|
|
17
|
+
import { unlock } from '../../lock-unlock';
|
|
18
|
+
import { store as editorStore } from '../../store';
|
|
19
|
+
export default function InserterSidebar() {
|
|
20
|
+
const {
|
|
21
|
+
insertionPoint,
|
|
22
|
+
showMostUsedBlocks
|
|
23
|
+
} = useSelect(select => {
|
|
24
|
+
const {
|
|
25
|
+
getInsertionPoint
|
|
26
|
+
} = unlock(select(editorStore));
|
|
27
|
+
const {
|
|
28
|
+
get
|
|
29
|
+
} = select(preferencesStore);
|
|
30
|
+
return {
|
|
31
|
+
insertionPoint: getInsertionPoint(),
|
|
32
|
+
showMostUsedBlocks: get('core', 'mostUsedBlocks')
|
|
33
|
+
};
|
|
34
|
+
}, []);
|
|
35
|
+
const {
|
|
36
|
+
setIsInserterOpened
|
|
37
|
+
} = useDispatch(editorStore);
|
|
38
|
+
const isMobileViewport = useViewportMatch('medium', '<');
|
|
39
|
+
const TagName = !isMobileViewport ? VisuallyHidden : 'div';
|
|
40
|
+
const [inserterDialogRef, inserterDialogProps] = useDialog({
|
|
41
|
+
onClose: () => setIsInserterOpened(false),
|
|
42
|
+
focusOnMount: null
|
|
43
|
+
});
|
|
44
|
+
const libraryRef = useRef();
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
libraryRef.current.focusSearch();
|
|
47
|
+
}, []);
|
|
48
|
+
return createElement("div", {
|
|
49
|
+
ref: inserterDialogRef,
|
|
50
|
+
...inserterDialogProps,
|
|
51
|
+
className: "editor-inserter-sidebar"
|
|
52
|
+
}, createElement(TagName, {
|
|
53
|
+
className: "editor-inserter-sidebar__header"
|
|
54
|
+
}, createElement(Button, {
|
|
55
|
+
icon: close,
|
|
56
|
+
label: __('Close block inserter'),
|
|
57
|
+
onClick: () => setIsInserterOpened(false)
|
|
58
|
+
})), createElement("div", {
|
|
59
|
+
className: "editor-inserter-sidebar__content"
|
|
60
|
+
}, createElement(Library, {
|
|
61
|
+
showMostUsedBlocks: showMostUsedBlocks,
|
|
62
|
+
showInserterHelpPanel: true,
|
|
63
|
+
shouldFocusBlock: isMobileViewport,
|
|
64
|
+
rootClientId: insertionPoint.rootClientId,
|
|
65
|
+
__experimentalInsertionIndex: insertionPoint.insertionIndex,
|
|
66
|
+
__experimentalFilterValue: insertionPoint.filterValue,
|
|
67
|
+
ref: libraryRef
|
|
68
|
+
})));
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useDispatch","useSelect","Button","VisuallyHidden","__experimentalLibrary","Library","close","useViewportMatch","__experimentalUseDialog","useDialog","__","useEffect","useRef","store","preferencesStore","unlock","editorStore","InserterSidebar","insertionPoint","showMostUsedBlocks","select","getInsertionPoint","get","setIsInserterOpened","isMobileViewport","TagName","inserterDialogRef","inserterDialogProps","onClose","focusOnMount","libraryRef","current","focusSearch","createElement","ref","className","icon","label","onClick","showInserterHelpPanel","shouldFocusBlock","rootClientId","__experimentalInsertionIndex","insertionIndex","__experimentalFilterValue","filterValue"],"sources":["@wordpress/editor/src/components/inserter-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Button, VisuallyHidden } from '@wordpress/components';\nimport { __experimentalLibrary as Library } from '@wordpress/block-editor';\nimport { close } from '@wordpress/icons';\nimport {\n\tuseViewportMatch,\n\t__experimentalUseDialog as useDialog,\n} from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nexport default function InserterSidebar() {\n\tconst { insertionPoint, showMostUsedBlocks } = useSelect( ( select ) => {\n\t\tconst { getInsertionPoint } = unlock( select( editorStore ) );\n\t\tconst { get } = select( preferencesStore );\n\t\treturn {\n\t\t\tinsertionPoint: getInsertionPoint(),\n\t\t\tshowMostUsedBlocks: get( 'core', 'mostUsedBlocks' ),\n\t\t};\n\t}, [] );\n\tconst { setIsInserterOpened } = useDispatch( editorStore );\n\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst TagName = ! isMobileViewport ? VisuallyHidden : 'div';\n\tconst [ inserterDialogRef, inserterDialogProps ] = useDialog( {\n\t\tonClose: () => setIsInserterOpened( false ),\n\t\tfocusOnMount: null,\n\t} );\n\n\tconst libraryRef = useRef();\n\tuseEffect( () => {\n\t\tlibraryRef.current.focusSearch();\n\t}, [] );\n\n\treturn (\n\t\t<div\n\t\t\tref={ inserterDialogRef }\n\t\t\t{ ...inserterDialogProps }\n\t\t\tclassName=\"editor-inserter-sidebar\"\n\t\t>\n\t\t\t<TagName className=\"editor-inserter-sidebar__header\">\n\t\t\t\t<Button\n\t\t\t\t\ticon={ close }\n\t\t\t\t\tlabel={ __( 'Close block inserter' ) }\n\t\t\t\t\tonClick={ () => setIsInserterOpened( false ) }\n\t\t\t\t/>\n\t\t\t</TagName>\n\t\t\t<div className=\"editor-inserter-sidebar__content\">\n\t\t\t\t<Library\n\t\t\t\t\tshowMostUsedBlocks={ showMostUsedBlocks }\n\t\t\t\t\tshowInserterHelpPanel\n\t\t\t\t\tshouldFocusBlock={ isMobileViewport }\n\t\t\t\t\trootClientId={ insertionPoint.rootClientId }\n\t\t\t\t\t__experimentalInsertionIndex={\n\t\t\t\t\t\tinsertionPoint.insertionIndex\n\t\t\t\t\t}\n\t\t\t\t\t__experimentalFilterValue={ insertionPoint.filterValue }\n\t\t\t\t\tref={ libraryRef }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,MAAM,EAAEC,cAAc,QAAQ,uBAAuB;AAC9D,SAASC,qBAAqB,IAAIC,OAAO,QAAQ,yBAAyB;AAC1E,SAASC,KAAK,QAAQ,kBAA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EAAG,CAAC;EAEP,OACCC,aAAA;IACCC,GAAG,EAAGR,iBAAmB;IAAA,GACpBC,mBAAmB;IACxBQ,SAAS,EAAC;EAAyB,GAEnCF,aAAA,CAACR,OAAO;IAACU,SAAS,EAAC;EAAiC,GACnDF,aAAA,CAAC/B,MAAM;IACNkC,IAAI,EAAG9B,KAAO;IACd+B,KAAK,EAAG3B,EAAE,CAAE,sBAAuB,CAAG;IACtC4B,OAAO,EAAGA,CAAA,KAAMf,mBAAmB,CAAE,KAAM;EAAG,CAC9C,CACO,CAAC,EACVU,aAAA;IAAKE,SAAS,EAAC;EAAkC,GAChDF,aAAA,CAAC5B,OAAO;IACPc,kBAAkB,EAAGA,kBAAoB;IACzCoB,qBAAqB;IACrBC,gBAAgB,EAAGhB,gBAAkB;IACrCiB,YAAY,EAAGvB,cAAc,CAACuB,YAAc;IAC5CC,4BAA4B,EAC3BxB,cAAc,CAACyB,cACf;IACDC,yBAAyB,EAAG1B,cAAc,CAAC2B,WAAa;IACxDX,GAAG,EAAGJ;EAAY,CAClB,CACG,CACD,CAAC;AAER"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* WordPress dependencies
|
|
4
|
+
*/
|
|
5
|
+
import { __experimentalListView as ListView } from '@wordpress/block-editor';
|
|
6
|
+
import { Button, TabPanel } from '@wordpress/components';
|
|
7
|
+
import { useFocusOnMount, useMergeRefs } from '@wordpress/compose';
|
|
8
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
9
|
+
import { focus } from '@wordpress/dom';
|
|
10
|
+
import { useCallback, useRef, useState } from '@wordpress/element';
|
|
11
|
+
import { __, _x } from '@wordpress/i18n';
|
|
12
|
+
import { closeSmall } from '@wordpress/icons';
|
|
13
|
+
import { useShortcut } from '@wordpress/keyboard-shortcuts';
|
|
14
|
+
import { ESCAPE } from '@wordpress/keycodes';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Internal dependencies
|
|
18
|
+
*/
|
|
19
|
+
import ListViewOutline from './list-view-outline';
|
|
20
|
+
import { unlock } from '../../lock-unlock';
|
|
21
|
+
import { store as editorStore } from '../../store';
|
|
22
|
+
export default function ListViewSidebar() {
|
|
23
|
+
const {
|
|
24
|
+
setIsListViewOpened
|
|
25
|
+
} = useDispatch(editorStore);
|
|
26
|
+
const {
|
|
27
|
+
getListViewToggleRef
|
|
28
|
+
} = unlock(useSelect(editorStore));
|
|
29
|
+
|
|
30
|
+
// This hook handles focus when the sidebar first renders.
|
|
31
|
+
const focusOnMountRef = useFocusOnMount('firstElement');
|
|
32
|
+
|
|
33
|
+
// When closing the list view, focus should return to the toggle button.
|
|
34
|
+
const closeListView = useCallback(() => {
|
|
35
|
+
setIsListViewOpened(false);
|
|
36
|
+
getListViewToggleRef().current?.focus();
|
|
37
|
+
}, [getListViewToggleRef, setIsListViewOpened]);
|
|
38
|
+
const closeOnEscape = useCallback(event => {
|
|
39
|
+
if (event.keyCode === ESCAPE && !event.defaultPrevented) {
|
|
40
|
+
event.preventDefault();
|
|
41
|
+
closeListView();
|
|
42
|
+
}
|
|
43
|
+
}, [closeListView]);
|
|
44
|
+
|
|
45
|
+
// Use internal state instead of a ref to make sure that the component
|
|
46
|
+
// re-renders when the dropZoneElement updates.
|
|
47
|
+
const [dropZoneElement, setDropZoneElement] = useState(null);
|
|
48
|
+
// Tracks our current tab.
|
|
49
|
+
const [tab, setTab] = useState('list-view');
|
|
50
|
+
|
|
51
|
+
// This ref refers to the sidebar as a whole.
|
|
52
|
+
const sidebarRef = useRef();
|
|
53
|
+
// This ref refers to the tab panel.
|
|
54
|
+
const tabPanelRef = useRef();
|
|
55
|
+
// This ref refers to the list view application area.
|
|
56
|
+
const listViewRef = useRef();
|
|
57
|
+
|
|
58
|
+
// Must merge the refs together so focus can be handled properly in the next function.
|
|
59
|
+
const listViewContainerRef = useMergeRefs([focusOnMountRef, listViewRef, setDropZoneElement]);
|
|
60
|
+
|
|
61
|
+
/*
|
|
62
|
+
* Callback function to handle list view or outline focus.
|
|
63
|
+
*
|
|
64
|
+
* @param {string} currentTab The current tab. Either list view or outline.
|
|
65
|
+
*
|
|
66
|
+
* @return void
|
|
67
|
+
*/
|
|
68
|
+
function handleSidebarFocus(currentTab) {
|
|
69
|
+
// Tab panel focus.
|
|
70
|
+
const tabPanelFocus = focus.tabbable.find(tabPanelRef.current)[0];
|
|
71
|
+
// List view tab is selected.
|
|
72
|
+
if (currentTab === 'list-view') {
|
|
73
|
+
// Either focus the list view or the tab panel. Must have a fallback because the list view does not render when there are no blocks.
|
|
74
|
+
const listViewApplicationFocus = focus.tabbable.find(listViewRef.current)[0];
|
|
75
|
+
const listViewFocusArea = sidebarRef.current.contains(listViewApplicationFocus) ? listViewApplicationFocus : tabPanelFocus;
|
|
76
|
+
listViewFocusArea.focus();
|
|
77
|
+
// Outline tab is selected.
|
|
78
|
+
} else {
|
|
79
|
+
tabPanelFocus.focus();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const handleToggleListViewShortcut = useCallback(() => {
|
|
83
|
+
// If the sidebar has focus, it is safe to close.
|
|
84
|
+
if (sidebarRef.current.contains(sidebarRef.current.ownerDocument.activeElement)) {
|
|
85
|
+
closeListView();
|
|
86
|
+
} else {
|
|
87
|
+
// If the list view or outline does not have focus, focus should be moved to it.
|
|
88
|
+
handleSidebarFocus(tab);
|
|
89
|
+
}
|
|
90
|
+
}, [closeListView, tab]);
|
|
91
|
+
|
|
92
|
+
// This only fires when the sidebar is open because of the conditional rendering.
|
|
93
|
+
// It is the same shortcut to open but that is defined as a global shortcut and only fires when the sidebar is closed.
|
|
94
|
+
useShortcut('core/editor/toggle-list-view', handleToggleListViewShortcut);
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Render tab content for a given tab name.
|
|
98
|
+
*
|
|
99
|
+
* @param {string} tabName The name of the tab to render.
|
|
100
|
+
*/
|
|
101
|
+
function renderTabContent(tabName) {
|
|
102
|
+
if (tabName === 'list-view') {
|
|
103
|
+
return createElement("div", {
|
|
104
|
+
className: "editor-list-view-sidebar__list-view-panel-content"
|
|
105
|
+
}, createElement(ListView, {
|
|
106
|
+
dropZoneElement: dropZoneElement
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
return createElement(ListViewOutline, null);
|
|
110
|
+
}
|
|
111
|
+
return (
|
|
112
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
113
|
+
createElement("div", {
|
|
114
|
+
className: "editor-list-view-sidebar",
|
|
115
|
+
onKeyDown: closeOnEscape,
|
|
116
|
+
ref: sidebarRef
|
|
117
|
+
}, createElement(Button, {
|
|
118
|
+
className: "editor-list-view-sidebar__close-button",
|
|
119
|
+
icon: closeSmall,
|
|
120
|
+
label: __('Close'),
|
|
121
|
+
onClick: closeListView
|
|
122
|
+
}), createElement(TabPanel, {
|
|
123
|
+
className: "editor-list-view-sidebar__tab-panel",
|
|
124
|
+
ref: tabPanelRef,
|
|
125
|
+
onSelect: tabName => setTab(tabName),
|
|
126
|
+
selectOnMove: false,
|
|
127
|
+
tabs: [{
|
|
128
|
+
name: 'list-view',
|
|
129
|
+
title: _x('List View', 'Post overview'),
|
|
130
|
+
className: 'editor-list-view-sidebar__panel-tab'
|
|
131
|
+
}, {
|
|
132
|
+
name: 'outline',
|
|
133
|
+
title: _x('Outline', 'Post overview'),
|
|
134
|
+
className: 'editor-list-view-sidebar__panel-tab'
|
|
135
|
+
}]
|
|
136
|
+
}, currentTab => createElement("div", {
|
|
137
|
+
className: "editor-list-view-sidebar__list-view-container",
|
|
138
|
+
ref: listViewContainerRef
|
|
139
|
+
}, renderTabContent(currentTab.name))))
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__experimentalListView","ListView","Button","TabPanel","useFocusOnMount","useMergeRefs","useDispatch","useSelect","focus","useCallback","useRef","useState","__","_x","closeSmall","useShortcut","ESCAPE","ListViewOutline","unlock","store","editorStore","ListViewSidebar","setIsListViewOpened","getListViewToggleRef","focusOnMountRef","closeListView","current","closeOnEscape","event","keyCode","defaultPrevented","preventDefault","dropZoneElement","setDropZoneElement","tab","setTab","sidebarRef","tabPanelRef","listViewRef","listViewContainerRef","handleSidebarFocus","currentTab","tabPanelFocus","tabbable","find","listViewApplicationFocus","listViewFocusArea","contains","handleToggleListViewShortcut","ownerDocument","activeElement","renderTabContent","tabName","createElement","className","onKeyDown","ref","icon","label","onClick","onSelect","selectOnMove","tabs","name","title"],"sources":["@wordpress/editor/src/components/list-view-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalListView as ListView } from '@wordpress/block-editor';\nimport { Button, TabPanel } from '@wordpress/components';\nimport { useFocusOnMount, useMergeRefs } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { focus } from '@wordpress/dom';\nimport { useCallback, useRef, useState } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\nimport { closeSmall } from '@wordpress/icons';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport ListViewOutline from './list-view-outline';\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nexport default function ListViewSidebar() {\n\tconst { setIsListViewOpened } = useDispatch( editorStore );\n\tconst { getListViewToggleRef } = unlock( useSelect( editorStore ) );\n\n\t// This hook handles focus when the sidebar first renders.\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\n\t// When closing the list view, focus should return to the toggle button.\n\tconst closeListView = useCallback( () => {\n\t\tsetIsListViewOpened( false );\n\t\tgetListViewToggleRef().current?.focus();\n\t}, [ getListViewToggleRef, setIsListViewOpened ] );\n\n\tconst closeOnEscape = useCallback(\n\t\t( event ) => {\n\t\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tcloseListView();\n\t\t\t}\n\t\t},\n\t\t[ closeListView ]\n\t);\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the dropZoneElement updates.\n\tconst [ dropZoneElement, setDropZoneElement ] = useState( null );\n\t// Tracks our current tab.\n\tconst [ tab, setTab ] = useState( 'list-view' );\n\n\t// This ref refers to the sidebar as a whole.\n\tconst sidebarRef = useRef();\n\t// This ref refers to the tab panel.\n\tconst tabPanelRef = useRef();\n\t// This ref refers to the list view application area.\n\tconst listViewRef = useRef();\n\n\t// Must merge the refs together so focus can be handled properly in the next function.\n\tconst listViewContainerRef = useMergeRefs( [\n\t\tfocusOnMountRef,\n\t\tlistViewRef,\n\t\tsetDropZoneElement,\n\t] );\n\n\t/*\n\t * Callback function to handle list view or outline focus.\n\t *\n\t * @param {string} currentTab The current tab. Either list view or outline.\n\t *\n\t * @return void\n\t */\n\tfunction handleSidebarFocus( currentTab ) {\n\t\t// Tab panel focus.\n\t\tconst tabPanelFocus = focus.tabbable.find( tabPanelRef.current )[ 0 ];\n\t\t// List view tab is selected.\n\t\tif ( currentTab === 'list-view' ) {\n\t\t\t// Either focus the list view or the tab panel. Must have a fallback because the list view does not render when there are no blocks.\n\t\t\tconst listViewApplicationFocus = focus.tabbable.find(\n\t\t\t\tlistViewRef.current\n\t\t\t)[ 0 ];\n\t\t\tconst listViewFocusArea = sidebarRef.current.contains(\n\t\t\t\tlistViewApplicationFocus\n\t\t\t)\n\t\t\t\t? listViewApplicationFocus\n\t\t\t\t: tabPanelFocus;\n\t\t\tlistViewFocusArea.focus();\n\t\t\t// Outline tab is selected.\n\t\t} else {\n\t\t\ttabPanelFocus.focus();\n\t\t}\n\t}\n\n\tconst handleToggleListViewShortcut = useCallback( () => {\n\t\t// If the sidebar has focus, it is safe to close.\n\t\tif (\n\t\t\tsidebarRef.current.contains(\n\t\t\t\tsidebarRef.current.ownerDocument.activeElement\n\t\t\t)\n\t\t) {\n\t\t\tcloseListView();\n\t\t} else {\n\t\t\t// If the list view or outline does not have focus, focus should be moved to it.\n\t\t\thandleSidebarFocus( tab );\n\t\t}\n\t}, [ closeListView, tab ] );\n\n\t// This only fires when the sidebar is open because of the conditional rendering.\n\t// It is the same shortcut to open but that is defined as a global shortcut and only fires when the sidebar is closed.\n\tuseShortcut( 'core/editor/toggle-list-view', handleToggleListViewShortcut );\n\n\t/**\n\t * Render tab content for a given tab name.\n\t *\n\t * @param {string} tabName The name of the tab to render.\n\t */\n\tfunction renderTabContent( tabName ) {\n\t\tif ( tabName === 'list-view' ) {\n\t\t\treturn (\n\t\t\t\t<div className=\"editor-list-view-sidebar__list-view-panel-content\">\n\t\t\t\t\t<ListView dropZoneElement={ dropZoneElement } />\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\t\treturn <ListViewOutline />;\n\t}\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tclassName=\"editor-list-view-sidebar\"\n\t\t\tonKeyDown={ closeOnEscape }\n\t\t\tref={ sidebarRef }\n\t\t>\n\t\t\t<Button\n\t\t\t\tclassName=\"editor-list-view-sidebar__close-button\"\n\t\t\t\ticon={ closeSmall }\n\t\t\t\tlabel={ __( 'Close' ) }\n\t\t\t\tonClick={ closeListView }\n\t\t\t/>\n\t\t\t<TabPanel\n\t\t\t\tclassName=\"editor-list-view-sidebar__tab-panel\"\n\t\t\t\tref={ tabPanelRef }\n\t\t\t\tonSelect={ ( tabName ) => setTab( tabName ) }\n\t\t\t\tselectOnMove={ false }\n\t\t\t\ttabs={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'list-view',\n\t\t\t\t\t\ttitle: _x( 'List View', 'Post overview' ),\n\t\t\t\t\t\tclassName: 'editor-list-view-sidebar__panel-tab',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'outline',\n\t\t\t\t\t\ttitle: _x( 'Outline', 'Post overview' ),\n\t\t\t\t\t\tclassName: 'editor-list-view-sidebar__panel-tab',\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t{ ( currentTab ) => (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"editor-list-view-sidebar__list-view-container\"\n\t\t\t\t\t\tref={ listViewContainerRef }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ renderTabContent( currentTab.name ) }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</TabPanel>\n\t\t</div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,sBAAsB,IAAIC,QAAQ,QAAQ,yBAAyB;AAC5E,SAASC,MAAM,EAAEC,QAAQ,QAAQ,uBAAuB;AACxD,SAASC,eAAe,EAAEC,YAAY,QAAQ,oBAAoB;AAClE,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,KAAK,QAAQ,gBAAgB;AACtC,SAASC,WAAW,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,oBAAoB;AAClE,SAASC,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAASC,WAAW,QAAQ,+BAA+B;AAC3D,SAASC,MAAM,QAAQ,qBAAqB;;AAE5C;AACA;AACA;AACA,OAAOC,eAAe,MAAM,qBAAqB;AACjD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAElD,eAAe,SAASC,eAAeA,CAAA,EAAG;EACzC,MAAM;IAAEC;EAAoB,CAAC,GAAGhB,WAAW,CAAEc,WAAY,CAAC;EAC1D,MAAM;IAAEG;EAAqB,CAAC,GAAGL,MAAM,CAAEX,SAAS,CAAEa,WAAY,CAAE,CAAC;;EAEnE;EACA,MAAMI,eAAe,GAAGpB,eAAe,CAAE,cAAe,CAAC;;EAEzD;EACA,MAAMqB,aAAa,GAAGhB,WAAW,CAAE,MAAM;IACxCa,mBAAmB,CAAE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B,OAAQ,CAAG;MAC7CS,YAAY,EAAG,KAAO;MACtBC,IAAI,EAAG,CACN;QACCC,IAAI,EAAE,WAAW;QACjBC,KAAK,EAAEnD,EAAE,CAAE,WAAW,EAAE,eAAgB,CAAC;QACzCyC,SAAS,EAAE;MACZ,CAAC,EACD;QACCS,IAAI,EAAE,SAAS;QACfC,KAAK,EAAEnD,EAAE,CAAE,SAAS,EAAE,eAAgB,CAAC;QACvCyC,SAAS,EAAE;MACZ,CAAC;IACC,GAECb,UAAU,IACbY,aAAA;MACCC,SAAS,EAAC,+CAA+C;MACzDE,GAAG,EAAGjB;IAAsB,GAE1BY,gBAAgB,CAAEV,UAAU,CAACsB,IAAK,CAChC,CAEG,CACN;EAAC;AAER"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createElement, Fragment } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* WordPress dependencies
|
|
4
|
+
*/
|
|
5
|
+
import { __experimentalText as Text } from '@wordpress/components';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
import CharacterCount from '../character-count';
|
|
12
|
+
import WordCount from '../word-count';
|
|
13
|
+
import TimeToRead from '../time-to-read';
|
|
14
|
+
import DocumentOutline from '../document-outline';
|
|
15
|
+
export default function ListViewOutline() {
|
|
16
|
+
return createElement(Fragment, null, createElement("div", {
|
|
17
|
+
className: "editor-list-view-sidebar__outline"
|
|
18
|
+
}, createElement("div", null, createElement(Text, null, __('Characters:')), createElement(Text, null, createElement(CharacterCount, null))), createElement("div", null, createElement(Text, null, __('Words:')), createElement(WordCount, null)), createElement("div", null, createElement(Text, null, __('Time to read:')), createElement(TimeToRead, null))), createElement(DocumentOutline, null));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=list-view-outline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__experimentalText","Text","__","CharacterCount","WordCount","TimeToRead","DocumentOutline","ListViewOutline","createElement","Fragment","className"],"sources":["@wordpress/editor/src/components/list-view-sidebar/list-view-outline.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalText as Text } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport CharacterCount from '../character-count';\nimport WordCount from '../word-count';\nimport TimeToRead from '../time-to-read';\nimport DocumentOutline from '../document-outline';\n\nexport default function ListViewOutline() {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"editor-list-view-sidebar__outline\">\n\t\t\t\t<div>\n\t\t\t\t\t<Text>{ __( 'Characters:' ) }</Text>\n\t\t\t\t\t<Text>\n\t\t\t\t\t\t<CharacterCount />\n\t\t\t\t\t</Text>\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<Text>{ __( 'Words:' ) }</Text>\n\t\t\t\t\t<WordCount />\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<Text>{ __( 'Time to read:' ) }</Text>\n\t\t\t\t\t<TimeToRead />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<DocumentOutline />\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,kBAAkB,IAAIC,IAAI,QAAQ,uBAAuB;AAClE,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,cAAc,MAAM,oBAAoB;AAC/C,OAAOC,SAAS,MAAM,eAAe;AACrC,OAAOC,UAAU,MAAM,iBAAiB;AACxC,OAAOC,eAAe,MAAM,qBAAqB;AAEjD,eAAe,SAASC,eAAeA,CAAA,EAAG;EACzC,OACCC,aAAA,CAAAC,QAAA,QACCD,aAAA;IAAKE,SAAS,EAAC;EAAmC,GACjDF,aAAA,cACCA,aAAA,CAACP,IAAI,QAAGC,EAAE,CAAE,aAAc,CAAS,CAAC,EACpCM,aAAA,CAACP,IAAI,QACJO,aAAA,CAACL,cAAc,MAAE,CACZ,CACF,CAAC,EACNK,aAAA,cACCA,aAAA,CAACP,IAAI,QAAGC,EAAE,CAAE,QAAS,CAAS,CAAC,EAC/BM,aAAA,CAACJ,SAAS,MAAE,CACR,CAAC,EACNI,aAAA,cACCA,aAAA,CAACP,IAAI,QAAGC,EAAE,CAAE,eAAgB,CAAS,CAAC,EACtCM,aAAA,CAACH,UAAU,MAAE,CACT,CACD,CAAC,EACNG,aAAA,CAACF,eAAe,MAAE,CACjB,CAAC;AAEL"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* External dependencies
|
|
4
|
+
*/
|
|
5
|
+
import { AccessibilityInfo, Text, View } from 'react-native';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* WordPress dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { usePreferredColorSchemeStyle, useNetworkConnectivity, usePrevious } from '@wordpress/compose';
|
|
11
|
+
import { Icon } from '@wordpress/components';
|
|
12
|
+
import { offline as offlineIcon } from '@wordpress/icons';
|
|
13
|
+
import { __ } from '@wordpress/i18n';
|
|
14
|
+
import { useEffect } from '@wordpress/element';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Internal dependencies
|
|
18
|
+
*/
|
|
19
|
+
import styles from './style.native.scss';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Conditionally announces messages for screen reader users. This Hook provides
|
|
23
|
+
* two benefits over React Native's `accessibilityLiveRegion`:
|
|
24
|
+
*
|
|
25
|
+
* 1. It works on both iOS and Android.
|
|
26
|
+
* 2. It allows announcing a secondary message when the component is inactive.
|
|
27
|
+
*
|
|
28
|
+
* @param {string} message The message to announce.
|
|
29
|
+
* @param {Object} options Options for the Hook.
|
|
30
|
+
* @param {boolean} [options.isActive] Whether the message should be announced.
|
|
31
|
+
* @param {string} [options.inactiveMessage] The message to announce when inactive.
|
|
32
|
+
*/
|
|
33
|
+
function useAccessibilityLiveRegion(message, {
|
|
34
|
+
isActive,
|
|
35
|
+
inactiveMessage
|
|
36
|
+
}) {
|
|
37
|
+
const {
|
|
38
|
+
announceForAccessibility
|
|
39
|
+
} = AccessibilityInfo;
|
|
40
|
+
const prevIsActive = usePrevious(isActive);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
const unconditionalMessage = typeof isActive === 'undefined';
|
|
43
|
+
const initialRender = typeof prevIsActive === 'undefined';
|
|
44
|
+
if (unconditionalMessage || isActive && !prevIsActive && !initialRender) {
|
|
45
|
+
announceForAccessibility(message);
|
|
46
|
+
} else if (!isActive && prevIsActive && inactiveMessage) {
|
|
47
|
+
announceForAccessibility(inactiveMessage);
|
|
48
|
+
}
|
|
49
|
+
}, [message, isActive, prevIsActive, inactiveMessage, announceForAccessibility]);
|
|
50
|
+
}
|
|
51
|
+
const OfflineStatus = () => {
|
|
52
|
+
const {
|
|
53
|
+
isConnected
|
|
54
|
+
} = useNetworkConnectivity();
|
|
55
|
+
useAccessibilityLiveRegion(__('Network connection re-established'), {
|
|
56
|
+
isActive: isConnected,
|
|
57
|
+
inactiveMessage: __('Network connection lost, working offline')
|
|
58
|
+
});
|
|
59
|
+
const containerStyle = usePreferredColorSchemeStyle(styles.offline, styles.offline__dark);
|
|
60
|
+
const textStyle = usePreferredColorSchemeStyle(styles['offline--text'], styles['offline--text__dark']);
|
|
61
|
+
const iconStyle = usePreferredColorSchemeStyle(styles['offline--icon'], styles['offline--icon__dark']);
|
|
62
|
+
return !isConnected ? createElement(View, {
|
|
63
|
+
accessible: true,
|
|
64
|
+
accessibilityRole: "alert",
|
|
65
|
+
accessibilityLabel: __('Network connection lost, working offline'),
|
|
66
|
+
style: containerStyle
|
|
67
|
+
}, createElement(View, {
|
|
68
|
+
style: containerStyle
|
|
69
|
+
}, createElement(Icon, {
|
|
70
|
+
fill: iconStyle.fill,
|
|
71
|
+
icon: offlineIcon
|
|
72
|
+
}), createElement(Text, {
|
|
73
|
+
style: textStyle
|
|
74
|
+
}, __('Working Offline')))) : null;
|
|
75
|
+
};
|
|
76
|
+
export default OfflineStatus;
|
|
77
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["AccessibilityInfo","Text","View","usePreferredColorSchemeStyle","useNetworkConnectivity","usePrevious","Icon","offline","offlineIcon","__","useEffect","styles","useAccessibilityLiveRegion","message","isActive","inactiveMessage","announceForAccessibility","prevIsActive","unconditionalMessage","initialRender","OfflineStatus","isConnected","containerStyle","offline__dark","textStyle","iconStyle","createElement","accessible","accessibilityRole","accessibilityLabel","style","fill","icon"],"sources":["@wordpress/editor/src/components/offline-status/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { AccessibilityInfo, Text, View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tusePreferredColorSchemeStyle,\n\tuseNetworkConnectivity,\n\tusePrevious,\n} from '@wordpress/compose';\nimport { Icon } from '@wordpress/components';\nimport { offline as offlineIcon } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.native.scss';\n\n/**\n * Conditionally announces messages for screen reader users. This Hook provides\n * two benefits over React Native's `accessibilityLiveRegion`:\n *\n * 1. It works on both iOS and Android.\n * 2. It allows announcing a secondary message when the component is inactive.\n *\n * @param {string} message The message to announce.\n * @param {Object} options Options for the Hook.\n * @param {boolean} [options.isActive] Whether the message should be announced.\n * @param {string} [options.inactiveMessage] The message to announce when inactive.\n */\nfunction useAccessibilityLiveRegion( message, { isActive, inactiveMessage } ) {\n\tconst { announceForAccessibility } = AccessibilityInfo;\n\tconst prevIsActive = usePrevious( isActive );\n\n\tuseEffect( () => {\n\t\tconst unconditionalMessage = typeof isActive === 'undefined';\n\t\tconst initialRender = typeof prevIsActive === 'undefined';\n\n\t\tif (\n\t\t\tunconditionalMessage ||\n\t\t\t( isActive && ! prevIsActive && ! initialRender )\n\t\t) {\n\t\t\tannounceForAccessibility( message );\n\t\t} else if ( ! isActive && prevIsActive && inactiveMessage ) {\n\t\t\tannounceForAccessibility( inactiveMessage );\n\t\t}\n\t}, [\n\t\tmessage,\n\t\tisActive,\n\t\tprevIsActive,\n\t\tinactiveMessage,\n\t\tannounceForAccessibility,\n\t] );\n}\n\nconst OfflineStatus = () => {\n\tconst { isConnected } = useNetworkConnectivity();\n\n\tuseAccessibilityLiveRegion( __( 'Network connection re-established' ), {\n\t\tisActive: isConnected,\n\t\tinactiveMessage: __( 'Network connection lost, working offline' ),\n\t} );\n\n\tconst containerStyle = usePreferredColorSchemeStyle(\n\t\tstyles.offline,\n\t\tstyles.offline__dark\n\t);\n\n\tconst textStyle = usePreferredColorSchemeStyle(\n\t\tstyles[ 'offline--text' ],\n\t\tstyles[ 'offline--text__dark' ]\n\t);\n\n\tconst iconStyle = usePreferredColorSchemeStyle(\n\t\tstyles[ 'offline--icon' ],\n\t\tstyles[ 'offline--icon__dark' ]\n\t);\n\n\treturn ! isConnected ? (\n\t\t<View\n\t\t\taccessible\n\t\t\taccessibilityRole=\"alert\"\n\t\t\taccessibilityLabel={ __(\n\t\t\t\t'Network connection lost, working offline'\n\t\t\t) }\n\t\t\tstyle={ containerStyle }\n\t\t>\n\t\t\t<View style={ containerStyle }>\n\t\t\t\t<Icon fill={ iconStyle.fill } icon={ offlineIcon } />\n\t\t\t\t<Text style={ textStyle }>{ __( 'Working Offline' ) }</Text>\n\t\t\t</View>\n\t\t</View>\n\t) : null;\n};\n\nexport default OfflineStatus;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,iBAAiB,EAAEC,IAAI,EAAEC,IAAI,QAAQ,cAAc;;AAE5D;AACA;AACA;AACA,SACCC,4BAA4B,EAC5BC,sBAAsB,EACtBC,WAAW,QACL,oBAAoB;AAC3B,SAASC,IAAI,QAAQ,uBAAuB;AAC5C,SAASC,OAAO,IAAIC,WAAW,QAAQ,kBAAkB;AACzD,SAASC,EAAE,QAAQ,i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B,CAC9B,CAAC;EAED,MAAMc,SAAS,GAAGtB,4BAA4B,CAC7CQ,MAAM,CAAE,eAAe,CAAE,EACzBA,MAAM,CAAE,qBAAqB,CAC9B,CAAC;EAED,OAAO,CAAEU,WAAW,GACnBK,aAAA,CAACxB,IAAI;IACJyB,UAAU;IACVC,iBAAiB,EAAC,OAAO;IACzBC,kBAAkB,EAAGpB,EAAE,CACtB,0CACD,CAAG;IACHqB,KAAK,EAAGR;EAAgB,GAExBI,aAAA,CAACxB,IAAI;IAAC4B,KAAK,EAAGR;EAAgB,GAC7BI,aAAA,CAACpB,IAAI;IAACyB,IAAI,EAAGN,SAAS,CAACM,IAAM;IAACC,IAAI,EAAGxB;EAAa,CAAE,CAAC,EACrDkB,aAAA,CAACzB,IAAI;IAAC6B,KAAK,EAAGN;EAAW,GAAGf,EAAE,CAAE,iBAAkB,CAAS,CACtD,CACD,CAAC,GACJ,IAAI;AACT,CAAC;AAED,eAAeW,aAAa"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* WordPress dependencies
|
|
4
|
+
*/
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
import { PanelBody, PanelRow } from '@wordpress/components';
|
|
7
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
8
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
import { store as editorStore } from '../../store';
|
|
14
|
+
import PageAttributesCheck from './check';
|
|
15
|
+
import PageAttributesOrder from './order';
|
|
16
|
+
import PageAttributesParent from './parent';
|
|
17
|
+
const PANEL_NAME = 'page-attributes';
|
|
18
|
+
export function PageAttributesPanel() {
|
|
19
|
+
var _postType$labels$attr;
|
|
20
|
+
const {
|
|
21
|
+
isEnabled,
|
|
22
|
+
isOpened,
|
|
23
|
+
postType
|
|
24
|
+
} = useSelect(select => {
|
|
25
|
+
const {
|
|
26
|
+
getEditedPostAttribute,
|
|
27
|
+
isEditorPanelEnabled,
|
|
28
|
+
isEditorPanelOpened
|
|
29
|
+
} = select(editorStore);
|
|
30
|
+
const {
|
|
31
|
+
getPostType
|
|
32
|
+
} = select(coreStore);
|
|
33
|
+
return {
|
|
34
|
+
isEnabled: isEditorPanelEnabled(PANEL_NAME),
|
|
35
|
+
isOpened: isEditorPanelOpened(PANEL_NAME),
|
|
36
|
+
postType: getPostType(getEditedPostAttribute('type'))
|
|
37
|
+
};
|
|
38
|
+
}, []);
|
|
39
|
+
const {
|
|
40
|
+
toggleEditorPanelOpened
|
|
41
|
+
} = useDispatch(editorStore);
|
|
42
|
+
if (!isEnabled || !postType) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
const onTogglePanel = (...args) => toggleEditorPanelOpened(PANEL_NAME, ...args);
|
|
46
|
+
return createElement(PageAttributesCheck, null, createElement(PanelBody, {
|
|
47
|
+
title: (_postType$labels$attr = postType?.labels?.attributes) !== null && _postType$labels$attr !== void 0 ? _postType$labels$attr : __('Page attributes'),
|
|
48
|
+
opened: isOpened,
|
|
49
|
+
onToggle: onTogglePanel
|
|
50
|
+
}, createElement(PageAttributesParent, null), createElement(PanelRow, null, createElement(PageAttributesOrder, null))));
|
|
51
|
+
}
|
|
52
|
+
export default PageAttributesPanel;
|
|
53
|
+
//# sourceMappingURL=panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__","PanelBody","PanelRow","useSelect","useDispatch","store","coreStore","editorStore","PageAttributesCheck","PageAttributesOrder","PageAttributesParent","PANEL_NAME","PageAttributesPanel","_postType$labels$attr","isEnabled","isOpened","postType","select","getEditedPostAttribute","isEditorPanelEnabled","isEditorPanelOpened","getPostType","toggleEditorPanelOpened","onTogglePanel","args","createElement","title","labels","attributes","opened","onToggle"],"sources":["@wordpress/editor/src/components/page-attributes/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { PanelBody, PanelRow } from '@wordpress/components';\n\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport PageAttributesCheck from './check';\nimport PageAttributesOrder from './order';\nimport PageAttributesParent from './parent';\n\nconst PANEL_NAME = 'page-attributes';\n\nexport function PageAttributesPanel() {\n\tconst { isEnabled, isOpened, postType } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetEditedPostAttribute,\n\t\t\tisEditorPanelEnabled,\n\t\t\tisEditorPanelOpened,\n\t\t} = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\treturn {\n\t\t\tisEnabled: isEditorPanelEnabled( PANEL_NAME ),\n\t\t\tisOpened: isEditorPanelOpened( PANEL_NAME ),\n\t\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\t};\n\t}, [] );\n\n\tconst { toggleEditorPanelOpened } = useDispatch( editorStore );\n\n\tif ( ! isEnabled || ! postType ) {\n\t\treturn null;\n\t}\n\n\tconst onTogglePanel = ( ...args ) =>\n\t\ttoggleEditorPanelOpened( PANEL_NAME, ...args );\n\n\treturn (\n\t\t<PageAttributesCheck>\n\t\t\t<PanelBody\n\t\t\t\ttitle={\n\t\t\t\t\tpostType?.labels?.attributes ?? __( 'Page attributes' )\n\t\t\t\t}\n\t\t\t\topened={ isOpened }\n\t\t\t\tonToggle={ onTogglePanel }\n\t\t\t>\n\t\t\t\t<PageAttributesParent />\n\t\t\t\t<PanelRow>\n\t\t\t\t\t<PageAttributesOrder />\n\t\t\t\t</PanelRow>\n\t\t\t</PanelBody>\n\t\t</PageAttributesCheck>\n\t);\n}\n\nexport default PageAttributesPanel;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,EAAEC,QAAQ,QAAQ,uBAAuB;AAE3D,SAASC,SAA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tD;IACD6B,MAAM,EAAGd,QAAU;IACnBe,QAAQ,EAAGP;EAAe,GAE1BE,aAAA,CAACf,oBAAoB,MAAE,CAAC,EACxBe,aAAA,CAACvB,QAAQ,QACRuB,aAAA,CAAChB,mBAAmB,MAAE,CACb,CACA,CACS,CAAC;AAExB;AAEA,eAAeG,mBAAmB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* WordPress dependencies
|
|
4
|
+
*/
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
import { PanelBody, PanelRow } from '@wordpress/components';
|
|
7
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
import { store as editorStore } from '../../store';
|
|
13
|
+
import PostTypeSupportCheck from '../post-type-support-check';
|
|
14
|
+
import PostComments from '../post-comments';
|
|
15
|
+
import PostPingbacks from '../post-pingbacks';
|
|
16
|
+
const PANEL_NAME = 'discussion-panel';
|
|
17
|
+
function PostDiscussionPanel() {
|
|
18
|
+
const {
|
|
19
|
+
isEnabled,
|
|
20
|
+
isOpened
|
|
21
|
+
} = useSelect(select => {
|
|
22
|
+
const {
|
|
23
|
+
isEditorPanelEnabled,
|
|
24
|
+
isEditorPanelOpened
|
|
25
|
+
} = select(editorStore);
|
|
26
|
+
return {
|
|
27
|
+
isEnabled: isEditorPanelEnabled(PANEL_NAME),
|
|
28
|
+
isOpened: isEditorPanelOpened(PANEL_NAME)
|
|
29
|
+
};
|
|
30
|
+
}, []);
|
|
31
|
+
const {
|
|
32
|
+
toggleEditorPanelOpened
|
|
33
|
+
} = useDispatch(editorStore);
|
|
34
|
+
if (!isEnabled) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
return createElement(PostTypeSupportCheck, {
|
|
38
|
+
supportKeys: ['comments', 'trackbacks']
|
|
39
|
+
}, createElement(PanelBody, {
|
|
40
|
+
title: __('Discussion'),
|
|
41
|
+
opened: isOpened,
|
|
42
|
+
onToggle: () => toggleEditorPanelOpened(PANEL_NAME)
|
|
43
|
+
}, createElement(PostTypeSupportCheck, {
|
|
44
|
+
supportKeys: "comments"
|
|
45
|
+
}, createElement(PanelRow, null, createElement(PostComments, null))), createElement(PostTypeSupportCheck, {
|
|
46
|
+
supportKeys: "trackbacks"
|
|
47
|
+
}, createElement(PanelRow, null, createElement(PostPingbacks, null)))));
|
|
48
|
+
}
|
|
49
|
+
export default PostDiscussionPanel;
|
|
50
|
+
//# sourceMappingURL=panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__","PanelBody","PanelRow","useDispatch","useSelect","store","editorStore","PostTypeSupportCheck","PostComments","PostPingbacks","PANEL_NAME","PostDiscussionPanel","isEnabled","isOpened","select","isEditorPanelEnabled","isEditorPanelOpened","toggleEditorPanelOpened","createElement","supportKeys","title","opened","onToggle"],"sources":["@wordpress/editor/src/components/post-discussion/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { PanelBody, PanelRow } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport PostComments from '../post-comments';\nimport PostPingbacks from '../post-pingbacks';\n\nconst PANEL_NAME = 'discussion-panel';\n\nfunction PostDiscussionPanel() {\n\tconst { isEnabled, isOpened } = useSelect( ( select ) => {\n\t\tconst { isEditorPanelEnabled, isEditorPanelOpened } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tisEnabled: isEditorPanelEnabled( PANEL_NAME ),\n\t\t\tisOpened: isEditorPanelOpened( PANEL_NAME ),\n\t\t};\n\t}, [] );\n\n\tconst { toggleEditorPanelOpened } = useDispatch( editorStore );\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys={ [ 'comments', 'trackbacks' ] }>\n\t\t\t<PanelBody\n\t\t\t\ttitle={ __( 'Discussion' ) }\n\t\t\t\topened={ isOpened }\n\t\t\t\tonToggle={ () => toggleEditorPanelOpened( PANEL_NAME ) }\n\t\t\t>\n\t\t\t\t<PostTypeSupportCheck supportKeys=\"comments\">\n\t\t\t\t\t<PanelRow>\n\t\t\t\t\t\t<PostComments />\n\t\t\t\t\t</PanelRow>\n\t\t\t\t</PostTypeSupportCheck>\n\n\t\t\t\t<PostTypeSupportCheck supportKeys=\"trackbacks\">\n\t\t\t\t\t<PanelRow>\n\t\t\t\t\t\t<PostPingbacks />\n\t\t\t\t\t</PanelRow>\n\t\t\t\t</PostTypeSupportCheck>\n\t\t\t</PanelBody>\n\t\t</PostTypeSupportCheck>\n\t);\n}\n\nexport default PostDiscussionPanel;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,EAAEC,QAAQ,QAAQ,uBAAuB;AAC3D,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;;AAExD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAClD,OAAOC,oBAAoB,MAAM,4BAA4B;AAC7D,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,aAAa,MAAM,mBAAmB;AAE7C,MAAMC,UAAU,GAAG,kBAAkB;AAErC,SAASC,mBAAmBA,CAAA,EAAG;EAC9B,MAAM;IAAEC,SAAS;IAAEC;EAAS,CAAC,GAAGT,SAAS,CAAIU,MAAM,IAAM;IACxD,MAAM;MAAEC,oBAAoB;MAAEC;IAAoB,CAAC,GAClDF,MAAM,CAAER,WAAY,CAAC;IACtB,OAAO;MACNM,SAAS,EAAEG,oBAAoB,CAAEL,UAAW,CAAC;MAC7CG,QAAQ,EAAEG,mBAAmB,CAAEN,UAAW;IAC3C,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAM;IAAEO;EAAwB,CAAC,GAAGd,WAAW,CAAEG,WAAY,CAAC;EAE9D,IAAK,CAAEM,SAAS,EAAG;IAClB,OAAO,IAAI;EACZ;EAEA,OACCM,aAAA,CAACX,oBAAoB;IAACY,WAAW,EAAG,CAAE,UAAU,EAAE,YAAY;EAAI,GACjED,aAAA,CAACjB,SAAS;IACTmB,KAAK,EAAGpB,EAAE,CAAE,YAAa,CAAG;IAC5BqB,MAAM,EAAGR,QAAU;IACnBS,QAAQ,EAAGA,CAAA,KAAML,uBAAuB,CAAEP,UAAW;EAAG,GAExDQ,aAAA,CAACX,oBAAoB;IAACY,WAAW,EAAC;EAAU,GAC3CD,aAAA,CAAChB,QAAQ,QACRgB,aAAA,CAACV,YAAY,MAAE,CACN,CACW,CAAC,EAEvBU,aAAA,CAACX,oBAAoB;IAACY,WAAW,EAAC;EAAY,GAC7CD,aAAA,CAAChB,QAAQ,QACRgB,aAAA,CAACT,aAAa,MAAE,CACP,CACW,CACZ,CACU,CAAC;AAEzB;AAEA,eAAeE,mBAAmB"}
|
|
@@ -1,11 +1,30 @@
|
|
|
1
1
|
import { createElement } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* WordPress dependencies
|
|
4
|
+
*/
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
|
|
2
7
|
/**
|
|
3
8
|
* Internal dependencies
|
|
4
9
|
*/
|
|
5
10
|
import PostTypeSupportCheck from '../post-type-support-check';
|
|
11
|
+
import { store as editorStore } from '../../store';
|
|
6
12
|
function PostExcerptCheck({
|
|
7
13
|
children
|
|
8
14
|
}) {
|
|
15
|
+
const postType = useSelect(select => {
|
|
16
|
+
const {
|
|
17
|
+
getEditedPostAttribute
|
|
18
|
+
} = select(editorStore);
|
|
19
|
+
return getEditedPostAttribute('type');
|
|
20
|
+
}, []);
|
|
21
|
+
|
|
22
|
+
// This special case is unfortunate, but the REST API of wp_template and wp_template_part
|
|
23
|
+
// support the excerpt field throught the "description" field rather than "excerpt" which means
|
|
24
|
+
// the default ExcerptPanel won't work for these.
|
|
25
|
+
if (['wp_template', 'wp_template_part'].includes(postType)) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
9
28
|
return createElement(PostTypeSupportCheck, {
|
|
10
29
|
supportKeys: "excerpt"
|
|
11
30
|
}, children);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PostTypeSupportCheck","PostExcerptCheck","children","createElement","supportKeys"],"sources":["@wordpress/editor/src/components/post-excerpt/check.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\n\nfunction PostExcerptCheck( { children } ) {\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"excerpt\">\n\t\t\t{ children }\n\t\t</PostTypeSupportCheck>\n\t);\n}\n\nexport default PostExcerptCheck;\n"],"mappings":";AAAA;AACA;AACA;AACA,
|
|
1
|
+
{"version":3,"names":["useSelect","PostTypeSupportCheck","store","editorStore","PostExcerptCheck","children","postType","select","getEditedPostAttribute","includes","createElement","supportKeys"],"sources":["@wordpress/editor/src/components/post-excerpt/check.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\n\nfunction PostExcerptCheck( { children } ) {\n\tconst postType = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\treturn getEditedPostAttribute( 'type' );\n\t}, [] );\n\n\t// This special case is unfortunate, but the REST API of wp_template and wp_template_part\n\t// support the excerpt field throught the \"description\" field rather than \"excerpt\" which means\n\t// the default ExcerptPanel won't work for these.\n\tif ( [ 'wp_template', 'wp_template_part' ].includes( postType ) ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"excerpt\">\n\t\t\t{ children }\n\t\t</PostTypeSupportCheck>\n\t);\n}\n\nexport default PostExcerptCheck;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,OAAOC,oBAAoB,MAAM,4BAA4B;AAC7D,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAElD,SAASC,gBAAgBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACzC,MAAMC,QAAQ,GAAGN,SAAS,CAAIO,MAAM,IAAM;IACzC,MAAM;MAAEC;IAAuB,CAAC,GAAGD,MAAM,CAAEJ,WAAY,CAAC;IACxD,OAAOK,sBAAsB,CAAE,MAAO,CAAC;EACxC,CAAC,EAAE,EAAG,CAAC;;EAEP;EACA;EACA;EACA,IAAK,CAAE,aAAa,EAAE,kBAAkB,CAAE,CAACC,QAAQ,CAAEH,QAAS,CAAC,EAAG;IACjE,OAAO,IAAI;EACZ;EAEA,OACCI,aAAA,CAACT,oBAAoB;IAACU,WAAW,EAAC;EAAS,GACxCN,QACmB,CAAC;AAEzB;AAEA,eAAeD,gBAAgB"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { createElement, Fragment } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* WordPress dependencies
|
|
4
|
+
*/
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
import { PanelBody } from '@wordpress/components';
|
|
7
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
import PostExcerptForm from './index';
|
|
13
|
+
import PostExcerptCheck from './check';
|
|
14
|
+
import PluginPostExcerpt from './plugin';
|
|
15
|
+
import { store as editorStore } from '../../store';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Module Constants
|
|
19
|
+
*/
|
|
20
|
+
const PANEL_NAME = 'post-excerpt';
|
|
21
|
+
export default function PostExcerptPanel() {
|
|
22
|
+
const {
|
|
23
|
+
isOpened,
|
|
24
|
+
isEnabled
|
|
25
|
+
} = useSelect(select => {
|
|
26
|
+
const {
|
|
27
|
+
isEditorPanelOpened,
|
|
28
|
+
isEditorPanelEnabled
|
|
29
|
+
} = select(editorStore);
|
|
30
|
+
return {
|
|
31
|
+
isOpened: isEditorPanelOpened(PANEL_NAME),
|
|
32
|
+
isEnabled: isEditorPanelEnabled(PANEL_NAME)
|
|
33
|
+
};
|
|
34
|
+
}, []);
|
|
35
|
+
const {
|
|
36
|
+
toggleEditorPanelOpened
|
|
37
|
+
} = useDispatch(editorStore);
|
|
38
|
+
const toggleExcerptPanel = () => toggleEditorPanelOpened(PANEL_NAME);
|
|
39
|
+
if (!isEnabled) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
return createElement(PostExcerptCheck, null, createElement(PanelBody, {
|
|
43
|
+
title: __('Excerpt'),
|
|
44
|
+
opened: isOpened,
|
|
45
|
+
onToggle: toggleExcerptPanel
|
|
46
|
+
}, createElement(PluginPostExcerpt.Slot, null, fills => createElement(Fragment, null, createElement(PostExcerptForm, null), fills))));
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__","PanelBody","useDispatch","useSelect","PostExcerptForm","PostExcerptCheck","PluginPostExcerpt","store","editorStore","PANEL_NAME","PostExcerptPanel","isOpened","isEnabled","select","isEditorPanelOpened","isEditorPanelEnabled","toggleEditorPanelOpened","toggleExcerptPanel","createElement","title","opened","onToggle","Slot","fills","Fragment"],"sources":["@wordpress/editor/src/components/post-excerpt/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { PanelBody } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport PostExcerptForm from './index';\nimport PostExcerptCheck from './check';\nimport PluginPostExcerpt from './plugin';\nimport { store as editorStore } from '../../store';\n\n/**\n * Module Constants\n */\nconst PANEL_NAME = 'post-excerpt';\n\nexport default function PostExcerptPanel() {\n\tconst { isOpened, isEnabled } = useSelect( ( select ) => {\n\t\tconst { isEditorPanelOpened, isEditorPanelEnabled } =\n\t\t\tselect( editorStore );\n\n\t\treturn {\n\t\t\tisOpened: isEditorPanelOpened( PANEL_NAME ),\n\t\t\tisEnabled: isEditorPanelEnabled( PANEL_NAME ),\n\t\t};\n\t}, [] );\n\n\tconst { toggleEditorPanelOpened } = useDispatch( editorStore );\n\tconst toggleExcerptPanel = () => toggleEditorPanelOpened( PANEL_NAME );\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostExcerptCheck>\n\t\t\t<PanelBody\n\t\t\t\ttitle={ __( 'Excerpt' ) }\n\t\t\t\topened={ isOpened }\n\t\t\t\tonToggle={ toggleExcerptPanel }\n\t\t\t>\n\t\t\t\t<PluginPostExcerpt.Slot>\n\t\t\t\t\t{ ( fills ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<PostExcerptForm />\n\t\t\t\t\t\t\t{ fills }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</PluginPostExcerpt.Slot>\n\t\t\t</PanelBody>\n\t\t</PostExcerptCheck>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,uBAAuB;AACjD,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;;AAExD;AACA;AACA;AACA,OAAOC,eAAe,MAAM,SAAS;AACrC,OAAOC,gBAAgB,MAAM,SAAS;AACtC,OAAOC,iBAAiB,MAAM,UAAU;AACxC,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;;AAElD;AACA;AACA;AACA,MAAMC,UAAU,GAAG,cAAc;AAEjC,eAAe,SAASC,gBAAgBA,CAAA,EAAG;EAC1C,MAAM;IAAEC,QAAQ;IAAEC;EAAU,CAAC,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