@wordpress/edit-post 7.20.0 → 7.21.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/header/header-toolbar/index.js +2 -1
  3. package/build/components/header/header-toolbar/index.js.map +1 -1
  4. package/build/components/layout/index.js +18 -1
  5. package/build/components/layout/index.js.map +1 -1
  6. package/build/components/sidebar/plugin-post-excerpt/index.js +72 -0
  7. package/build/components/sidebar/plugin-post-excerpt/index.js.map +1 -0
  8. package/build/components/sidebar/post-excerpt/index.js +23 -20
  9. package/build/components/sidebar/post-excerpt/index.js.map +1 -1
  10. package/build/editor.js +0 -7
  11. package/build/editor.js.map +1 -1
  12. package/build/index.js +7 -0
  13. package/build/index.js.map +1 -1
  14. package/build/lock-unlock.js +1 -1
  15. package/build/lock-unlock.js.map +1 -1
  16. package/build-module/components/header/header-toolbar/index.js +2 -1
  17. package/build-module/components/header/header-toolbar/index.js.map +1 -1
  18. package/build-module/components/layout/index.js +18 -2
  19. package/build-module/components/layout/index.js.map +1 -1
  20. package/build-module/components/sidebar/plugin-post-excerpt/index.js +64 -0
  21. package/build-module/components/sidebar/plugin-post-excerpt/index.js.map +1 -0
  22. package/build-module/components/sidebar/post-excerpt/index.js +23 -20
  23. package/build-module/components/sidebar/post-excerpt/index.js.map +1 -1
  24. package/build-module/editor.js +0 -7
  25. package/build-module/editor.js.map +1 -1
  26. package/build-module/index.js +1 -0
  27. package/build-module/index.js.map +1 -1
  28. package/build-module/lock-unlock.js +1 -1
  29. package/build-module/lock-unlock.js.map +1 -1
  30. package/build-style/style-rtl.css +0 -1
  31. package/build-style/style.css +0 -1
  32. package/package.json +32 -32
  33. package/src/components/header/header-toolbar/index.js +1 -0
  34. package/src/components/header/header-toolbar/style.scss +0 -1
  35. package/src/components/layout/index.js +19 -0
  36. package/src/components/sidebar/plugin-post-excerpt/index.js +61 -0
  37. package/src/components/sidebar/plugin-post-excerpt/test/index.js +36 -0
  38. package/src/components/sidebar/post-excerpt/index.js +25 -22
  39. package/src/editor.js +0 -5
  40. package/src/index.js +1 -0
  41. package/src/lock-unlock.js +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["store","blocksStore","useSelect","useDispatch","ErrorBoundary","PostLockedModal","editorStore","privateApis","editorPrivateApis","useMemo","SlotFillProvider","coreStore","preferencesStore","CommandMenu","coreCommandsPrivateApis","Layout","EditorInitialization","editPostStore","unlock","useCommonCommands","ExperimentalEditorProvider","useCommands","Editor","postId","postType","settings","initialEdits","props","hasFixedToolbar","focusMode","isDistractionFree","hasInlineToolbar","post","preferredStyleVariations","hiddenBlockTypes","blockTypes","keepCaretInsideBlock","isTemplateMode","template","select","_getPostType$viewable","isFeatureActive","isEditingTemplate","getEditedPostTemplate","getHiddenBlockTypes","getEntityRecord","getPostType","getEntityRecords","canUser","getEditorSettings","getBlockTypes","isTemplate","includes","postObject","posts","wp_id","supportsTemplateMode","isViewable","viewable","canEditTemplate","get","updatePreferredStyleVariations","setIsInserterOpened","editorSettings","result","__experimentalPreferredStyleVariations","value","onChange","__experimentalSetIsInserterOpened","defaultAllowedBlockTypes","allowedBlockTypes","length","map","name","filter","type","createElement","useSubRegistry","__unstableTemplate","undefined"],"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';\nimport { privateApis as coreCommandsPrivateApis } from '@wordpress/core-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 useCommonCommands from './hooks/commands/use-common-commands';\n\nconst { ExperimentalEditorProvider } = unlock( editorPrivateApis );\nconst { useCommands } = unlock( coreCommandsPrivateApis );\n\nfunction Editor( { postId, postType, settings, initialEdits, ...props } ) {\n\tuseCommands();\n\tuseCommonCommands();\n\tconst {\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\tisDistractionFree,\n\t\thasInlineToolbar,\n\t\tpost,\n\t\tpreferredStyleVariations,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tkeepCaretInsideBlock,\n\t\tisTemplateMode,\n\t\ttemplate,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisFeatureActive,\n\t\t\t\tisEditingTemplate,\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\tpostType\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( 'postType', postType, {\n\t\t\t\t\twp_id: postId,\n\t\t\t\t} );\n\t\t\t\tpostObject = posts?.[ 0 ];\n\t\t\t} else {\n\t\t\t\tpostObject = getEntityRecord( 'postType', postType, postId );\n\t\t\t}\n\t\t\tconst supportsTemplateMode =\n\t\t\t\tgetEditorSettings().supportsTemplateMode;\n\t\t\tconst isViewable = getPostType( postType )?.viewable ?? false;\n\t\t\tconst canEditTemplate = canUser( 'create', 'templates' );\n\n\t\t\treturn {\n\t\t\t\thasFixedToolbar: isFeatureActive( 'fixedToolbar' ),\n\t\t\t\tfocusMode: isFeatureActive( 'focusMode' ),\n\t\t\t\tisDistractionFree: isFeatureActive( 'distractionFree' ),\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\tkeepCaretInsideBlock: isFeatureActive( 'keepCaretInsideBlock' ),\n\t\t\t\tisTemplateMode: isEditingTemplate(),\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[ postType, postId ]\n\t);\n\n\tconst { updatePreferredStyleVariations, setIsInserterOpened } =\n\t\tuseDispatch( editPostStore );\n\n\tconst editorSettings = useMemo( () => {\n\t\tconst result = {\n\t\t\t...settings,\n\t\t\t__experimentalPreferredStyleVariations: {\n\t\t\t\tvalue: preferredStyleVariations,\n\t\t\t\tonChange: updatePreferredStyleVariations,\n\t\t\t},\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\tisDistractionFree,\n\t\t\thasInlineToolbar,\n\n\t\t\t// This is marked as experimental to give time for the quick inserter to mature.\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tkeepCaretInsideBlock,\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\thasFixedToolbar,\n\t\thasInlineToolbar,\n\t\tfocusMode,\n\t\tisDistractionFree,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tpreferredStyleVariations,\n\t\tsetIsInserterOpened,\n\t\tupdatePreferredStyleVariations,\n\t\tkeepCaretInsideBlock,\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={ isTemplateMode ? template : undefined }\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={ 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":";AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SACCC,aAAa,EACbC,eAAe,EACfL,KAAK,IAAIM,WAAW,EACpBC,WAAW,IAAIC,iBAAiB,QAC1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EH,IAAK,CAAEJ,IAAI,EAAG;IACb,OAAO,IAAI;EACZ;EAEA,OACC4C,aAAA,CAAClE,gBAAgB,QAChBkE,aAAA,CAACxD,0BAA0B;IAC1BK,QAAQ,EAAGsC,cAAgB;IAC3B/B,IAAI,EAAGA,IAAM;IACbN,YAAY,EAAGA,YAAc;IAC7BmD,cAAc,EAAG,KAAO;IACxBC,kBAAkB,EAAGzC,cAAc,GAAGC,QAAQ,GAAGyC,SAAW;IAAA,GACvDpD;EAAK,GAEViD,aAAA,CAACxE,aAAa,QACbwE,aAAA,CAAC/D,WAAW,MAAE,CAAC,EACf+D,aAAA,CAAC5D,oBAAoB;IAACO,MAAM,EAAGA;EAAQ,CAAE,CAAC,EAC1CqD,aAAA,CAAC7D,MAAM,MAAE,CACK,CAAC,EAChB6D,aAAA,CAACvE,eAAe,MAAE,CACS,CACX,CAAC;AAErB;AAEA,eAAeiB,MAAM"}
