@wordpress/edit-post 7.26.0 → 7.27.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 +2 -0
- package/build/components/header/index.js +2 -2
- package/build/components/header/index.js.map +1 -1
- package/build/components/layout/index.native.js +1 -3
- package/build/components/layout/index.native.js.map +1 -1
- package/build/components/meta-boxes/index.js +3 -2
- package/build/components/meta-boxes/index.js.map +1 -1
- package/build/components/preferences-modal/{options/enable-custom-fields.js → enable-custom-fields.js} +10 -2
- package/build/components/preferences-modal/enable-custom-fields.js.map +1 -0
- package/build/components/preferences-modal/{options/enable-panel.js → enable-panel.js} +11 -2
- package/build/components/preferences-modal/enable-panel.js.map +1 -0
- package/build/components/preferences-modal/{options/enable-publish-sidebar.js → enable-publish-sidebar.js} +11 -2
- package/build/components/preferences-modal/enable-publish-sidebar.js.map +1 -0
- package/build/components/preferences-modal/index.js +31 -149
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preferences-modal/meta-boxes-section.js +11 -5
- package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build/components/sidebar/plugin-document-setting-panel/index.js +5 -2
- package/build/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
- package/build/editor.js +3 -26
- package/build/editor.js.map +1 -1
- package/build/editor.native.js +4 -28
- package/build/editor.native.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +48 -8
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/index.js +2 -2
- package/build/index.js.map +1 -1
- package/build/index.native.js +1 -1
- package/build/index.native.js.map +1 -1
- package/build/store/actions.js +11 -10
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js +24 -6
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/header/index.js +2 -2
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/layout/index.native.js +1 -3
- package/build-module/components/layout/index.native.js.map +1 -1
- package/build-module/components/meta-boxes/index.js +3 -2
- package/build-module/components/meta-boxes/index.js.map +1 -1
- package/build-module/components/preferences-modal/{options/enable-custom-fields.js → enable-custom-fields.js} +10 -2
- package/build-module/components/preferences-modal/enable-custom-fields.js.map +1 -0
- package/build-module/components/preferences-modal/{options/enable-panel.js → enable-panel.js} +10 -2
- package/build-module/components/preferences-modal/enable-panel.js.map +1 -0
- package/build-module/components/preferences-modal/{options/enable-publish-sidebar.js → enable-publish-sidebar.js} +10 -2
- package/build-module/components/preferences-modal/enable-publish-sidebar.js.map +1 -0
- package/build-module/components/preferences-modal/index.js +31 -150
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preferences-modal/meta-boxes-section.js +7 -2
- package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build-module/components/sidebar/plugin-document-setting-panel/index.js +5 -2
- package/build-module/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
- package/build-module/editor.js +3 -26
- package/build-module/editor.js.map +1 -1
- package/build-module/editor.native.js +5 -29
- package/build-module/editor.native.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +49 -9
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/index.js +2 -2
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +1 -1
- package/build-module/index.native.js.map +1 -1
- package/build-module/store/actions.js +11 -10
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js +24 -6
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/classic-rtl.css +1 -1
- package/build-style/classic.css +1 -1
- package/build-style/style-rtl.css +16 -182
- package/build-style/style.css +16 -182
- package/package.json +32 -32
- package/src/components/header/index.js +2 -4
- package/src/components/header/style.scss +13 -4
- package/src/components/layout/index.native.js +1 -4
- package/src/components/meta-boxes/index.js +4 -2
- package/src/components/preferences-modal/{options/enable-custom-fields.js → enable-custom-fields.js} +10 -3
- package/src/components/preferences-modal/{options/enable-panel.js → enable-panel.js} +9 -2
- package/src/components/preferences-modal/{options/enable-publish-sidebar.js → enable-publish-sidebar.js} +9 -2
- package/src/components/preferences-modal/index.js +44 -267
- package/src/components/preferences-modal/meta-boxes-section.js +6 -2
- package/src/components/preferences-modal/{options/test → test}/__snapshots__/enable-custom-fields.js.snap +4 -4
- package/src/components/preferences-modal/test/__snapshots__/meta-boxes-section.js.snap +18 -18
- package/src/components/sidebar/plugin-document-setting-panel/index.js +6 -2
- package/src/editor.js +55 -85
- package/src/editor.native.js +4 -33
- package/src/hooks/commands/use-common-commands.js +77 -7
- package/src/index.js +2 -2
- package/src/index.native.js +1 -1
- package/src/store/actions.js +14 -33
- package/src/store/selectors.js +52 -26
- package/src/store/test/actions.js +9 -9
- package/src/style.scss +0 -1
- package/build/components/block-manager/category.js +0 -105
- package/build/components/block-manager/category.js.map +0 -1
- package/build/components/block-manager/checklist.js +0 -35
- package/build/components/block-manager/checklist.js.map +0 -1
- package/build/components/block-manager/index.js +0 -127
- package/build/components/block-manager/index.js.map +0 -1
- package/build/components/preferences-modal/options/enable-custom-fields.js.map +0 -1
- package/build/components/preferences-modal/options/enable-feature.js +0 -36
- package/build/components/preferences-modal/options/enable-feature.js.map +0 -1
- package/build/components/preferences-modal/options/enable-panel.js.map +0 -1
- package/build/components/preferences-modal/options/enable-plugin-document-setting-panel.js +0 -32
- package/build/components/preferences-modal/options/enable-plugin-document-setting-panel.js.map +0 -1
- package/build/components/preferences-modal/options/enable-publish-sidebar.js.map +0 -1
- package/build/components/preferences-modal/options/index.js +0 -42
- package/build/components/preferences-modal/options/index.js.map +0 -1
- package/build-module/components/block-manager/category.js +0 -96
- package/build-module/components/block-manager/category.js.map +0 -1
- package/build-module/components/block-manager/checklist.js +0 -27
- package/build-module/components/block-manager/checklist.js.map +0 -1
- package/build-module/components/block-manager/index.js +0 -118
- package/build-module/components/block-manager/index.js.map +0 -1
- package/build-module/components/preferences-modal/options/enable-custom-fields.js.map +0 -1
- package/build-module/components/preferences-modal/options/enable-feature.js +0 -29
- package/build-module/components/preferences-modal/options/enable-feature.js.map +0 -1
- package/build-module/components/preferences-modal/options/enable-panel.js.map +0 -1
- package/build-module/components/preferences-modal/options/enable-plugin-document-setting-panel.js +0 -24
- package/build-module/components/preferences-modal/options/enable-plugin-document-setting-panel.js.map +0 -1
- package/build-module/components/preferences-modal/options/enable-publish-sidebar.js.map +0 -1
- package/build-module/components/preferences-modal/options/index.js +0 -6
- package/build-module/components/preferences-modal/options/index.js.map +0 -1
- package/src/components/block-manager/category.js +0 -94
- package/src/components/block-manager/checklist.js +0 -30
- package/src/components/block-manager/index.js +0 -158
- package/src/components/block-manager/style.scss +0 -82
- package/src/components/preferences-modal/options/enable-feature.js +0 -31
- package/src/components/preferences-modal/options/enable-plugin-document-setting-panel.js +0 -23
- package/src/components/preferences-modal/options/index.js +0 -5
- /package/src/components/preferences-modal/{options/test → test}/enable-custom-fields.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_compose","_data","_element","_editor","_interface","_preferences","_options","_metaBoxesSection","_interopRequireDefault","_store","_blockManager","PREFERENCES_MODAL_NAME","exports","EditPostPreferencesModal","isLargeViewport","useViewportMatch","closeModal","useDispatch","interfaceStore","isModalActive","showBlockBreadcrumbsOption","useSelect","select","getEditorSettings","editorStore","getEditorMode","editPostStore","get","preferencesStore","modalActive","mode","isRichEditingEnabled","richEditingEnabled","isDistractionFreeEnabled","closeGeneralSidebar","setIsListViewOpened","setIsInserterOpened","set","setPreference","toggleDistractionFree","turnOffDistractionFree","sections","useMemo","name","tabLabel","__","content","_react","createElement","Fragment","PreferencesModalSection","title","EnablePublishSidebarOption","help","label","EnableFeature","scope","featureName","description","EnablePluginDocumentSettingPanelOption","Slot","PostTaxonomies","taxonomyWrapper","taxonomy","EnablePanelOption","labels","menu_name","panelName","slug","PostFeaturedImageCheck","PostExcerptCheck","PostTypeSupportCheck","supportKeys","PageAttributesCheck","default","onToggle","PreferencesModal","PreferencesModalTabs"],"sources":["@wordpress/edit-post/src/components/preferences-modal/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\n\nimport { __ } from '@wordpress/i18n';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport {\n\tPostTaxonomies,\n\tPostExcerptCheck,\n\tPageAttributesCheck,\n\tPostFeaturedImageCheck,\n\tPostTypeSupportCheck,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport {\n\tPreferencesModal,\n\tPreferencesModalTabs,\n\tPreferencesModalSection,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\n\nimport {\n\tEnablePluginDocumentSettingPanelOption,\n\tEnablePublishSidebarOption,\n\tEnablePanelOption,\n\tEnableFeature,\n} from './options';\nimport MetaBoxesSection from './meta-boxes-section';\nimport { store as editPostStore } from '../../store';\nimport BlockManager from '../block-manager';\n\nexport const PREFERENCES_MODAL_NAME = 'edit-post/preferences';\n\nexport default function EditPostPreferencesModal() {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst { closeModal } = useDispatch( interfaceStore );\n\tconst [ isModalActive, showBlockBreadcrumbsOption ] = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getEditorMode } = select( editPostStore );\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\tconst modalActive = select( interfaceStore ).isModalActive(\n\t\t\t\tPREFERENCES_MODAL_NAME\n\t\t\t);\n\t\t\tconst mode = getEditorMode();\n\t\t\tconst isRichEditingEnabled = getEditorSettings().richEditingEnabled;\n\t\t\tconst isDistractionFreeEnabled = get( 'core', 'distractionFree' );\n\t\t\treturn [\n\t\t\t\tmodalActive,\n\t\t\t\t! isDistractionFreeEnabled &&\n\t\t\t\t\tisLargeViewport &&\n\t\t\t\t\tisRichEditingEnabled &&\n\t\t\t\t\tmode === 'visual',\n\t\t\t\tisDistractionFreeEnabled,\n\t\t\t];\n\t\t},\n\t\t[ isLargeViewport ]\n\t);\n\n\tconst { closeGeneralSidebar } = useDispatch( editPostStore );\n\tconst { setIsListViewOpened, setIsInserterOpened } =\n\t\tuseDispatch( editorStore );\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\tconst toggleDistractionFree = () => {\n\t\tsetPreference( 'core', 'fixedToolbar', true );\n\t\tsetIsInserterOpened( false );\n\t\tsetIsListViewOpened( false );\n\t\tcloseGeneralSidebar();\n\t};\n\n\tconst turnOffDistractionFree = () => {\n\t\tsetPreference( 'core', 'distractionFree', false );\n\t};\n\n\tconst sections = useMemo(\n\t\t() => [\n\t\t\t{\n\t\t\t\tname: 'general',\n\t\t\t\ttabLabel: __( 'General' ),\n\t\t\t\tcontent: (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t\t\t<PreferencesModalSection\n\t\t\t\t\t\t\t\ttitle={ __( 'Publishing' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<EnablePublishSidebarOption\n\t\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t\t'Review settings, such as visibility and tags.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Enable pre-publish checks' ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<PreferencesModalSection title={ __( 'Interface' ) }>\n\t\t\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tfeatureName=\"showListViewByDefault\"\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Opens the block list view sidebar by default.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __( 'Always open list view' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ showBlockBreadcrumbsOption && (\n\t\t\t\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\t\tfeatureName=\"showBlockBreadcrumbs\"\n\t\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t\t'Display the block hierarchy trail at the bottom of the editor.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Show block breadcrumbs' ) }\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<EnableFeature\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tfeatureName=\"allowRightClickOverrides\"\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Allows contextual list view menus via right-click, overriding browser defaults.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t'Allow right-click contextual menus'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t\t\t<PreferencesModalSection\n\t\t\t\t\t\t\ttitle={ __( 'Document settings' ) }\n\t\t\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t\t\t'Select what settings are shown in the document panel.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<EnablePluginDocumentSettingPanelOption.Slot />\n\t\t\t\t\t\t\t<PostTaxonomies\n\t\t\t\t\t\t\t\ttaxonomyWrapper={ ( content, taxonomy ) => (\n\t\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\t\tlabel={ taxonomy.labels.menu_name }\n\t\t\t\t\t\t\t\t\t\tpanelName={ `taxonomy-panel-${ taxonomy.slug }` }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PostFeaturedImageCheck>\n\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Featured image' ) }\n\t\t\t\t\t\t\t\t\tpanelName=\"featured-image\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PostFeaturedImageCheck>\n\t\t\t\t\t\t\t<PostExcerptCheck>\n\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Excerpt' ) }\n\t\t\t\t\t\t\t\t\tpanelName=\"post-excerpt\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PostExcerptCheck>\n\t\t\t\t\t\t\t<PostTypeSupportCheck\n\t\t\t\t\t\t\t\tsupportKeys={ [ 'comments', 'trackbacks' ] }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Discussion' ) }\n\t\t\t\t\t\t\t\t\tpanelName=\"discussion-panel\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PostTypeSupportCheck>\n\t\t\t\t\t\t\t<PageAttributesCheck>\n\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Page attributes' ) }\n\t\t\t\t\t\t\t\t\tpanelName=\"page-attributes\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PageAttributesCheck>\n\t\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t\t\t<MetaBoxesSection title={ __( 'Advanced' ) } />\n\t\t\t\t\t</>\n\t\t\t\t),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'appearance',\n\t\t\t\ttabLabel: __( 'Appearance' ),\n\t\t\t\tcontent: (\n\t\t\t\t\t<PreferencesModalSection\n\t\t\t\t\t\ttitle={ __( 'Appearance' ) }\n\t\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t\t'Customize the editor interface to suit your needs.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\tfeatureName=\"fixedToolbar\"\n\t\t\t\t\t\t\tonToggle={ turnOffDistractionFree }\n\t\t\t\t\t\t\thelp={ __(\n\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) }\n\t\t\t\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\tfeatureName=\"distractionFree\"\n\t\t\t\t\t\t\tonToggle={ toggleDistractionFree }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Reduce visual distractions by hiding the toolbar and other elements to focus on writing.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tlabel={ __( 'Distraction free' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\tfeatureName=\"focusMode\"\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Highlights the current block and fades other content.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tlabel={ __( 'Spotlight mode' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\t\tfeatureName=\"themeStyles\"\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Make the editor look like your theme.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tlabel={ __( 'Use theme styles' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'accessibility',\n\t\t\t\ttabLabel: __( 'Accessibility' ),\n\t\t\t\tcontent: (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<PreferencesModalSection\n\t\t\t\t\t\t\ttitle={ __( 'Navigation' ) }\n\t\t\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t\t\t'Optimize the editing experience for enhanced control.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tfeatureName=\"keepCaretInsideBlock\"\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Keeps the text cursor within the block boundaries, aiding users with screen readers by preventing unintentional cursor movement outside the block.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t\t\t<PreferencesModalSection title={ __( 'Interface' ) }>\n\t\t\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tfeatureName=\"showIconLabels\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Show button text labels' ) }\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Show text instead of icons on buttons across the interface.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t\t</>\n\t\t\t\t),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'blocks',\n\t\t\t\ttabLabel: __( 'Blocks' ),\n\t\t\t\tcontent: (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<PreferencesModalSection title={ __( 'Inserter' ) }>\n\t\t\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tfeatureName=\"mostUsedBlocks\"\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Adds a category with the most frequently used blocks in the inserter.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __( 'Show most used blocks' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t\t\t<PreferencesModalSection\n\t\t\t\t\t\t\ttitle={ __( 'Manage block visibility' ) }\n\t\t\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t\t\t\"Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later.\"\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockManager />\n\t\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t\t</>\n\t\t\t\t),\n\t\t\t},\n\t\t],\n\t\t[ isLargeViewport, showBlockBreadcrumbsOption ]\n\t);\n\n\tif ( ! isModalActive ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PreferencesModal closeModal={ closeModal }>\n\t\t\t<PreferencesModalTabs sections={ sections } />\n\t\t</PreferencesModal>\n\t);\n}\n"],"mappings":";;;;;;;;;AAIA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAQA,IAAAK,UAAA,GAAAL,OAAA;AAMA,IAAAM,YAAA,GAAAN,OAAA;AAMA,IAAAO,QAAA,GAAAP,OAAA;AAMA,IAAAQ,iBAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,aAAA,GAAAF,sBAAA,CAAAT,OAAA;AApCA;AACA;AACA;;AAsBA;AACA;AACA;;AAYO,MAAMY,sBAAsB,GAAG,uBAAuB;AAACC,OAAA,CAAAD,sBAAA,GAAAA,sBAAA;AAE/C,SAASE,wBAAwBA,CAAA,EAAG;EAClD,MAAMC,eAAe,GAAG,IAAAC,yBAAgB,EAAE,QAAS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5D,UAAU,EAAGA;EAAY,GAC1C,IAAA+B,MAAA,CAAAC,aAAA,EAAC5C,UAAA,CAAAyE,oBAAoB;IAACpC,QAAQ,EAAGA;EAAU,CAAE,CAC5B,CAAC;AAErB"}
|
|
1
|
+
{"version":3,"names":["_i18n","require","_compose","_data","_interface","_preferences","_editor","_lockUnlock","_metaBoxesSection","_interopRequireDefault","_enablePublishSidebar","PreferencesModalSection","PreferenceToggleControl","unlock","preferencesPrivateApis","PreferencesModal","editorPrivateApis","PREFERENCES_MODAL_NAME","exports","EditPostPreferencesModal","isLargeViewport","useViewportMatch","closeModal","useDispatch","interfaceStore","isModalActive","useSelect","select","modalActive","extraSections","general","_react","createElement","Fragment","title","__","default","help","label","appearance","scope","featureName","isActive","onClose"],"sources":["@wordpress/edit-post/src/components/preferences-modal/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\n\nimport { __ } from '@wordpress/i18n';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { privateApis as preferencesPrivateApis } from '@wordpress/preferences';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport MetaBoxesSection from './meta-boxes-section';\nimport EnablePublishSidebarOption from './enable-publish-sidebar';\n\nconst { PreferencesModalSection, PreferenceToggleControl } = unlock(\n\tpreferencesPrivateApis\n);\nconst { PreferencesModal } = unlock( editorPrivateApis );\n\nexport const PREFERENCES_MODAL_NAME = 'edit-post/preferences';\n\nexport default function EditPostPreferencesModal() {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst { closeModal } = useDispatch( interfaceStore );\n\tconst { isModalActive } = useSelect( ( select ) => {\n\t\tconst modalActive = select( interfaceStore ).isModalActive(\n\t\t\tPREFERENCES_MODAL_NAME\n\t\t);\n\t\treturn {\n\t\t\tisModalActive: modalActive,\n\t\t};\n\t}, [] );\n\n\tconst extraSections = {\n\t\tgeneral: (\n\t\t\t<>\n\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t<PreferencesModalSection title={ __( 'Publishing' ) }>\n\t\t\t\t\t\t<EnablePublishSidebarOption\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Review settings, such as visibility and tags.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tlabel={ __( 'Enable pre-publish checks' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t) }\n\t\t\t\t<MetaBoxesSection title={ __( 'Advanced' ) } />\n\t\t\t</>\n\t\t),\n\t\tappearance: (\n\t\t\t<PreferenceToggleControl\n\t\t\t\tscope=\"core/edit-post\"\n\t\t\t\tfeatureName=\"themeStyles\"\n\t\t\t\thelp={ __( 'Make the editor look like your theme.' ) }\n\t\t\t\tlabel={ __( 'Use theme styles' ) }\n\t\t\t/>\n\t\t),\n\t};\n\n\tif ( ! isModalActive ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PreferencesModal\n\t\t\textraSections={ extraSections }\n\t\t\tisActive={ isModalActive }\n\t\t\tonClose={ closeModal }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;;AAIA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,iBAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,qBAAA,GAAAD,sBAAA,CAAAR,OAAA;AAhBA;AACA;AACA;;AASA;AACA;AACA;;AAKA,MAAM;EAAEU,uBAAuB;EAAEC;AAAwB,CAAC,GAAG,IAAAC,kBAAM,EAClEC,wBACD,CAAC;AACD,MAAM;EAAEC;AAA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AAAH,QAAE,EAAE,kBAAmB;IAAG,CAClC;EAEH,CAAC;EAED,IAAK,CAAEV,aAAa,EAAG;IACtB,OAAO,IAAI;EACZ;EAEA,OACC,IAAAM,MAAA,CAAAC,aAAA,EAACjB,gBAAgB;IAChBc,aAAa,EAAGA,aAAe;IAC/Ba,QAAQ,EAAGjB,aAAe;IAC1BkB,OAAO,EAAGrB;EAAY,CACtB,CAAC;AAEJ"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -9,9 +10,11 @@ var _react = require("react");
|
|
|
9
10
|
var _i18n = require("@wordpress/i18n");
|
|
10
11
|
var _data = require("@wordpress/data");
|
|
11
12
|
var _editor = require("@wordpress/editor");
|
|
12
|
-
var
|
|
13
|
-
var
|
|
13
|
+
var _preferences = require("@wordpress/preferences");
|
|
14
|
+
var _enableCustomFields = _interopRequireDefault(require("./enable-custom-fields"));
|
|
15
|
+
var _enablePanel = _interopRequireDefault(require("./enable-panel"));
|
|
14
16
|
var _store = require("../../store");
|
|
17
|
+
var _lockUnlock = require("../../lock-unlock");
|
|
15
18
|
/**
|
|
16
19
|
* WordPress dependencies
|
|
17
20
|
*/
|
|
@@ -20,6 +23,9 @@ var _store = require("../../store");
|
|
|
20
23
|
* Internal dependencies
|
|
21
24
|
*/
|
|
22
25
|
|
|
26
|
+
const {
|
|
27
|
+
PreferencesModalSection
|
|
28
|
+
} = (0, _lockUnlock.unlock)(_preferences.privateApis);
|
|
23
29
|
function MetaBoxesSection({
|
|
24
30
|
areCustomFieldsRegistered,
|
|
25
31
|
metaBoxes,
|
|
@@ -32,14 +38,14 @@ function MetaBoxesSection({
|
|
|
32
38
|
if (!areCustomFieldsRegistered && thirdPartyMetaBoxes.length === 0) {
|
|
33
39
|
return null;
|
|
34
40
|
}
|
|
35
|
-
return (0, _react.createElement)(
|
|
41
|
+
return (0, _react.createElement)(PreferencesModalSection, {
|
|
36
42
|
...sectionProps
|
|
37
|
-
}, areCustomFieldsRegistered && (0, _react.createElement)(
|
|
43
|
+
}, areCustomFieldsRegistered && (0, _react.createElement)(_enableCustomFields.default, {
|
|
38
44
|
label: (0, _i18n.__)('Custom fields')
|
|
39
45
|
}), thirdPartyMetaBoxes.map(({
|
|
40
46
|
id,
|
|
41
47
|
title
|
|
42
|
-
}) => (0, _react.createElement)(
|
|
48
|
+
}) => (0, _react.createElement)(_enablePanel.default, {
|
|
43
49
|
key: id,
|
|
44
50
|
label: title,
|
|
45
51
|
panelName: `meta-box-${id}`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_data","_editor","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_data","_editor","_preferences","_enableCustomFields","_interopRequireDefault","_enablePanel","_store","_lockUnlock","PreferencesModalSection","unlock","preferencesPrivateApis","MetaBoxesSection","areCustomFieldsRegistered","metaBoxes","sectionProps","thirdPartyMetaBoxes","filter","id","length","_react","createElement","default","label","__","map","title","key","panelName","_default","withSelect","select","getEditorSettings","editorStore","getAllMetaBoxes","editPostStore","enableCustomFields","undefined","exports"],"sources":["@wordpress/edit-post/src/components/preferences-modal/meta-boxes-section.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { withSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { privateApis as preferencesPrivateApis } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport EnableCustomFieldsOption from './enable-custom-fields';\nimport EnablePanelOption from './enable-panel';\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { PreferencesModalSection } = unlock( preferencesPrivateApis );\n\nexport function MetaBoxesSection( {\n\tareCustomFieldsRegistered,\n\tmetaBoxes,\n\t...sectionProps\n} ) {\n\t// The 'Custom Fields' meta box is a special case that we handle separately.\n\tconst thirdPartyMetaBoxes = metaBoxes.filter(\n\t\t( { id } ) => id !== 'postcustom'\n\t);\n\n\tif ( ! areCustomFieldsRegistered && thirdPartyMetaBoxes.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PreferencesModalSection { ...sectionProps }>\n\t\t\t{ areCustomFieldsRegistered && (\n\t\t\t\t<EnableCustomFieldsOption label={ __( 'Custom fields' ) } />\n\t\t\t) }\n\t\t\t{ thirdPartyMetaBoxes.map( ( { id, title } ) => (\n\t\t\t\t<EnablePanelOption\n\t\t\t\t\tkey={ id }\n\t\t\t\t\tlabel={ title }\n\t\t\t\t\tpanelName={ `meta-box-${ id }` }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</PreferencesModalSection>\n\t);\n}\n\nexport default withSelect( ( select ) => {\n\tconst { getEditorSettings } = select( editorStore );\n\tconst { getAllMetaBoxes } = select( editPostStore );\n\n\treturn {\n\t\t// This setting should not live in the block editor's store.\n\t\tareCustomFieldsRegistered:\n\t\t\tgetEditorSettings().enableCustomFields !== undefined,\n\t\tmetaBoxes: getAllMetaBoxes(),\n\t};\n} )( MetaBoxesSection );\n"],"mappings":";;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAKA,IAAAI,mBAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,YAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AAdA;AACA;AACA;;AAMA;AACA;AACA;;AAMA,MAAM;EAAES;AAAwB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAE7D,SAASC,gBAAgBA,CAAE;EACjCC,yBAAyB;EACzBC,SAAS;EACT,GAAGC;AACJ,CAAC,EAAG;EACH;EACA,MAAMC,mBAAmB,GAAGF,SAAS,CAACG,MAAM,CAC3C,CAAE;IAAEC;EAAG,CAAC,KAAMA,EAAE,KAAK,YACtB,CAAC;EAED,IAAK,CAAEL,yBAAyB,IAAIG,mBAAmB,CAACG,MAAM,KAAK,CAAC,EAAG;IACtE,OAAO,IAAI;EACZ;EAEA,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACZ,uBAAuB;IAAA,GAAMM;EAAY,GACvCF,yBAAyB,IAC1B,IAAAO,MAAA,CAAAC,aAAA,EAACjB,mBAAA,CAAAkB,OAAwB;IAACC,KAAK,EAAG,IAAAC,QAAE,EAAE,eAAgB;EAAG,CAAE,CAC3D,EACCR,mBAAmB,CAACS,GAAG,CAAE,CAAE;IAAEP,EAAE;IAAEQ;EAAM,CAAC,KACzC,IAAAN,MAAA,CAAAC,aAAA,EAACf,YAAA,CAAAgB,OAAiB;IACjBK,GAAG,EAAGT,EAAI;IACVK,KAAK,EAAGG,KAAO;IACfE,SAAS,EAAI,YAAYV,EAAI;EAAG,CAChC,CACA,CACsB,CAAC;AAE5B;AAAC,IAAAW,QAAA,GAEc,IAAAC,gBAAU,EAAIC,MAAM,IAAM;EACxC,MAAM;IAAEC;EAAkB,CAAC,GAAGD,MAAM,CAAEE,aAAY,CAAC;EACnD,MAAM;IAAEC;EAAgB,CAAC,GAAGH,MAAM,CAAEI,YAAc,CAAC;EAEnD,OAAO;IACN;IACAtB,yBAAyB,EACxBmB,iBAAiB,CAAC,CAAC,CAACI,kBAAkB,KAAKC,SAAS;IACrDvB,SAAS,EAAEoB,eAAe,CAAC;EAC5B,CAAC;AACF,CAAE,CAAC,CAAEtB,gBAAiB,CAAC;AAAA0B,OAAA,CAAAhB,OAAA,GAAAO,QAAA"}
|
|
@@ -11,7 +11,7 @@ var _plugins = require("@wordpress/plugins");
|
|
|
11
11
|
var _data = require("@wordpress/data");
|
|
12
12
|
var _warning = _interopRequireDefault(require("@wordpress/warning"));
|
|
13
13
|
var _editor = require("@wordpress/editor");
|
|
14
|
-
var
|
|
14
|
+
var _lockUnlock = require("../../../lock-unlock");
|
|
15
15
|
/**
|
|
16
16
|
* WordPress dependencies
|
|
17
17
|
*/
|
|
@@ -24,6 +24,9 @@ const {
|
|
|
24
24
|
Fill,
|
|
25
25
|
Slot
|
|
26
26
|
} = (0, _components.createSlotFill)('PluginDocumentSettingPanel');
|
|
27
|
+
const {
|
|
28
|
+
EnablePluginDocumentSettingPanelOption
|
|
29
|
+
} = (0, _lockUnlock.unlock)(_editor.privateApis);
|
|
27
30
|
|
|
28
31
|
/**
|
|
29
32
|
* Renders items below the Status & Availability panel in the Document Sidebar.
|
|
@@ -107,7 +110,7 @@ const PluginDocumentSettingPanel = ({
|
|
|
107
110
|
if (undefined === name) {
|
|
108
111
|
typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? (0, _warning.default)('PluginDocumentSettingPanel requires a name property.') : void 0;
|
|
109
112
|
}
|
|
110
|
-
return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(
|
|
113
|
+
return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(EnablePluginDocumentSettingPanelOption, {
|
|
111
114
|
label: title,
|
|
112
115
|
panelName: panelName
|
|
113
116
|
}), (0, _react.createElement)(Fill, null, isEnabled && (0, _react.createElement)(_components.PanelBody, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_plugins","_data","_warning","_interopRequireDefault","_editor","
|
|
1
|
+
{"version":3,"names":["_components","require","_plugins","_data","_warning","_interopRequireDefault","_editor","_lockUnlock","Fill","Slot","createSlotFill","EnablePluginDocumentSettingPanelOption","unlock","editorPrivateApis","PluginDocumentSettingPanel","name","className","title","icon","children","pluginName","usePluginContext","panelName","opened","isEnabled","useSelect","select","isEditorPanelOpened","isEditorPanelEnabled","editorStore","toggleEditorPanelOpened","useDispatch","undefined","SCRIPT_DEBUG","warning","_react","createElement","Fragment","label","PanelBody","onToggle","_default","exports","default"],"sources":["@wordpress/edit-post/src/components/sidebar/plugin-document-setting-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill, PanelBody } from '@wordpress/components';\nimport { usePluginContext } from '@wordpress/plugins';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport warning from '@wordpress/warning';\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../../lock-unlock';\n\nconst { Fill, Slot } = createSlotFill( 'PluginDocumentSettingPanel' );\nconst { EnablePluginDocumentSettingPanelOption } = unlock( editorPrivateApis );\n\n/**\n * Renders items below the Status & Availability panel in the Document Sidebar.\n *\n * @param {Object} props Component properties.\n * @param {string} props.name Required. A machine-friendly name for the panel.\n * @param {string} [props.className] An optional class name added to the row.\n * @param {string} [props.title] The title of the panel\n * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.\n * @param {Element} props.children Children to be rendered\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var el = React.createElement;\n * var __ = wp.i18n.__;\n * var registerPlugin = wp.plugins.registerPlugin;\n * var PluginDocumentSettingPanel = wp.editPost.PluginDocumentSettingPanel;\n *\n * function MyDocumentSettingPlugin() {\n * \treturn el(\n * \t\tPluginDocumentSettingPanel,\n * \t\t{\n * \t\t\tclassName: 'my-document-setting-plugin',\n * \t\t\ttitle: 'My Panel',\n * \t\t\tname: 'my-panel',\n * \t\t},\n * \t\t__( 'My Document Setting Panel' )\n * \t);\n * }\n *\n * registerPlugin( 'my-document-setting-plugin', {\n * \t\trender: MyDocumentSettingPlugin\n * } );\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { registerPlugin } from '@wordpress/plugins';\n * import { PluginDocumentSettingPanel } from '@wordpress/edit-post';\n *\n * const MyDocumentSettingTest = () => (\n * \t\t<PluginDocumentSettingPanel className=\"my-document-setting-plugin\" title=\"My Panel\" name=\"my-panel\">\n *\t\t\t<p>My Document Setting Panel</p>\n *\t\t</PluginDocumentSettingPanel>\n *\t);\n *\n * registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } );\n * ```\n *\n * @return {Component} The component to be rendered.\n */\nconst PluginDocumentSettingPanel = ( {\n\tname,\n\tclassName,\n\ttitle,\n\ticon,\n\tchildren,\n} ) => {\n\tconst { name: pluginName } = usePluginContext();\n\tconst panelName = `${ pluginName }/${ name }`;\n\tconst { opened, isEnabled } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isEditorPanelOpened, isEditorPanelEnabled } =\n\t\t\t\tselect( editorStore );\n\n\t\t\treturn {\n\t\t\t\topened: isEditorPanelOpened( panelName ),\n\t\t\t\tisEnabled: isEditorPanelEnabled( panelName ),\n\t\t\t};\n\t\t},\n\t\t[ panelName ]\n\t);\n\tconst { toggleEditorPanelOpened } = useDispatch( editorStore );\n\n\tif ( undefined === name ) {\n\t\twarning( 'PluginDocumentSettingPanel requires a name property.' );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<EnablePluginDocumentSettingPanelOption\n\t\t\t\tlabel={ title }\n\t\t\t\tpanelName={ panelName }\n\t\t\t/>\n\t\t\t<Fill>\n\t\t\t\t{ isEnabled && (\n\t\t\t\t\t<PanelBody\n\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\topened={ opened }\n\t\t\t\t\t\tonToggle={ () => toggleEditorPanelOpened( panelName ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ children }\n\t\t\t\t\t</PanelBody>\n\t\t\t\t) }\n\t\t\t</Fill>\n\t\t</>\n\t);\n};\n\nPluginDocumentSettingPanel.Slot = Slot;\n\nexport default PluginDocumentSettingPanel;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAC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AW,EAAEF,aAAY,CAAC;EAE9D,IAAKG,SAAS,KAAKjB,IAAI,EAAG;IACzB,OAAAkB,YAAA,oBAAAA,YAAA,gBAAAC,gBAAO,EAAE,sDAAuD,CAAC;EAClE;EAEA,OACC,IAAAC,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACC,IAAAF,MAAA,CAAAC,aAAA,EAACzB,sCAAsC;IACtC2B,KAAK,EAAGrB,KAAO;IACfK,SAAS,EAAGA;EAAW,CACvB,CAAC,EACF,IAAAa,MAAA,CAAAC,aAAA,EAAC5B,IAAI,QACFgB,SAAS,IACV,IAAAW,MAAA,CAAAC,aAAA,EAACpC,WAAA,CAAAuC,SAAS;IACTvB,SAAS,EAAGA,SAAW;IACvBC,KAAK,EAAGA,KAAO;IACfC,IAAI,EAAGA,IAAM;IACbK,MAAM,EAAGA,MAAQ;IACjBiB,QAAQ,EAAGA,CAAA,KAAMV,uBAAuB,CAAER,SAAU;EAAG,GAErDH,QACQ,CAEP,CACL,CAAC;AAEL,CAAC;AAEDL,0BAA0B,CAACL,IAAI,GAAGA,IAAI;AAAC,IAAAgC,QAAA,GAExB3B,0BAA0B;AAAA4B,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
package/build/editor.js
CHANGED
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var _blocks = require("@wordpress/blocks");
|
|
10
9
|
var _data = require("@wordpress/data");
|
|
11
10
|
var _editor = require("@wordpress/editor");
|
|
12
11
|
var _element = require("@wordpress/element");
|
|
@@ -46,15 +45,12 @@ function Editor({
|
|
|
46
45
|
hasInlineToolbar,
|
|
47
46
|
post,
|
|
48
47
|
preferredStyleVariations,
|
|
49
|
-
hiddenBlockTypes,
|
|
50
|
-
blockTypes,
|
|
51
48
|
template
|
|
52
49
|
} = (0, _data.useSelect)(select => {
|
|
53
50
|
var _getPostType$viewable;
|
|
54
51
|
const {
|
|
55
52
|
isFeatureActive,
|
|
56
|
-
getEditedPostTemplate
|
|
57
|
-
getHiddenBlockTypes
|
|
53
|
+
getEditedPostTemplate
|
|
58
54
|
} = select(_store.store);
|
|
59
55
|
const {
|
|
60
56
|
getEntityRecord,
|
|
@@ -65,9 +61,6 @@ function Editor({
|
|
|
65
61
|
const {
|
|
66
62
|
getEditorSettings
|
|
67
63
|
} = select(_editor.store);
|
|
68
|
-
const {
|
|
69
|
-
getBlockTypes
|
|
70
|
-
} = select(_blocks.store);
|
|
71
64
|
const isTemplate = ['wp_template', 'wp_template_part'].includes(currentPost.postType);
|
|
72
65
|
// Ideally the initializeEditor function should be called using the ID of the REST endpoint.
|
|
73
66
|
// to avoid the special case.
|
|
@@ -86,8 +79,6 @@ function Editor({
|
|
|
86
79
|
return {
|
|
87
80
|
hasInlineToolbar: isFeatureActive('inlineToolbar'),
|
|
88
81
|
preferredStyleVariations: select(_preferences.store).get('core/edit-post', 'preferredStyleVariations'),
|
|
89
|
-
hiddenBlockTypes: getHiddenBlockTypes(),
|
|
90
|
-
blockTypes: getBlockTypes(),
|
|
91
82
|
template: supportsTemplateMode && isViewable && canEditTemplate ? getEditedPostTemplate() : null,
|
|
92
83
|
post: postObject
|
|
93
84
|
};
|
|
@@ -104,24 +95,10 @@ function Editor({
|
|
|
104
95
|
value: preferredStyleVariations,
|
|
105
96
|
onChange: updatePreferredStyleVariations
|
|
106
97
|
},
|
|
107
|
-
hasInlineToolbar
|
|
108
|
-
// Keep a reference of the `allowedBlockTypes` from the server to handle use cases
|
|
109
|
-
// where we need to differentiate if a block is disabled by the user or some plugin.
|
|
110
|
-
defaultAllowedBlockTypes: settings.allowedBlockTypes
|
|
98
|
+
hasInlineToolbar
|
|
111
99
|
};
|
|
112
|
-
|
|
113
|
-
// Omit hidden block types if exists and non-empty.
|
|
114
|
-
if (hiddenBlockTypes.length > 0) {
|
|
115
|
-
// Defer to passed setting for `allowedBlockTypes` if provided as
|
|
116
|
-
// anything other than `true` (where `true` is equivalent to allow
|
|
117
|
-
// all block types).
|
|
118
|
-
const defaultAllowedBlockTypes = true === settings.allowedBlockTypes ? blockTypes.map(({
|
|
119
|
-
name
|
|
120
|
-
}) => name) : settings.allowedBlockTypes || [];
|
|
121
|
-
result.allowedBlockTypes = defaultAllowedBlockTypes.filter(type => !hiddenBlockTypes.includes(type));
|
|
122
|
-
}
|
|
123
100
|
return result;
|
|
124
|
-
}, [settings, hasInlineToolbar,
|
|
101
|
+
}, [settings, hasInlineToolbar, preferredStyleVariations, updatePreferredStyleVariations, getPostLinkProps, goBack]);
|
|
125
102
|
if (!post) {
|
|
126
103
|
return null;
|
|
127
104
|
}
|
package/build/editor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blocks","require","_data","_editor","_element","_components","_coreData","_preferences","_commands","_layout","_interopRequireDefault","_editorInitialization","_store","_lockUnlock","_usePostHistory","ExperimentalEditorProvider","unlock","editorPrivateApis","Editor","postId","initialPostId","postType","initialPostType","settings","initialEdits","props","currentPost","getPostLinkProps","goBack","usePostHistory","hasInlineToolbar","post","preferredStyleVariations","hiddenBlockTypes","blockTypes","template","useSelect","select","_getPostType$viewable","isFeatureActive","getEditedPostTemplate","getHiddenBlockTypes","editPostStore","getEntityRecord","getPostType","getEntityRecords","canUser","coreStore","getEditorSettings","editorStore","getBlockTypes","blocksStore","isTemplate","includes","postObject","posts","wp_id","supportsTemplateMode","isViewable","viewable","canEditTemplate","preferencesStore","get","updatePreferredStyleVariations","useDispatch","editorSettings","useMemo","result","__experimentalPreferredStyleVariations","value","onChange","defaultAllowedBlockTypes","allowedBlockTypes","length","map","name","filter","type","_react","createElement","SlotFillProvider","useSubRegistry","__unstableTemplate","ErrorBoundary","CommandMenu","default","PostLockedModal","_default","exports"],"sources":["@wordpress/edit-post/src/editor.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useMemo } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { CommandMenu } from '@wordpress/commands';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport EditorInitialization from './components/editor-initialization';\nimport { store as editPostStore } from './store';\nimport { unlock } from './lock-unlock';\nimport usePostHistory from './hooks/use-post-history';\n\nconst { ExperimentalEditorProvider } = unlock( editorPrivateApis );\n\nfunction Editor( {\n\tpostId: initialPostId,\n\tpostType: initialPostType,\n\tsettings,\n\tinitialEdits,\n\t...props\n} ) {\n\tconst { currentPost, getPostLinkProps, goBack } = usePostHistory(\n\t\tinitialPostId,\n\t\tinitialPostType\n\t);\n\n\tconst {\n\t\thasInlineToolbar,\n\t\tpost,\n\t\tpreferredStyleVariations,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\ttemplate,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisFeatureActive,\n\t\t\t\tgetEditedPostTemplate,\n\t\t\t\tgetHiddenBlockTypes,\n\t\t\t} = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, getEntityRecords, canUser } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\t\tcurrentPost.postType\n\t\t\t);\n\t\t\t// Ideally the initializeEditor function should be called using the ID of the REST endpoint.\n\t\t\t// to avoid the special case.\n\t\t\tlet postObject;\n\t\t\tif ( isTemplate ) {\n\t\t\t\tconst posts = getEntityRecords(\n\t\t\t\t\t'postType',\n\t\t\t\t\tcurrentPost.postType,\n\t\t\t\t\t{\n\t\t\t\t\t\twp_id: currentPost.postId,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\tpostObject = posts?.[ 0 ];\n\t\t\t} else {\n\t\t\t\tpostObject = getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tcurrentPost.postType,\n\t\t\t\t\tcurrentPost.postId\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst supportsTemplateMode =\n\t\t\t\tgetEditorSettings().supportsTemplateMode;\n\t\t\tconst isViewable =\n\t\t\t\tgetPostType( currentPost.postType )?.viewable ?? false;\n\t\t\tconst canEditTemplate = canUser( 'create', 'templates' );\n\t\t\treturn {\n\t\t\t\thasInlineToolbar: isFeatureActive( 'inlineToolbar' ),\n\t\t\t\tpreferredStyleVariations: select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t'preferredStyleVariations'\n\t\t\t\t),\n\t\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\t\tblockTypes: getBlockTypes(),\n\t\t\t\ttemplate:\n\t\t\t\t\tsupportsTemplateMode && isViewable && canEditTemplate\n\t\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t\t: null,\n\t\t\t\tpost: postObject,\n\t\t\t};\n\t\t},\n\t\t[ currentPost.postType, currentPost.postId ]\n\t);\n\n\tconst { updatePreferredStyleVariations } = useDispatch( editPostStore );\n\n\tconst editorSettings = useMemo( () => {\n\t\tconst result = {\n\t\t\t...settings,\n\t\t\tgetPostLinkProps,\n\t\t\tgoBack,\n\t\t\t__experimentalPreferredStyleVariations: {\n\t\t\t\tvalue: preferredStyleVariations,\n\t\t\t\tonChange: updatePreferredStyleVariations,\n\t\t\t},\n\t\t\thasInlineToolbar,\n\n\t\t\t// Keep a reference of the `allowedBlockTypes` from the server to handle use cases\n\t\t\t// where we need to differentiate if a block is disabled by the user or some plugin.\n\t\t\tdefaultAllowedBlockTypes: settings.allowedBlockTypes,\n\t\t};\n\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes.length > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\tresult.allowedBlockTypes = defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn result;\n\t}, [\n\t\tsettings,\n\t\thasInlineToolbar,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tpreferredStyleVariations,\n\t\tupdatePreferredStyleVariations,\n\t\tgetPostLinkProps,\n\t\tgoBack,\n\t] );\n\n\tif ( ! post ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<ExperimentalEditorProvider\n\t\t\t\tsettings={ editorSettings }\n\t\t\t\tpost={ post }\n\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t__unstableTemplate={ template }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t<CommandMenu />\n\t\t\t\t\t<EditorInitialization postId={ currentPost.postId } />\n\t\t\t\t\t<Layout />\n\t\t\t\t</ErrorBoundary>\n\t\t\t\t<PostLockedModal />\n\t\t\t</ExperimentalEditorProvider>\n\t\t</SlotFillProvider>\n\t);\n}\n\nexport default Editor;\n"],"mappings":";;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAMA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA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,aAAA,EAACpE,qBAAA,CAAA0E,OAAoB;IAAClE,MAAM,EAAGO,WAAW,CAACP;EAAQ,CAAE,CAAC,EACtD,IAAA2D,MAAA,CAAAC,aAAA,EAACtE,OAAA,CAAA4E,OAAM,MAAE,CACK,CAAC,EAChB,IAAAP,MAAA,CAAAC,aAAA,EAAC5E,OAAA,CAAAmF,eAAe,MAAE,CACS,CACX,CAAC;AAErB;AAAC,IAAAC,QAAA,GAEcrE,MAAM;AAAAsE,OAAA,CAAAH,OAAA,GAAAE,QAAA"}
|
|
1
|
+
{"version":3,"names":["_data","require","_editor","_element","_components","_coreData","_preferences","_commands","_layout","_interopRequireDefault","_editorInitialization","_store","_lockUnlock","_usePostHistory","ExperimentalEditorProvider","unlock","editorPrivateApis","Editor","postId","initialPostId","postType","initialPostType","settings","initialEdits","props","currentPost","getPostLinkProps","goBack","usePostHistory","hasInlineToolbar","post","preferredStyleVariations","template","useSelect","select","_getPostType$viewable","isFeatureActive","getEditedPostTemplate","editPostStore","getEntityRecord","getPostType","getEntityRecords","canUser","coreStore","getEditorSettings","editorStore","isTemplate","includes","postObject","posts","wp_id","supportsTemplateMode","isViewable","viewable","canEditTemplate","preferencesStore","get","updatePreferredStyleVariations","useDispatch","editorSettings","useMemo","result","__experimentalPreferredStyleVariations","value","onChange","_react","createElement","SlotFillProvider","useSubRegistry","__unstableTemplate","ErrorBoundary","CommandMenu","default","PostLockedModal","_default","exports"],"sources":["@wordpress/edit-post/src/editor.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useMemo } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { CommandMenu } from '@wordpress/commands';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport EditorInitialization from './components/editor-initialization';\nimport { store as editPostStore } from './store';\nimport { unlock } from './lock-unlock';\nimport usePostHistory from './hooks/use-post-history';\n\nconst { ExperimentalEditorProvider } = unlock( editorPrivateApis );\n\nfunction Editor( {\n\tpostId: initialPostId,\n\tpostType: initialPostType,\n\tsettings,\n\tinitialEdits,\n\t...props\n} ) {\n\tconst { currentPost, getPostLinkProps, goBack } = usePostHistory(\n\t\tinitialPostId,\n\t\tinitialPostType\n\t);\n\n\tconst { hasInlineToolbar, post, preferredStyleVariations, template } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst { isFeatureActive, getEditedPostTemplate } =\n\t\t\t\t\tselect( editPostStore );\n\t\t\t\tconst {\n\t\t\t\t\tgetEntityRecord,\n\t\t\t\t\tgetPostType,\n\t\t\t\t\tgetEntityRecords,\n\t\t\t\t\tcanUser,\n\t\t\t\t} = select( coreStore );\n\t\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\t\tconst isTemplate = [\n\t\t\t\t\t'wp_template',\n\t\t\t\t\t'wp_template_part',\n\t\t\t\t].includes( currentPost.postType );\n\t\t\t\t// Ideally the initializeEditor function should be called using the ID of the REST endpoint.\n\t\t\t\t// to avoid the special case.\n\t\t\t\tlet postObject;\n\t\t\t\tif ( isTemplate ) {\n\t\t\t\t\tconst posts = getEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tcurrentPost.postType,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\twp_id: currentPost.postId,\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\tpostObject = posts?.[ 0 ];\n\t\t\t\t} else {\n\t\t\t\t\tpostObject = getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tcurrentPost.postType,\n\t\t\t\t\t\tcurrentPost.postId\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst supportsTemplateMode =\n\t\t\t\t\tgetEditorSettings().supportsTemplateMode;\n\t\t\t\tconst isViewable =\n\t\t\t\t\tgetPostType( currentPost.postType )?.viewable ?? false;\n\t\t\t\tconst canEditTemplate = canUser( 'create', 'templates' );\n\t\t\t\treturn {\n\t\t\t\t\thasInlineToolbar: isFeatureActive( 'inlineToolbar' ),\n\t\t\t\t\tpreferredStyleVariations: select( preferencesStore ).get(\n\t\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t\t'preferredStyleVariations'\n\t\t\t\t\t),\n\t\t\t\t\ttemplate:\n\t\t\t\t\t\tsupportsTemplateMode && isViewable && canEditTemplate\n\t\t\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t\t\t: null,\n\t\t\t\t\tpost: postObject,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ currentPost.postType, currentPost.postId ]\n\t\t);\n\n\tconst { updatePreferredStyleVariations } = useDispatch( editPostStore );\n\n\tconst editorSettings = useMemo( () => {\n\t\tconst result = {\n\t\t\t...settings,\n\t\t\tgetPostLinkProps,\n\t\t\tgoBack,\n\t\t\t__experimentalPreferredStyleVariations: {\n\t\t\t\tvalue: preferredStyleVariations,\n\t\t\t\tonChange: updatePreferredStyleVariations,\n\t\t\t},\n\t\t\thasInlineToolbar,\n\t\t};\n\t\treturn result;\n\t}, [\n\t\tsettings,\n\t\thasInlineToolbar,\n\t\tpreferredStyleVariations,\n\t\tupdatePreferredStyleVariations,\n\t\tgetPostLinkProps,\n\t\tgoBack,\n\t] );\n\n\tif ( ! post ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<ExperimentalEditorProvider\n\t\t\t\tsettings={ editorSettings }\n\t\t\t\tpost={ post }\n\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t__unstableTemplate={ template }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t<CommandMenu />\n\t\t\t\t\t<EditorInitialization postId={ currentPost.postId } />\n\t\t\t\t\t<Layout />\n\t\t\t\t</ErrorBoundary>\n\t\t\t\t<PostLockedModal />\n\t\t\t</ExperimentalEditorProvider>\n\t\t</SlotFillProvider>\n\t);\n}\n\nexport default Editor;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAMA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAKA,IAAAO,OAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,qBAAA,GAAAD,sBAAA,CAAAR,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,WAAA,GAAAX,OAAA;AACA,IAAAY,eAAA,GAAAJ,sBAAA,CAAAR,OAAA;AAvBA;AACA;AACA;;AAcA;AACA;AACA;;AAOA,MAAM;EAAEa;AAA2B,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAElE,SAASC,MAAMA,CAAE;EAChBC,MAAM,EAAEC,aAAa;EACrBC,QAAQ,EAAEC,eAAe;EACzBC,QAAQ;EACRC,YAAY;EACZ,GAAGC;AACJ,CAAC,EAAG;EACH,MAAM;IAAEC,WAAW;IAAEC,gBAAgB;IAAEC;EAAO,CAAC,GAAG,IAAAC,uBAAc,EAC/DT,aAAa,EACbE,eACD,CAAC;EAED,MAAM;IAAEQ,gBAAgB;IAAEC,IAAI;IAAEC,wBAAwB;IAAEC;EAAS,CAAC,GACnE,IAAAC,eAAS,EACNC,MAAM,IAAM;IAAA,IAAAC,qBAAA;IACb,MAAM;MAAEC,eAAe;MAAEC;IAAsB,CAAC,GAC/CH,MAAM,CAAEI,YAAc,CAAC;IACxB,MAAM;MACLC,eAAe;MACfC,WAAW;MACXC,gBAAgB;MAChBC;IACD,CAAC,GAAGR,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
|
@@ -50,27 +50,11 @@ class Editor extends _element.Component {
|
|
|
50
50
|
});
|
|
51
51
|
this.setTitleRef = this.setTitleRef.bind(this);
|
|
52
52
|
}
|
|
53
|
-
getEditorSettings(settings
|
|
53
|
+
getEditorSettings(settings) {
|
|
54
54
|
settings = {
|
|
55
55
|
...settings,
|
|
56
56
|
isRTL: _reactNative.I18nManager.isRTL
|
|
57
57
|
};
|
|
58
|
-
|
|
59
|
-
// Omit hidden block types if exists and non-empty.
|
|
60
|
-
if (hiddenBlockTypes.length > 0) {
|
|
61
|
-
if (settings.allowedBlockTypes === undefined) {
|
|
62
|
-
// If no specific flags for allowedBlockTypes are set, assume `true`
|
|
63
|
-
// meaning allow all block types.
|
|
64
|
-
settings.allowedBlockTypes = true;
|
|
65
|
-
}
|
|
66
|
-
// Defer to passed setting for `allowedBlockTypes` if provided as
|
|
67
|
-
// anything other than `true` (where `true` is equivalent to allow
|
|
68
|
-
// all block types).
|
|
69
|
-
const defaultAllowedBlockTypes = true === settings.allowedBlockTypes ? blockTypes.map(({
|
|
70
|
-
name
|
|
71
|
-
}) => name) : settings.allowedBlockTypes || [];
|
|
72
|
-
settings.allowedBlockTypes = defaultAllowedBlockTypes.filter(type => !hiddenBlockTypes.includes(type));
|
|
73
|
-
}
|
|
74
58
|
return settings;
|
|
75
59
|
}
|
|
76
60
|
componentDidMount() {
|
|
@@ -114,8 +98,6 @@ class Editor extends _element.Component {
|
|
|
114
98
|
const {
|
|
115
99
|
settings,
|
|
116
100
|
initialEdits,
|
|
117
|
-
hiddenBlockTypes,
|
|
118
|
-
blockTypes,
|
|
119
101
|
post,
|
|
120
102
|
postId,
|
|
121
103
|
postType,
|
|
@@ -123,7 +105,7 @@ class Editor extends _element.Component {
|
|
|
123
105
|
initialHtml,
|
|
124
106
|
...props
|
|
125
107
|
} = this.props;
|
|
126
|
-
const editorSettings = this.getEditorSettings(settings
|
|
108
|
+
const editorSettings = this.getEditorSettings(settings);
|
|
127
109
|
const normalizedPost = post || {
|
|
128
110
|
id: postId,
|
|
129
111
|
title: {
|
|
@@ -157,16 +139,10 @@ class Editor extends _element.Component {
|
|
|
157
139
|
}
|
|
158
140
|
var _default = (0, _compose.compose)([(0, _data.withSelect)(select => {
|
|
159
141
|
const {
|
|
160
|
-
getEditorMode
|
|
161
|
-
getHiddenBlockTypes
|
|
142
|
+
getEditorMode
|
|
162
143
|
} = select(_store.store);
|
|
163
|
-
const {
|
|
164
|
-
getBlockTypes
|
|
165
|
-
} = select(_blocks.store);
|
|
166
144
|
return {
|
|
167
|
-
mode: getEditorMode()
|
|
168
|
-
hiddenBlockTypes: getHiddenBlockTypes(),
|
|
169
|
-
blockTypes: getBlockTypes()
|
|
145
|
+
mode: getEditorMode()
|
|
170
146
|
};
|
|
171
147
|
}), (0, _data.withDispatch)(dispatch => {
|
|
172
148
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_memize","_interopRequireDefault","require","_reactNative","_reactNativeGestureHandler","_element","_editor","_blocks","_data","_compose","_reactNativeBridge","_components","_coreData","_layout","_store","Editor","Component","constructor","props","arguments","galleryWithImageBlocks","window","wp","galleryBlockV2Enabled","initialHtmlModeEnabled","mode","switchEditorMode","getEditorSettings","memize","maxSize","setTitleRef","bind","settings","hiddenBlockTypes","blockTypes","isRTL","I18nManager","length","allowedBlockTypes","undefined","defaultAllowedBlockTypes","map","name","filter","type","includes","componentDidMount","editEntityRecord","postType","postId","subscriptionParentSetFocusOnTitle","subscribeSetFocusOnTitle","postTitleRef","focus","focusTitleWhenAvailable","subscriptionParentFeaturedImageIdNativeUpdated","subscribeFeaturedImageIdNativeUpdated","payload","featured_media","featuredImageId","undoIgnore","componentWillUnmount","remove","titleRef","render","initialEdits","post","initialHtml","editorSettings","normalizedPost","id","title","raw","initialTitle","content","serialize","parse","status","meta","_react","createElement","GestureHandlerRootView","style","flex","SlotFillProvider","EditorProvider","useSubRegistry","default","_default","compose","withSelect","select","getEditorMode","getHiddenBlockTypes","editPostStore","getBlockTypes","blocksStore","withDispatch","dispatch","coreStore","exports"],"sources":["@wordpress/edit-post/src/editor.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport memize from 'memize';\nimport { I18nManager } from 'react-native';\nimport { GestureHandlerRootView } from 'react-native-gesture-handler';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { EditorProvider } from '@wordpress/editor';\nimport { parse, serialize, store as blocksStore } from '@wordpress/blocks';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport {\n\tsubscribeSetFocusOnTitle,\n\tsubscribeFeaturedImageIdNativeUpdated,\n} from '@wordpress/react-native-bridge';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport { store as editPostStore } from './store';\n\nclass Editor extends Component {\n\tconstructor( props ) {\n\t\tsuper( ...arguments );\n\n\t\t// need to set this globally to avoid race with deprecations\n\t\t// defaulting to true to avoid issues with a not-yet-cached value\n\t\tconst { galleryWithImageBlocks = true } = props;\n\t\twindow.wp.galleryBlockV2Enabled = galleryWithImageBlocks;\n\n\t\tif ( props.initialHtmlModeEnabled && props.mode === 'visual' ) {\n\t\t\t// Enable html mode if the initial mode the parent wants it but we're not already in it.\n\t\t\tthis.props.switchEditorMode( 'text' );\n\t\t}\n\n\t\tthis.getEditorSettings = memize( this.getEditorSettings, {\n\t\t\tmaxSize: 1,\n\t\t} );\n\n\t\tthis.setTitleRef = this.setTitleRef.bind( this );\n\t}\n\n\tgetEditorSettings( settings, hiddenBlockTypes, blockTypes ) {\n\t\tsettings = {\n\t\t\t...settings,\n\t\t\tisRTL: I18nManager.isRTL,\n\t\t};\n\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes.length > 0 ) {\n\t\t\tif ( settings.allowedBlockTypes === undefined ) {\n\t\t\t\t// If no specific flags for allowedBlockTypes are set, assume `true`\n\t\t\t\t// meaning allow all block types.\n\t\t\t\tsettings.allowedBlockTypes = true;\n\t\t\t}\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\tsettings.allowedBlockTypes = defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn settings;\n\t}\n\n\tcomponentDidMount() {\n\t\tconst { editEntityRecord, postType, postId } = this.props;\n\n\t\tthis.subscriptionParentSetFocusOnTitle = subscribeSetFocusOnTitle(\n\t\t\t() => {\n\t\t\t\tif ( this.postTitleRef ) {\n\t\t\t\t\tthis.postTitleRef.focus();\n\t\t\t\t} else {\n\t\t\t\t\t// If the post title ref is not available, we postpone setting focus to when it's available.\n\t\t\t\t\tthis.focusTitleWhenAvailable = true;\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentFeaturedImageIdNativeUpdated =\n\t\t\tsubscribeFeaturedImageIdNativeUpdated( ( payload ) => {\n\t\t\t\teditEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId,\n\t\t\t\t\t{ featured_media: payload.featuredImageId },\n\t\t\t\t\t{\n\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} );\n\t}\n\n\tcomponentWillUnmount() {\n\t\tif ( this.subscriptionParentSetFocusOnTitle ) {\n\t\t\tthis.subscriptionParentSetFocusOnTitle.remove();\n\t\t}\n\n\t\tif ( this.subscribeFeaturedImageIdNativeUpdated ) {\n\t\t\tthis.subscribeFeaturedImageIdNativeUpdated.remove();\n\t\t}\n\t}\n\n\tsetTitleRef( titleRef ) {\n\t\tif ( this.focusTitleWhenAvailable && ! this.postTitleRef ) {\n\t\t\tthis.focusTitleWhenAvailable = false;\n\t\t\ttitleRef.focus();\n\t\t}\n\n\t\tthis.postTitleRef = titleRef;\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tsettings,\n\t\t\tinitialEdits,\n\t\t\thiddenBlockTypes,\n\t\t\tblockTypes,\n\t\t\tpost,\n\t\t\tpostId,\n\t\t\tpostType,\n\t\t\tfeaturedImageId,\n\t\t\tinitialHtml,\n\t\t\t...props\n\t\t} = this.props;\n\n\t\tconst editorSettings = this.getEditorSettings(\n\t\t\tsettings,\n\t\t\thiddenBlockTypes,\n\t\t\tblockTypes\n\t\t);\n\n\t\tconst normalizedPost = post || {\n\t\t\tid: postId,\n\t\t\ttitle: {\n\t\t\t\traw: props.initialTitle || '',\n\t\t\t},\n\t\t\tfeatured_media: featuredImageId,\n\t\t\tcontent: {\n\t\t\t\t// Make sure the post content is in sync with gutenberg store\n\t\t\t\t// to avoid marking the post as modified when simply loaded\n\t\t\t\t// For now, let's assume: serialize( parse( html ) ) !== html.\n\t\t\t\traw: serialize( parse( initialHtml || '' ) ),\n\t\t\t},\n\t\t\ttype: postType,\n\t\t\tstatus: 'draft',\n\t\t\tmeta: [],\n\t\t};\n\n\t\treturn (\n\t\t\t<GestureHandlerRootView style={ { flex: 1 } }>\n\t\t\t\t<SlotFillProvider>\n\t\t\t\t\t<EditorProvider\n\t\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\t\tpost={ normalizedPost }\n\t\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Layout setTitleRef={ this.setTitleRef } />\n\t\t\t\t\t</EditorProvider>\n\t\t\t\t</SlotFillProvider>\n\t\t\t</GestureHandlerRootView>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getEditorMode, getHiddenBlockTypes } = select( editPostStore );\n\t\tconst { getBlockTypes } = select( blocksStore );\n\n\t\treturn {\n\t\t\tmode: getEditorMode(),\n\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\tblockTypes: getBlockTypes(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { switchEditorMode } = dispatch( editPostStore );\n\t\tconst { editEntityRecord } = dispatch( coreStore );\n\t\treturn {\n\t\t\tswitchEditorMode,\n\t\t\teditEntityRecord,\n\t\t};\n\t} ),\n] )( Editor );\n"],"mappings":";;;;;;;;AAGA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,0BAAA,GAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,kBAAA,GAAAR,OAAA;AAIA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,SAAA,GAAAV,OAAA;AAKA,IAAAW,OAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AA1BA;AACA;AACA;;AAKA;AACA;AACA;;AAaA;AACA;AACA;;AAIA,MAAMa,MAAM,SAASC,kBAAS,CAAC;EAC9BC,WAAWA,CAAEC,KAAK,EAAG;IACpB,KAAK,CAAE,GAAGC,SAAU,CAAC;;IAErB;IACA;IACA,MAAM;MAAEC,sBAAsB,GAAG;IAAK,CAAC,GAAGF,KAAK;IAC/CG,MAAM,CAACC,EAAE,CAACC,qBAAqB,GAAGH,sBAAsB;IAExD,IAAKF,KAAK,CAACM,sBAAsB,IAAIN,KAAK,CAACO,IAAI,KAAK,QAAQ,EAAG;MAC9D;MACA,IAAI,CAACP,KAAK,CAACQ,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Q,CAAEC,eAAU,CAAC;EAClD,OAAO;IACNzE,gBAAgB;IAChBqB;EACD,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAEhC,MAAO,CAAC;AAAAqF,OAAA,CAAAb,OAAA,GAAAC,QAAA"}
|
|
1
|
+
{"version":3,"names":["_memize","_interopRequireDefault","require","_reactNative","_reactNativeGestureHandler","_element","_editor","_blocks","_data","_compose","_reactNativeBridge","_components","_coreData","_layout","_store","Editor","Component","constructor","props","arguments","galleryWithImageBlocks","window","wp","galleryBlockV2Enabled","initialHtmlModeEnabled","mode","switchEditorMode","getEditorSettings","memize","maxSize","setTitleRef","bind","settings","isRTL","I18nManager","componentDidMount","editEntityRecord","postType","postId","subscriptionParentSetFocusOnTitle","subscribeSetFocusOnTitle","postTitleRef","focus","focusTitleWhenAvailable","subscriptionParentFeaturedImageIdNativeUpdated","subscribeFeaturedImageIdNativeUpdated","payload","featured_media","featuredImageId","undoIgnore","componentWillUnmount","remove","titleRef","render","initialEdits","post","initialHtml","editorSettings","normalizedPost","id","title","raw","initialTitle","content","serialize","parse","type","status","meta","_react","createElement","GestureHandlerRootView","style","flex","SlotFillProvider","EditorProvider","useSubRegistry","default","_default","compose","withSelect","select","getEditorMode","editPostStore","withDispatch","dispatch","coreStore","exports"],"sources":["@wordpress/edit-post/src/editor.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport memize from 'memize';\nimport { I18nManager } from 'react-native';\nimport { GestureHandlerRootView } from 'react-native-gesture-handler';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { EditorProvider } from '@wordpress/editor';\nimport { parse, serialize } from '@wordpress/blocks';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport {\n\tsubscribeSetFocusOnTitle,\n\tsubscribeFeaturedImageIdNativeUpdated,\n} from '@wordpress/react-native-bridge';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport { store as editPostStore } from './store';\n\nclass Editor extends Component {\n\tconstructor( props ) {\n\t\tsuper( ...arguments );\n\n\t\t// need to set this globally to avoid race with deprecations\n\t\t// defaulting to true to avoid issues with a not-yet-cached value\n\t\tconst { galleryWithImageBlocks = true } = props;\n\t\twindow.wp.galleryBlockV2Enabled = galleryWithImageBlocks;\n\n\t\tif ( props.initialHtmlModeEnabled && props.mode === 'visual' ) {\n\t\t\t// Enable html mode if the initial mode the parent wants it but we're not already in it.\n\t\t\tthis.props.switchEditorMode( 'text' );\n\t\t}\n\n\t\tthis.getEditorSettings = memize( this.getEditorSettings, {\n\t\t\tmaxSize: 1,\n\t\t} );\n\n\t\tthis.setTitleRef = this.setTitleRef.bind( this );\n\t}\n\n\tgetEditorSettings( settings ) {\n\t\tsettings = {\n\t\t\t...settings,\n\t\t\tisRTL: I18nManager.isRTL,\n\t\t};\n\n\t\treturn settings;\n\t}\n\n\tcomponentDidMount() {\n\t\tconst { editEntityRecord, postType, postId } = this.props;\n\n\t\tthis.subscriptionParentSetFocusOnTitle = subscribeSetFocusOnTitle(\n\t\t\t() => {\n\t\t\t\tif ( this.postTitleRef ) {\n\t\t\t\t\tthis.postTitleRef.focus();\n\t\t\t\t} else {\n\t\t\t\t\t// If the post title ref is not available, we postpone setting focus to when it's available.\n\t\t\t\t\tthis.focusTitleWhenAvailable = true;\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentFeaturedImageIdNativeUpdated =\n\t\t\tsubscribeFeaturedImageIdNativeUpdated( ( payload ) => {\n\t\t\t\teditEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId,\n\t\t\t\t\t{ featured_media: payload.featuredImageId },\n\t\t\t\t\t{\n\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} );\n\t}\n\n\tcomponentWillUnmount() {\n\t\tif ( this.subscriptionParentSetFocusOnTitle ) {\n\t\t\tthis.subscriptionParentSetFocusOnTitle.remove();\n\t\t}\n\n\t\tif ( this.subscribeFeaturedImageIdNativeUpdated ) {\n\t\t\tthis.subscribeFeaturedImageIdNativeUpdated.remove();\n\t\t}\n\t}\n\n\tsetTitleRef( titleRef ) {\n\t\tif ( this.focusTitleWhenAvailable && ! this.postTitleRef ) {\n\t\t\tthis.focusTitleWhenAvailable = false;\n\t\t\ttitleRef.focus();\n\t\t}\n\n\t\tthis.postTitleRef = titleRef;\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tsettings,\n\t\t\tinitialEdits,\n\t\t\tpost,\n\t\t\tpostId,\n\t\t\tpostType,\n\t\t\tfeaturedImageId,\n\t\t\tinitialHtml,\n\t\t\t...props\n\t\t} = this.props;\n\n\t\tconst editorSettings = this.getEditorSettings( settings );\n\n\t\tconst normalizedPost = post || {\n\t\t\tid: postId,\n\t\t\ttitle: {\n\t\t\t\traw: props.initialTitle || '',\n\t\t\t},\n\t\t\tfeatured_media: featuredImageId,\n\t\t\tcontent: {\n\t\t\t\t// Make sure the post content is in sync with gutenberg store\n\t\t\t\t// to avoid marking the post as modified when simply loaded\n\t\t\t\t// For now, let's assume: serialize( parse( html ) ) !== html.\n\t\t\t\traw: serialize( parse( initialHtml || '' ) ),\n\t\t\t},\n\t\t\ttype: postType,\n\t\t\tstatus: 'draft',\n\t\t\tmeta: [],\n\t\t};\n\n\t\treturn (\n\t\t\t<GestureHandlerRootView style={ { flex: 1 } }>\n\t\t\t\t<SlotFillProvider>\n\t\t\t\t\t<EditorProvider\n\t\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\t\tpost={ normalizedPost }\n\t\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Layout setTitleRef={ this.setTitleRef } />\n\t\t\t\t\t</EditorProvider>\n\t\t\t\t</SlotFillProvider>\n\t\t\t</GestureHandlerRootView>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getEditorMode } = select( editPostStore );\n\n\t\treturn {\n\t\t\tmode: getEditorMode(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { switchEditorMode } = dispatch( editPostStore );\n\t\tconst { editEntityRecord } = dispatch( coreStore );\n\t\treturn {\n\t\t\tswitchEditorMode,\n\t\t\teditEntityRecord,\n\t\t};\n\t} ),\n] )( Editor );\n"],"mappings":";;;;;;;;AAGA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,0BAAA,GAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,kBAAA,GAAAR,OAAA;AAIA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,SAAA,GAAAV,OAAA;AAKA,IAAAW,OAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AA1BA;AACA;AACA;;AAKA;AACA;AACA;;AAaA;AACA;AACA;;AAIA,MAAMa,MAAM,SAASC,kBAAS,CAAC;EAC9BC,WAAWA,CAAEC,KAAK,EAAG;IACpB,KAAK,CAAE,GAAGC,SAAU,CAAC;;IAErB;IACA;IACA,MAAM;MAAEC,sBAAsB,GAAG;IAAK,CAAC,GAAGF,KAAK;IAC/CG,MAAM,CAACC,EAAE,CAACC,qBAAqB,GAAGH,sBAAsB;IAExD,IAAKF,KAAK,CAACM,sBAAsB,IAAIN,KAAK,CAACO,IAAI,KAAK,QAAQ,EAAG;MAC9D;MACA,IAAI,CAACP,KAAK,CAACQ,gBAAgB,CAAE,MAAO,CAAC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,WAAW,EAAG,IAAI,CAACA;IAAa,CAAE,CAC3B,CACC,CACK,CAAC;EAE3B;AACD;AAAC,IAAAgD,QAAA,GAEc,IAAAC,gBAAO,EAAE,CACvB,IAAAC,gBAAU,EAAIC,MAAM,IAAM;EACzB,MAAM;IAAEC;EAAc,CAAC,GAAGD,MAAM,CAAEE,YAAc,CAAC;EAEjD,OAAO;IACN1D,IAAI,EAAEyD,aAAa,CAAC;EACrB,CAAC;AACF,CAAE,CAAC,EACH,IAAAE,kBAAY,EAAIC,QAAQ,IAAM;EAC7B,MAAM;IAAE3D;EAAiB,CAAC,GAAG2D,QAAQ,CAAEF,YAAc,CAAC;EACtD,MAAM;IAAE/C;EAAiB,CAAC,GAAGiD,QAAQ,CAAEC,eAAU,CAAC;EAClD,OAAO;IACN5D,gBAAgB;IAChBU;EACD,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAErB,MAAO,CAAC;AAAAwE,OAAA,CAAAV,OAAA,GAAAC,QAAA"}
|
|
@@ -37,9 +37,12 @@ function useCommonCommands() {
|
|
|
37
37
|
editorMode,
|
|
38
38
|
activeSidebar,
|
|
39
39
|
isListViewOpen,
|
|
40
|
+
isFullscreen,
|
|
40
41
|
isPublishSidebarEnabled,
|
|
41
42
|
showBlockBreadcrumbs,
|
|
42
|
-
isDistractionFree
|
|
43
|
+
isDistractionFree,
|
|
44
|
+
isTopToolbar,
|
|
45
|
+
isFocusMode
|
|
43
46
|
} = (0, _data.useSelect)(select => {
|
|
44
47
|
const {
|
|
45
48
|
get
|
|
@@ -56,7 +59,10 @@ function useCommonCommands() {
|
|
|
56
59
|
isListViewOpen: isListViewOpened(),
|
|
57
60
|
isPublishSidebarEnabled: select(_editor.store).isPublishSidebarEnabled(),
|
|
58
61
|
showBlockBreadcrumbs: get('core', 'showBlockBreadcrumbs'),
|
|
59
|
-
isDistractionFree: get('core', 'distractionFree')
|
|
62
|
+
isDistractionFree: get('core', 'distractionFree'),
|
|
63
|
+
isFocusMode: get('core', 'focusMode'),
|
|
64
|
+
isTopToolbar: get('core', 'fixedToolbar'),
|
|
65
|
+
isFullscreen: get('core/edit-post', 'fullscreenMode')
|
|
60
66
|
};
|
|
61
67
|
}, []);
|
|
62
68
|
const {
|
|
@@ -104,7 +110,7 @@ function useCommonCommands() {
|
|
|
104
110
|
});
|
|
105
111
|
(0, _commands.useCommand)({
|
|
106
112
|
name: 'core/toggle-distraction-free',
|
|
107
|
-
label: (0, _i18n.__)('
|
|
113
|
+
label: isDistractionFree ? (0, _i18n.__)('Exit Distraction Free') : (0, _i18n.__)('Enter Distraction Free '),
|
|
108
114
|
callback: ({
|
|
109
115
|
close
|
|
110
116
|
}) => {
|
|
@@ -114,34 +120,58 @@ function useCommonCommands() {
|
|
|
114
120
|
});
|
|
115
121
|
(0, _commands.useCommand)({
|
|
116
122
|
name: 'core/toggle-spotlight-mode',
|
|
117
|
-
label: (0, _i18n.__)('Toggle spotlight
|
|
123
|
+
label: (0, _i18n.__)('Toggle spotlight'),
|
|
118
124
|
callback: ({
|
|
119
125
|
close
|
|
120
126
|
}) => {
|
|
121
127
|
toggle('core', 'focusMode');
|
|
122
128
|
close();
|
|
129
|
+
createInfoNotice(isFocusMode ? (0, _i18n.__)('Spotlight off.') : (0, _i18n.__)('Spotlight on.'), {
|
|
130
|
+
id: 'core/edit-post/toggle-spotlight-mode/notice',
|
|
131
|
+
type: 'snackbar',
|
|
132
|
+
actions: [{
|
|
133
|
+
label: (0, _i18n.__)('Undo'),
|
|
134
|
+
onClick: () => {
|
|
135
|
+
toggle('core', 'focusMode');
|
|
136
|
+
}
|
|
137
|
+
}]
|
|
138
|
+
});
|
|
123
139
|
}
|
|
124
140
|
});
|
|
125
141
|
(0, _commands.useCommand)({
|
|
126
142
|
name: 'core/toggle-fullscreen-mode',
|
|
127
|
-
label: (0, _i18n.__)('
|
|
128
|
-
icon: _icons.
|
|
143
|
+
label: isFullscreen ? (0, _i18n.__)('Exit fullscreen') : (0, _i18n.__)('Enter fullscreen'),
|
|
144
|
+
icon: _icons.fullscreen,
|
|
129
145
|
callback: ({
|
|
130
146
|
close
|
|
131
147
|
}) => {
|
|
132
148
|
toggle('core/edit-post', 'fullscreenMode');
|
|
133
149
|
close();
|
|
150
|
+
createInfoNotice(isFullscreen ? (0, _i18n.__)('Fullscreen off.') : (0, _i18n.__)('Fullscreen on.'), {
|
|
151
|
+
id: 'core/edit-post/toggle-fullscreen-mode/notice',
|
|
152
|
+
type: 'snackbar',
|
|
153
|
+
actions: [{
|
|
154
|
+
label: (0, _i18n.__)('Undo'),
|
|
155
|
+
onClick: () => {
|
|
156
|
+
toggle('core/edit-post', 'fullscreenMode');
|
|
157
|
+
}
|
|
158
|
+
}]
|
|
159
|
+
});
|
|
134
160
|
}
|
|
135
161
|
});
|
|
136
162
|
(0, _commands.useCommand)({
|
|
137
163
|
name: 'core/toggle-list-view',
|
|
138
|
-
label: (0, _i18n.__)('
|
|
164
|
+
label: isListViewOpen ? (0, _i18n.__)('Close List View') : (0, _i18n.__)('Open List View'),
|
|
139
165
|
icon: _icons.listView,
|
|
140
166
|
callback: ({
|
|
141
167
|
close
|
|
142
168
|
}) => {
|
|
143
169
|
setIsListViewOpened(!isListViewOpen);
|
|
144
170
|
close();
|
|
171
|
+
createInfoNotice(isListViewOpen ? (0, _i18n.__)('List View off.') : (0, _i18n.__)('List View on.'), {
|
|
172
|
+
id: 'core/edit-post/toggle-list-view/notice',
|
|
173
|
+
type: 'snackbar'
|
|
174
|
+
});
|
|
145
175
|
}
|
|
146
176
|
});
|
|
147
177
|
(0, _commands.useCommand)({
|
|
@@ -155,11 +185,21 @@ function useCommonCommands() {
|
|
|
155
185
|
toggleDistractionFree();
|
|
156
186
|
}
|
|
157
187
|
close();
|
|
188
|
+
createInfoNotice(isTopToolbar ? (0, _i18n.__)('Top toolbar off.') : (0, _i18n.__)('Top toolbar on.'), {
|
|
189
|
+
id: 'core/edit-post/toggle-top-toolbar/notice',
|
|
190
|
+
type: 'snackbar',
|
|
191
|
+
actions: [{
|
|
192
|
+
label: (0, _i18n.__)('Undo'),
|
|
193
|
+
onClick: () => {
|
|
194
|
+
toggle('core', 'fixedToolbar');
|
|
195
|
+
}
|
|
196
|
+
}]
|
|
197
|
+
});
|
|
158
198
|
}
|
|
159
199
|
});
|
|
160
200
|
(0, _commands.useCommand)({
|
|
161
201
|
name: 'core/toggle-code-editor',
|
|
162
|
-
label: (0, _i18n.__)('
|
|
202
|
+
label: editorMode === 'visual' ? (0, _i18n.__)('Open code editor') : (0, _i18n.__)('Exit code editor'),
|
|
163
203
|
icon: _icons.code,
|
|
164
204
|
callback: ({
|
|
165
205
|
close
|