@wordpress/edit-post 7.34.0 → 7.35.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 (90) hide show
  1. package/CHANGELOG.md +8 -2
  2. package/build/components/header/fullscreen-mode-close/index.js +2 -2
  3. package/build/components/header/fullscreen-mode-close/index.js.map +1 -1
  4. package/build/components/header/index.js +7 -96
  5. package/build/components/header/index.js.map +1 -1
  6. package/build/components/header/more-menu/manage-patterns-menu-item.js +1 -1
  7. package/build/components/header/more-menu/manage-patterns-menu-item.js.map +1 -1
  8. package/build/components/layout/index.js +56 -24
  9. package/build/components/layout/index.js.map +1 -1
  10. package/build/components/meta-boxes/meta-boxes-area/index.js +2 -2
  11. package/build/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
  12. package/build/components/visual-editor/index.js +11 -5
  13. package/build/components/visual-editor/index.js.map +1 -1
  14. package/build/components/visual-editor/use-padding-appender.js +6 -1
  15. package/build/components/visual-editor/use-padding-appender.js.map +1 -1
  16. package/build-module/components/header/fullscreen-mode-close/index.js +2 -2
  17. package/build-module/components/header/fullscreen-mode-close/index.js.map +1 -1
  18. package/build-module/components/header/index.js +8 -97
  19. package/build-module/components/header/index.js.map +1 -1
  20. package/build-module/components/header/more-menu/manage-patterns-menu-item.js +1 -1
  21. package/build-module/components/header/more-menu/manage-patterns-menu-item.js.map +1 -1
  22. package/build-module/components/layout/index.js +57 -25
  23. package/build-module/components/layout/index.js.map +1 -1
  24. package/build-module/components/meta-boxes/meta-boxes-area/index.js +2 -2
  25. package/build-module/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
  26. package/build-module/components/visual-editor/index.js +11 -5
  27. package/build-module/components/visual-editor/index.js.map +1 -1
  28. package/build-module/components/visual-editor/use-padding-appender.js +6 -1
  29. package/build-module/components/visual-editor/use-padding-appender.js.map +1 -1
  30. package/build-style/style-rtl.css +8 -268
  31. package/build-style/style.css +8 -268
  32. package/package.json +32 -32
  33. package/src/components/header/fullscreen-mode-close/index.js +2 -2
  34. package/src/components/header/index.js +9 -112
  35. package/src/components/header/more-menu/manage-patterns-menu-item.js +1 -1
  36. package/src/components/header/style.scss +4 -241
  37. package/src/components/layout/index.js +72 -19
  38. package/src/components/meta-boxes/meta-boxes-area/index.js +4 -8
  39. package/src/components/visual-editor/index.js +11 -4
  40. package/src/components/visual-editor/use-padding-appender.js +7 -1
  41. package/src/style.scss +1 -5
  42. package/build/components/sidebar/post-format/index.js +0 -21
  43. package/build/components/sidebar/post-format/index.js.map +0 -1
  44. package/build/components/sidebar/post-pending-status/index.js +0 -26
  45. package/build/components/sidebar/post-pending-status/index.js.map +0 -1
  46. package/build/components/sidebar/post-slug/index.js +0 -21
  47. package/build/components/sidebar/post-slug/index.js.map +0 -1
  48. package/build/components/sidebar/post-status/index.js +0 -92
  49. package/build/components/sidebar/post-status/index.js.map +0 -1
  50. package/build/components/sidebar/post-sticky/index.js +0 -26
  51. package/build/components/sidebar/post-sticky/index.js.map +0 -1
  52. package/build/components/sidebar/post-trash/index.js +0 -16
  53. package/build/components/sidebar/post-trash/index.js.map +0 -1
  54. package/build/components/sidebar/post-visibility/index.js +0 -78
  55. package/build/components/sidebar/post-visibility/index.js.map +0 -1
  56. package/build/components/sidebar/settings-header/index.js +0 -53
  57. package/build/components/sidebar/settings-header/index.js.map +0 -1
  58. package/build/components/sidebar/settings-sidebar/index.js +0 -193
  59. package/build/components/sidebar/settings-sidebar/index.js.map +0 -1
  60. package/build-module/components/sidebar/post-format/index.js +0 -13
  61. package/build-module/components/sidebar/post-format/index.js.map +0 -1
  62. package/build-module/components/sidebar/post-pending-status/index.js +0 -18
  63. package/build-module/components/sidebar/post-pending-status/index.js.map +0 -1
  64. package/build-module/components/sidebar/post-slug/index.js +0 -13
  65. package/build-module/components/sidebar/post-slug/index.js.map +0 -1
  66. package/build-module/components/sidebar/post-status/index.js +0 -84
  67. package/build-module/components/sidebar/post-status/index.js.map +0 -1
  68. package/build-module/components/sidebar/post-sticky/index.js +0 -18
  69. package/build-module/components/sidebar/post-sticky/index.js.map +0 -1
  70. package/build-module/components/sidebar/post-trash/index.js +0 -9
  71. package/build-module/components/sidebar/post-trash/index.js.map +0 -1
  72. package/build-module/components/sidebar/post-visibility/index.js +0 -70
  73. package/build-module/components/sidebar/post-visibility/index.js.map +0 -1
  74. package/build-module/components/sidebar/settings-header/index.js +0 -46
  75. package/build-module/components/sidebar/settings-header/index.js.map +0 -1
  76. package/build-module/components/sidebar/settings-sidebar/index.js +0 -185
  77. package/build-module/components/sidebar/settings-sidebar/index.js.map +0 -1
  78. package/src/components/sidebar/post-format/index.js +0 -20
  79. package/src/components/sidebar/post-format/style.scss +0 -5
  80. package/src/components/sidebar/post-pending-status/index.js +0 -27
  81. package/src/components/sidebar/post-slug/index.js +0 -17
  82. package/src/components/sidebar/post-slug/style.scss +0 -5
  83. package/src/components/sidebar/post-status/index.js +0 -128
  84. package/src/components/sidebar/post-sticky/index.js +0 -27
  85. package/src/components/sidebar/post-trash/index.js +0 -12
  86. package/src/components/sidebar/post-visibility/index.js +0 -88
  87. package/src/components/sidebar/post-visibility/style.scss +0 -5
  88. package/src/components/sidebar/settings-header/index.js +0 -49
  89. package/src/components/sidebar/settings-sidebar/index.js +0 -247
  90. package/src/components/sidebar/style.scss +0 -18
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_element","_components","_data","_store","MetaBoxesArea","location","container","useRef","formRef","useEffect","current","document","querySelector","appendChild","isSaving","useSelect","select","editPostStore","isSavingMetaBoxes","classes","classnames","_react","createElement","className","Spinner","ref","_default","exports","default"],"sources":["@wordpress/edit-post/src/components/meta-boxes/meta-boxes-area/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useEffect } from '@wordpress/element';\nimport { Spinner } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\n/**\n * Render metabox area.\n *\n * @param {Object} props Component props.\n * @param {string} props.location metabox location.\n * @return {Component} The component to be rendered.\n */\nfunction MetaBoxesArea( { location } ) {\n\tconst container = useRef( null );\n\tconst formRef = useRef( null );\n\n\tuseEffect( () => {\n\t\tformRef.current = document.querySelector(\n\t\t\t'.metabox-location-' + location\n\t\t);\n\n\t\tif ( formRef.current ) {\n\t\t\tcontainer.current.appendChild( formRef.current );\n\t\t}\n\n\t\treturn () => {\n\t\t\tif ( formRef.current ) {\n\t\t\t\tdocument\n\t\t\t\t\t.querySelector( '#metaboxes' )\n\t\t\t\t\t.appendChild( formRef.current );\n\t\t\t}\n\t\t};\n\t}, [ location ] );\n\n\tconst isSaving = useSelect( ( select ) => {\n\t\treturn select( editPostStore ).isSavingMetaBoxes();\n\t}, [] );\n\n\tconst classes = classnames(\n\t\t'edit-post-meta-boxes-area',\n\t\t`is-${ location }`,\n\t\t{\n\t\t\t'is-loading': isSaving,\n\t\t}\n\t);\n\n\treturn (\n\t\t<div className={ classes }>\n\t\t\t{ isSaving && <Spinner /> }\n\t\t\t<div\n\t\t\t\tclassName=\"edit-post-meta-boxes-area__container\"\n\t\t\t\tref={ container }\n\t\t\t/>\n\t\t\t<div className=\"edit-post-meta-boxes-area__clear\" />\n\t\t</div>\n\t);\n}\n\nexport default MetaBoxesArea;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASK,aAAaA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACtC,MAAMC,SAAS,GAAG,IAAAC,eAAM,EAAE,IAAK,CAAC;EAChC,MAAMC,OAAO,GAAG,IAAAD,eAAM,EAAE,IAAK,CAAC;EAE9B,IAAAE,kBAAS,EAAE,MAAM;IAChBD,OAAO,CAACE,OAAO,GAAGC,QAAQ,CAACC,aAAa,CACvC,oBAAoB,GAAGP,QACxB,CAAC;IAED,IAAKG,OAAO,CAACE,OAAO,EAAG;MACtBJ,SAAS,CAACI,OAAO,CAACG,WAAW,CAAEL,OAAO,CAACE,OAAQ,CAAC;IACjD;IAEA,OAAO,MAAM;MACZ,IAAKF,OAAO,CAACE,OAAO,EAAG;QACtBC,QAAQ,CACNC,aAAa,CAAE,YAAa,CAAC,CAC7BC,WAAW,CAAEL,OAAO,CAACE,OAAQ,CAAC;MACjC;IACD,CAAC;EACF,CAAC,EAAE,CAAEL,QAAQ,CAAG,CAAC;EAEjB,MAAMS,QAAQ,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACzC,OAAOA,MAAM,CAAEC,YAAc,CAAC,CAACC,iBAAiB,CAAC,CAAC;EACnD,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMC,OAAO,GAAG,IAAAC,mBAAU,EACzB,2BAA2B,EAC1B,MAAMf,QAAU,EAAC,EAClB;IACC,YAAY,EAAES;EACf,CACD,CAAC;EAED,OACC,IAAAO,MAAA,CAAAC,aAAA;IAAKC,SAAS,EAAGJ;EAAS,GACvBL,QAAQ,IAAI,IAAAO,MAAA,CAAAC,aAAA,EAACrB,WAAA,CAAAuB,OAAO,MAAE,CAAC,EACzB,IAAAH,MAAA,CAAAC,aAAA;IACCC,SAAS,EAAC,sCAAsC;IAChDE,GAAG,EAAGnB;EAAW,CACjB,CAAC,EACF,IAAAe,MAAA,CAAAC,aAAA;IAAKC,SAAS,EAAC;EAAkC,CAAE,CAC/C,CAAC;AAER;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcxB,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_element","_components","_data","_store","MetaBoxesArea","location","container","useRef","formRef","useEffect","current","document","querySelector","appendChild","isSaving","useSelect","select","editPostStore","isSavingMetaBoxes","classes","clsx","_react","createElement","className","Spinner","ref","_default","exports","default"],"sources":["@wordpress/edit-post/src/components/meta-boxes/meta-boxes-area/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useEffect } from '@wordpress/element';\nimport { Spinner } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\n/**\n * Render metabox area.\n *\n * @param {Object} props Component props.\n * @param {string} props.location metabox location.\n * @return {Component} The component to be rendered.\n */\nfunction MetaBoxesArea( { location } ) {\n\tconst container = useRef( null );\n\tconst formRef = useRef( null );\n\n\tuseEffect( () => {\n\t\tformRef.current = document.querySelector(\n\t\t\t'.metabox-location-' + location\n\t\t);\n\n\t\tif ( formRef.current ) {\n\t\t\tcontainer.current.appendChild( formRef.current );\n\t\t}\n\n\t\treturn () => {\n\t\t\tif ( formRef.current ) {\n\t\t\t\tdocument\n\t\t\t\t\t.querySelector( '#metaboxes' )\n\t\t\t\t\t.appendChild( formRef.current );\n\t\t\t}\n\t\t};\n\t}, [ location ] );\n\n\tconst isSaving = useSelect( ( select ) => {\n\t\treturn select( editPostStore ).isSavingMetaBoxes();\n\t}, [] );\n\n\tconst classes = clsx( 'edit-post-meta-boxes-area', `is-${ location }`, {\n\t\t'is-loading': isSaving,\n\t} );\n\n\treturn (\n\t\t<div className={ classes }>\n\t\t\t{ isSaving && <Spinner /> }\n\t\t\t<div\n\t\t\t\tclassName=\"edit-post-meta-boxes-area__container\"\n\t\t\t\tref={ container }\n\t\t\t/>\n\t\t\t<div className=\"edit-post-meta-boxes-area__clear\" />\n\t\t</div>\n\t);\n}\n\nexport default MetaBoxesArea;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA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AAH,MAAA,CAAAC,aAAA;IACCC,SAAS,EAAC,sCAAsC;IAChDE,GAAG,EAAGnB;EAAW,CACjB,CAAC,EACF,IAAAe,MAAA,CAAAC,aAAA;IAAKC,SAAS,EAAC;EAAkC,CAAE,CAC/C,CAAC;AAER;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcxB,aAAa","ignoreList":[]}
@@ -6,11 +6,12 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = VisualEditor;
8
8
  var _react = require("react");
9
- var _classnames = _interopRequireDefault(require("classnames"));
9
+ var _clsx = _interopRequireDefault(require("clsx"));
10
10
  var _editor = require("@wordpress/editor");
11
11
  var _element = require("@wordpress/element");
12
12
  var _data = require("@wordpress/data");
13
13
  var _blocks = require("@wordpress/blocks");
14
+ var _blockEditor = require("@wordpress/block-editor");
14
15
  var _store = require("../../store");
15
16
  var _lockUnlock = require("../../lock-unlock");
16
17
  var _usePaddingAppender = require("./use-padding-appender");
@@ -38,7 +39,8 @@ function VisualEditor({
38
39
  renderingMode,
39
40
  isBlockBasedTheme,
40
41
  hasV3BlocksOnly,
41
- isEditingTemplate
42
+ isEditingTemplate,
43
+ isZoomedOutView
42
44
  } = (0, _data.useSelect)(select => {
43
45
  const {
44
46
  isFeatureActive
@@ -50,6 +52,9 @@ function VisualEditor({
50
52
  const {
51
53
  getBlockTypes
52
54
  } = select(_blocks.store);
55
+ const {
56
+ __unstableGetEditorMode
57
+ } = select(_blockEditor.store);
53
58
  const editorSettings = getEditorSettings();
54
59
  return {
55
60
  isWelcomeGuideVisible: isFeatureActive('welcomeGuide'),
@@ -58,7 +63,8 @@ function VisualEditor({
58
63
  hasV3BlocksOnly: getBlockTypes().every(type => {
59
64
  return type.apiVersion >= 3;
60
65
  }),
61
- isEditingTemplate: select(_editor.store).getCurrentPostType() === 'wp_template'
66
+ isEditingTemplate: select(_editor.store).getCurrentPostType() === 'wp_template',
67
+ isZoomedOutView: __unstableGetEditorMode() === 'zoom-out'
62
68
  };
63
69
  }, []);
64
70
  const hasMetaBoxes = (0, _data.useSelect)(select => select(_store.store).hasMetaBoxes(), []);
@@ -67,7 +73,7 @@ function VisualEditor({
67
73
 
68
74
  // Add a constant padding for the typewritter effect. When typing at the
69
75
  // bottom, there needs to be room to scroll up.
70
- if (!hasMetaBoxes && renderingMode === 'post-only') {
76
+ if (!isZoomedOutView && !hasMetaBoxes && renderingMode === 'post-only') {
71
77
  paddingBottom = '40vh';
72
78
  }
73
79
  styles = (0, _element.useMemo)(() => [...styles, {
@@ -76,7 +82,7 @@ function VisualEditor({
76
82
  }], [styles, paddingBottom]);
77
83
  const isToBeIframed = (hasV3BlocksOnly || isGutenbergPlugin && isBlockBasedTheme) && !hasMetaBoxes || isEditingTemplate;
78
84
  return (0, _react.createElement)("div", {
79
- className: (0, _classnames.default)('edit-post-visual-editor', {
85
+ className: (0, _clsx.default)('edit-post-visual-editor', {
80
86
  'has-inline-canvas': !isToBeIframed
81
87
  })
82
88
  }, (0, _react.createElement)(EditorCanvas, {
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_editor","_element","_data","_blocks","_store","_lockUnlock","_usePaddingAppender","EditorCanvas","unlock","editorPrivateApis","isGutenbergPlugin","process","env","IS_GUTENBERG_PLUGIN","VisualEditor","styles","isWelcomeGuideVisible","renderingMode","isBlockBasedTheme","hasV3BlocksOnly","isEditingTemplate","useSelect","select","isFeatureActive","editPostStore","getEditorSettings","getRenderingMode","editorStore","getBlockTypes","blocksStore","editorSettings","__unstableIsBlockBasedTheme","every","type","apiVersion","getCurrentPostType","hasMetaBoxes","paddingAppenderRef","usePaddingAppender","paddingBottom","useMemo","css","isToBeIframed","_react","createElement","className","classnames","disableIframe","autoFocus","contentRef"],"sources":["@wordpress/edit-post/src/components/visual-editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as blocksStore } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { usePaddingAppender } from './use-padding-appender';\n\nconst { EditorCanvas } = unlock( editorPrivateApis );\n\nconst isGutenbergPlugin = process.env.IS_GUTENBERG_PLUGIN ? true : false;\n\nexport default function VisualEditor( { styles } ) {\n\tconst {\n\t\tisWelcomeGuideVisible,\n\t\trenderingMode,\n\t\tisBlockBasedTheme,\n\t\thasV3BlocksOnly,\n\t\tisEditingTemplate,\n\t} = useSelect( ( select ) => {\n\t\tconst { isFeatureActive } = select( editPostStore );\n\t\tconst { getEditorSettings, getRenderingMode } = select( editorStore );\n\t\tconst { getBlockTypes } = select( blocksStore );\n\t\tconst editorSettings = getEditorSettings();\n\n\t\treturn {\n\t\t\tisWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),\n\t\t\trenderingMode: getRenderingMode(),\n\t\t\tisBlockBasedTheme: editorSettings.__unstableIsBlockBasedTheme,\n\t\t\thasV3BlocksOnly: getBlockTypes().every( ( type ) => {\n\t\t\t\treturn type.apiVersion >= 3;\n\t\t\t} ),\n\t\t\tisEditingTemplate:\n\t\t\t\tselect( editorStore ).getCurrentPostType() === 'wp_template',\n\t\t};\n\t}, [] );\n\tconst hasMetaBoxes = useSelect(\n\t\t( select ) => select( editPostStore ).hasMetaBoxes(),\n\t\t[]\n\t);\n\n\tconst paddingAppenderRef = usePaddingAppender();\n\n\tlet paddingBottom;\n\n\t// Add a constant padding for the typewritter effect. When typing at the\n\t// bottom, there needs to be room to scroll up.\n\tif ( ! hasMetaBoxes && renderingMode === 'post-only' ) {\n\t\tpaddingBottom = '40vh';\n\t}\n\n\tstyles = useMemo(\n\t\t() => [\n\t\t\t...styles,\n\t\t\t{\n\t\t\t\t// We should move this in to future to the body.\n\t\t\t\tcss: paddingBottom\n\t\t\t\t\t? `body{padding-bottom:${ paddingBottom }}`\n\t\t\t\t\t: '',\n\t\t\t},\n\t\t],\n\t\t[ styles, paddingBottom ]\n\t);\n\n\tconst isToBeIframed =\n\t\t( ( hasV3BlocksOnly || ( isGutenbergPlugin && isBlockBasedTheme ) ) &&\n\t\t\t! hasMetaBoxes ) ||\n\t\tisEditingTemplate;\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames( 'edit-post-visual-editor', {\n\t\t\t\t'has-inline-canvas': ! isToBeIframed,\n\t\t\t} ) }\n\t\t>\n\t\t\t<EditorCanvas\n\t\t\t\tdisableIframe={ ! isToBeIframed }\n\t\t\t\tstyles={ styles }\n\t\t\t\t// We should auto-focus the canvas (title) on load.\n\t\t\t\t// eslint-disable-next-line jsx-a11y/no-autofocus\n\t\t\t\tautoFocus={ ! isWelcomeGuideVisible }\n\t\t\t\tcontentRef={ paddingAppenderRef }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,OAAA,GAAAD,OAAA;AAIA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,mBAAA,GAAAP,OAAA;AArBA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;;AAKA,MAAM;EAAEQ;AAAa,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAEpD,MAAMC,iBAAiB,GAAGC,OAAO,CAACC,GAAG,CAACC,mBAAmB,GAAG,IAAI,GAAG,KAAK;AAEzD,SAASC,YAAYA,CAAE;EAAEC;AAAO,CAAC,EAAG;EAClD,MAAM;IACLC,qBAAqB;IACrBC,aAAa;IACbC,iBAAiB;IACjBC,e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GAChB,CAAEvB,eAAe,IAAMT,iBAAiB,IAAIQ,iBAAmB,KAChE,CAAEkB,YAAY,IACfhB,iBAAiB;EAElB,OACC,IAAAuB,MAAA,CAAAC,aAAA;IACCC,SAAS,EAAG,IAAAC,mBAAU,EAAE,yBAAyB,EAAE;MAClD,mBAAmB,EAAE,CAAEJ;IACxB,CAAE;EAAG,GAEL,IAAAC,MAAA,CAAAC,aAAA,EAACrC,YAAY;IACZwC,aAAa,EAAG,CAAEL,aAAe;IACjC3B,MAAM,EAAGA;IACT;IACA;IAAA;IACAiC,SAAS,EAAG,CAAEhC,qBAAuB;IACrCiC,UAAU,EAAGZ;EAAoB,CACjC,CACG,CAAC;AAER","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_editor","_element","_data","_blocks","_blockEditor","_store","_lockUnlock","_usePaddingAppender","EditorCanvas","unlock","editorPrivateApis","isGutenbergPlugin","process","env","IS_GUTENBERG_PLUGIN","VisualEditor","styles","isWelcomeGuideVisible","renderingMode","isBlockBasedTheme","hasV3BlocksOnly","isEditingTemplate","isZoomedOutView","useSelect","select","isFeatureActive","editPostStore","getEditorSettings","getRenderingMode","editorStore","getBlockTypes","blocksStore","__unstableGetEditorMode","blockEditorStore","editorSettings","__unstableIsBlockBasedTheme","every","type","apiVersion","getCurrentPostType","hasMetaBoxes","paddingAppenderRef","usePaddingAppender","paddingBottom","useMemo","css","isToBeIframed","_react","createElement","className","clsx","disableIframe","autoFocus","contentRef"],"sources":["@wordpress/edit-post/src/components/visual-editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { usePaddingAppender } from './use-padding-appender';\n\nconst { EditorCanvas } = unlock( editorPrivateApis );\n\nconst isGutenbergPlugin = process.env.IS_GUTENBERG_PLUGIN ? true : false;\n\nexport default function VisualEditor( { styles } ) {\n\tconst {\n\t\tisWelcomeGuideVisible,\n\t\trenderingMode,\n\t\tisBlockBasedTheme,\n\t\thasV3BlocksOnly,\n\t\tisEditingTemplate,\n\t\tisZoomedOutView,\n\t} = useSelect( ( select ) => {\n\t\tconst { isFeatureActive } = select( editPostStore );\n\t\tconst { getEditorSettings, getRenderingMode } = select( editorStore );\n\t\tconst { getBlockTypes } = select( blocksStore );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\t\tconst editorSettings = getEditorSettings();\n\t\treturn {\n\t\t\tisWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),\n\t\t\trenderingMode: getRenderingMode(),\n\t\t\tisBlockBasedTheme: editorSettings.__unstableIsBlockBasedTheme,\n\t\t\thasV3BlocksOnly: getBlockTypes().every( ( type ) => {\n\t\t\t\treturn type.apiVersion >= 3;\n\t\t\t} ),\n\t\t\tisEditingTemplate:\n\t\t\t\tselect( editorStore ).getCurrentPostType() === 'wp_template',\n\t\t\tisZoomedOutView: __unstableGetEditorMode() === 'zoom-out',\n\t\t};\n\t}, [] );\n\tconst hasMetaBoxes = useSelect(\n\t\t( select ) => select( editPostStore ).hasMetaBoxes(),\n\t\t[]\n\t);\n\n\tconst paddingAppenderRef = usePaddingAppender();\n\n\tlet paddingBottom;\n\n\t// Add a constant padding for the typewritter effect. When typing at the\n\t// bottom, there needs to be room to scroll up.\n\tif (\n\t\t! isZoomedOutView &&\n\t\t! hasMetaBoxes &&\n\t\trenderingMode === 'post-only'\n\t) {\n\t\tpaddingBottom = '40vh';\n\t}\n\n\tstyles = useMemo(\n\t\t() => [\n\t\t\t...styles,\n\t\t\t{\n\t\t\t\t// We should move this in to future to the body.\n\t\t\t\tcss: paddingBottom\n\t\t\t\t\t? `body{padding-bottom:${ paddingBottom }}`\n\t\t\t\t\t: '',\n\t\t\t},\n\t\t],\n\t\t[ styles, paddingBottom ]\n\t);\n\n\tconst isToBeIframed =\n\t\t( ( hasV3BlocksOnly || ( isGutenbergPlugin && isBlockBasedTheme ) ) &&\n\t\t\t! hasMetaBoxes ) ||\n\t\tisEditingTemplate;\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx( 'edit-post-visual-editor', {\n\t\t\t\t'has-inline-canvas': ! isToBeIframed,\n\t\t\t} ) }\n\t\t>\n\t\t\t<EditorCanvas\n\t\t\t\tdisableIframe={ ! isToBeIframed }\n\t\t\t\tstyles={ styles }\n\t\t\t\t// We should auto-focus the canvas (title) on load.\n\t\t\t\t// eslint-disable-next-line jsx-a11y/no-autofocus\n\t\t\t\tautoFocus={ ! isWelcomeGuideVisible }\n\t\t\t\tcontentRef={ paddingAppenderRef }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,OAAA,GAAAD,OAAA;AAIA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,mBAAA,GAAAR,OAAA;AAtBA;AACA;AACA;;AAGA;AACA;AACA;;AAUA;AACA;AACA;;AAKA,MAAM;EAAES;AAAa,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAEpD,MAAMC,iBAAiB,GAAGC,OAAO,CAACC,GAAG,CAACC,mBAAmB,GAAG,IAAI,GAAG,KAAK;AAEzD,SAASC,YAAYA,CAAE;EAAEC;AAAO,CAAC,EAAG;EAClD,MAAM;IACLC,qBAAqB;IACrBC,aA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4B,gBAAO,EACf,MAAM,CACL,GAAG5B,MAAM,EACT;IACC;IACA6B,GAAG,EAAEF,aAAa,GACd,uBAAuBA,aAAe,GAAE,GACzC;EACJ,CAAC,CACD,EACD,CAAE3B,MAAM,EAAE2B,aAAa,CACxB,CAAC;EAED,MAAMG,aAAa,GAChB,CAAE1B,eAAe,IAAMT,iBAAiB,IAAIQ,iBAAmB,KAChE,CAAEqB,YAAY,IACfnB,iBAAiB;EAElB,OACC,IAAA0B,MAAA,CAAAC,aAAA;IACCC,SAAS,EAAG,IAAAC,aAAI,EAAE,yBAAyB,EAAE;MAC5C,mBAAmB,EAAE,CAAEJ;IACxB,CAAE;EAAG,GAEL,IAAAC,MAAA,CAAAC,aAAA,EAACxC,YAAY;IACZ2C,aAAa,EAAG,CAAEL,aAAe;IACjC9B,MAAM,EAAGA;IACT;IACA;IAAA;IACAoC,SAAS,EAAG,CAAEnC,qBAAuB;IACrCoC,UAAU,EAAGZ;EAAoB,CACjC,CACG,CAAC;AAER","ignoreList":[]}
@@ -30,7 +30,7 @@ function usePaddingAppender() {
30
30
  return;
31
31
  }
32
32
 
33
- // only handle clicks under the last child
33
+ // Only handle clicks under the last child.
34
34
  const lastChild = node.lastElementChild;
35
35
  if (!lastChild) {
36
36
  return;
@@ -42,6 +42,11 @@ function usePaddingAppender() {
42
42
  event.preventDefault();
43
43
  const blockOrder = registry.select(_blockEditor.store).getBlockOrder('');
44
44
  const lastBlockClientId = blockOrder[blockOrder.length - 1];
45
+
46
+ // Do nothing when only default block appender is present.
47
+ if (!lastBlockClientId) {
48
+ return;
49
+ }
45
50
  const lastBlock = registry.select(_blockEditor.store).getBlock(lastBlockClientId);
46
51
  const {
47
52
  selectBlock,
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_compose","_blockEditor","_blocks","usePaddingAppender","registry","useRegistry","useRefEffect","node","onMouseDown","event","target","ownerDocument","defaultView","paddingBottom","parseInt","getComputedStyle","lastChild","lastElementChild","lastChildRect","getBoundingClientRect","clientY","bottom","preventDefault","blockOrder","select","blockEditorStore","getBlockOrder","lastBlockClientId","length","lastBlock","getBlock","selectBlock","insertDefaultBlock","dispatch","isUnmodifiedDefaultBlock","addEventListener","removeEventListener"],"sources":["@wordpress/edit-post/src/components/visual-editor/use-padding-appender.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRegistry } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { isUnmodifiedDefaultBlock } from '@wordpress/blocks';\n\nexport function usePaddingAppender() {\n\tconst registry = useRegistry();\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tfunction onMouseDown( event ) {\n\t\t\t\tif ( event.target !== node ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst { ownerDocument } = node;\n\t\t\t\tconst { defaultView } = ownerDocument;\n\n\t\t\t\tconst paddingBottom = defaultView.parseInt(\n\t\t\t\t\tdefaultView.getComputedStyle( node ).paddingBottom,\n\t\t\t\t\t10\n\t\t\t\t);\n\n\t\t\t\tif ( ! paddingBottom ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// only handle clicks under the last child\n\t\t\t\tconst lastChild = node.lastElementChild;\n\t\t\t\tif ( ! lastChild ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst lastChildRect = lastChild.getBoundingClientRect();\n\t\t\t\tif ( event.clientY < lastChildRect.bottom ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tconst blockOrder = registry\n\t\t\t\t\t.select( blockEditorStore )\n\t\t\t\t\t.getBlockOrder( '' );\n\t\t\t\tconst lastBlockClientId = blockOrder[ blockOrder.length - 1 ];\n\t\t\t\tconst lastBlock = registry\n\t\t\t\t\t.select( blockEditorStore )\n\t\t\t\t\t.getBlock( lastBlockClientId );\n\t\t\t\tconst { selectBlock, insertDefaultBlock } =\n\t\t\t\t\tregistry.dispatch( blockEditorStore );\n\n\t\t\t\tif ( isUnmodifiedDefaultBlock( lastBlock ) ) {\n\t\t\t\t\tselectBlock( lastBlockClientId );\n\t\t\t\t} else {\n\t\t\t\t\tinsertDefaultBlock();\n\t\t\t\t}\n\t\t\t}\n\t\t\tnode.addEventListener( 'mousedown', onMouseDown );\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'mousedown', onMouseDown );\n\t\t\t};\n\t\t},\n\t\t[ registry ]\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AANA;AACA;AACA;;AAMO,SAASI,kBAAkBA,CAAA,EAAG;EACpC,MAAMC,QAAQ,GAAG,IAAAC,iBAAW,EAAC,CAAC;EAC9B,OAAO,IAAAC,qBAAY,EAChBC,IAAI,IAAM;IACX,SAASC,WAAWA,CAAEC,KAAK,EAAG;MAC7B,IAAKA,KAAK,CAACC,MAAM,KAAKH,IAAI,EAAG;QAC5B;MACD;MAEA,MAAM;QAAEI;MAAc,CAAC,GAAGJ,IAAI;MAC9B,MAAM;QAAEK;MAAY,CAAC,GAAGD,aAAa;MAErC,MAAME,aAAa,GAAGD,WAAW,CAACE,QAAQ,CACzCF,WAAW,CAACG,gBAAgB,CAAER,IAAK,CAAC,CAACM,aAAa,EAClD,EACD,CAAC;MAED,IAAK,CAAEA,aAAa,EAAG;QACtB;MACD;;MAEA;MACA,MAAMG,SAAS,GAAGT,IAAI,CAACU,gBAAgB;MACvC,IAAK,CAAED,SAAS,EAAG;QAClB;MACD;MAEA,MAAME,aAAa,GAAGF,SAAS,CAACG,qBAAqB,CAAC,CAAC;MACvD,IAAKV,KAAK,CAACW,OAAO,GAAGF,aAAa,CAACG,MAAM,EAAG;QAC3C;MACD;MAEAZ,KAAK,CAACa,cAAc,CAAC,CAAC;MAEtB,MAAMC,UAAU,GAAGnB,QAAQ,CACzBoB,MAAM,CAAEC,kBAAiB,CAAC,CAC1BC,aAAa,CAAE,EAAG,CAAC;MACrB,MAAMC,iBAAiB,GAAGJ,UAAU,CAAEA,UAAU,CAACK,MAAM,GAAG,CAAC,CAAE;MAC7D,MAAMC,SAAS,GAAGzB,QAAQ,CACxBoB,MAAM,CAAEC,kBAAiB,CAAC,CAC1BK,QAAQ,CAAEH,iBAAkB,CAAC;MAC/B,MAAM;QAAEI,WAAW;QAAEC;MAAmB,CAAC,GACxC5B,QAAQ,CAAC6B,QAAQ,CAAER,kBAAiB,CAAC;MAEtC,IAAK,IAAAS,gCAAwB,EAAEL,SAAU,CAAC,EAAG;QAC5CE,WAAW,CAAEJ,iBAAkB,CAAC;MACjC,CAAC,MAAM;QACNK,kBAAkB,CAAC,CAAC;MACrB;IACD;IACAzB,IAAI,CAAC4B,gBAAgB,CAAE,WAAW,EAAE3B,WAAY,CAAC;IACjD,OAAO,MAAM;MACZD,IAAI,CAAC6B,mBAAmB,CAAE,WAAW,EAAE5B,WAAY,CAAC;IACrD,CAAC;EACF,CAAC,EACD,CAAEJ,QAAQ,CACX,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_compose","_blockEditor","_blocks","usePaddingAppender","registry","useRegistry","useRefEffect","node","onMouseDown","event","target","ownerDocument","defaultView","paddingBottom","parseInt","getComputedStyle","lastChild","lastElementChild","lastChildRect","getBoundingClientRect","clientY","bottom","preventDefault","blockOrder","select","blockEditorStore","getBlockOrder","lastBlockClientId","length","lastBlock","getBlock","selectBlock","insertDefaultBlock","dispatch","isUnmodifiedDefaultBlock","addEventListener","removeEventListener"],"sources":["@wordpress/edit-post/src/components/visual-editor/use-padding-appender.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRegistry } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { isUnmodifiedDefaultBlock } from '@wordpress/blocks';\n\nexport function usePaddingAppender() {\n\tconst registry = useRegistry();\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tfunction onMouseDown( event ) {\n\t\t\t\tif ( event.target !== node ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst { ownerDocument } = node;\n\t\t\t\tconst { defaultView } = ownerDocument;\n\n\t\t\t\tconst paddingBottom = defaultView.parseInt(\n\t\t\t\t\tdefaultView.getComputedStyle( node ).paddingBottom,\n\t\t\t\t\t10\n\t\t\t\t);\n\n\t\t\t\tif ( ! paddingBottom ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Only handle clicks under the last child.\n\t\t\t\tconst lastChild = node.lastElementChild;\n\t\t\t\tif ( ! lastChild ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst lastChildRect = lastChild.getBoundingClientRect();\n\t\t\t\tif ( event.clientY < lastChildRect.bottom ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tconst blockOrder = registry\n\t\t\t\t\t.select( blockEditorStore )\n\t\t\t\t\t.getBlockOrder( '' );\n\t\t\t\tconst lastBlockClientId = blockOrder[ blockOrder.length - 1 ];\n\n\t\t\t\t// Do nothing when only default block appender is present.\n\t\t\t\tif ( ! lastBlockClientId ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst lastBlock = registry\n\t\t\t\t\t.select( blockEditorStore )\n\t\t\t\t\t.getBlock( lastBlockClientId );\n\t\t\t\tconst { selectBlock, insertDefaultBlock } =\n\t\t\t\t\tregistry.dispatch( blockEditorStore );\n\n\t\t\t\tif ( isUnmodifiedDefaultBlock( lastBlock ) ) {\n\t\t\t\t\tselectBlock( lastBlockClientId );\n\t\t\t\t} else {\n\t\t\t\t\tinsertDefaultBlock();\n\t\t\t\t}\n\t\t\t}\n\t\t\tnode.addEventListener( 'mousedown', onMouseDown );\n\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AC1B;MACD;MAEA,MAAME,SAAS,GAAGzB,QAAQ,CACxBoB,MAAM,CAAEC,kBAAiB,CAAC,CAC1BK,QAAQ,CAAEH,iBAAkB,CAAC;MAC/B,MAAM;QAAEI,WAAW;QAAEC;MAAmB,CAAC,GACxC5B,QAAQ,CAAC6B,QAAQ,CAAER,kBAAiB,CAAC;MAEtC,IAAK,IAAAS,gCAAwB,EAAEL,SAAU,CAAC,EAAG;QAC5CE,WAAW,CAAEJ,iBAAkB,CAAC;MACjC,CAAC,MAAM;QACNK,kBAAkB,CAAC,CAAC;MACrB;IACD;IACAzB,IAAI,CAAC4B,gBAAgB,CAAE,WAAW,EAAE3B,WAAY,CAAC;IACjD,OAAO,MAAM;MACZD,IAAI,CAAC6B,mBAAmB,CAAE,WAAW,EAAE5B,WAAY,CAAC;IACrD,CAAC;EACF,CAAC,EACD,CAAEJ,QAAQ,CACX,CAAC;AACF","ignoreList":[]}
@@ -2,7 +2,7 @@ import { createElement } from "react";
2
2
  /**
3
3
  * External dependencies
4
4
  */
5
- import classnames from 'classnames';
5
+ import clsx from 'clsx';
6
6
 
7
7
  /**
8
8
  * WordPress dependencies
@@ -89,7 +89,7 @@ function FullscreenModeClose({
89
89
  icon: icon
90
90
  });
91
91
  }
92
- const classes = classnames({
92
+ const classes = clsx({
93
93
  'edit-post-fullscreen-mode-close': true,
94
94
  'has-icon': siteIconUrl
95
95
  });
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","useSelect","Button","Icon","__unstableMotion","motion","__","addQueryArgs","wordpress","store","editorStore","coreStore","useReducedMotion","editPostStore","FullscreenModeClose","showTooltip","icon","href","initialPost","_postType$labels$view","isActive","isRequestingSiteIcon","postType","siteIconUrl","select","getCurrentPostType","isFeatureActive","getEntityRecord","getPostType","isResolving","siteData","undefined","_postType","type","site_icon_url","disableMotion","buttonIcon","createElement","size","effect","expand","scale","transition","duration","img","variants","alt","className","src","classes","buttonHref","post_type","slug","buttonLabel","labels","view_items","div","whileHover","label"],"sources":["@wordpress/edit-post/src/components/header/fullscreen-mode-close/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tButton,\n\tIcon,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { addQueryArgs } from '@wordpress/url';\nimport { wordpress } from '@wordpress/icons';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useReducedMotion } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nfunction FullscreenModeClose( { showTooltip, icon, href, initialPost } ) {\n\tconst { isActive, isRequestingSiteIcon, postType, siteIconUrl } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPostType } = select( editorStore );\n\t\t\tconst { isFeatureActive } = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, isResolving } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst siteData =\n\t\t\t\tgetEntityRecord( 'root', '__unstableBase', undefined ) || {};\n\t\t\tconst _postType = initialPost?.type || getCurrentPostType();\n\t\t\treturn {\n\t\t\t\tisActive: isFeatureActive( 'fullscreenMode' ),\n\t\t\t\tisRequestingSiteIcon: isResolving( 'getEntityRecord', [\n\t\t\t\t\t'root',\n\t\t\t\t\t'__unstableBase',\n\t\t\t\t\tundefined,\n\t\t\t\t] ),\n\t\t\t\tpostType: getPostType( _postType ),\n\t\t\t\tsiteIconUrl: siteData.site_icon_url,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst disableMotion = useReducedMotion();\n\n\tif ( ! isActive || ! postType ) {\n\t\treturn null;\n\t}\n\n\tlet buttonIcon = <Icon size=\"36px\" icon={ wordpress } />;\n\n\tconst effect = {\n\t\texpand: {\n\t\t\tscale: 1.25,\n\t\t\ttransition: { type: 'tween', duration: '0.3' },\n\t\t},\n\t};\n\n\tif ( siteIconUrl ) {\n\t\tbuttonIcon = (\n\t\t\t<motion.img\n\t\t\t\tvariants={ ! disableMotion && effect }\n\t\t\t\talt={ __( 'Site Icon' ) }\n\t\t\t\tclassName=\"edit-post-fullscreen-mode-close_site-icon\"\n\t\t\t\tsrc={ siteIconUrl }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( isRequestingSiteIcon ) {\n\t\tbuttonIcon = null;\n\t}\n\n\t// Override default icon if custom icon is provided via props.\n\tif ( icon ) {\n\t\tbuttonIcon = <Icon size=\"36px\" icon={ icon } />;\n\t}\n\n\tconst classes = classnames( {\n\t\t'edit-post-fullscreen-mode-close': true,\n\t\t'has-icon': siteIconUrl,\n\t} );\n\n\tconst buttonHref =\n\t\thref ??\n\t\taddQueryArgs( 'edit.php', {\n\t\t\tpost_type: postType.slug,\n\t\t} );\n\n\tconst buttonLabel = postType?.labels?.view_items ?? __( 'Back' );\n\n\treturn (\n\t\t<motion.div whileHover=\"expand\">\n\t\t\t<Button\n\t\t\t\tclassName={ classes }\n\t\t\t\thref={ buttonHref }\n\t\t\t\tlabel={ buttonLabel }\n\t\t\t\tshowTooltip={ showTooltip }\n\t\t\t>\n\t\t\t\t{ buttonIcon }\n\t\t\t</Button>\n\t\t</motion.div>\n\t);\n}\n\nexport default FullscreenModeClose;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SACCC,MAAM,EACNC,IAAI,EACJC,gBAAgB,IAAIC,MAAM,QACpB,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASD,KAAK,IAAIE,SAAS,QAAQ,sBAAsB;AACzD,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;A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":["clsx","useSelect","Button","Icon","__unstableMotion","motion","__","addQueryArgs","wordpress","store","editorStore","coreStore","useReducedMotion","editPostStore","FullscreenModeClose","showTooltip","icon","href","initialPost","_postType$labels$view","isActive","isRequestingSiteIcon","postType","siteIconUrl","select","getCurrentPostType","isFeatureActive","getEntityRecord","getPostType","isResolving","siteData","undefined","_postType","type","site_icon_url","disableMotion","buttonIcon","createElement","size","effect","expand","scale","transition","duration","img","variants","alt","className","src","classes","buttonHref","post_type","slug","buttonLabel","labels","view_items","div","whileHover","label"],"sources":["@wordpress/edit-post/src/components/header/fullscreen-mode-close/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tButton,\n\tIcon,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { addQueryArgs } from '@wordpress/url';\nimport { wordpress } from '@wordpress/icons';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useReducedMotion } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nfunction FullscreenModeClose( { showTooltip, icon, href, initialPost } ) {\n\tconst { isActive, isRequestingSiteIcon, postType, siteIconUrl } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPostType } = select( editorStore );\n\t\t\tconst { isFeatureActive } = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, isResolving } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst siteData =\n\t\t\t\tgetEntityRecord( 'root', '__unstableBase', undefined ) || {};\n\t\t\tconst _postType = initialPost?.type || getCurrentPostType();\n\t\t\treturn {\n\t\t\t\tisActive: isFeatureActive( 'fullscreenMode' ),\n\t\t\t\tisRequestingSiteIcon: isResolving( 'getEntityRecord', [\n\t\t\t\t\t'root',\n\t\t\t\t\t'__unstableBase',\n\t\t\t\t\tundefined,\n\t\t\t\t] ),\n\t\t\t\tpostType: getPostType( _postType ),\n\t\t\t\tsiteIconUrl: siteData.site_icon_url,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst disableMotion = useReducedMotion();\n\n\tif ( ! isActive || ! postType ) {\n\t\treturn null;\n\t}\n\n\tlet buttonIcon = <Icon size=\"36px\" icon={ wordpress } />;\n\n\tconst effect = {\n\t\texpand: {\n\t\t\tscale: 1.25,\n\t\t\ttransition: { type: 'tween', duration: '0.3' },\n\t\t},\n\t};\n\n\tif ( siteIconUrl ) {\n\t\tbuttonIcon = (\n\t\t\t<motion.img\n\t\t\t\tvariants={ ! disableMotion && effect }\n\t\t\t\talt={ __( 'Site Icon' ) }\n\t\t\t\tclassName=\"edit-post-fullscreen-mode-close_site-icon\"\n\t\t\t\tsrc={ siteIconUrl }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( isRequestingSiteIcon ) {\n\t\tbuttonIcon = null;\n\t}\n\n\t// Override default icon if custom icon is provided via props.\n\tif ( icon ) {\n\t\tbuttonIcon = <Icon size=\"36px\" icon={ icon } />;\n\t}\n\n\tconst classes = clsx( {\n\t\t'edit-post-fullscreen-mode-close': true,\n\t\t'has-icon': siteIconUrl,\n\t} );\n\n\tconst buttonHref =\n\t\thref ??\n\t\taddQueryArgs( 'edit.php', {\n\t\t\tpost_type: postType.slug,\n\t\t} );\n\n\tconst buttonLabel = postType?.labels?.view_items ?? __( 'Back' );\n\n\treturn (\n\t\t<motion.div whileHover=\"expand\">\n\t\t\t<Button\n\t\t\t\tclassName={ classes }\n\t\t\t\thref={ buttonHref }\n\t\t\t\tlabel={ buttonLabel }\n\t\t\t\tshowTooltip={ showTooltip }\n\t\t\t>\n\t\t\t\t{ buttonIcon }\n\t\t\t</Button>\n\t\t</motion.div>\n\t);\n}\n\nexport default FullscreenModeClose;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,SA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AAA,qBAAA,GAAIb,EAAE,CAAE,MAAO,CAAC;EAEhE,OACC+B,aAAA,CAAChC,MAAM,CAACmD,GAAG;IAACC,UAAU,EAAC;EAAQ,GAC9BpB,aAAA,CAACnC,MAAM;IACN6C,SAAS,EAAGE,OAAS;IACrBhC,IAAI,EAAGiC,UAAY;IACnBQ,KAAK,EAAGL,WAAa;IACrBtC,WAAW,EAAGA;EAAa,GAEzBqB,UACK,CACG,CAAC;AAEf;AAEA,eAAetB,mBAAmB","ignoreList":[]}
@@ -1,18 +1,10 @@
1
1
  import { createElement } from "react";
2
- /**
3
- * External dependencies
4
- */
5
- import classnames from 'classnames';
6
-
7
2
  /**
8
3
  * WordPress dependencies
9
4
  */
10
- import { DocumentBar, PostSavedState, PostPreviewButton, store as editorStore, privateApis as editorPrivateApis } from '@wordpress/editor';
5
+ import { privateApis as editorPrivateApis } from '@wordpress/editor';
11
6
  import { useSelect } from '@wordpress/data';
12
- import { useViewportMatch } from '@wordpress/compose';
13
7
  import { __unstableMotion as motion } from '@wordpress/components';
14
- import { store as preferencesStore } from '@wordpress/preferences';
15
- import { useState } from '@wordpress/element';
16
8
 
17
9
  /**
18
10
  * Internal dependencies
@@ -23,29 +15,8 @@ import MainDashboardButton from './main-dashboard-button';
23
15
  import { store as editPostStore } from '../../store';
24
16
  import { unlock } from '../../lock-unlock';
25
17
  const {
26
- CollapsableBlockToolbar,
27
- DocumentTools,
28
- PostViewLink,
29
- PreviewDropdown,
30
- PinnedItems,
31
- MoreMenu,
32
- PostPublishButtonOrToggle
18
+ Header: EditorHeader
33
19
  } = unlock(editorPrivateApis);
34
- const slideY = {
35
- hidden: {
36
- y: '-50px'
37
- },
38
- distractionFreeInactive: {
39
- y: 0
40
- },
41
- hover: {
42
- y: 0,
43
- transition: {
44
- type: 'tween',
45
- delay: 0.2
46
- }
47
- }
48
- };
49
20
  const slideX = {
50
21
  hidden: {
51
22
  x: '-100%'
@@ -65,35 +36,16 @@ function Header({
65
36
  setEntitiesSavedStatesCallback,
66
37
  initialPost
67
38
  }) {
68
- const isWideViewport = useViewportMatch('large');
69
- const isLargeViewport = useViewportMatch('medium');
70
39
  const {
71
- isTextEditor,
72
- hasActiveMetaboxes,
73
- isPublishSidebarOpened,
74
- showIconLabels,
75
- hasHistory,
76
- hasFixedToolbar
40
+ hasActiveMetaboxes
77
41
  } = useSelect(select => {
78
- const {
79
- get: getPreference
80
- } = select(preferencesStore);
81
- const {
82
- getEditorMode
83
- } = select(editorStore);
84
42
  return {
85
- isTextEditor: getEditorMode() === 'text',
86
- hasActiveMetaboxes: select(editPostStore).hasMetaBoxes(),
87
- hasHistory: !!select(editorStore).getEditorSettings().onNavigateToPreviousEntityRecord,
88
- isPublishSidebarOpened: select(editorStore).isPublishSidebarOpened(),
89
- showIconLabels: getPreference('core', 'showIconLabels'),
90
- hasFixedToolbar: getPreference('core', 'fixedToolbar')
43
+ hasActiveMetaboxes: select(editPostStore).hasMetaBoxes()
91
44
  };
92
45
  }, []);
93
- const hasTopToolbar = isLargeViewport && hasFixedToolbar;
94
- const [isBlockToolsCollapsed, setIsBlockToolsCollapsed] = useState(true);
95
- return createElement("div", {
96
- className: "edit-post-header"
46
+ return createElement(EditorHeader, {
47
+ forceIsDirty: hasActiveMetaboxes,
48
+ setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
97
49
  }, createElement(MainDashboardButton.Slot, null, createElement(motion.div, {
98
50
  variants: slideX,
99
51
  transition: {
@@ -103,48 +55,7 @@ function Header({
103
55
  }, createElement(FullscreenModeClose, {
104
56
  showTooltip: true,
105
57
  initialPost: initialPost
106
- }))), createElement(motion.div, {
107
- variants: slideY,
108
- transition: {
109
- type: 'tween',
110
- delay: 0.8
111
- },
112
- className: "edit-post-header__toolbar"
113
- }, createElement(DocumentTools, {
114
- disableBlockTools: isTextEditor
115
- }), hasTopToolbar && createElement(CollapsableBlockToolbar, {
116
- isCollapsed: isBlockToolsCollapsed,
117
- onToggle: setIsBlockToolsCollapsed
118
- }), createElement("div", {
119
- className: classnames('edit-post-header__center', {
120
- 'is-collapsed': hasHistory && !isBlockToolsCollapsed && hasTopToolbar
121
- })
122
- }, hasHistory && createElement(DocumentBar, null))), createElement(motion.div, {
123
- variants: slideY,
124
- transition: {
125
- type: 'tween',
126
- delay: 0.8
127
- },
128
- className: "edit-post-header__settings"
129
- }, !isPublishSidebarOpened &&
130
- // This button isn't completely hidden by the publish sidebar.
131
- // We can't hide the whole toolbar when the publish sidebar is open because
132
- // we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.
133
- // We track that DOM node to return focus to the PostPublishButtonOrToggle
134
- // when the publish sidebar has been closed.
135
- createElement(PostSavedState, {
136
- forceIsDirty: hasActiveMetaboxes
137
- }), createElement(PreviewDropdown, {
138
- forceIsAutosaveable: hasActiveMetaboxes
139
- }), createElement(PostPreviewButton, {
140
- className: "edit-post-header__post-preview-button",
141
- forceIsAutosaveable: hasActiveMetaboxes
142
- }), createElement(PostViewLink, null), createElement(PostPublishButtonOrToggle, {
143
- forceIsDirty: hasActiveMetaboxes,
144
- setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
145
- }), (isWideViewport || !showIconLabels) && createElement(PinnedItems.Slot, {
146
- scope: "core"
147
- }), createElement(MoreMenu, null), createElement(PostEditorMoreMenu, null)));
58
+ }))), createElement(PostEditorMoreMenu, null));
148
59
  }
149
60
  export default Header;
150
61
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","DocumentBar","PostSavedState","PostPreviewButton","store","editorStore","privateApis","editorPrivateApis","useSelect","useViewportMatch","__unstableMotion","motion","preferencesStore","useState","FullscreenModeClose","PostEditorMoreMenu","MainDashboardButton","editPostStore","unlock","CollapsableBlockToolbar","DocumentTools","PostViewLink","PreviewDropdown","PinnedItems","MoreMenu","PostPublishButtonOrToggle","slideY","hidden","y","distractionFreeInactive","hover","transition","type","delay","slideX","x","Header","setEntitiesSavedStatesCallback","initialPost","isWideViewport","isLargeViewport","isTextEditor","hasActiveMetaboxes","isPublishSidebarOpened","showIconLabels","hasHistory","hasFixedToolbar","select","get","getPreference","getEditorMode","hasMetaBoxes","getEditorSettings","onNavigateToPreviousEntityRecord","hasTopToolbar","isBlockToolsCollapsed","setIsBlockToolsCollapsed","createElement","className","Slot","div","variants","showTooltip","disableBlockTools","isCollapsed","onToggle","forceIsDirty","forceIsAutosaveable","scope"],"sources":["@wordpress/edit-post/src/components/header/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tDocumentBar,\n\tPostSavedState,\n\tPostPreviewButton,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport FullscreenModeClose from './fullscreen-mode-close';\nimport PostEditorMoreMenu from './more-menu';\nimport MainDashboardButton from './main-dashboard-button';\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst {\n\tCollapsableBlockToolbar,\n\tDocumentTools,\n\tPostViewLink,\n\tPreviewDropdown,\n\tPinnedItems,\n\tMoreMenu,\n\tPostPublishButtonOrToggle,\n} = unlock( editorPrivateApis );\n\nconst slideY = {\n\thidden: { y: '-50px' },\n\tdistractionFreeInactive: { y: 0 },\n\thover: { y: 0, transition: { type: 'tween', delay: 0.2 } },\n};\n\nconst slideX = {\n\thidden: { x: '-100%' },\n\tdistractionFreeInactive: { x: 0 },\n\thover: { x: 0, transition: { type: 'tween', delay: 0.2 } },\n};\n\nfunction Header( { setEntitiesSavedStatesCallback, initialPost } ) {\n\tconst isWideViewport = useViewportMatch( 'large' );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst {\n\t\tisTextEditor,\n\t\thasActiveMetaboxes,\n\t\tisPublishSidebarOpened,\n\t\tshowIconLabels,\n\t\thasHistory,\n\t\thasFixedToolbar,\n\t} = useSelect( ( select ) => {\n\t\tconst { get: getPreference } = select( preferencesStore );\n\t\tconst { getEditorMode } = select( editorStore );\n\n\t\treturn {\n\t\t\tisTextEditor: getEditorMode() === 'text',\n\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t\thasHistory:\n\t\t\t\t!! select( editorStore ).getEditorSettings()\n\t\t\t\t\t.onNavigateToPreviousEntityRecord,\n\t\t\tisPublishSidebarOpened:\n\t\t\t\tselect( editorStore ).isPublishSidebarOpened(),\n\t\t\tshowIconLabels: getPreference( 'core', 'showIconLabels' ),\n\t\t\thasFixedToolbar: getPreference( 'core', 'fixedToolbar' ),\n\t\t};\n\t}, [] );\n\n\tconst hasTopToolbar = isLargeViewport && hasFixedToolbar;\n\n\tconst [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =\n\t\tuseState( true );\n\n\treturn (\n\t\t<div className=\"edit-post-header\">\n\t\t\t<MainDashboardButton.Slot>\n\t\t\t\t<motion.div\n\t\t\t\t\tvariants={ slideX }\n\t\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\t>\n\t\t\t\t\t<FullscreenModeClose\n\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\tinitialPost={ initialPost }\n\t\t\t\t\t/>\n\t\t\t\t</motion.div>\n\t\t\t</MainDashboardButton.Slot>\n\t\t\t<motion.div\n\t\t\t\tvariants={ slideY }\n\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\tclassName=\"edit-post-header__toolbar\"\n\t\t\t>\n\t\t\t\t<DocumentTools disableBlockTools={ isTextEditor } />\n\t\t\t\t{ hasTopToolbar && (\n\t\t\t\t\t<CollapsableBlockToolbar\n\t\t\t\t\t\tisCollapsed={ isBlockToolsCollapsed }\n\t\t\t\t\t\tonToggle={ setIsBlockToolsCollapsed }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<div\n\t\t\t\t\tclassName={ classnames( 'edit-post-header__center', {\n\t\t\t\t\t\t'is-collapsed':\n\t\t\t\t\t\t\thasHistory &&\n\t\t\t\t\t\t\t! isBlockToolsCollapsed &&\n\t\t\t\t\t\t\thasTopToolbar,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t{ hasHistory && <DocumentBar /> }\n\t\t\t\t</div>\n\t\t\t</motion.div>\n\t\t\t<motion.div\n\t\t\t\tvariants={ slideY }\n\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\tclassName=\"edit-post-header__settings\"\n\t\t\t>\n\t\t\t\t{ ! isPublishSidebarOpened && (\n\t\t\t\t\t// This button isn't completely hidden by the publish sidebar.\n\t\t\t\t\t// We can't hide the whole toolbar when the publish sidebar is open because\n\t\t\t\t\t// we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.\n\t\t\t\t\t// We track that DOM node to return focus to the PostPublishButtonOrToggle\n\t\t\t\t\t// when the publish sidebar has been closed.\n\t\t\t\t\t<PostSavedState forceIsDirty={ hasActiveMetaboxes } />\n\t\t\t\t) }\n\t\t\t\t<PreviewDropdown forceIsAutosaveable={ hasActiveMetaboxes } />\n\t\t\t\t<PostPreviewButton\n\t\t\t\t\tclassName=\"edit-post-header__post-preview-button\"\n\t\t\t\t\tforceIsAutosaveable={ hasActiveMetaboxes }\n\t\t\t\t/>\n\t\t\t\t<PostViewLink />\n\t\t\t\t<PostPublishButtonOrToggle\n\t\t\t\t\tforceIsDirty={ hasActiveMetaboxes }\n\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<PinnedItems.Slot scope=\"core\" />\n\t\t\t\t) }\n\t\t\t\t<MoreMenu />\n\t\t\t\t<PostEditorMoreMenu />\n\t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,CAC1C,CAAC,EACFe,aAAA,CAACpC,YAAY,MAAE,CAAC,EAChBoC,aAAA,CAAChC,yBAAyB;IACzByC,YAAY,EAAGxB,kBAAoB;IACnCL,8BAA8B,EAC7BA;EACA,CACD,CAAC,EACA,CAAEE,cAAc,IAAI,CAAEK,cAAc,KACrCa,aAAA,CAAClC,WAAW,CAACoC,IAAI;IAACS,KAAK,EAAC;EAAM,CAAE,CAChC,EACDX,aAAA,CAACjC,QAAQ,MAAE,CAAC,EACZiC,aAAA,CAAC1C,kBAAkB,MAAE,CACV,CACR,CAAC;AAER;AAEA,eAAeqB,MAAM","ignoreList":[]}
1
+ {"version":3,"names":["privateApis","editorPrivateApis","useSelect","__unstableMotion","motion","FullscreenModeClose","PostEditorMoreMenu","MainDashboardButton","store","editPostStore","unlock","Header","EditorHeader","slideX","hidden","x","distractionFreeInactive","hover","transition","type","delay","setEntitiesSavedStatesCallback","initialPost","hasActiveMetaboxes","select","hasMetaBoxes","createElement","forceIsDirty","Slot","div","variants","showTooltip"],"sources":["@wordpress/edit-post/src/components/header/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\nimport { __unstableMotion as motion } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport FullscreenModeClose from './fullscreen-mode-close';\nimport PostEditorMoreMenu from './more-menu';\nimport MainDashboardButton from './main-dashboard-button';\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Header: EditorHeader } = unlock( editorPrivateApis );\n\nconst slideX = {\n\thidden: { x: '-100%' },\n\tdistractionFreeInactive: { x: 0 },\n\thover: { x: 0, transition: { type: 'tween', delay: 0.2 } },\n};\n\nfunction Header( { setEntitiesSavedStatesCallback, initialPost } ) {\n\tconst { hasActiveMetaboxes } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<EditorHeader\n\t\t\tforceIsDirty={ hasActiveMetaboxes }\n\t\t\tsetEntitiesSavedStatesCallback={ setEntitiesSavedStatesCallback }\n\t\t>\n\t\t\t<MainDashboardButton.Slot>\n\t\t\t\t<motion.div\n\t\t\t\t\tvariants={ slideX }\n\t\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\t>\n\t\t\t\t\t<FullscreenModeClose\n\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\tinitialPost={ initialPost }\n\t\t\t\t\t/>\n\t\t\t\t</motion.div>\n\t\t\t</MainDashboardButton.Slot>\n\t\t\t<PostEditorMoreMenu />\n\t\t</EditorHeader>\n\t);\n}\n\nexport default Header;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,gBAAgB,IAAIC,MAAM,QAAQ,uBAAuB;;AAElE;AACA;AACA;AACA,OAAOC,mBAAmB,MAAM,yBAAyB;AACzD,OAAOC,kBAAkB,MAAM,aAAa;AAC5C,OAAOC,mBAAmB,MAAM,yBAAyB;AACzD,SAASC,KAAK,IAAIC,aAAa,QAAQ,aAAa;AACpD,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC,MAAM,EAAEC;AAAa,CAAC,GAAGF,MAAM,CAAET,iBAAkB,CAAC;AAE5D,MAAMY,MAAM,GAAG;EACdC,MAAM,EAAE;IAAEC,CAAC,EAAE;EAAQ,CAAC;EACtBC,uBAAuB,EAAE;IAAED,CAAC,EAAE;EAAE,CAAC;EACjCE,KAAK,EAAE;IAAEF,CAAC,EAAE,CAAC;IAAEG,UAAU,EAAE;MAAEC,IAAI,EAAE,OAAO;MAAEC,KAAK,EAAE;IAAI;EAAE;AAC1D,CAAC;AAED,SAAST,MAAMA,CAAE;EAAEU,8BAA8B;EAAEC;AAAY,CAAC,EAAG;EAClE,MAAM;IAAEC;EAAmB,CAAC,GAAGrB,SAAS,CAAIsB,MAAM,IAAM;IACvD,OAAO;MACND,kBAAkB,EAAEC,MAAM,CAAEf,aAAc,CAAC,CAACgB,YAAY,CAAC;IAC1D,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,OACCC,aAAA,CAACd,YAAY;IACZe,YAAY,EAAGJ,kBAAoB;IACnCF,8BAA8B,EAAGA;EAAgC,GAEjEK,aAAA,CAACnB,mBAAmB,CAACqB,IAAI,QACxBF,aAAA,CAACtB,MAAM,CAACyB,GAAG;IACVC,QAAQ,EAAGjB,MAAQ;IACnBK,UAAU,EAAG;MAAEC,IAAI,EAAE,OAAO;MAAEC,KAAK,EAAE;IAAI;EAAG,GAE5CM,aAAA,CAACrB,mBAAmB;IACnB0B,WAAW;IACXT,WAAW,EAAGA;EAAa,CAC3B,CACU,CACa,CAAC,EAC3BI,aAAA,CAACpB,kBAAkB,MAAE,CACR,CAAC;AAEjB;AAEA,eAAeK,MAAM","ignoreList":[]}
@@ -22,7 +22,7 @@ function ManagePatternsMenuItem() {
22
22
  // The site editor and templates both check whether the user has
23
23
  // edit_theme_options capabilities. We can leverage that here and not
24
24
  // display the manage patterns link if the user can't access it.
25
- return canUser('read', 'templates') ? patternsUrl : defaultUrl;
25
+ return canUser('create', 'templates') ? patternsUrl : defaultUrl;
26
26
  }, []);
27
27
  return createElement(MenuItem, {
28
28
  role: "menuitem",
@@ -1 +1 @@
1
- {"version":3,"names":["MenuItem","store","coreStore","useSelect","__","addQueryArgs","ManagePatternsMenuItem","url","select","canUser","defaultUrl","post_type","patternsUrl","path","createElement","role","href"],"sources":["@wordpress/edit-post/src/components/header/more-menu/manage-patterns-menu-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { addQueryArgs } from '@wordpress/url';\n\nfunction ManagePatternsMenuItem() {\n\tconst url = useSelect( ( select ) => {\n\t\tconst { canUser } = select( coreStore );\n\t\tconst defaultUrl = addQueryArgs( 'edit.php', {\n\t\t\tpost_type: 'wp_block',\n\t\t} );\n\t\tconst patternsUrl = addQueryArgs( 'site-editor.php', {\n\t\t\tpath: '/patterns',\n\t\t} );\n\n\t\t// The site editor and templates both check whether the user has\n\t\t// edit_theme_options capabilities. We can leverage that here and not\n\t\t// display the manage patterns link if the user can't access it.\n\t\treturn canUser( 'read', 'templates' ) ? patternsUrl : defaultUrl;\n\t}, [] );\n\n\treturn (\n\t\t<MenuItem role=\"menuitem\" href={ url }>\n\t\t\t{ __( 'Manage patterns' ) }\n\t\t</MenuItem>\n\t);\n}\n\nexport default ManagePatternsMenuItem;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,YAAY,QAAQ,gBAAgB;AAE7C,SAASC,sBAAsBA,CAAA,EAAG;EACjC,MAAMC,GAAG,GAAGJ,SAAS,CAAIK,MAAM,IAAM;IACpC,MAAM;MAAEC;IAAQ,CAAC,GAAGD,MAAM,CAAEN,SAAU,CAAC;IACvC,MAAMQ,UAAU,GAAGL,YAAY,CAAE,UAAU,EAAE;MAC5CM,SAAS,EAAE;IACZ,CAAE,CAAC;IACH,MAAMC,WAAW,GAAGP,YAAY,CAAE,iBAAiB,EAAE;MACpDQ,IAAI,EAAE;IACP,CAAE,CAAC;;IAEH;IACA;IACA;IACA,OAAOJ,OAAO,CAAE,MAAM,EAAE,WAAY,CAAC,GAAGG,WAAW,GAAGF,UAAU;EACjE,CAAC,EAAE,EAAG,CAAC;EAEP,OACCI,aAAA,CAACd,QAAQ;IAACe,IAAI,EAAC,UAAU;IAACC,IAAI,EAAGT;EAAK,GACnCH,EAAE,CAAE,iBAAkB,CACf,CAAC;AAEb;AAEA,eAAeE,sBAAsB","ignoreList":[]}
1
+ {"version":3,"names":["MenuItem","store","coreStore","useSelect","__","addQueryArgs","ManagePatternsMenuItem","url","select","canUser","defaultUrl","post_type","patternsUrl","path","createElement","role","href"],"sources":["@wordpress/edit-post/src/components/header/more-menu/manage-patterns-menu-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { addQueryArgs } from '@wordpress/url';\n\nfunction ManagePatternsMenuItem() {\n\tconst url = useSelect( ( select ) => {\n\t\tconst { canUser } = select( coreStore );\n\t\tconst defaultUrl = addQueryArgs( 'edit.php', {\n\t\t\tpost_type: 'wp_block',\n\t\t} );\n\t\tconst patternsUrl = addQueryArgs( 'site-editor.php', {\n\t\t\tpath: '/patterns',\n\t\t} );\n\n\t\t// The site editor and templates both check whether the user has\n\t\t// edit_theme_options capabilities. We can leverage that here and not\n\t\t// display the manage patterns link if the user can't access it.\n\t\treturn canUser( 'create', 'templates' ) ? patternsUrl : defaultUrl;\n\t}, [] );\n\n\treturn (\n\t\t<MenuItem role=\"menuitem\" href={ url }>\n\t\t\t{ __( 'Manage patterns' ) }\n\t\t</MenuItem>\n\t);\n}\n\nexport default ManagePatternsMenuItem;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,YAAY,QAAQ,gBAAgB;AAE7C,SAASC,sBAAsBA,CAAA,EAAG;EACjC,MAAMC,GAAG,GAAGJ,SAAS,CAAIK,MAAM,IAAM;IACpC,MAAM;MAAEC;IAAQ,CAAC,GAAGD,MAAM,CAAEN,SAAU,CAAC;IACvC,MAAMQ,UAAU,GAAGL,YAAY,CAAE,UAAU,EAAE;MAC5CM,SAAS,EAAE;IACZ,CAAE,CAAC;IACH,MAAMC,WAAW,GAAGP,YAAY,CAAE,iBAAiB,EAAE;MACpDQ,IAAI,EAAE;IACP,CAAE,CAAC;;IAEH;IACA;IACA;IACA,OAAOJ,OAAO,CAAE,QAAQ,EAAE,WAAY,CAAC,GAAGG,WAAW,GAAGF,UAAU;EACnE,CAAC,EAAE,EAAG,CAAC;EAEP,OACCI,aAAA,CAACd,QAAQ;IAACe,IAAI,EAAC,UAAU;IAACC,IAAI,EAAGT;EAAK,GACnCH,EAAE,CAAE,iBAAkB,CACf,CAAC;AAEb;AAEA,eAAeE,sBAAsB","ignoreList":[]}
@@ -2,7 +2,7 @@ import { createElement, Fragment } from "react";
2
2
  /**
3
3
  * External dependencies
4
4
  */
5
- import classnames from 'classnames';
5
+ import clsx from 'clsx';
6
6
 
7
7
  /**
8
8
  * WordPress dependencies
@@ -14,13 +14,14 @@ import { ScrollLock } from '@wordpress/components';
14
14
  import { useViewportMatch } from '@wordpress/compose';
15
15
  import { PluginArea } from '@wordpress/plugins';
16
16
  import { __, _x, sprintf } from '@wordpress/i18n';
17
- import { useState, useEffect, useCallback, useMemo } from '@wordpress/element';
17
+ import { useState, useCallback, useMemo } from '@wordpress/element';
18
18
  import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
19
19
  import { store as noticesStore } from '@wordpress/notices';
20
20
  import { store as preferencesStore } from '@wordpress/preferences';
21
21
  import { privateApis as commandsPrivateApis } from '@wordpress/commands';
22
22
  import { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';
23
23
  import { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';
24
+ import { addQueryArgs } from '@wordpress/url';
24
25
 
25
26
  /**
26
27
  * Internal dependencies
@@ -31,7 +32,6 @@ import EditPostKeyboardShortcuts from '../keyboard-shortcuts';
31
32
  import InitPatternModal from '../init-pattern-modal';
32
33
  import BrowserURL from '../browser-url';
33
34
  import Header from '../header';
34
- import SettingsSidebar from '../sidebar/settings-sidebar';
35
35
  import MetaBoxes from '../meta-boxes';
36
36
  import WelcomeGuide from '../welcome-guide';
37
37
  import { store as editPostStore } from '../../store';
@@ -53,7 +53,8 @@ const {
53
53
  FullscreenMode,
54
54
  SavePublishPanels,
55
55
  InterfaceSkeleton,
56
- interfaceStore
56
+ interfaceStore,
57
+ Sidebar
57
58
  } = unlock(editorPrivateApis);
58
59
  const {
59
60
  BlockKeyboardShortcuts
@@ -110,7 +111,6 @@ function Layout({
110
111
  useCommands();
111
112
  useCommonCommands();
112
113
  const isMobileViewport = useViewportMatch('medium', '<');
113
- const isHugeViewport = useViewportMatch('huge', '>=');
114
114
  const isWideViewport = useViewportMatch('large');
115
115
  const isLargeViewport = useViewportMatch('medium');
116
116
  const {
@@ -119,9 +119,6 @@ function Layout({
119
119
  const {
120
120
  createErrorNotice
121
121
  } = useDispatch(noticesStore);
122
- const {
123
- setIsInserterOpened
124
- } = useDispatch(editorStore);
125
122
  const {
126
123
  mode,
127
124
  isFullscreenActive,
@@ -139,7 +136,9 @@ function Layout({
139
136
  showMetaBoxes,
140
137
  documentLabel,
141
138
  hasHistory,
142
- hasBlockBreadcrumbs
139
+ hasBlockBreadcrumbs,
140
+ blockEditorMode,
141
+ isEditingTemplate
143
142
  } = useSelect(select => {
144
143
  const {
145
144
  get
@@ -168,7 +167,9 @@ function Layout({
168
167
  documentLabel: postTypeLabel || _x('Document', 'noun'),
169
168
  hasBlockSelected: !!select(blockEditorStore).getBlockSelectionStart(),
170
169
  hasHistory: !!getEditorSettings().onNavigateToPreviousEntityRecord,
171
- hasBlockBreadcrumbs: get('core', 'showBlockBreadcrumbs')
170
+ hasBlockBreadcrumbs: get('core', 'showBlockBreadcrumbs'),
171
+ blockEditorMode: select(blockEditorStore).__unstableGetEditorMode(),
172
+ isEditingTemplate: select(editorStore).getCurrentPostType() === 'wp_template'
172
173
  };
173
174
  }, []);
174
175
 
@@ -177,18 +178,6 @@ function Layout({
177
178
  useCommandContext(commandContext);
178
179
  const styles = useEditorStyles();
179
180
 
180
- // Inserter and Sidebars are mutually exclusive
181
- useEffect(() => {
182
- if (sidebarIsOpened && !isHugeViewport) {
183
- setIsInserterOpened(false);
184
- }
185
- }, [isHugeViewport, setIsInserterOpened, sidebarIsOpened]);
186
- useEffect(() => {
187
- if (isInserterOpened && !isHugeViewport) {
188
- closeGeneralSidebar();
189
- }
190
- }, [closeGeneralSidebar, isInserterOpened, isHugeViewport]);
191
-
192
181
  // Local state for save panel.
193
182
  // Note 'truthy' callback implies an open panel.
194
183
  const [entitiesSavedStatesCallback, setEntitiesSavedStatesCallback] = useState(false);
@@ -205,7 +194,7 @@ function Layout({
205
194
  } else {
206
195
  document.body.classList.remove('show-icon-labels');
207
196
  }
208
- const className = classnames('edit-post-layout', 'is-mode-' + mode, {
197
+ const className = clsx('edit-post-layout', 'is-mode-' + mode, {
209
198
  'is-sidebar-opened': sidebarIsOpened,
210
199
  'has-metaboxes': hasActiveMetaboxes,
211
200
  'is-distraction-free': isDistractionFree && isWideViewport,
@@ -229,6 +218,44 @@ function Layout({
229
218
  createErrorNotice(sprintf( /* translators: %s: plugin name */
230
219
  __('The "%s" plugin has encountered an error and cannot be rendered.'), name));
231
220
  }
221
+ const {
222
+ createSuccessNotice
223
+ } = useDispatch(noticesStore);
224
+ const onActionPerformed = useCallback((actionId, items) => {
225
+ switch (actionId) {
226
+ case 'move-to-trash':
227
+ {
228
+ document.location.href = addQueryArgs('edit.php', {
229
+ trashed: 1,
230
+ post_type: items[0].type,
231
+ ids: items[0].id
232
+ });
233
+ }
234
+ break;
235
+ case 'duplicate-post':
236
+ {
237
+ const newItem = items[0];
238
+ const title = typeof newItem.title === 'string' ? newItem.title : newItem.title?.rendered;
239
+ createSuccessNotice(sprintf(
240
+ // translators: %s: Title of the created post e.g: "Post 1".
241
+ __('"%s" successfully created.'), title), {
242
+ type: 'snackbar',
243
+ id: 'duplicate-post-action',
244
+ actions: [{
245
+ label: __('Edit'),
246
+ onClick: () => {
247
+ const postId = newItem.id;
248
+ document.location.href = addQueryArgs('post.php', {
249
+ post: postId,
250
+ action: 'edit'
251
+ });
252
+ }
253
+ }]
254
+ });
255
+ }
256
+ break;
257
+ }
258
+ }, [createSuccessNotice]);
232
259
  return createElement(Fragment, null, createElement(FullscreenMode, {
233
260
  isActive: isFullscreenActive
234
261
  }), createElement(BrowserURL, {
@@ -261,7 +288,7 @@ function Layout({
261
288
  }), createElement(MetaBoxes, {
262
289
  location: "advanced"
263
290
  })), isMobileViewport && sidebarIsOpened && createElement(ScrollLock, null)),
264
- footer: !isDistractionFree && !isMobileViewport && showBlockBreadcrumbs && isRichEditingEnabled && mode === 'visual' && createElement("div", {
291
+ footer: !isDistractionFree && !isMobileViewport && showBlockBreadcrumbs && isRichEditingEnabled && blockEditorMode !== 'zoom-out' && mode === 'visual' && createElement("div", {
265
292
  className: "edit-post-layout__footer"
266
293
  }, createElement(BlockBreadcrumb, {
267
294
  rootLabelText: documentLabel
@@ -278,7 +305,12 @@ function Layout({
278
305
  }
279
306
  }), createElement(WelcomeGuide, null), createElement(InitPatternModal, null), createElement(PluginArea, {
280
307
  onError: onPluginAreaError
281
- }), !isDistractionFree && createElement(SettingsSidebar, null));
308
+ }), !isDistractionFree && createElement(Sidebar, {
309
+ onActionPerformed: onActionPerformed,
310
+ extraPanels: !isEditingTemplate && createElement(MetaBoxes, {
311
+ location: "side"
312
+ })
313
+ }));
282
314
  }
283
315
  export default Layout;
284
316
  //# sourceMappingURL=index.js.map