1
+ {"version":3,"names":["store","blocksStore","useSelect","useDispatch","ErrorBoundary","PostLockedModal","editorStore","privateApis","editorPrivateApis","useMemo","SlotFillProvider","coreStore","preferencesStore","CommandMenu","Layout","EditorInitialization","editPostStore","unlock","ExperimentalEditorProvider","Editor","postId","postType","settings","initialEdits","props","hasFixedToolbar","focusMode","isDistractionFree","hasInlineToolbar","post","preferredStyleVariations","hiddenBlockTypes","blockTypes","keepCaretInsideBlock","isTemplateMode","template","select","_getPostType$viewable","isFeatureActive","isEditingTemplate","getEditedPostTemplate","getHiddenBlockTypes","getEntityRecord","getPostType","getEntityRecords","canUser","getEditorSettings","getBlockTypes","isTemplate","includes","postObject","posts","wp_id","supportsTemplateMode","isViewable","viewable","canEditTemplate","get","updatePreferredStyleVariations","setIsInserterOpened","editorSettings","result","__experimentalPreferredStyleVariations","value","onChange","__experimentalSetIsInserterOpened","defaultAllowedBlockTypes","allowedBlockTypes","length","map","name","filter","type","createElement","useSubRegistry","__unstableTemplate","undefined"],"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';\n\nconst { ExperimentalEditorProvider } = unlock( editorPrivateApis );\n\nfunction Editor( { postId, postType, settings, initialEdits, ...props } ) {\n\tconst {\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\tisDistractionFree,\n\t\thasInlineToolbar,\n\t\tpost,\n\t\tpreferredStyleVariations,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tkeepCaretInsideBlock,\n\t\tisTemplateMode,\n\t\ttemplate,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisFeatureActive,\n\t\t\t\tisEditingTemplate,\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\tpostType\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( 'postType', postType, {\n\t\t\t\t\twp_id: postId,\n\t\t\t\t} );\n\t\t\t\tpostObject = posts?.[ 0 ];\n\t\t\t} else {\n\t\t\t\tpostObject = getEntityRecord( 'postType', postType, postId );\n\t\t\t}\n\t\t\tconst supportsTemplateMode =\n\t\t\t\tgetEditorSettings().supportsTemplateMode;\n\t\t\tconst isViewable = getPostType( postType )?.viewable ?? false;\n\t\t\tconst canEditTemplate = canUser( 'create', 'templates' );\n\n\t\t\treturn {\n\t\t\t\thasFixedToolbar: isFeatureActive( 'fixedToolbar' ),\n\t\t\t\tfocusMode: isFeatureActive( 'focusMode' ),\n\t\t\t\tisDistractionFree: isFeatureActive( 'distractionFree' ),\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\tkeepCaretInsideBlock: isFeatureActive( 'keepCaretInsideBlock' ),\n\t\t\t\tisTemplateMode: isEditingTemplate(),\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[ postType, postId ]\n\t);\n\n\tconst { updatePreferredStyleVariations, setIsInserterOpened } =\n\t\tuseDispatch( editPostStore );\n\n\tconst editorSettings = useMemo( () => {\n\t\tconst result = {\n\t\t\t...settings,\n\t\t\t__experimentalPreferredStyleVariations: {\n\t\t\t\tvalue: preferredStyleVariations,\n\t\t\t\tonChange: updatePreferredStyleVariations,\n\t\t\t},\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\tisDistractionFree,\n\t\t\thasInlineToolbar,\n\n\t\t\t// This is marked as experimental to give time for the quick inserter to mature.\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tkeepCaretInsideBlock,\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\thasFixedToolbar,\n\t\thasInlineToolbar,\n\t\tfocusMode,\n\t\tisDistractionFree,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tpreferredStyleVariations,\n\t\tsetIsInserterOpened,\n\t\tupdatePreferredStyleVariations,\n\t\tkeepCaretInsideBlock,\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={ isTemplateMode ? template : undefined }\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={ postId } />\n\t\t\t\t\t<Layout />\n\t\t\t\t</ErrorBoundary>\n\t\t\t\t<PostLockedModal />\n\t\t\t</Experim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AmB,EACnBD,8BAA8B,EAC9BzB,oBAAoB,CACnB,CAAC;EAEH,IAAK,CAAEJ,IAAI,EAAG;IACb,OAAO,IAAI;EACZ;EAEA,OACC4C,aAAA,CAAC/D,gBAAgB,QAChB+D,aAAA,CAACvD,0BAA0B;IAC1BI,QAAQ,EAAGsC,cAAgB;IAC3B/B,IAAI,EAAGA,IAAM;IACbN,YAAY,EAAGA,YAAc;IAC7BmD,cAAc,EAAG,KAAO;IACxBC,kBAAkB,EAAGzC,cAAc,GAAGC,QAAQ,GAAGyC,SAAW;IAAA,GACvDpD;EAAK,GAEViD,aAAA,CAACrE,aAAa,QACbqE,aAAA,CAAC5D,WAAW,MAAE,CAAC,EACf4D,aAAA,CAAC1D,oBAAoB;IAACK,MAAM,EAAGA;EAAQ,CAAE,CAAC,EAC1CqD,aAAA,CAAC3D,MAAM,MAAE,CACK,CAAC,EAChB2D,aAAA,CAACpE,eAAe,MAAE,CACS,CACX,CAAC;AAErB;AAEA,eAAec,MAAM"}
@@ -160,5 +160,6 @@ export { default as PluginSidebar } from './components/sidebar/plugin-sidebar';
160
160
  export { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';
161
161
  export { default as __experimentalFullscreenModeClose } from './components/header/fullscreen-mode-close';
162
162
  export { default as __experimentalMainDashboardButton } from './components/header/main-dashboard-button';
163
+ export { default as __experimentalPluginPostExcerpt } from './components/sidebar/plugin-post-excerpt';
163
164
  export { store } from './store';
164
165
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["store","blocksStore","registerCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","deprecated","createRoot","dispatch","select","addFilter","preferencesStore","registerLegacyWidgetBlock","registerWidgetGroupBlock","Editor","editPostStore","initializeEditor","id","postType","postId","settings","initialEdits","target","document","getElementById","root","setDefaults","editorMode","fixedToolbar","fullscreenMode","hiddenBlockTypes","inactivePanels","isPublishSidebarEnabled","openPanels","preferredStyleVariations","showBlockBreadcrumbs","showIconLabels","showListViewByDefault","themeStyles","welcomeGuide","welcomeGuideTemplate","reapplyBlockTypeFilters","isFeatureActive","setIsListViewOpened","inserter","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","__unstableEnableFullSiteEditingBlocks","canInsert","blockType","isEditingTemplate","name","rootClientId","getBlockParentsByBlockName","length","documentMode","compatMode","console","warn","isIphone","window","navigator","userAgent","indexOf","addEventListener","event","editorScrollContainer","getElementsByClassName","scrollY","scrollTop","scrollTo","e","preventDefault","render","createElement","reinitializeEditor","since","version","default","PluginBlockSettingsMenuItem","PluginDocumentSettingPanel","PluginMoreMenuItem","PluginPostPublishPanel","PluginPostStatusInfo","PluginPrePublishPanel","PluginSidebar","PluginSidebarMoreMenuItem","__experimentalFullscreenModeClose","__experimentalMainDashboardButton"],"sources":["@wordpress/edit-post/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport { dispatch, select } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport './plugins';\nimport Editor from './editor';\nimport { store as editPostStore } from './store';\n\n/**\n * Initializes and returns an instance of Editor.\n *\n * @param {string} id Unique identifier for editor instance.\n * @param {string} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit.\n * @param {?Object} settings Editor settings object.\n * @param {Object} initialEdits Programmatic edits to apply initially, to be\n * considered as non-user-initiated (bypass for\n * unsaved changes prompt).\n */\nexport function initializeEditor(\n\tid,\n\tpostType,\n\tpostId,\n\tsettings,\n\tinitialEdits\n) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-post', {\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfullscreenMode: true,\n\t\thiddenBlockTypes: [],\n\t\tinactivePanels: [],\n\t\tisPublishSidebarEnabled: true,\n\t\topenPanels: [ 'post-status' ],\n\t\tpreferredStyleVariations: {},\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowIconLabels: false,\n\t\tshowListViewByDefault: false,\n\t\tthemeStyles: true,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\n\t// Check if the block list view should be open by default.\n\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\tif (\n\t\tselect( editPostStore ).isFeatureActive( 'showListViewByDefault' ) &&\n\t\t! select( editPostStore ).isFeatureActive( 'distractionFree' )\n\t) {\n\t\tdispatch( editPostStore ).setIsListViewOpened( true );\n\t}\n\n\tregisterCoreBlocks();\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks,\n\t\t} );\n\t}\n\n\t/*\n\t * Prevent adding template part in the post editor.\n\t * Only add the filter when the post editor is initialized, not imported.\n\t * Also only add the filter(s) after registerCoreBlocks()\n\t * so that common filters in the block library are not overwritten.\n\t */\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'removeTemplatePartsFromInserter',\n\t\t( canInsert, blockType ) => {\n\t\t\tif (\n\t\t\t\t! select( editPostStore ).isEditingTemplate() &&\n\t\t\t\tblockType.name === 'core/template-part'\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn canInsert;\n\t\t}\n\t);\n\n\t/*\n\t * Prevent adding post content block (except in query block) in the post editor.\n\t * Only add the filter when the post editor is initialized, not imported.\n\t * Also only add the filter(s) after registerCoreBlocks()\n\t * so that common filters in the block library are not overwritten.\n\t */\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'removePostContentFromInserter',\n\t\t(\n\t\t\tcanInsert,\n\t\t\tblockType,\n\t\t\trootClientId,\n\t\t\t{ getBlockParentsByBlockName }\n\t\t) => {\n\t\t\tif (\n\t\t\t\t! select( editPostStore ).isEditingTemplate() &&\n\t\t\t\tblockType.name === 'core/post-content'\n\t\t\t) {\n\t\t\t\treturn (\n\t\t\t\t\tgetBlockParentsByBlockName( rootClientId, 'core/query' )\n\t\t\t\t\t\t.length > 0\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn canInsert;\n\t\t}\n\t);\n\n\t// Show a console log warning if the browser is not in Standards rendering mode.\n\tconst documentMode =\n\t\tdocument.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';\n\tif ( documentMode !== 'Standards' ) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t\"Your browser is using Quirks Mode. \\nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins.\"\n\t\t);\n\t}\n\n\t// This is a temporary fix for a couple of issues specific to Webkit on iOS.\n\t// Without this hack the browser scrolls the mobile toolbar off-screen.\n\t// Once supported in Safari we can replace this in favor of preventScroll.\n\t// For details see issue #18632 and PR #18686\n\t// Specifically, we scroll `interface-interface-skeleton__body` to enable a fixed top toolbar.\n\t// But Mobile Safari forces the `html` element to scroll upwards, hiding the toolbar.\n\n\tconst isIphone = window.navigator.userAgent.indexOf( 'iPhone' ) !== -1;\n\tif ( isIphone ) {\n\t\twindow.addEventListener( 'scroll', ( event ) => {\n\t\t\tconst editorScrollContainer = document.getElementsByClassName(\n\t\t\t\t'interface-interface-skeleton__body'\n\t\t\t)[ 0 ];\n\t\t\tif ( event.target === document ) {\n\t\t\t\t// Scroll element into view by scrolling the editor container by the same amount\n\t\t\t\t// that Mobile Safari tried to scroll the html element upwards.\n\t\t\t\tif ( window.scrollY > 100 ) {\n\t\t\t\t\teditorScrollContainer.scrollTop =\n\t\t\t\t\t\teditorScrollContainer.scrollTop + window.scrollY;\n\t\t\t\t}\n\t\t\t\t// Undo unwanted scroll on html element, but only in the visual editor.\n\t\t\t\tif (\n\t\t\t\t\tdocument.getElementsByClassName( 'is-mode-visual' )[ 0 ]\n\t\t\t\t) {\n\t\t\t\t\twindow.scrollTo( 0, 0 );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t}\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(\n\t\t<Editor\n\t\t\tsettings={ settings }\n\t\t\tpostId={ postId }\n\t\t\tpostType={ postType }\n\t\t\tinitialEdits={ initialEdits }\n\t\t/>\n\t);\n\n\treturn root;\n}\n\n/**\n * Used to reinitialize the editor after an error. Now it's a deprecated noop function.\n */\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editPost.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginBlockSettingsMenuItem } from './components/block-settings-menu/plugin-block-settings-menu-item';\nexport { default as PluginDocumentSettingPanel } from './components/sidebar/plugin-document-setting-panel';\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\nexport { default as PluginPostPublishPanel } from './components/sidebar/plugin-post-publish-panel';\nexport { default as PluginPostStatusInfo } from './components/sidebar/plugin-post-status-info';\nexport { default as PluginPrePublishPanel } from './components/sidebar/plugin-pre-publish-panel';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as __experimentalFullscreenModeClose } from './components/header/fullscreen-mode-close';\nexport { default as __experimentalMainDashboardButton } from './components/header/main-dashboard-button';\nexport { store } from './store';\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SACCC,kBAAkB,EAClBC,4CAA4C,QACtC,0BAA0B;AACjC,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,QAAQ,EAAEC,MAAM,QAAQ,iBAAiB;AAClD,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASR,KAAK,IAAIS,gBAAgB,QAAQ,wBAAwB;AAClE,SACCC,yBAAyB,EACzBC,wBAAwB,QAClB,oBAAoB;;AAE3B;AACA;AACA;AACA,OAAO,SAAS;AAChB,OAAO,WAAW;AAClB,OAAOC,MAAM,MAAM,UAAU;AAC7B,SAASZ,KAAK,IAAIa,aAAa,QAAQ,SAAS;;AAEhD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAC/BC,EAAE,EACFC,QAAQ,EACRC,MAAM,EACNC,QAAQ,EACRC,YAAY,EACX;EACD,MAAMC,MAAM,GAAGC,QAAQ,CAACC,cAAc,CAAEP,EAAG,CAAC;EAC5C,MAAMQ,IAAI,GAAGlB,UAAU,CAAEe,MAAO,CAAC;EAEjCd,QAAQ,CAAEG,gBAAiB,CAAC,CAACe,WAAW,CAAE,gBAAgB,EAAE;IAC3DC,UAAU,EAAE,QAAQ;IACpBC,YAAY,EAAE,KAAK;IACnBC,cAAc,EAAE,IAAI;IACpBC,gBAAgB,EAAE,EAAE;IACpBC,cAAc,EAAE,EAAE;IAClBC,uBAAuB,EAAE,IAAI;IAC7BC,UAAU,EAAE,CAAE,aAAa,CAAE;IAC7BC,wBAAwB,EAAE,CAAC,CAAC;IAC5BC,oBAAoB,EAAE,IAAI;IAC1BC,c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C,CAACC,cAAc,CAAC,CAAC,EAAE,KAAM,CAAC;EAErEjD,IAAI,CAACkD,MAAM,CACVC,aAAA,CAAC9D,MAAM;IACNM,QAAQ,EAAGA,QAAU;IACrBD,MAAM,EAAGA,MAAQ;IACjBD,QAAQ,EAAGA,QAAU;IACrBG,YAAY,EAAGA;EAAc,CAC7B,CACF,CAAC;EAED,OAAOI,IAAI;AACZ;;AAEA;AACA;AACA;AACA,OAAO,SAASoD,kBAAkBA,CAAA,EAAG;EACpCvE,UAAU,CAAE,gCAAgC,EAAE;IAC7CwE,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;AAEA,SAASC,OAAO,IAAIC,2BAA2B,QAAQ,kEAAkE;AACzH,SAASD,OAAO,IAAIE,0BAA0B,QAAQ,oDAAoD;AAC1G,SAASF,OAAO,IAAIG,kBAAkB,QAAQ,2CAA2C;AACzF,SAASH,OAAO,IAAII,sBAAsB,QAAQ,gDAAgD;AAClG,SAASJ,OAAO,IAAIK,oBAAoB,QAAQ,8CAA8C;AAC9F,SAASL,OAAO,IAAIM,qBAAqB,QAAQ,+CAA+C;AAChG,SAASN,OAAO,IAAIO,aAAa,QAAQ,qCAAqC;AAC9E,SAASP,OAAO,IAAIQ,yBAAyB,QAAQ,mDAAmD;AACxG,SAASR,OAAO,IAAIS,iCAAiC,QAAQ,2CAA2C;AACxG,SAAST,OAAO,IAAIU,iCAAiC,QAAQ,2CAA2C;AACxG,SAASxF,KAAK,QAAQ,SAAS"}
1
+ {"version":3,"names":["store","blocksStore","registerCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","deprecated","createRoot","dispatch","select","addFilter","preferencesStore","registerLegacyWidgetBlock","registerWidgetGroupBlock","Editor","editPostStore","initializeEditor","id","postType","postId","settings","initialEdits","target","document","getElementById","root","setDefaults","editorMode","fixedToolbar","fullscreenMode","hiddenBlockTypes","inactivePanels","isPublishSidebarEnabled","openPanels","preferredStyleVariations","showBlockBreadcrumbs","showIconLabels","showListViewByDefault","themeStyles","welcomeGuide","welcomeGuideTemplate","reapplyBlockTypeFilters","isFeatureActive","setIsListViewOpened","inserter","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","__unstableEnableFullSiteEditingBlocks","canInsert","blockType","isEditingTemplate","name","rootClientId","getBlockParentsByBlockName","length","documentMode","compatMode","console","warn","isIphone","window","navigator","userAgent","indexOf","addEventListener","event","editorScrollContainer","getElementsByClassName","scrollY","scrollTop","scrollTo","e","preventDefault","render","createElement","reinitializeEditor","since","version","default","PluginBlockSettingsMenuItem","PluginDocumentSettingPanel","PluginMoreMenuItem","PluginPostPublishPanel","PluginPostStatusInfo","PluginPrePublishPanel","PluginSidebar","PluginSidebarMoreMenuItem","__experimentalFullscreenModeClose","__experimentalMainDashboardButton","__experimentalPluginPostExcerpt"],"sources":["@wordpress/edit-post/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport { dispatch, select } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport './plugins';\nimport Editor from './editor';\nimport { store as editPostStore } from './store';\n\n/**\n * Initializes and returns an instance of Editor.\n *\n * @param {string} id Unique identifier for editor instance.\n * @param {string} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit.\n * @param {?Object} settings Editor settings object.\n * @param {Object} initialEdits Programmatic edits to apply initially, to be\n * considered as non-user-initiated (bypass for\n * unsaved changes prompt).\n */\nexport function initializeEditor(\n\tid,\n\tpostType,\n\tpostId,\n\tsettings,\n\tinitialEdits\n) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-post', {\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfullscreenMode: true,\n\t\thiddenBlockTypes: [],\n\t\tinactivePanels: [],\n\t\tisPublishSidebarEnabled: true,\n\t\topenPanels: [ 'post-status' ],\n\t\tpreferredStyleVariations: {},\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowIconLabels: false,\n\t\tshowListViewByDefault: false,\n\t\tthemeStyles: true,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\n\t// Check if the block list view should be open by default.\n\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\tif (\n\t\tselect( editPostStore ).isFeatureActive( 'showListViewByDefault' ) &&\n\t\t! select( editPostStore ).isFeatureActive( 'distractionFree' )\n\t) {\n\t\tdispatch( editPostStore ).setIsListViewOpened( true );\n\t}\n\n\tregisterCoreBlocks();\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks,\n\t\t} );\n\t}\n\n\t/*\n\t * Prevent adding template part in the post editor.\n\t * Only add the filter when the post editor is initialized, not imported.\n\t * Also only add the filter(s) after registerCoreBlocks()\n\t * so that common filters in the block library are not overwritten.\n\t */\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'removeTemplatePartsFromInserter',\n\t\t( canInsert, blockType ) => {\n\t\t\tif (\n\t\t\t\t! select( editPostStore ).isEditingTemplate() &&\n\t\t\t\tblockType.name === 'core/template-part'\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn canInsert;\n\t\t}\n\t);\n\n\t/*\n\t * Prevent adding post content block (except in query block) in the post editor.\n\t * Only add the filter when the post editor is initialized, not imported.\n\t * Also only add the filter(s) after registerCoreBlocks()\n\t * so that common filters in the block library are not overwritten.\n\t */\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'removePostContentFromInserter',\n\t\t(\n\t\t\tcanInsert,\n\t\t\tblockType,\n\t\t\trootClientId,\n\t\t\t{ getBlockParentsByBlockName }\n\t\t) => {\n\t\t\tif (\n\t\t\t\t! select( editPostStore ).isEditingTemplate() &&\n\t\t\t\tblockType.name === 'core/post-content'\n\t\t\t) {\n\t\t\t\treturn (\n\t\t\t\t\tgetBlockParentsByBlockName( rootClientId, 'core/query' )\n\t\t\t\t\t\t.length > 0\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn canInsert;\n\t\t}\n\t);\n\n\t// Show a console log warning if the browser is not in Standards rendering mode.\n\tconst documentMode =\n\t\tdocument.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';\n\tif ( documentMode !== 'Standards' ) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t\"Your browser is using Quirks Mode. \\nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins.\"\n\t\t);\n\t}\n\n\t// This is a temporary fix for a couple of issues specific to Webkit on iOS.\n\t// Without this hack the browser scrolls the mobile toolbar off-screen.\n\t// Once supported in Safari we can replace this in favor of preventScroll.\n\t// For details see issue #18632 and PR #18686\n\t// Specifically, we scroll `interface-interface-skeleton__body` to enable a fixed top toolbar.\n\t// But Mobile Safari forces the `html` element to scroll upwards, hiding the toolbar.\n\n\tconst isIphone = window.navigator.userAgent.indexOf( 'iPhone' ) !== -1;\n\tif ( isIphone ) {\n\t\twindow.addEventListener( 'scroll', ( event ) => {\n\t\t\tconst editorScrollContainer = document.getElementsByClassName(\n\t\t\t\t'interface-interface-skeleton__body'\n\t\t\t)[ 0 ];\n\t\t\tif ( event.target === document ) {\n\t\t\t\t// Scroll element into view by scrolling the editor container by the same amount\n\t\t\t\t// that Mobile Safari tried to scroll the html element upwards.\n\t\t\t\tif ( window.scrollY > 100 ) {\n\t\t\t\t\teditorScrollContainer.scrollTop =\n\t\t\t\t\t\teditorScrollContainer.scrollTop + window.scrollY;\n\t\t\t\t}\n\t\t\t\t// Undo unwanted scroll on html element, but only in the visual editor.\n\t\t\t\tif (\n\t\t\t\t\tdocument.getElementsByClassName( 'is-mode-visual' )[ 0 ]\n\t\t\t\t) {\n\t\t\t\t\twindow.scrollTo( 0, 0 );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t}\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(\n\t\t<Editor\n\t\t\tsettings={ settings }\n\t\t\tpostId={ postId }\n\t\t\tpostType={ postType }\n\t\t\tinitialEdits={ initialEdits }\n\t\t/>\n\t);\n\n\treturn root;\n}\n\n/**\n * Used to reinitialize the editor after an error. Now it's a deprecated noop function.\n */\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editPost.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginBlockSettingsMenuItem } from './components/block-settings-menu/plugin-block-settings-menu-item';\nexport { default as PluginDocumentSettingPanel } from './components/sidebar/plugin-document-setting-panel';\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\nexport { default as PluginPostPublishPanel } from './components/sidebar/plugin-post-publish-panel';\nexport { default as PluginPostStatusInfo } from './components/sidebar/plugin-post-status-info';\nexport { default as PluginPrePublishPanel } from './components/sidebar/plugin-pre-publish-panel';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as __experimentalFullscreenModeClose } from './components/header/fullscreen-mode-close';\nexport { default as __experimentalMainDashboardButton } from './components/header/main-dashboard-button';\nexport { default as __experimentalPluginPostExcerpt } from './components/sidebar/plugin-post-excerpt';\nexport { store } from './store';\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SACCC,kBAAkB,EAClBC,4CAA4C,QACtC,0BAA0B;AACjC,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,QAAQ,EAAEC,MAAM,QAAQ,iBAAiB;AAClD,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASR,KAAK,IAAIS,gBAAgB,QAAQ,wBAAwB;AAClE,SACCC,yBAAyB,EACzBC,wBAAwB,QAClB,oBAAoB;;AAE3B;AACA;AACA;AACA,OAAO,SAAS;AAChB,OAAO,WAAW;AAClB,OAAOC,MAAM,MAAM,UAAU;AAC7B,SAASZ,KAAK,IAAIa,aAAa,QAAQ,SAAS;;AAEhD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAC/BC,EAAE,EACFC,QAAQ,EACRC,MAAM,EACNC,QAAQ,EACRC,YAAY,EACX;EACD,MAAMC,MAAM,GAAGC,QAAQ,CAACC,cAAc,CAAEP,EAAG,CAAC;EAC5C,MAAMQ,IAAI,GAAGlB,UAAU,CAAEe,MAAO,CAAC;EAEjCd,QAAQ,CAAEG,gBAAiB,CAAC,CAACe,WAAW,CAAE,gBAAgB,EAAE;IAC3DC,UAAU,EAAE,QAAQ;IACpBC,YAAY,EAAE,KAAK;IACnBC,cAAc,EAAE,IAAI;IACpBC,gBAAgB,EAAE,EAAE;IACpBC,cAAc,EAAE,EAAE;IAClBC,uBAAuB,EAAE,IAAI;IAC7BC,UAAU,EAAE,CAAE,aAAa,CAAE;IAC7BC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;EACzEZ,MAAM,CAACI,gBAAgB,CAAE,MAAM,EAAIO,CAAC,IAAMA,CAAC,CAACC,cAAc,CAAC,CAAC,EAAE,KAAM,CAAC;EAErEjD,IAAI,CAACkD,MAAM,CACVC,aAAA,CAAC9D,MAAM;IACNM,QAAQ,EAAGA,QAAU;IACrBD,MAAM,EAAGA,MAAQ;IACjBD,QAAQ,EAAGA,QAAU;IACrBG,YAAY,EAAGA;EAAc,CAC7B,CACF,CAAC;EAED,OAAOI,IAAI;AACZ;;AAEA;AACA;AACA;AACA,OAAO,SAASoD,kBAAkBA,CAAA,EAAG;EACpCvE,UAAU,CAAE,gCAAgC,EAAE;IAC7CwE,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;AAEA,SAASC,OAAO,IAAIC,2BAA2B,QAAQ,kEAAkE;AACzH,SAASD,OAAO,IAAIE,0BAA0B,QAAQ,oDAAoD;AAC1G,SAASF,OAAO,IAAIG,kBAAkB,QAAQ,2CAA2C;AACzF,SAASH,OAAO,IAAII,sBAAsB,QAAQ,gDAAgD;AAClG,SAASJ,OAAO,IAAIK,oBAAoB,QAAQ,8CAA8C;AAC9F,SAASL,OAAO,IAAIM,qBAAqB,QAAQ,+CAA+C;AAChG,SAASN,OAAO,IAAIO,aAAa,QAAQ,qCAAqC;AAC9E,SAASP,OAAO,IAAIQ,yBAAyB,QAAQ,mDAAmD;AACxG,SAASR,OAAO,IAAIS,iCAAiC,QAAQ,2CAA2C;AACxG,SAAST,OAAO,IAAIU,iCAAiC,QAAQ,2CAA2C;AACxG,SAASV,OAAO,IAAIW,+BAA+B,QAAQ,0CAA0C;AACrG,SAASzF,KAAK,QAAQ,SAAS"}
@@ -5,5 +5,5 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/pri
5
5
  export const {
6
6
  lock,
7
7
  unlock
8
- } = __dangerousOptInToUnstableAPIsOnlyForCoreModules('I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.', '@wordpress/edit-post');
8
+ } = __dangerousOptInToUnstableAPIsOnlyForCoreModules('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/edit-post');
9
9
  //# sourceMappingURL=lock-unlock.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__dangerousOptInToUnstableAPIsOnlyForCoreModules","lock","unlock"],"sources":["@wordpress/edit-post/src/lock-unlock.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',\n\t\t'@wordpress/edit-post'\n\t);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gDAAgD,QAAQ,yBAAyB;AAE1F,OAAO,MAAM;EAAEC,IAAI;EAAEC;AAAO,CAAC,GAC5BF,gDAAgD,CAC/C,8GAA8G,EAC9G,sBACD,CAAC"}
1
+ {"version":3,"names":["__dangerousOptInToUnstableAPIsOnlyForCoreModules","lock","unlock"],"sources":["@wordpress/edit-post/src/lock-unlock.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',\n\t\t'@wordpress/edit-post'\n\t);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gDAAgD,QAAQ,yBAAyB;AAE1F,OAAO,MAAM;EAAEC,IAAI;EAAEC;AAAO,CAAC,GAC5BF,gDAAgD,CAC/C,iHAAiH,EACjH,sBACD,CAAC"}
@@ -879,7 +879,6 @@ body.is-fullscreen-mode .interface-interface-skeleton {
879
879
  .edit-post-header-toolbar {
880
880
  display: inline-flex;
881
881
  align-items: center;
882
- border: none;
883
882
  }
884
883
  .edit-post-header-toolbar .edit-post-header-toolbar__left > .components-button {
885
884
  display: none;
@@ -879,7 +879,6 @@ body.is-fullscreen-mode .interface-interface-skeleton {
879
879
  .edit-post-header-toolbar {
880
880
  display: inline-flex;
881
881
  align-items: center;
882
- border: none;
883
882
  }
884
883
  .edit-post-header-toolbar .edit-post-header-toolbar__left > .components-button {
885
884
  display: none;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-post",
3
- "version": "7.20.0",
3
+ "version": "7.21.0",
4
4
  "description": "Edit Post module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -27,36 +27,36 @@
27
27
  "react-native": "src/index",
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.0",
30
- "@wordpress/a11y": "^3.43.0",
31
- "@wordpress/api-fetch": "^6.40.0",
32
- "@wordpress/block-editor": "^12.11.0",
33
- "@wordpress/block-library": "^8.20.0",
34
- "@wordpress/blocks": "^12.20.0",
35
- "@wordpress/commands": "^0.14.0",
36
- "@wordpress/components": "^25.9.0",
37
- "@wordpress/compose": "^6.20.0",
38
- "@wordpress/core-commands": "^0.12.0",
39
- "@wordpress/core-data": "^6.20.0",
40
- "@wordpress/data": "^9.13.0",
41
- "@wordpress/deprecated": "^3.43.0",
42
- "@wordpress/dom": "^3.43.0",
43
- "@wordpress/editor": "^13.20.0",
44
- "@wordpress/element": "^5.20.0",
45
- "@wordpress/hooks": "^3.43.0",
46
- "@wordpress/i18n": "^4.43.0",
47
- "@wordpress/icons": "^9.34.0",
48
- "@wordpress/interface": "^5.20.0",
49
- "@wordpress/keyboard-shortcuts": "^4.20.0",
50
- "@wordpress/keycodes": "^3.43.0",
51
- "@wordpress/media-utils": "^4.34.0",
52
- "@wordpress/notices": "^4.11.0",
53
- "@wordpress/plugins": "^6.11.0",
54
- "@wordpress/preferences": "^3.20.0",
55
- "@wordpress/private-apis": "^0.25.0",
56
- "@wordpress/url": "^3.44.0",
57
- "@wordpress/viewport": "^5.20.0",
58
- "@wordpress/warning": "^2.43.0",
59
- "@wordpress/widgets": "^3.20.0",
30
+ "@wordpress/a11y": "^3.44.0",
31
+ "@wordpress/api-fetch": "^6.41.0",
32
+ "@wordpress/block-editor": "^12.12.0",
33
+ "@wordpress/block-library": "^8.21.0",
34
+ "@wordpress/blocks": "^12.21.0",
35
+ "@wordpress/commands": "^0.15.0",
36
+ "@wordpress/components": "^25.10.0",
37
+ "@wordpress/compose": "^6.21.0",
38
+ "@wordpress/core-commands": "^0.13.0",
39
+ "@wordpress/core-data": "^6.21.0",
40
+ "@wordpress/data": "^9.14.0",
41
+ "@wordpress/deprecated": "^3.44.0",
42
+ "@wordpress/dom": "^3.44.0",
43
+ "@wordpress/editor": "^13.21.0",
44
+ "@wordpress/element": "^5.21.0",
45
+ "@wordpress/hooks": "^3.44.0",
46
+ "@wordpress/i18n": "^4.44.0",
47
+ "@wordpress/icons": "^9.35.0",
48
+ "@wordpress/interface": "^5.21.0",
49
+ "@wordpress/keyboard-shortcuts": "^4.21.0",
50
+ "@wordpress/keycodes": "^3.44.0",
51
+ "@wordpress/media-utils": "^4.35.0",
52
+ "@wordpress/notices": "^4.12.0",
53
+ "@wordpress/plugins": "^6.12.0",
54
+ "@wordpress/preferences": "^3.21.0",
55
+ "@wordpress/private-apis": "^0.26.0",
56
+ "@wordpress/url": "^3.45.0",
57
+ "@wordpress/viewport": "^5.21.0",
58
+ "@wordpress/warning": "^2.44.0",
59
+ "@wordpress/widgets": "^3.21.0",
60
60
  "classnames": "^2.3.1",
61
61
  "memize": "^2.1.0",
62
62
  "rememo": "^4.0.2"
@@ -68,5 +68,5 @@
68
68
  "publishConfig": {
69
69
  "access": "public"
70
70
  },
71
- "gitHead": "9b8e598c5418d38fe72197c24ef1d3dd6c712151"
71
+ "gitHead": "f83bb1a71e8fa416131b81a9f282a72a1dc6c694"
72
72
  }
@@ -136,6 +136,7 @@ function HeaderToolbar( { setListViewToggleElement } ) {
136
136
  className="edit-post-header-toolbar"
137
137
  aria-label={ toolbarAriaLabel }
138
138
  shouldUseKeyboardFocusShortcut={ ! blockToolbarCanBeFocused }
139
+ variant="unstyled"
139
140
  >
140
141
  <div className="edit-post-header-toolbar__left">
141
142
  <ToolbarItem
@@ -1,7 +1,6 @@
1
1
  .edit-post-header-toolbar {
2
2
  display: inline-flex;
3
3
  align-items: center;
4
- border: none;
5
4
 
6
5
  // Hide all action buttons except the inserter on mobile.
7
6
  .edit-post-header-toolbar__left > .components-button {
@@ -22,6 +22,7 @@ import {
22
22
  useBlockCommands,
23
23
  BlockBreadcrumb,
24
24
  privateApis as blockEditorPrivateApis,
25
+ store as blockEditorStore,
25
26
  } from '@wordpress/block-editor';
26
27
  import { Button, ScrollLock } from '@wordpress/components';
27
28
  import { useViewportMatch } from '@wordpress/compose';
@@ -37,6 +38,12 @@ import { useState, useEffect, useCallback, useMemo } from '@wordpress/element';
37
38
  import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
38
39
  import { store as noticesStore } from '@wordpress/notices';
39
40
 
41
+ import { privateApis as commandsPrivateApis } from '@wordpress/commands';
42
+ import { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';
43
+
44
+ const { useCommands } = unlock( coreCommandsPrivateApis );
45
+ const { useCommandContext } = unlock( commandsPrivateApis );
46
+
40
47
  /**
41
48
  * Internal dependencies
42
49
  */
@@ -56,6 +63,7 @@ import ActionsPanel from './actions-panel';
56
63
  import StartPageOptions from '../start-page-options';
57
64
  import { store as editPostStore } from '../../store';
58
65
  import { unlock } from '../../lock-unlock';
66
+ import useCommonCommands from '../../hooks/commands/use-common-commands';
59
67
 
60
68
  const { getLayoutStyles } = unlock( blockEditorPrivateApis );
61
69
 
@@ -124,7 +132,10 @@ function useEditorStyles() {
124
132
  }
125
133
 
126
134
  function Layout() {
135
+ useCommands();
136
+ useCommonCommands();
127
137
  useBlockCommands();
138
+
128
139
  const isMobileViewport = useViewportMatch( 'medium', '<' );
129
140
  const isHugeViewport = useViewportMatch( 'huge', '>=' );
130
141
  const isLargeViewport = useViewportMatch( 'large' );
@@ -184,9 +195,17 @@ function Layout() {
184
195
  ),
185
196
  // translators: Default label for the Document in the Block Breadcrumb.
186
197
  documentLabel: postTypeLabel || _x( 'Document', 'noun' ),
198
+ hasBlockSelected:
199
+ select( blockEditorStore ).getBlockSelectionStart(),
187
200
  };
188
201
  }, [] );
189
202
 
203
+ // Set the right context for the command palette
204
+ const commandContext = hasBlockSelected
205
+ ? 'block-selection-edit'
206
+ : 'post-editor-edit';
207
+ useCommandContext( commandContext );
208
+
190
209
  const styles = useEditorStyles();
191
210
 
192
211
  const openSidebarPanel = () =>
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Defines as extensibility slot for the Excerpt panel.
3
+ */
4
+
5
+ /**
6
+ * WordPress dependencies
7
+ */
8
+ import { createSlotFill, PanelRow } from '@wordpress/components';
9
+
10
+ const { Fill, Slot } = createSlotFill( 'PluginPostExcerpt' );
11
+
12
+ /**
13
+ * Renders a post excerpt panel in the post sidebar.
14
+ *
15
+ * @param {Object} props Component properties.
16
+ * @param {string} [props.className] An optional class name added to the row.
17
+ * @param {Element} props.children Children to be rendered.
18
+ *
19
+ * @example
20
+ * ```js
21
+ * // Using ES5 syntax
22
+ * var __ = wp.i18n.__;
23
+ * var PluginPostExcerpt = wp.editPost.PluginPostExcerpt;
24
+ *
25
+ * function MyPluginPostExcerpt() {
26
+ * return React.createElement(
27
+ * PluginPostExcerpt,
28
+ * {
29
+ * className: 'my-plugin-post-excerpt',
30
+ * },
31
+ * __( 'Post excerpt custom content' )
32
+ * )
33
+ * }
34
+ * ```
35
+ *
36
+ * @example
37
+ * ```jsx
38
+ * // Using ESNext syntax
39
+ * import { __ } from '@wordpress/i18n';
40
+ * import { PluginPostExcerpt } from '@wordpress/edit-post';
41
+ *
42
+ * const MyPluginPostExcerpt = () => (
43
+ * <PluginPostExcerpt className="my-plugin-post-excerpt">
44
+ * { __( 'Post excerpt custom content' ) }
45
+ * </PluginPostExcerpt>
46
+ * );
47
+ * ```
48
+ *
49
+ * @return {Component} The component to be rendered.
50
+ */
51
+ const PluginPostExcerpt = ( { children, className } ) => {
52
+ return (
53
+ <Fill>
54
+ <PanelRow className={ className }>{ children }</PanelRow>
55
+ </Fill>
56
+ );
57
+ };
58
+
59
+ PluginPostExcerpt.Slot = Slot;
60
+
61
+ export default PluginPostExcerpt;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { render, screen } from '@testing-library/react';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { SlotFillProvider } from '@wordpress/components';
10
+
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+ import PluginPostExcerptPanel from '../';
15
+
16
+ describe( 'PluginPostExcerptPanel', () => {
17
+ test( 'renders fill properly', () => {
18
+ render(
19
+ <SlotFillProvider>
20
+ <PluginPostExcerptPanel className="my-plugin-post-excerpt-custom-content">
21
+ Post Excerpt - Custom content
22
+ </PluginPostExcerptPanel>
23
+ <div role="tabpanel">
24
+ <PluginPostExcerptPanel.Slot />
25
+ </div>
26
+ </SlotFillProvider>
27
+ );
28
+
29
+ expect( screen.getByRole( 'tabpanel' ) ).toHaveTextContent(
30
+ 'Post Excerpt - Custom content'
31
+ );
32
+ expect(
33
+ screen.getByText( 'Post Excerpt - Custom content' )
34
+ ).toHaveClass( 'my-plugin-post-excerpt-custom-content' );
35
+ } );
36
+ } );
@@ -7,20 +7,33 @@ import {
7
7
  PostExcerpt as PostExcerptForm,
8
8
  PostExcerptCheck,
9
9
  } from '@wordpress/editor';
10
- import { compose } from '@wordpress/compose';
11
- import { withSelect, withDispatch } from '@wordpress/data';
10
+ import { useDispatch, useSelect } from '@wordpress/data';
12
11
 
13
12
  /**
14
13
  * Internal dependencies
15
14
  */
16
15
  import { store as editPostStore } from '../../../store';
16
+ import PluginPostExcerpt from '../plugin-post-excerpt';
17
17
 
18
18
  /**
19
19
  * Module Constants
20
20
  */
21
21
  const PANEL_NAME = 'post-excerpt';
22
22
 
23
- function PostExcerpt( { isEnabled, isOpened, onTogglePanel } ) {
23
+ export default function PostExcerpt() {
24
+ const { isOpened, isEnabled } = useSelect( ( select ) => {
25
+ const { isEditorPanelOpened, isEditorPanelEnabled } =
26
+ select( editPostStore );
27
+
28
+ return {
29
+ isOpened: isEditorPanelOpened( PANEL_NAME ),
30
+ isEnabled: isEditorPanelEnabled( PANEL_NAME ),
31
+ };
32
+ }, [] );
33
+
34
+ const { toggleEditorPanelOpened } = useDispatch( editPostStore );
35
+ const toggleExcerptPanel = () => toggleEditorPanelOpened( PANEL_NAME );
36
+
24
37
  if ( ! isEnabled ) {
25
38
  return null;
26
39
  }
@@ -30,27 +43,17 @@ function PostExcerpt( { isEnabled, isOpened, onTogglePanel } ) {
30
43
  <PanelBody
31
44
  title={ __( 'Excerpt' ) }
32
45
  opened={ isOpened }
33
- onToggle={ onTogglePanel }
46
+ onToggle={ toggleExcerptPanel }
34
47
  >
35
- <PostExcerptForm />
48
+ <PluginPostExcerpt.Slot>
49
+ { ( fills ) => (
50
+ <>
51
+ <PostExcerptForm />
52
+ { fills }
53
+ </>
54
+ ) }
55
+ </PluginPostExcerpt.Slot>
36
56
  </PanelBody>
37
57
  </PostExcerptCheck>
38
58
  );
39
59
  }
40
-
41
- export default compose( [
42
- withSelect( ( select ) => {
43
- return {
44
- isEnabled:
45
- select( editPostStore ).isEditorPanelEnabled( PANEL_NAME ),
46
- isOpened: select( editPostStore ).isEditorPanelOpened( PANEL_NAME ),
47
- };
48
- } ),
49
- withDispatch( ( dispatch ) => ( {
50
- onTogglePanel() {
51
- return dispatch( editPostStore ).toggleEditorPanelOpened(
52
- PANEL_NAME
53
- );
54
- },
55
- } ) ),
56
- ] )( PostExcerpt );
package/src/editor.js CHANGED
@@ -14,7 +14,6 @@ import { SlotFillProvider } from '@wordpress/components';
14
14
  import { store as coreStore } from '@wordpress/core-data';
15
15
  import { store as preferencesStore } from '@wordpress/preferences';
16
16
  import { CommandMenu } from '@wordpress/commands';
17
- import { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';
18
17
 
19
18
  /**
20
19
  * Internal dependencies
@@ -23,14 +22,10 @@ import Layout from './components/layout';
23
22
  import EditorInitialization from './components/editor-initialization';
24
23
  import { store as editPostStore } from './store';
25
24
  import { unlock } from './lock-unlock';
26
- import useCommonCommands from './hooks/commands/use-common-commands';
27
25
 
28
26
  const { ExperimentalEditorProvider } = unlock( editorPrivateApis );
29
- const { useCommands } = unlock( coreCommandsPrivateApis );
30
27
 
31
28
  function Editor( { postId, postType, settings, initialEdits, ...props } ) {
32
- useCommands();
33
- useCommonCommands();
34
29
  const {
35
30
  hasFixedToolbar,
36
31
  focusMode,
package/src/index.js CHANGED
@@ -206,4 +206,5 @@ export { default as PluginSidebar } from './components/sidebar/plugin-sidebar';
206
206
  export { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';
207
207
  export { default as __experimentalFullscreenModeClose } from './components/header/fullscreen-mode-close';
208
208
  export { default as __experimentalMainDashboardButton } from './components/header/main-dashboard-button';
209
+ export { default as __experimentalPluginPostExcerpt } from './components/sidebar/plugin-post-excerpt';
209
210
  export { store } from './store';
@@ -5,6 +5,6 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/pri
5
5
 
6
6
  export const { lock, unlock } =
7
7
  __dangerousOptInToUnstableAPIsOnlyForCoreModules(
8
- 'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',
8
+ 'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
9
9
  '@wordpress/edit-post'
10
10
  );