@wordpress/edit-post 7.29.0 → 7.30.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 (43) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/editor-initialization/index.js +3 -6
  3. package/build/components/editor-initialization/index.js.map +1 -1
  4. package/build/components/editor-initialization/listener-hooks.js +6 -10
  5. package/build/components/editor-initialization/listener-hooks.js.map +1 -1
  6. package/build/components/header/header-toolbar/index.native.js.map +1 -1
  7. package/build/components/header/index.js +18 -11
  8. package/build/components/header/index.js.map +1 -1
  9. package/build/components/header/more-menu/index.js +10 -2
  10. package/build/components/header/more-menu/index.js.map +1 -1
  11. package/build/editor.js +1 -15
  12. package/build/editor.js.map +1 -1
  13. package/build/store/selectors.js +1 -1
  14. package/build/store/selectors.js.map +1 -1
  15. package/build-module/components/editor-initialization/index.js +3 -6
  16. package/build-module/components/editor-initialization/index.js.map +1 -1
  17. package/build-module/components/editor-initialization/listener-hooks.js +6 -10
  18. package/build-module/components/editor-initialization/listener-hooks.js.map +1 -1
  19. package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
  20. package/build-module/components/header/index.js +19 -12
  21. package/build-module/components/header/index.js.map +1 -1
  22. package/build-module/components/header/more-menu/index.js +12 -4
  23. package/build-module/components/header/more-menu/index.js.map +1 -1
  24. package/build-module/editor.js +1 -15
  25. package/build-module/editor.js.map +1 -1
  26. package/build-module/store/selectors.js +1 -1
  27. package/build-module/store/selectors.js.map +1 -1
  28. package/build-style/classic-rtl.css +1 -0
  29. package/build-style/classic.css +1 -0
  30. package/build-style/style-rtl.css +5 -32
  31. package/build-style/style.css +5 -32
  32. package/package.json +32 -32
  33. package/src/components/editor-initialization/index.js +3 -4
  34. package/src/components/editor-initialization/listener-hooks.js +20 -22
  35. package/src/components/editor-initialization/test/listener-hooks.js +8 -8
  36. package/src/components/header/header-toolbar/index.native.js +1 -1
  37. package/src/components/header/index.js +31 -28
  38. package/src/components/header/more-menu/index.js +13 -9
  39. package/src/components/header/style.scss +4 -0
  40. package/src/components/header/test/index.js +4 -14
  41. package/src/components/sidebar/plugin-post-publish-panel/test/index.js +1 -1
  42. package/src/editor.js +1 -12
  43. package/src/store/selectors.js +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 7.30.0 (2024-03-06)
6
+
5
7
  ## 7.29.0 (2024-02-21)
6
8
 
7
9
  ## 7.28.0 (2024-02-09)
@@ -13,14 +13,11 @@ var _listenerHooks = require("./listener-hooks");
13
13
  * Data component used for initializing the editor and re-initializes
14
14
  * when postId changes or on unmount.
15
15
  *
16
- * @param {number} postId The id of the post.
17
16
  * @return {null} This is a data component so does not render any ui.
18
17
  */
19
- function EditorInitialization({
20
- postId
21
- }) {
22
- (0, _listenerHooks.useBlockSelectionListener)(postId);
23
- (0, _listenerHooks.useUpdatePostLinkListener)(postId);
18
+ function EditorInitialization() {
19
+ (0, _listenerHooks.useBlockSelectionListener)();
20
+ (0, _listenerHooks.useUpdatePostLinkListener)();
24
21
  return null;
25
22
  }
26
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_listenerHooks","require","EditorInitialization","postId","useBlockSelectionListener","useUpdatePostLinkListener"],"sources":["@wordpress/edit-post/src/components/editor-initialization/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tuseBlockSelectionListener,\n\tuseUpdatePostLinkListener,\n} from './listener-hooks';\n\n/**\n * Data component used for initializing the editor and re-initializes\n * when postId changes or on unmount.\n *\n * @param {number} postId The id of the post.\n * @return {null} This is a data component so does not render any ui.\n */\nexport default function EditorInitialization( { postId } ) {\n\tuseBlockSelectionListener( postId );\n\tuseUpdatePostLinkListener( postId );\n\treturn null;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,cAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,oBAAoBA,CAAE;EAAEC;AAAO,CAAC,EAAG;EAC1D,IAAAC,wCAAyB,EAAED,MAAO,CAAC;EACnC,IAAAE,wCAAyB,EAAEF,MAAO,CAAC;EACnC,OAAO,IAAI;AACZ"}
1
+ {"version":3,"names":["_listenerHooks","require","EditorInitialization","useBlockSelectionListener","useUpdatePostLinkListener"],"sources":["@wordpress/edit-post/src/components/editor-initialization/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tuseBlockSelectionListener,\n\tuseUpdatePostLinkListener,\n} from './listener-hooks';\n\n/**\n * Data component used for initializing the editor and re-initializes\n * when postId changes or on unmount.\n *\n * @return {null} This is a data component so does not render any ui.\n */\nexport default function EditorInitialization() {\n\tuseBlockSelectionListener();\n\tuseUpdatePostLinkListener();\n\treturn null;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,cAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,oBAAoBA,CAAA,EAAG;EAC9C,IAAAC,wCAAyB,EAAC,CAAC;EAC3B,IAAAC,wCAAyB,EAAC,CAAC;EAC3B,OAAO,IAAI;AACZ"}
@@ -21,10 +21,8 @@ var _constants = require("../../store/constants");
21
21
  /**
22
22
  * This listener hook monitors for block selection and triggers the appropriate
23
23
  * sidebar state.
24
- *
25
- * @param {number} postId The current post id.
26
24
  */
27
- const useBlockSelectionListener = postId => {
25
+ const useBlockSelectionListener = () => {
28
26
  const {
29
27
  hasBlockSelection,
30
28
  isEditorSidebarOpened,
@@ -38,7 +36,7 @@ const useBlockSelectionListener = postId => {
38
36
  isEditorSidebarOpened: select(_constants.STORE_NAME).isEditorSidebarOpened(),
39
37
  isDistractionFree: get('core', 'distractionFree')
40
38
  };
41
- }, [postId]);
39
+ }, []);
42
40
  const {
43
41
  openGeneralSidebar
44
42
  } = (0, _data.useDispatch)(_constants.STORE_NAME);
@@ -51,26 +49,24 @@ const useBlockSelectionListener = postId => {
51
49
  } else {
52
50
  openGeneralSidebar('edit-post/document');
53
51
  }
54
- }, [hasBlockSelection, isEditorSidebarOpened]);
52
+ }, [hasBlockSelection, isDistractionFree, isEditorSidebarOpened, openGeneralSidebar]);
55
53
  };
56
54
 
57
55
  /**
58
56
  * This listener hook monitors any change in permalink and updates the view
59
57
  * post link in the admin bar.
60
- *
61
- * @param {number} postId
62
58
  */
63
59
  exports.useBlockSelectionListener = useBlockSelectionListener;
64
- const useUpdatePostLinkListener = postId => {
60
+ const useUpdatePostLinkListener = () => {
65
61
  const {
66
62
  newPermalink
67
63
  } = (0, _data.useSelect)(select => ({
68
64
  newPermalink: select(_editor.store).getCurrentPost().link
69
- }), [postId]);
65
+ }), []);
70
66
  const nodeToUpdate = (0, _element.useRef)();
71
67
  (0, _element.useEffect)(() => {
72
68
  nodeToUpdate.current = document.querySelector(_constants.VIEW_AS_PREVIEW_LINK_SELECTOR) || document.querySelector(_constants.VIEW_AS_LINK_SELECTOR);
73
- }, [postId]);
69
+ }, []);
74
70
  (0, _element.useEffect)(() => {
75
71
  if (!newPermalink || !nodeToUpdate.current) {
76
72
  return;
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_element","_blockEditor","_editor","_preferences","_constants","useBlockSelectionListener","postId","hasBlockSelection","isEditorSidebarOpened","isDistractionFree","useSelect","select","get","preferencesStore","blockEditorStore","getBlockSelectionStart","STORE_NAME","openGeneralSidebar","useDispatch","useEffect","exports","useUpdatePostLinkListener","newPermalink","editorStore","getCurrentPost","link","nodeToUpdate","useRef","current","document","querySelector","VIEW_AS_PREVIEW_LINK_SELECTOR","VIEW_AS_LINK_SELECTOR","setAttribute"],"sources":["@wordpress/edit-post/src/components/editor-initialization/listener-hooks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport {\n\tSTORE_NAME,\n\tVIEW_AS_LINK_SELECTOR,\n\tVIEW_AS_PREVIEW_LINK_SELECTOR,\n} from '../../store/constants';\n\n/**\n * This listener hook monitors for block selection and triggers the appropriate\n * sidebar state.\n *\n * @param {number} postId The current post id.\n */\nexport const useBlockSelectionListener = ( postId ) => {\n\tconst { hasBlockSelection, isEditorSidebarOpened, isDistractionFree } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst { get } = select( preferencesStore );\n\t\t\t\treturn {\n\t\t\t\t\thasBlockSelection:\n\t\t\t\t\t\t!! select( blockEditorStore ).getBlockSelectionStart(),\n\t\t\t\t\tisEditorSidebarOpened:\n\t\t\t\t\t\tselect( STORE_NAME ).isEditorSidebarOpened(),\n\t\t\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ postId ]\n\t\t);\n\n\tconst { openGeneralSidebar } = useDispatch( STORE_NAME );\n\n\tuseEffect( () => {\n\t\tif ( ! isEditorSidebarOpened || isDistractionFree ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( hasBlockSelection ) {\n\t\t\topenGeneralSidebar( 'edit-post/block' );\n\t\t} else {\n\t\t\topenGeneralSidebar( 'edit-post/document' );\n\t\t}\n\t}, [ hasBlockSelection, isEditorSidebarOpened ] );\n};\n\n/**\n * This listener hook monitors any change in permalink and updates the view\n * post link in the admin bar.\n *\n * @param {number} postId\n */\nexport const useUpdatePostLinkListener = ( postId ) => {\n\tconst { newPermalink } = useSelect(\n\t\t( select ) => ( {\n\t\t\tnewPermalink: select( editorStore ).getCurrentPost().link,\n\t\t} ),\n\t\t[ postId ]\n\t);\n\tconst nodeToUpdate = useRef();\n\n\tuseEffect( () => {\n\t\tnodeToUpdate.current =\n\t\t\tdocument.querySelector( VIEW_AS_PREVIEW_LINK_SELECTOR ) ||\n\t\t\tdocument.querySelector( VIEW_AS_LINK_SELECTOR );\n\t}, [ postId ] );\n\n\tuseEffect( () => {\n\t\tif ( ! newPermalink || ! nodeToUpdate.current ) {\n\t\t\treturn;\n\t\t}\n\t\tnodeToUpdate.current.setAttribute( 'href', newPermalink );\n\t}, [ newPermalink ] );\n};\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAKA,IAAAK,UAAA,GAAAL,OAAA;AAZA;AACA;AACA;;AAOA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMM,yBAAyB,GAAKC,MAAM,IAAM;EACtD,MAAM;IAAEC,iBAAiB;IAAEC,qBAAqB;IAAEC;EAAkB,CAAC,GACpE,IAAAC,eAAS,EACNC,MAAM,IAAM;IACb,MAAM;MAAEC;IAAI,CAAC,GAAGD,MAAM,CAAEE,kBAAiB,CAAC;IAC1C,OAAO;MACNN,iBAAiB,EAChB,CAAC,CAAEI,MAAM,CAAEG,kBAAiB,CAAC,CAACC,sBAAsB,CAAC,CAAC;MACvDP,qBAAqB,EACpBG,MAAM,CAAEK,qBAAW,CAAC,CAACR,qBAAqB,CAAC,CAAC;MAC7CC,iBAAiB,EAAEG,GAAG,CAAE,MAAM,EAAE,iBAAkB;IACnD,CAAC;EACF,CAAC,EACD,CAAEN,MAAM,CACT,CAAC;EAEF,MAAM;IAAEW;EAAmB,CAAC,GAAG,IAAAC,iBAAW,EAAEF,qBAAW,CAAC;EAExD,IAAAG,kBAAS,EAAE,MAAM;IAChB,IAAK,CAAEX,qBAAqB,IAAIC,iBAAiB,EAAG;MACnD;IACD;IACA,IAAKF,iBAAiB,EAAG;MACxBU,kBAAkB,CAAE,iBAAkB,CAAC;IACxC,CAAC,MAAM;MACNA,kBAAkB,CAAE,oBAAqB,CAAC;IAC3C;EACD,CAAC,EAAE,CAAEV,iBAAiB,EAAEC,qBAAqB,CAAG,CAAC;AAClD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AALAY,OAAA,CAAAf,yBAAA,GAAAA,yBAAA;AAMO,MAAMgB,yBAAyB,GAAKf,MAAM,IAAM;EACtD,MAAM;IAAEgB;EAAa,CAAC,GAAG,IAAAZ,eAAS,EAC/BC,MAAM,KAAQ;IACfW,YAAY,EAAEX,MAAM,CAAEY,aAAY,CAAC,CAACC,cAAc,CAAC,CAAC,CAACC;EACtD,CAAC,CAAE,EACH,CAAEnB,MAAM,CACT,CAAC;EACD,MAAMoB,YAAY,GAAG,IAAAC,eAAM,EAAC,CAAC;EAE7B,IAAAR,kBAAS,EAAE,MAAM;IAChBO,YAAY,CAACE,OAAO,GACnBC,QAAQ,CAACC,aAAa,CAAEC,wCAA8B,CAAC,IACvDF,QAAQ,CAACC,aAAa,CAAEE,gCAAsB,CAAC;EACjD,CAAC,EAAE,CAAE1B,MAAM,CAAG,CAAC;EAEf,IAAAa,kBAAS,EAAE,MAAM;IAChB,IAAK,CAAEG,YAAY,IAAI,CAAEI,YAAY,CAACE,OAAO,EAAG;MAC/C;IACD;IACAF,YAAY,CAACE,OAAO,CAACK,YAAY,CAAE,MAAM,EAAEX,YAAa,CAAC;EAC1D,CAAC,EAAE,CAAEA,YAAY,CAAG,CAAC;AACtB,CAAC;AAACF,OAAA,CAAAC,yBAAA,GAAAA,yBAAA"}
1
+ {"version":3,"names":["_data","require","_element","_blockEditor","_editor","_preferences","_constants","useBlockSelectionListener","hasBlockSelection","isEditorSidebarOpened","isDistractionFree","useSelect","select","get","preferencesStore","blockEditorStore","getBlockSelectionStart","STORE_NAME","openGeneralSidebar","useDispatch","useEffect","exports","useUpdatePostLinkListener","newPermalink","editorStore","getCurrentPost","link","nodeToUpdate","useRef","current","document","querySelector","VIEW_AS_PREVIEW_LINK_SELECTOR","VIEW_AS_LINK_SELECTOR","setAttribute"],"sources":["@wordpress/edit-post/src/components/editor-initialization/listener-hooks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport {\n\tSTORE_NAME,\n\tVIEW_AS_LINK_SELECTOR,\n\tVIEW_AS_PREVIEW_LINK_SELECTOR,\n} from '../../store/constants';\n\n/**\n * This listener hook monitors for block selection and triggers the appropriate\n * sidebar state.\n */\nexport const useBlockSelectionListener = () => {\n\tconst { hasBlockSelection, isEditorSidebarOpened, isDistractionFree } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\treturn {\n\t\t\t\thasBlockSelection:\n\t\t\t\t\t!! select( blockEditorStore ).getBlockSelectionStart(),\n\t\t\t\tisEditorSidebarOpened:\n\t\t\t\t\tselect( STORE_NAME ).isEditorSidebarOpened(),\n\t\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\t};\n\t\t}, [] );\n\n\tconst { openGeneralSidebar } = useDispatch( STORE_NAME );\n\n\tuseEffect( () => {\n\t\tif ( ! isEditorSidebarOpened || isDistractionFree ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( hasBlockSelection ) {\n\t\t\topenGeneralSidebar( 'edit-post/block' );\n\t\t} else {\n\t\t\topenGeneralSidebar( 'edit-post/document' );\n\t\t}\n\t}, [\n\t\thasBlockSelection,\n\t\tisDistractionFree,\n\t\tisEditorSidebarOpened,\n\t\topenGeneralSidebar,\n\t] );\n};\n\n/**\n * This listener hook monitors any change in permalink and updates the view\n * post link in the admin bar.\n */\nexport const useUpdatePostLinkListener = () => {\n\tconst { newPermalink } = useSelect(\n\t\t( select ) => ( {\n\t\t\tnewPermalink: select( editorStore ).getCurrentPost().link,\n\t\t} ),\n\t\t[]\n\t);\n\tconst nodeToUpdate = useRef();\n\n\tuseEffect( () => {\n\t\tnodeToUpdate.current =\n\t\t\tdocument.querySelector( VIEW_AS_PREVIEW_LINK_SELECTOR ) ||\n\t\t\tdocument.querySelector( VIEW_AS_LINK_SELECTOR );\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( ! newPermalink || ! nodeToUpdate.current ) {\n\t\t\treturn;\n\t\t}\n\t\tnodeToUpdate.current.setAttribute( 'href', newPermalink );\n\t}, [ newPermalink ] );\n};\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAKA,IAAAK,UAAA,GAAAL,OAAA;AAZA;AACA;AACA;;AAOA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACO,MAAMM,yBAAyB,GAAGA,CAAA,KAAM;EAC9C,MAAM;IAAEC,iBAAiB;IAAEC,qBAAqB;IAAEC;EAAkB,CAAC,GACpE,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACxB,MAAM;MAAEC;IAAI,CAAC,GAAGD,MAAM,CAAEE,kBAAiB,CAAC;IAC1C,OAAO;MACNN,iBAAiB,EAChB,CAAC,CAAEI,MAAM,CAAEG,kBAAiB,CAAC,CAACC,sBAAsB,CAAC,CAAC;MACvDP,qBAAqB,EACpBG,MAAM,CAAEK,qBAAW,CAAC,CAACR,qBAAqB,CAAC,CAAC;MAC7CC,iBAAiB,EAAEG,GAAG,CAAE,MAAM,EAAE,iBAAkB;IACnD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAER,MAAM;IAAEK;EAAmB,CAAC,GAAG,IAAAC,iBAAW,EAAEF,qBAAW,CAAC;EAExD,IAAAG,kBAAS,EAAE,MAAM;IAChB,IAAK,CAAEX,qBAAqB,IAAIC,iBAAiB,EAAG;MACnD;IACD;IACA,IAAKF,iBAAiB,EAAG;MACxBU,kBAAkB,CAAE,iBAAkB,CAAC;IACxC,CAAC,MAAM;MACNA,kBAAkB,CAAE,oBAAqB,CAAC;IAC3C;EACD,CAAC,EAAE,CACFV,iBAAiB,EACjBE,iBAAiB,EACjBD,qBAAqB,EACrBS,kBAAkB,CACjB,CAAC;AACJ,CAAC;;AAED;AACA;AACA;AACA;AAHAG,OAAA,CAAAd,yBAAA,GAAAA,yBAAA;AAIO,MAAMe,yBAAyB,GAAGA,CAAA,KAAM;EAC9C,MAAM;IAAEC;EAAa,CAAC,GAAG,IAAAZ,eAAS,EAC/BC,MAAM,KAAQ;IACfW,YAAY,EAAEX,MAAM,CAAEY,aAAY,CAAC,CAACC,cAAc,CAAC,CAAC,CAACC;EACtD,CAAC,CAAE,EACH,EACD,CAAC;EACD,MAAMC,YAAY,GAAG,IAAAC,eAAM,EAAC,CAAC;EAE7B,IAAAR,kBAAS,EAAE,MAAM;IAChBO,YAAY,CAACE,OAAO,GACnBC,QAAQ,CAACC,aAAa,CAAEC,wCAA8B,CAAC,IACvDF,QAAQ,CAACC,aAAa,CAAEE,gCAAsB,CAAC;EACjD,CAAC,EAAE,EAAG,CAAC;EAEP,IAAAb,kBAAS,EAAE,MAAM;IAChB,IAAK,CAAEG,YAAY,IAAI,CAAEI,YAAY,CAACE,OAAO,EAAG;MAC/C;IACD;IACAF,YAAY,CAACE,OAAO,CAACK,YAAY,CAAE,MAAM,EAAEX,YAAa,CAAC;EAC1D,CAAC,EAAE,CAAEA,YAAY,CAAG,CAAC;AACtB,CAAC;AAACF,OAAA,CAAAC,yBAAA,GAAAA,yBAAA"}
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_element","_compose","_data","_viewport","_i18n","_blockEditor","_components","_icons","_editor","_blocks","_reactNativeBridge","_style","_interopRequireDefault","_store","shadowStyle","shadowOffset","width","height","shadowOpacity","shadowRadius","elevation","HeaderToolbar","hasRedo","hasUndo","redo","undo","showInserter","showKeyboardHideButton","insertBlock","onHideKeyboard","isRTL","noContentSelected","anchorNodeRef","useRef","containerStyle","usePreferredColorSchemeStyle","styles","borderTopWidth","StyleSheet","hairlineWidth","useEffect","onUndoSubscription","subscribeOnUndoPressed","onRedoSubscription","subscribeOnRedoPressed","remove","toggleUndoButton","toggleRedoButton","scrollViewRef","scrollToStart","Platform","isAndroid","current","scrollToEnd","scrollTo","x","onInsertBlock","useCallback","blockType","createBlock","undefined","source","inserterMethod","renderMediaButtons","_react","createElement","ToolbarGroup","ToolbarButton","key","title","__","icon","imageIcon","onClick","testID","extraProps","hint","videoIcon","galleryIcon","audioIcon","toolbarAriaLabel","shadowColor","showKeyboardButtonStyles","color","View","ref","accessibilityLabel","style","ScrollView","onContentSizeChange","horizontal","showsHorizontalScrollIndicator","keyboardShouldPersistTaps","alwaysBounceHorizontal","contentContainerStyle","Inserter","disabled","BlockToolbar","passedStyle","keyboardClose","_default","exports","default","compose","withSelect","select","getBlockRootClientId","getBlockSelectionEnd","hasInserterItems","hasSelectedBlock","blockEditorStore","getEditorSettings","editorStore","isAnyBlockSelected","hasEditorRedo","hasEditorUndo","editPostStore","getEditorMode","richEditingEnabled","isTextModeEnabled","getSettings","withDispatch","dispatch","clearSelectedBlock","togglePostTitleSelection","withViewportMatch","isLargeViewport"],"sources":["@wordpress/edit-post/src/components/header/header-toolbar/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { ScrollView, StyleSheet, View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useRef, useEffect, Platform } from '@wordpress/element';\nimport { compose, usePreferredColorSchemeStyle } from '@wordpress/compose';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { withViewportMatch } from '@wordpress/viewport';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tInserter,\n\tBlockToolbar,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { ToolbarGroup, ToolbarButton } from '@wordpress/components';\nimport {\n\tkeyboardClose,\n\taudio as audioIcon,\n\tmedia as imageIcon,\n\tvideo as videoIcon,\n\tgallery as galleryIcon,\n} from '@wordpress/icons';\nimport { store as editorStore } from '@wordpress/editor';\nimport { createBlock } from '@wordpress/blocks';\nimport {\n\ttoggleUndoButton,\n\ttoggleRedoButton,\n\tsubscribeOnUndoPressed,\n\tsubscribeOnRedoPressed,\n} from '@wordpress/react-native-bridge';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport { store as editPostStore } from '../../../store';\n\nconst shadowStyle = {\n\tshadowOffset: { width: 2, height: 2 },\n\tshadowOpacity: 1,\n\tshadowRadius: 6,\n\televation: 18,\n};\n\nfunction HeaderToolbar( {\n\thasRedo,\n\thasUndo,\n\tredo,\n\tundo,\n\tshowInserter,\n\tshowKeyboardHideButton,\n\tinsertBlock,\n\tonHideKeyboard,\n\tisRTL,\n\tnoContentSelected,\n} ) {\n\tconst anchorNodeRef = useRef();\n\n\tconst containerStyle = [\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles[ 'header-toolbar__container' ],\n\t\t\tstyles[ 'header-toolbar__container--dark' ]\n\t\t),\n\t\t{ borderTopWidth: StyleSheet.hairlineWidth },\n\t];\n\n\tuseEffect( () => {\n\t\tconst onUndoSubscription = subscribeOnUndoPressed( undo );\n\t\tconst onRedoSubscription = subscribeOnRedoPressed( redo );\n\n\t\treturn () => {\n\t\t\tonUndoSubscription?.remove();\n\t\t\tonRedoSubscription?.remove();\n\t\t};\n\t}, [ undo, redo ] );\n\n\tuseEffect( () => {\n\t\ttoggleUndoButton( ! hasUndo );\n\t}, [ hasUndo ] );\n\n\tuseEffect( () => {\n\t\ttoggleRedoButton( ! hasRedo );\n\t}, [ hasRedo ] );\n\n\tconst scrollViewRef = useRef( null );\n\tconst scrollToStart = () => {\n\t\t// scrollview doesn't seem to automatically adjust to RTL on Android so, scroll to end when Android\n\t\tif ( Platform.isAndroid && isRTL ) {\n\t\t\tscrollViewRef.current.scrollToEnd();\n\t\t} else {\n\t\t\tscrollViewRef.current.scrollTo( { x: 0 } );\n\t\t}\n\t};\n\n\tconst onInsertBlock = useCallback(\n\t\t( blockType ) => () => {\n\t\t\tinsertBlock( createBlock( blockType ), undefined, undefined, true, {\n\t\t\t\tsource: 'inserter_menu',\n\t\t\t\tinserterMethod: 'quick-inserter',\n\t\t\t} );\n\t\t},\n\t\t[ insertBlock ]\n\t);\n\n\tconst renderMediaButtons = (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarButton\n\t\t\t\tkey=\"imageButton\"\n\t\t\t\ttitle={ __( 'Image' ) }\n\t\t\t\ticon={ imageIcon }\n\t\t\t\tonClick={ onInsertBlock( 'core/image' ) }\n\t\t\t\ttestID=\"insert-image-button\"\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: __( 'Insert Image Block' ),\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\tkey=\"videoButton\"\n\t\t\t\ttitle={ __( 'Video' ) }\n\t\t\t\ticon={ videoIcon }\n\t\t\t\tonClick={ onInsertBlock( 'core/video' ) }\n\t\t\t\ttestID=\"insert-video-button\"\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: __( 'Insert Video Block' ),\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\tkey=\"galleryButton\"\n\t\t\t\ttitle={ __( 'Gallery' ) }\n\t\t\t\ticon={ galleryIcon }\n\t\t\t\tonClick={ onInsertBlock( 'core/gallery' ) }\n\t\t\t\ttestID=\"insert-gallery-button\"\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: __( 'Insert Gallery Block' ),\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\tkey=\"audioButton\"\n\t\t\t\ttitle={ __( 'Audio' ) }\n\t\t\t\ticon={ audioIcon }\n\t\t\t\tonClick={ onInsertBlock( 'core/audio' ) }\n\t\t\t\ttestID=\"insert-audio-button\"\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: __( 'Insert Audio Block' ),\n\t\t\t\t} }\n\t\t\t/>\n\t\t</ToolbarGroup>\n\t);\n\n\t/* translators: accessibility text for the editor toolbar */\n\tconst toolbarAriaLabel = __( 'Document tools' );\n\n\tconst shadowColor = usePreferredColorSchemeStyle(\n\t\tstyles[ 'header-toolbar__keyboard-hide-shadow--light' ],\n\t\tstyles[ 'header-toolbar__keyboard-hide-shadow--dark' ]\n\t);\n\tconst showKeyboardButtonStyles = [\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles[ 'header-toolbar__keyboard-hide-container' ],\n\t\t\tstyles[ 'header-toolbar__keyboard-hide-container--dark' ]\n\t\t),\n\t\tshadowStyle,\n\t\t{\n\t\t\tshadowColor: Platform.isAndroid\n\t\t\t\t? styles[ 'header-toolbar__keyboard-hide-shadow--solid' ].color\n\t\t\t\t: shadowColor.color,\n\t\t},\n\t];\n\n\treturn (\n\t\t<View\n\t\t\tref={ anchorNodeRef }\n\t\t\ttestID={ toolbarAriaLabel }\n\t\t\taccessibilityLabel={ toolbarAriaLabel }\n\t\t\tstyle={ containerStyle }\n\t\t>\n\t\t\t<ScrollView\n\t\t\t\tref={ scrollViewRef }\n\t\t\t\tonContentSizeChange={ scrollToStart }\n\t\t\t\thorizontal={ true }\n\t\t\t\tshowsHorizontalScrollIndicator={ false }\n\t\t\t\tkeyboardShouldPersistTaps=\"always\"\n\t\t\t\talwaysBounceHorizontal={ false }\n\t\t\t\tcontentContainerStyle={\n\t\t\t\t\tstyles[ 'header-toolbar__scrollable-content' ]\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<Inserter disabled={ ! showInserter } />\n\n\t\t\t\t{ noContentSelected && renderMediaButtons }\n\t\t\t\t<BlockToolbar anchorNodeRef={ anchorNodeRef.current } />\n\t\t\t</ScrollView>\n\t\t\t{ showKeyboardHideButton && (\n\t\t\t\t<ToolbarGroup passedStyle={ showKeyboardButtonStyles }>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ttitle={ __( 'Hide keyboard' ) }\n\t\t\t\t\t\ticon={ keyboardClose }\n\t\t\t\t\t\tonClick={ onHideKeyboard }\n\t\t\t\t\t\textraProps={ {\n\t\t\t\t\t\t\thint: __( 'Tap to hide the keyboard' ),\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t) }\n\t\t</View>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockRootClientId,\n\t\t\tgetBlockSelectionEnd,\n\t\t\thasInserterItems,\n\t\t\thasSelectedBlock,\n\t\t} = select( blockEditorStore );\n\t\tconst { getEditorSettings } = select( editorStore );\n\t\tconst isAnyBlockSelected = hasSelectedBlock();\n\t\treturn {\n\t\t\thasRedo: select( editorStore ).hasEditorRedo(),\n\t\t\thasUndo: select( editorStore ).hasEditorUndo(),\n\t\t\t// This setting (richEditingEnabled) should not live in the block editor's setting.\n\t\t\tshowInserter:\n\t\t\t\tselect( editPostStore ).getEditorMode() === 'visual' &&\n\t\t\t\tgetEditorSettings().richEditingEnabled &&\n\t\t\t\thasInserterItems(\n\t\t\t\t\tgetBlockRootClientId( getBlockSelectionEnd() )\n\t\t\t\t),\n\t\t\tisTextModeEnabled:\n\t\t\t\tselect( editPostStore ).getEditorMode() === 'text',\n\t\t\tisRTL: select( blockEditorStore ).getSettings().isRTL,\n\t\t\tnoContentSelected: ! isAnyBlockSelected,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { clearSelectedBlock, insertBlock } =\n\t\t\tdispatch( blockEditorStore );\n\t\tconst { togglePostTitleSelection } = dispatch( editorStore );\n\n\t\treturn {\n\t\t\tredo: dispatch( editorStore ).redo,\n\t\t\tundo: dispatch( editorStore ).undo,\n\t\t\tonHideKeyboard() {\n\t\t\t\tclearSelectedBlock();\n\t\t\t\ttogglePostTitleSelection( false );\n\t\t\t},\n\t\t\tinsertBlock,\n\t\t};\n\t} ),\n\twithViewportMatch( { isLargeViewport: 'medium' } ),\n] )( HeaderToolbar );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tB,CAAC;AACF,CAAE,CAAC,EACH,IAAAQ,kBAAY,EAAIC,QAAQ,IAAM;EAC7B,MAAM;IAAEC,kBAAkB;IAAE/F;EAAY,CAAC,GACxC8F,QAAQ,CAAEZ,kBAAiB,CAAC;EAC7B,MAAM;IAAEc;EAAyB,CAAC,GAAGF,QAAQ,CAAEV,aAAY,CAAC;EAE5D,OAAO;IACNxF,IAAI,EAAEkG,QAAQ,CAAEV,aAAY,CAAC,CAACxF,IAAI;IAClCC,IAAI,EAAEiG,QAAQ,CAAEV,aAAY,CAAC,CAACvF,IAAI;IAClCI,cAAcA,CAAA,EAAG;MAChB8F,kBAAkB,CAAC,CAAC;MACpBC,wBAAwB,CAAE,KAAM,CAAC;IAClC,CAAC;IACDhG;EACD,CAAC;AACF,CAAE,CAAC,EACH,IAAAiG,2BAAiB,EAAE;EAAEC,eAAe,EAAE;AAAS,CAAE,CAAC,CACjD,CAAC,CAAEzG,aAAc,CAAC"}
1
+ {"version":3,"names":["_reactNative","require","_element","_compose","_data","_viewport","_i18n","_blockEditor","_components","_icons","_editor","_blocks","_reactNativeBridge","_style","_interopRequireDefault","_store","shadowStyle","shadowOffset","width","height","shadowOpacity","shadowRadius","elevation","HeaderToolbar","hasRedo","hasUndo","redo","undo","showInserter","showKeyboardHideButton","insertBlock","onHideKeyboard","isRTL","noContentSelected","anchorNodeRef","useRef","containerStyle","usePreferredColorSchemeStyle","styles","borderTopWidth","StyleSheet","hairlineWidth","useEffect","onUndoSubscription","subscribeOnUndoPressed","onRedoSubscription","subscribeOnRedoPressed","remove","toggleUndoButton","toggleRedoButton","scrollViewRef","scrollToStart","Platform","isAndroid","current","scrollToEnd","scrollTo","x","onInsertBlock","useCallback","blockType","createBlock","undefined","source","inserterMethod","renderMediaButtons","_react","createElement","ToolbarGroup","ToolbarButton","key","title","__","icon","imageIcon","onClick","testID","extraProps","hint","videoIcon","galleryIcon","audioIcon","toolbarAriaLabel","shadowColor","showKeyboardButtonStyles","color","View","ref","accessibilityLabel","style","ScrollView","onContentSizeChange","horizontal","showsHorizontalScrollIndicator","keyboardShouldPersistTaps","alwaysBounceHorizontal","contentContainerStyle","Inserter","disabled","BlockToolbar","passedStyle","keyboardClose","_default","exports","default","compose","withSelect","select","getBlockRootClientId","getBlockSelectionEnd","hasInserterItems","hasSelectedBlock","blockEditorStore","getEditorSettings","editorStore","isAnyBlockSelected","hasEditorRedo","hasEditorUndo","editPostStore","getEditorMode","richEditingEnabled","isTextModeEnabled","getSettings","withDispatch","dispatch","clearSelectedBlock","togglePostTitleSelection","withViewportMatch","isLargeViewport"],"sources":["@wordpress/edit-post/src/components/header/header-toolbar/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { ScrollView, StyleSheet, View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useRef, useEffect, Platform } from '@wordpress/element';\nimport { compose, usePreferredColorSchemeStyle } from '@wordpress/compose';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { withViewportMatch } from '@wordpress/viewport';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tInserter,\n\tBlockToolbar,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { ToolbarGroup, ToolbarButton } from '@wordpress/components';\nimport {\n\tkeyboardClose,\n\taudio as audioIcon,\n\tmedia as imageIcon,\n\tvideo as videoIcon,\n\tgallery as galleryIcon,\n} from '@wordpress/icons';\nimport { store as editorStore } from '@wordpress/editor';\nimport { createBlock } from '@wordpress/blocks';\nimport {\n\ttoggleUndoButton,\n\ttoggleRedoButton,\n\tsubscribeOnUndoPressed,\n\tsubscribeOnRedoPressed,\n} from '@wordpress/react-native-bridge';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport { store as editPostStore } from '../../../store';\n\nconst shadowStyle = {\n\tshadowOffset: { width: 2, height: 2 },\n\tshadowOpacity: 1,\n\tshadowRadius: 6,\n\televation: 18,\n};\n\nfunction HeaderToolbar( {\n\thasRedo,\n\thasUndo,\n\tredo,\n\tundo,\n\tshowInserter,\n\tshowKeyboardHideButton,\n\tinsertBlock,\n\tonHideKeyboard,\n\tisRTL,\n\tnoContentSelected,\n} ) {\n\tconst anchorNodeRef = useRef();\n\n\tconst containerStyle = [\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles[ 'header-toolbar__container' ],\n\t\t\tstyles[ 'header-toolbar__container--dark' ]\n\t\t),\n\t\t{ borderTopWidth: StyleSheet.hairlineWidth },\n\t];\n\n\tuseEffect( () => {\n\t\tconst onUndoSubscription = subscribeOnUndoPressed( undo );\n\t\tconst onRedoSubscription = subscribeOnRedoPressed( redo );\n\n\t\treturn () => {\n\t\t\tonUndoSubscription?.remove();\n\t\t\tonRedoSubscription?.remove();\n\t\t};\n\t}, [ undo, redo ] );\n\n\tuseEffect( () => {\n\t\ttoggleUndoButton( ! hasUndo );\n\t}, [ hasUndo ] );\n\n\tuseEffect( () => {\n\t\ttoggleRedoButton( ! hasRedo );\n\t}, [ hasRedo ] );\n\n\tconst scrollViewRef = useRef( null );\n\tconst scrollToStart = () => {\n\t\t// scrollview doesn't seem to automatically adjust to RTL on Android so, scroll to end when Android\n\t\tif ( Platform.isAndroid && isRTL ) {\n\t\t\tscrollViewRef.current.scrollToEnd();\n\t\t} else {\n\t\t\tscrollViewRef.current.scrollTo( { x: 0 } );\n\t\t}\n\t};\n\n\tconst onInsertBlock = useCallback(\n\t\t( blockType ) => () => {\n\t\t\tinsertBlock( createBlock( blockType ), undefined, undefined, true, {\n\t\t\t\tsource: 'inserter_menu',\n\t\t\t\tinserterMethod: 'quick-inserter',\n\t\t\t} );\n\t\t},\n\t\t[ insertBlock ]\n\t);\n\n\tconst renderMediaButtons = (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarButton\n\t\t\t\tkey=\"imageButton\"\n\t\t\t\ttitle={ __( 'Image' ) }\n\t\t\t\ticon={ imageIcon }\n\t\t\t\tonClick={ onInsertBlock( 'core/image' ) }\n\t\t\t\ttestID=\"insert-image-button\"\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: __( 'Insert Image Block' ),\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\tkey=\"videoButton\"\n\t\t\t\ttitle={ __( 'Video' ) }\n\t\t\t\ticon={ videoIcon }\n\t\t\t\tonClick={ onInsertBlock( 'core/video' ) }\n\t\t\t\ttestID=\"insert-video-button\"\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: __( 'Insert Video Block' ),\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\tkey=\"galleryButton\"\n\t\t\t\ttitle={ __( 'Gallery' ) }\n\t\t\t\ticon={ galleryIcon }\n\t\t\t\tonClick={ onInsertBlock( 'core/gallery' ) }\n\t\t\t\ttestID=\"insert-gallery-button\"\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: __( 'Insert Gallery Block' ),\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\tkey=\"audioButton\"\n\t\t\t\ttitle={ __( 'Audio' ) }\n\t\t\t\ticon={ audioIcon }\n\t\t\t\tonClick={ onInsertBlock( 'core/audio' ) }\n\t\t\t\ttestID=\"insert-audio-button\"\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: __( 'Insert Audio Block' ),\n\t\t\t\t} }\n\t\t\t/>\n\t\t</ToolbarGroup>\n\t);\n\n\t/* translators: accessibility text for the editor toolbar */\n\tconst toolbarAriaLabel = __( 'Document tools' );\n\n\tconst shadowColor = usePreferredColorSchemeStyle(\n\t\tstyles[ 'header-toolbar__keyboard-hide-shadow--light' ],\n\t\tstyles[ 'header-toolbar__keyboard-hide-shadow--dark' ]\n\t);\n\tconst showKeyboardButtonStyles = [\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles[ 'header-toolbar__keyboard-hide-container' ],\n\t\t\tstyles[ 'header-toolbar__keyboard-hide-container--dark' ]\n\t\t),\n\t\tshadowStyle,\n\t\t{\n\t\t\tshadowColor: Platform.isAndroid\n\t\t\t\t? styles[ 'header-toolbar__keyboard-hide-shadow--solid' ].color\n\t\t\t\t: shadowColor.color,\n\t\t},\n\t];\n\n\treturn (\n\t\t<View\n\t\t\tref={ anchorNodeRef }\n\t\t\ttestID={ toolbarAriaLabel }\n\t\t\taccessibilityLabel={ toolbarAriaLabel }\n\t\t\tstyle={ containerStyle }\n\t\t>\n\t\t\t<ScrollView\n\t\t\t\tref={ scrollViewRef }\n\t\t\t\tonContentSizeChange={ scrollToStart }\n\t\t\t\thorizontal\n\t\t\t\tshowsHorizontalScrollIndicator={ false }\n\t\t\t\tkeyboardShouldPersistTaps=\"always\"\n\t\t\t\talwaysBounceHorizontal={ false }\n\t\t\t\tcontentContainerStyle={\n\t\t\t\t\tstyles[ 'header-toolbar__scrollable-content' ]\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<Inserter disabled={ ! showInserter } />\n\n\t\t\t\t{ noContentSelected && renderMediaButtons }\n\t\t\t\t<BlockToolbar anchorNodeRef={ anchorNodeRef.current } />\n\t\t\t</ScrollView>\n\t\t\t{ showKeyboardHideButton && (\n\t\t\t\t<ToolbarGroup passedStyle={ showKeyboardButtonStyles }>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ttitle={ __( 'Hide keyboard' ) }\n\t\t\t\t\t\ticon={ keyboardClose }\n\t\t\t\t\t\tonClick={ onHideKeyboard }\n\t\t\t\t\t\textraProps={ {\n\t\t\t\t\t\t\thint: __( 'Tap to hide the keyboard' ),\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t) }\n\t\t</View>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockRootClientId,\n\t\t\tgetBlockSelectionEnd,\n\t\t\thasInserterItems,\n\t\t\thasSelectedBlock,\n\t\t} = select( blockEditorStore );\n\t\tconst { getEditorSettings } = select( editorStore );\n\t\tconst isAnyBlockSelected = hasSelectedBlock();\n\t\treturn {\n\t\t\thasRedo: select( editorStore ).hasEditorRedo(),\n\t\t\thasUndo: select( editorStore ).hasEditorUndo(),\n\t\t\t// This setting (richEditingEnabled) should not live in the block editor's setting.\n\t\t\tshowInserter:\n\t\t\t\tselect( editPostStore ).getEditorMode() === 'visual' &&\n\t\t\t\tgetEditorSettings().richEditingEnabled &&\n\t\t\t\thasInserterItems(\n\t\t\t\t\tgetBlockRootClientId( getBlockSelectionEnd() )\n\t\t\t\t),\n\t\t\tisTextModeEnabled:\n\t\t\t\tselect( editPostStore ).getEditorMode() === 'text',\n\t\t\tisRTL: select( blockEditorStore ).getSettings().isRTL,\n\t\t\tnoContentSelected: ! isAnyBlockSelected,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { clearSelectedBlock, insertBlock } =\n\t\t\tdispatch( blockEditorStore );\n\t\tconst { togglePostTitleSelection } = dispatch( editorStore );\n\n\t\treturn {\n\t\t\tredo: dispatch( editorStore ).redo,\n\t\t\tundo: dispatch( editorStore ).undo,\n\t\t\tonHideKeyboard() {\n\t\t\t\tclearSelectedBlock();\n\t\t\t\ttogglePostTitleSelection( false );\n\t\t\t},\n\t\t\tinsertBlock,\n\t\t};\n\t} ),\n\twithViewportMatch( { isLargeViewport: 'medium' } ),\n] )( HeaderToolbar );\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAKA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAOA,IAAAS,OAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AACA,IAAAW,kBAAA,GAAAX,OAAA;AAUA,IAAAY,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AAE,KAAM,CAAC;IAClC,CAAC;IACDhG;EACD,CAAC;AACF,CAAE,CAAC,EACH,IAAAiG,2BAAiB,EAAE;EAAEC,eAAe,EAAE;AAAS,CAAE,CAAC,CACjD,CAAC,CAAEzG,aAAc,CAAC"}
@@ -35,6 +35,9 @@ var _lockUnlock = require("../../lock-unlock");
35
35
  * Internal dependencies
36
36
  */
37
37
 
38
+ const {
39
+ useShowBlockTools
40
+ } = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
38
41
  const {
39
42
  DocumentTools,
40
43
  PostViewLink,
@@ -79,9 +82,8 @@ function Header({
79
82
  const blockToolbarRef = (0, _element.useRef)();
80
83
  const {
81
84
  isTextEditor,
82
- hasBlockSelection,
85
+ blockSelectionStart,
83
86
  hasActiveMetaboxes,
84
- hasFixedToolbar,
85
87
  isPublishSidebarOpened,
86
88
  showIconLabels,
87
89
  hasHistory
@@ -94,21 +96,25 @@ function Header({
94
96
  } = select(_editor.store);
95
97
  return {
96
98
  isTextEditor: getEditorMode() === 'text',
97
- hasBlockSelection: !!select(_blockEditor.store).getBlockSelectionStart(),
99
+ blockSelectionStart: select(_blockEditor.store).getBlockSelectionStart(),
98
100
  hasActiveMetaboxes: select(_store.store).hasMetaBoxes(),
99
101
  hasHistory: !!select(_editor.store).getEditorSettings().onNavigateToPreviousEntityRecord,
100
102
  isPublishSidebarOpened: select(_store.store).isPublishSidebarOpened(),
101
- hasFixedToolbar: getPreference('core', 'fixedToolbar'),
102
103
  showIconLabels: getPreference('core', 'showIconLabels')
103
104
  };
104
105
  }, []);
106
+ const {
107
+ showFixedToolbar
108
+ } = useShowBlockTools();
109
+ const showTopToolbar = isLargeViewport && showFixedToolbar;
105
110
  const [isBlockToolsCollapsed, setIsBlockToolsCollapsed] = (0, _element.useState)(true);
111
+ const hasBlockSelection = !!blockSelectionStart;
106
112
  (0, _element.useEffect)(() => {
107
113
  // If we have a new block selection, show the block tools
108
- if (hasBlockSelection) {
114
+ if (blockSelectionStart) {
109
115
  setIsBlockToolsCollapsed(false);
110
116
  }
111
- }, [hasBlockSelection]);
117
+ }, [blockSelectionStart]);
112
118
  return (0, _react.createElement)("div", {
113
119
  className: "edit-post-header"
114
120
  }, (0, _react.createElement)(_mainDashboardButton.default.Slot, null, (0, _react.createElement)(_components.__unstableMotion.div, {
@@ -129,25 +135,26 @@ function Header({
129
135
  className: "edit-post-header__toolbar"
130
136
  }, (0, _react.createElement)(DocumentTools, {
131
137
  disableBlockTools: isTextEditor
132
- }), hasFixedToolbar && isLargeViewport && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)("div", {
138
+ }), showTopToolbar && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)("div", {
133
139
  className: (0, _classnames.default)('selected-block-tools-wrapper', {
134
- 'is-collapsed': isBlockToolsCollapsed
140
+ 'is-collapsed': isBlockToolsCollapsed || !hasBlockSelection
135
141
  })
136
142
  }, (0, _react.createElement)(_blockEditor.BlockToolbar, {
137
143
  hideDragHandle: true
138
144
  })), (0, _react.createElement)(_components.Popover.Slot, {
139
145
  ref: blockToolbarRef,
140
146
  name: "block-toolbar"
141
- }), hasBlockSelection && (0, _react.createElement)(_components.Button, {
147
+ }), (0, _react.createElement)(_components.Button, {
142
148
  className: "edit-post-header__block-tools-toggle",
143
149
  icon: isBlockToolsCollapsed ? _icons.next : _icons.previous,
144
150
  onClick: () => {
145
151
  setIsBlockToolsCollapsed(collapsed => !collapsed);
146
152
  },
147
- label: isBlockToolsCollapsed ? (0, _i18n.__)('Show block tools') : (0, _i18n.__)('Hide block tools')
153
+ label: isBlockToolsCollapsed ? (0, _i18n.__)('Show block tools') : (0, _i18n.__)('Hide block tools'),
154
+ size: "compact"
148
155
  })), (0, _react.createElement)("div", {
149
156
  className: (0, _classnames.default)('edit-post-header__center', {
150
- 'is-collapsed': hasHistory && hasBlockSelection && !isBlockToolsCollapsed && hasFixedToolbar && isLargeViewport
157
+ 'is-collapsed': hasHistory && !isBlockToolsCollapsed && showTopToolbar
151
158
  })
152
159
  }, hasHistory && (0, _react.createElement)(_editor.DocumentBar, null))), (0, _react.createElement)(_components.__unstableMotion.div, {
153
160
  variants: slideY,
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_blockEditor","_editor","_element","_data","_i18n","_icons","_interface","_compose","_components","_preferences","_fullscreenModeClose","_moreMenu","_postPublishButtonOrToggle","_mainDashboardButton","_store","_lockUnlock","DocumentTools","PostViewLink","PreviewDropdown","unlock","editorPrivateApis","slideY","hidden","y","distractionFreeInactive","hover","transition","type","delay","slideX","x","Header","setEntitiesSavedStatesCallback","initialPost","isWideViewport","useViewportMatch","isLargeViewport","blockToolbarRef","useRef","isTextEditor","hasBlockSelection","hasActiveMetaboxes","hasFixedToolbar","isPublishSidebarOpened","showIconLabels","hasHistory","useSelect","select","get","getPreference","preferencesStore","getEditorMode","editorStore","blockEditorStore","getBlockSelectionStart","editPostStore","hasMetaBoxes","getEditorSettings","onNavigateToPreviousEntityRecord","isBlockToolsCollapsed","setIsBlockToolsCollapsed","useState","useEffect","_react","createElement","className","default","Slot","__unstableMotion","div","variants","showTooltip","disableBlockTools","Fragment","classnames","BlockToolbar","hideDragHandle","Popover","ref","name","Button","icon","next","previous","onClick","collapsed","label","__","DocumentBar","PostSavedState","forceIsDirty","forceIsAutosaveable","PostPreviewButton","PinnedItems","scope","_default","exports"],"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\tBlockToolbar,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tPostSavedState,\n\tPostPreviewButton,\n\tstore as editorStore,\n\tDocumentBar,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { next, previous } from '@wordpress/icons';\nimport { PinnedItems } from '@wordpress/interface';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tButton,\n\t__unstableMotion as motion,\n\tPopover,\n} from '@wordpress/components';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport FullscreenModeClose from './fullscreen-mode-close';\nimport MoreMenu from './more-menu';\nimport PostPublishButtonOrToggle from './post-publish-button-or-toggle';\nimport MainDashboardButton from './main-dashboard-button';\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { DocumentTools, PostViewLink, PreviewDropdown } =\n\tunlock( 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 blockToolbarRef = useRef();\n\tconst {\n\t\tisTextEditor,\n\t\thasBlockSelection,\n\t\thasActiveMetaboxes,\n\t\thasFixedToolbar,\n\t\tisPublishSidebarOpened,\n\t\tshowIconLabels,\n\t\thasHistory,\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\thasBlockSelection:\n\t\t\t\t!! select( blockEditorStore ).getBlockSelectionStart(),\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( editPostStore ).isPublishSidebarOpened(),\n\t\t\thasFixedToolbar: getPreference( 'core', 'fixedToolbar' ),\n\t\t\tshowIconLabels: getPreference( 'core', 'showIconLabels' ),\n\t\t};\n\t}, [] );\n\n\tconst [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =\n\t\tuseState( true );\n\n\tuseEffect( () => {\n\t\t// If we have a new block selection, show the block tools\n\t\tif ( hasBlockSelection ) {\n\t\t\tsetIsBlockToolsCollapsed( false );\n\t\t}\n\t}, [ hasBlockSelection ] );\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{ hasFixedToolbar && isLargeViewport && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'selected-block-tools-wrapper',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'is-collapsed': isBlockToolsCollapsed,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<Popover.Slot\n\t\t\t\t\t\t\tref={ blockToolbarRef }\n\t\t\t\t\t\t\tname=\"block-toolbar\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ hasBlockSelection && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tclassName=\"edit-post-header__block-tools-toggle\"\n\t\t\t\t\t\t\t\ticon={ isBlockToolsCollapsed ? next : previous }\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tsetIsBlockToolsCollapsed(\n\t\t\t\t\t\t\t\t\t\t( collapsed ) => ! collapsed\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\tisBlockToolsCollapsed\n\t\t\t\t\t\t\t\t\t\t? __( 'Show block tools' )\n\t\t\t\t\t\t\t\t\t\t: __( 'Hide block tools' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\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\thasBlockSelection &&\n\t\t\t\t\t\t\t! isBlockToolsCollapsed &&\n\t\t\t\t\t\t\thasFixedToolbar &&\n\t\t\t\t\t\t\tisLargeViewport,\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/edit-post\" />\n\t\t\t\t) }\n\t\t\t\t<MoreMenu showIconLabels={ showIconLabels } />\n\t\t\t</motion.div>\n\t\t</div>\n\t);\n}\n\nexport default Header;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAIA,IAAAE,OAAA,GAAAF,OAAA;AAOA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AAKA,IAAAU,YAAA,GAAAV,OAAA;AAKA,IAAAW,oBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,SAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,0BAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,oBAAA,GAAAf,sBAAA,CAAAC,OAAA;AACA,IAAAe,MAAA,GAAAf,OAA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AE,CAClC,CACR,CAAC;AAER;AAAC,IAAAmD,QAAA,GAAAC,OAAA,CAAA9B,OAAA,GAEcnC,MAAM"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_blockEditor","_editor","_element","_data","_i18n","_icons","_interface","_compose","_components","_preferences","_fullscreenModeClose","_moreMenu","_postPublishButtonOrToggle","_mainDashboardButton","_store","_lockUnlock","useShowBlockTools","unlock","blockEditorPrivateApis","DocumentTools","PostViewLink","PreviewDropdown","editorPrivateApis","slideY","hidden","y","distractionFreeInactive","hover","transition","type","delay","slideX","x","Header","setEntitiesSavedStatesCallback","initialPost","isWideViewport","useViewportMatch","isLargeViewport","blockToolbarRef","useRef","isTextEditor","blockSelectionStart","hasActiveMetaboxes","isPublishSidebarOpened","showIconLabels","hasHistory","useSelect","select","get","getPreference","preferencesStore","getEditorMode","editorStore","blockEditorStore","getBlockSelectionStart","editPostStore","hasMetaBoxes","getEditorSettings","onNavigateToPreviousEntityRecord","showFixedToolbar","showTopToolbar","isBlockToolsCollapsed","setIsBlockToolsCollapsed","useState","hasBlockSelection","useEffect","_react","createElement","className","default","Slot","__unstableMotion","div","variants","showTooltip","disableBlockTools","Fragment","classnames","BlockToolbar","hideDragHandle","Popover","ref","name","Button","icon","next","previous","onClick","collapsed","label","__","size","DocumentBar","PostSavedState","forceIsDirty","forceIsAutosaveable","PostPreviewButton","PinnedItems","scope","_default","exports"],"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\tBlockToolbar,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tPostSavedState,\n\tPostPreviewButton,\n\tstore as editorStore,\n\tDocumentBar,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { next, previous } from '@wordpress/icons';\nimport { PinnedItems } from '@wordpress/interface';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tButton,\n\t__unstableMotion as motion,\n\tPopover,\n} from '@wordpress/components';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport FullscreenModeClose from './fullscreen-mode-close';\nimport MoreMenu from './more-menu';\nimport PostPublishButtonOrToggle from './post-publish-button-or-toggle';\nimport MainDashboardButton from './main-dashboard-button';\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { useShowBlockTools } = unlock( blockEditorPrivateApis );\nconst { DocumentTools, PostViewLink, PreviewDropdown } =\n\tunlock( 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 blockToolbarRef = useRef();\n\tconst {\n\t\tisTextEditor,\n\t\tblockSelectionStart,\n\t\thasActiveMetaboxes,\n\t\tisPublishSidebarOpened,\n\t\tshowIconLabels,\n\t\thasHistory,\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\tblockSelectionStart:\n\t\t\t\tselect( blockEditorStore ).getBlockSelectionStart(),\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( editPostStore ).isPublishSidebarOpened(),\n\t\t\tshowIconLabels: getPreference( 'core', 'showIconLabels' ),\n\t\t};\n\t}, [] );\n\n\tconst { showFixedToolbar } = useShowBlockTools();\n\tconst showTopToolbar = isLargeViewport && showFixedToolbar;\n\n\tconst [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =\n\t\tuseState( true );\n\tconst hasBlockSelection = !! blockSelectionStart;\n\n\tuseEffect( () => {\n\t\t// If we have a new block selection, show the block tools\n\t\tif ( blockSelectionStart ) {\n\t\t\tsetIsBlockToolsCollapsed( false );\n\t\t}\n\t}, [ blockSelectionStart ] );\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{ showTopToolbar && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'selected-block-tools-wrapper',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'is-collapsed':\n\t\t\t\t\t\t\t\t\t\tisBlockToolsCollapsed ||\n\t\t\t\t\t\t\t\t\t\t! hasBlockSelection,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<Popover.Slot\n\t\t\t\t\t\t\tref={ blockToolbarRef }\n\t\t\t\t\t\t\tname=\"block-toolbar\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"edit-post-header__block-tools-toggle\"\n\t\t\t\t\t\t\ticon={ isBlockToolsCollapsed ? next : previous }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetIsBlockToolsCollapsed(\n\t\t\t\t\t\t\t\t\t( collapsed ) => ! collapsed\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tisBlockToolsCollapsed\n\t\t\t\t\t\t\t\t\t? __( 'Show block tools' )\n\t\t\t\t\t\t\t\t\t: __( 'Hide block tools' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t/>\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\tshowTopToolbar,\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/edit-post\" />\n\t\t\t\t) }\n\t\t\t\t<MoreMenu showIconLabels={ showIconLabels } />\n\t\t\t</motion.div>\n\t\t</div>\n\t);\n}\n\nexport default Header;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAKA,IAAAE,OAAA,GAAAF,OAAA;AAOA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AAKA,IAAAU,YAAA,GAAAV,OAAA;AAKA,IAAAW,oBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,SAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,0BAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,I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,CAAES,cAAc,KACrC,IAAAsB,MAAA,CAAAC,aAAA,EAAC9D,UAAA,CAAA4F,WAAW,CAAC3B,IAAI;IAAC4B,KAAK,EAAC;EAAgB,CAAE,CAC1C,EACD,IAAAhC,MAAA,CAAAC,aAAA,EAACzD,SAAA,CAAA2D,OAAQ;IAACzB,cAAc,EAAGA;EAAgB,CAAE,CAClC,CACR,CAAC;AAER;AAAC,IAAAuD,QAAA,GAAAC,OAAA,CAAA/B,OAAA,GAEcrC,MAAM"}
@@ -11,6 +11,7 @@ var _components = require("@wordpress/components");
11
11
  var _interface = require("@wordpress/interface");
12
12
  var _compose = require("@wordpress/compose");
13
13
  var _editor = require("@wordpress/editor");
14
+ var _icons = require("@wordpress/icons");
14
15
  var _preferencesMenuItem = _interopRequireDefault(require("../preferences-menu-item"));
15
16
  var _toolsMoreMenuGroup = _interopRequireDefault(require("../tools-more-menu-group"));
16
17
  var _writingMenu = _interopRequireDefault(require("../writing-menu"));
@@ -30,12 +31,19 @@ const MoreMenu = ({
30
31
  showIconLabels
31
32
  }) => {
32
33
  const isLargeViewport = (0, _compose.useViewportMatch)('large');
33
- return (0, _react.createElement)(_interface.MoreMenuDropdown, {
34
+ return (0, _react.createElement)(_components.DropdownMenu, {
35
+ icon: _icons.moreVertical,
36
+ label: (0, _i18n.__)('Options'),
37
+ popoverProps: {
38
+ placement: 'bottom-end',
39
+ className: 'more-menu-dropdown__content'
40
+ },
34
41
  toggleProps: {
35
- showTooltip: !showIconLabels,
36
42
  ...(showIconLabels && {
37
43
  variant: 'tertiary'
38
44
  }),
45
+ tooltipPosition: 'bottom',
46
+ showTooltip: !showIconLabels,
39
47
  size: 'compact'
40
48
  }
41
49
  }, ({
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_components","_interface","_compose","_editor","_preferencesMenuItem","_interopRequireDefault","_toolsMoreMenuGroup","_writingMenu","_lockUnlock","ModeSwitcher","unlock","editorPrivateApis","MoreMenu","showIconLabels","isLargeViewport","useViewportMatch","_react","createElement","MoreMenuDropdown","toggleProps","showTooltip","variant","size","onClose","Fragment","PinnedItems","Slot","className","scope","default","ActionItem","name","label","__","as","MenuGroup","fillProps","onClick","_default","exports"],"sources":["@wordpress/edit-post/src/components/header/more-menu/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuGroup } from '@wordpress/components';\nimport {\n\tActionItem,\n\tMoreMenuDropdown,\n\tPinnedItems,\n} from '@wordpress/interface';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport PreferencesMenuItem from '../preferences-menu-item';\nimport ToolsMoreMenuGroup from '../tools-more-menu-group';\nimport WritingMenu from '../writing-menu';\nimport { unlock } from '../../../lock-unlock';\n\nconst { ModeSwitcher } = unlock( editorPrivateApis );\n\nconst MoreMenu = ( { showIconLabels } ) => {\n\tconst isLargeViewport = useViewportMatch( 'large' );\n\n\treturn (\n\t\t<MoreMenuDropdown\n\t\t\ttoggleProps={ {\n\t\t\t\tshowTooltip: ! showIconLabels,\n\t\t\t\t...( showIconLabels && { variant: 'tertiary' } ),\n\t\t\t\tsize: 'compact',\n\t\t\t} }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t{ showIconLabels && ! isLargeViewport && (\n\t\t\t\t\t\t<PinnedItems.Slot\n\t\t\t\t\t\t\tclassName={ showIconLabels && 'show-icon-labels' }\n\t\t\t\t\t\t\tscope=\"core/edit-post\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<WritingMenu />\n\t\t\t\t\t<ModeSwitcher />\n\t\t\t\t\t<ActionItem.Slot\n\t\t\t\t\t\tname=\"core/edit-post/plugin-more-menu\"\n\t\t\t\t\t\tlabel={ __( 'Plugins' ) }\n\t\t\t\t\t\tas={ MenuGroup }\n\t\t\t\t\t\tfillProps={ { onClick: onClose } }\n\t\t\t\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AI,kBAAoB;IAClDe,KAAK,EAAC;EAAgB,CACtB,CACD,EACD,IAAAZ,MAAA,CAAAC,aAAA,EAACV,YAAA,CAAAsB,OAAW,MAAE,CAAC,EACf,IAAAb,MAAA,CAAAC,aAAA,EAACR,YAAY,MAAE,CAAC,EAChB,IAAAO,MAAA,CAAAC,aAAA,EAAChB,UAAA,CAAA6B,UAAU,CAACJ,IAAI;IACfK,IAAI,EAAC,iCAAiC;IACtCC,KAAK,EAAG,IAAAC,QAAE,EAAE,SAAU,CAAG;IACzBC,EAAE,EAAGC,qBAAW;IAChBC,SAAS,EAAG;MAAEC,OAAO,EAAEd;IAAQ;EAAG,CAClC,CAAC,EACF,IAAAP,MAAA,CAAAC,aAAA,EAACX,mBAAA,CAAAuB,OAAkB,CAACH,IAAI;IAACU,SAAS,EAAG;MAAEb;IAAQ;EAAG,CAAE,CAAC,EACrD,IAAAP,MAAA,CAAAC,aAAA,EAACjB,WAAA,CAAAmC,SAAS,QACT,IAAAnB,MAAA,CAAAC,aAAA,EAACb,oBAAA,CAAAyB,OAAmB,MAAE,CACZ,CACV,CAEc,CAAC;AAErB,CAAC;AAAC,IAAAS,QAAA,GAAAC,OAAA,CAAAV,OAAA,GAEajB,QAAQ"}
1
+ {"version":3,"names":["_i18n","require","_components","_interface","_compose","_editor","_icons","_preferencesMenuItem","_interopRequireDefault","_toolsMoreMenuGroup","_writingMenu","_lockUnlock","ModeSwitcher","unlock","editorPrivateApis","MoreMenu","showIconLabels","isLargeViewport","useViewportMatch","_react","createElement","DropdownMenu","icon","moreVertical","label","__","popoverProps","placement","className","toggleProps","variant","tooltipPosition","showTooltip","size","onClose","Fragment","PinnedItems","Slot","scope","default","ActionItem","name","as","MenuGroup","fillProps","onClick","_default","exports"],"sources":["@wordpress/edit-post/src/components/header/more-menu/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuGroup, DropdownMenu } from '@wordpress/components';\nimport { ActionItem, PinnedItems } from '@wordpress/interface';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { moreVertical } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport PreferencesMenuItem from '../preferences-menu-item';\nimport ToolsMoreMenuGroup from '../tools-more-menu-group';\nimport WritingMenu from '../writing-menu';\nimport { unlock } from '../../../lock-unlock';\n\nconst { ModeSwitcher } = unlock( editorPrivateApis );\n\nconst MoreMenu = ( { showIconLabels } ) => {\n\tconst isLargeViewport = useViewportMatch( 'large' );\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ moreVertical }\n\t\t\tlabel={ __( 'Options' ) }\n\t\t\tpopoverProps={ {\n\t\t\t\tplacement: 'bottom-end',\n\t\t\t\tclassName: 'more-menu-dropdown__content',\n\t\t\t} }\n\t\t\ttoggleProps={ {\n\t\t\t\t...( showIconLabels && { variant: 'tertiary' } ),\n\t\t\t\ttooltipPosition: 'bottom',\n\t\t\t\tshowTooltip: ! showIconLabels,\n\t\t\t\tsize: 'compact',\n\t\t\t} }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t{ showIconLabels && ! isLargeViewport && (\n\t\t\t\t\t\t<PinnedItems.Slot\n\t\t\t\t\t\t\tclassName={ showIconLabels && 'show-icon-labels' }\n\t\t\t\t\t\t\tscope=\"core/edit-post\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<WritingMenu />\n\t\t\t\t\t<ModeSwitcher />\n\t\t\t\t\t<ActionItem.Slot\n\t\t\t\t\t\tname=\"core/edit-post/plugin-more-menu\"\n\t\t\t\t\t\tlabel={ __( 'Plugins' ) }\n\t\t\t\t\t\tas={ MenuGroup }\n\t\t\t\t\t\tfillProps={ { onClick: onClose } }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolsMoreMenuGroup.Slot fillProps={ { onClose } } />\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\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,eAAe,IACpC,IAAAE,MAAA,CAAAC,aAAA,EAACjB,UAAA,CAAAiC,WAAW,CAACC,IAAI;IAChBT,SAAS,EAAGZ,cAAc,IAAI,kBAAoB;IAClDsB,KAAK,EAAC;EAAgB,CACtB,CACD,EACD,IAAAnB,MAAA,CAAAC,aAAA,EAACV,YAAA,CAAA6B,OAAW,MAAE,CAAC,EACf,IAAApB,MAAA,CAAAC,aAAA,EAACR,YAAY,MAAE,CAAC,EAChB,IAAAO,MAAA,CAAAC,aAAA,EAACjB,UAAA,CAAAqC,UAAU,CAACH,IAAI;IACfI,IAAI,EAAC,iCAAiC;IACtCjB,KAAK,EAAG,IAAAC,QAAE,EAAE,SAAU,CAAG;IACzBiB,EAAE,EAAGC,qBAAW;IAChBC,SAAS,EAAG;MAAEC,OAAO,EAAEX;IAAQ;EAAG,CAClC,CAAC,EACF,IAAAf,MAAA,CAAAC,aAAA,EAACX,mBAAA,CAAA8B,OAAkB,CAACF,IAAI;IAACO,SAAS,EAAG;MAAEV;IAAQ;EAAG,CAAE,CAAC,EACrD,IAAAf,MAAA,CAAAC,aAAA,EAAClB,WAAA,CAAAyC,SAAS,QACT,IAAAxB,MAAA,CAAAC,aAAA,EAACb,oBAAA,CAAAgC,OAAmB,MAAE,CACZ,CACV,CAEU,CAAC;AAEjB,CAAC;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAR,OAAA,GAEaxB,QAAQ"}
package/build/editor.js CHANGED
@@ -12,8 +12,6 @@ var _element = require("@wordpress/element");
12
12
  var _components = require("@wordpress/components");
13
13
  var _coreData = require("@wordpress/core-data");
14
14
  var _commands = require("@wordpress/commands");
15
- var _blockEditor = require("@wordpress/block-editor");
16
- var _i18n = require("@wordpress/i18n");
17
15
  var _layout = _interopRequireDefault(require("./components/layout"));
18
16
  var _editorInitialization = _interopRequireDefault(require("./components/editor-initialization"));
19
17
  var _store = require("./store");
@@ -30,14 +28,6 @@ var _useNavigateToEntityRecord = _interopRequireDefault(require("./hooks/use-nav
30
28
  const {
31
29
  ExperimentalEditorProvider
32
30
  } = (0, _lockUnlock.unlock)(_editor.privateApis);
33
- const {
34
- BlockRemovalWarningModal
35
- } = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
36
- // Prevent accidental removal of certain blocks, asking the user for
37
- // confirmation.
38
- const blockRemovalRules = {
39
- 'bindings/core/pattern-overrides': (0, _i18n.__)('Blocks from synced patterns that can have overriden content.')
40
- };
41
31
  function Editor({
42
32
  postId: initialPostId,
43
33
  postType: initialPostType,
@@ -92,12 +82,8 @@ function Editor({
92
82
  useSubRegistry: false,
93
83
  __unstableTemplate: template,
94
84
  ...props
95
- }, (0, _react.createElement)(_editor.ErrorBoundary, null, (0, _react.createElement)(_commands.CommandMenu, null), (0, _react.createElement)(_editorInitialization.default, {
96
- postId: currentPost.postId
97
- }), (0, _react.createElement)(_layout.default, {
85
+ }, (0, _react.createElement)(_editor.ErrorBoundary, null, (0, _react.createElement)(_commands.CommandMenu, null), (0, _react.createElement)(_editorInitialization.default, null), (0, _react.createElement)(_layout.default, {
98
86
  initialPost: initialPost
99
- }), (0, _react.createElement)(BlockRemovalWarningModal, {
100
- rules: blockRemovalRules
101
87
  })), (0, _react.createElement)(_editor.PostLockedModal, null)));
102
88
  }
103
89
  var _default = exports.default = Editor;
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_editor","_element","_components","_coreData","_commands","_blockEditor","_i18n","_layout","_interopRequireDefault","_editorInitialization","_store","_lockUnlock","_useNavigateToEntityRecord","ExperimentalEditorProvider","unlock","editorPrivateApis","BlockRemovalWarningModal","blockEditorPrivateApis","blockRemovalRules","__","Editor","postId","initialPostId","postType","initialPostType","settings","initialEdits","props","initialPost","currentPost","onNavigateToEntityRecord","onNavigateToPreviousEntityRecord","useNavigateToEntityRecord","post","template","useSelect","select","_getPostType$viewable","getEditedPostTemplate","editPostStore","getEntityRecord","getPostType","canUser","coreStore","getEditorSettings","editorStore","postObject","supportsTemplateMode","isViewable","viewable","canEditTemplate","editorSettings","useMemo","defaultRenderingMode","_react","createElement","SlotFillProvider","useSubRegistry","__unstableTemplate","ErrorBoundary","CommandMenu","default","rules","PostLockedModal","_default","exports"],"sources":["@wordpress/edit-post/src/editor.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } 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 { CommandMenu } from '@wordpress/commands';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\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 useNavigateToEntityRecord from './hooks/use-navigate-to-entity-record';\n\nconst { ExperimentalEditorProvider } = unlock( editorPrivateApis );\nconst { BlockRemovalWarningModal } = unlock( blockEditorPrivateApis );\n// Prevent accidental removal of certain blocks, asking the user for\n// confirmation.\nconst blockRemovalRules = {\n\t'bindings/core/pattern-overrides': __(\n\t\t'Blocks from synced patterns that can have overriden content.'\n\t),\n};\n\nfunction Editor( {\n\tpostId: initialPostId,\n\tpostType: initialPostType,\n\tsettings,\n\tinitialEdits,\n\t...props\n} ) {\n\tconst {\n\t\tinitialPost,\n\t\tcurrentPost,\n\t\tonNavigateToEntityRecord,\n\t\tonNavigateToPreviousEntityRecord,\n\t} = useNavigateToEntityRecord( initialPostId, initialPostType );\n\n\tconst { post, template } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostTemplate } = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, canUser } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\n\t\t\tconst postObject = getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tcurrentPost.postType,\n\t\t\t\tcurrentPost.postId\n\t\t\t);\n\n\t\t\tconst supportsTemplateMode =\n\t\t\t\tgetEditorSettings().supportsTemplateMode;\n\t\t\tconst isViewable =\n\t\t\t\tgetPostType( currentPost.postType )?.viewable ?? false;\n\t\t\tconst canEditTemplate = canUser( 'create', 'templates' );\n\t\t\treturn {\n\t\t\t\ttemplate:\n\t\t\t\t\tsupportsTemplateMode &&\n\t\t\t\t\tisViewable &&\n\t\t\t\t\tcanEditTemplate &&\n\t\t\t\t\tcurrentPost.postType !== 'wp_template'\n\t\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t\t: null,\n\t\t\t\tpost: postObject,\n\t\t\t};\n\t\t},\n\t\t[ currentPost.postType, currentPost.postId ]\n\t);\n\n\tconst editorSettings = useMemo(\n\t\t() => ( {\n\t\t\t...settings,\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t\tdefaultRenderingMode: 'post-only',\n\t\t} ),\n\t\t[ settings, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord ]\n\t);\n\n\tif ( ! post ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<ExperimentalEditorProvider\n\t\t\t\tsettings={ editorSettings }\n\t\t\t\tpost={ post }\n\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t__unstableTemplate={ template }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t<CommandMenu />\n\t\t\t\t\t<EditorInitialization postId={ currentPost.postId } />\n\t\t\t\t\t<Layout initialPost={ initialPost } />\n\t\t\t\t\t<BlockRemovalWarningModal rules={ blockRemovalRules } />\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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GxB,QAAU;IAAA,GAC1BP;EAAK,GAEV,IAAA2B,MAAA,CAAAC,aAAA,EAACvD,OAAA,CAAA2D,aAAa,QACb,IAAAL,MAAA,CAAAC,aAAA,EAACnD,SAAA,CAAAwD,WAAW,MAAE,CAAC,EACf,IAAAN,MAAA,CAAAC,aAAA,EAAC9C,qBAAA,CAAAoD,OAAoB;IAACxC,MAAM,EAAGQ,WAAW,CAACR;EAAQ,CAAE,CAAC,EACtD,IAAAiC,MAAA,CAAAC,aAAA,EAAChD,OAAA,CAAAsD,OAAM;IAACjC,WAAW,EAAGA;EAAa,CAAE,CAAC,EACtC,IAAA0B,MAAA,CAAAC,aAAA,EAACvC,wBAAwB;IAAC8C,KAAK,EAAG5C;EAAmB,CAAE,CACzC,CAAC,EAChB,IAAAoC,MAAA,CAAAC,aAAA,EAACvD,OAAA,CAAA+D,eAAe,MAAE,CACS,CACX,CAAC;AAErB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAJ,OAAA,GAEczC,MAAM"}
1
+ {"version":3,"names":["_data","require","_editor","_element","_components","_coreData","_commands","_layout","_interopRequireDefault","_editorInitialization","_store","_lockUnlock","_useNavigateToEntityRecord","ExperimentalEditorProvider","unlock","editorPrivateApis","Editor","postId","initialPostId","postType","initialPostType","settings","initialEdits","props","initialPost","currentPost","onNavigateToEntityRecord","onNavigateToPreviousEntityRecord","useNavigateToEntityRecord","post","template","useSelect","select","_getPostType$viewable","getEditedPostTemplate","editPostStore","getEntityRecord","getPostType","canUser","coreStore","getEditorSettings","editorStore","postObject","supportsTemplateMode","isViewable","viewable","canEditTemplate","editorSettings","useMemo","defaultRenderingMode","_react","createElement","SlotFillProvider","useSubRegistry","__unstableTemplate","ErrorBoundary","CommandMenu","default","PostLockedModal","_default","exports"],"sources":["@wordpress/edit-post/src/editor.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } 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 { CommandMenu } from '@wordpress/commands';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport EditorInitialization from './components/editor-initialization';\nimport { store as editPostStore } from './store';\nimport { unlock } from './lock-unlock';\nimport useNavigateToEntityRecord from './hooks/use-navigate-to-entity-record';\n\nconst { ExperimentalEditorProvider } = unlock( editorPrivateApis );\n\nfunction Editor( {\n\tpostId: initialPostId,\n\tpostType: initialPostType,\n\tsettings,\n\tinitialEdits,\n\t...props\n} ) {\n\tconst {\n\t\tinitialPost,\n\t\tcurrentPost,\n\t\tonNavigateToEntityRecord,\n\t\tonNavigateToPreviousEntityRecord,\n\t} = useNavigateToEntityRecord( initialPostId, initialPostType );\n\n\tconst { post, template } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostTemplate } = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, canUser } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\n\t\t\tconst postObject = getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tcurrentPost.postType,\n\t\t\t\tcurrentPost.postId\n\t\t\t);\n\n\t\t\tconst supportsTemplateMode =\n\t\t\t\tgetEditorSettings().supportsTemplateMode;\n\t\t\tconst isViewable =\n\t\t\t\tgetPostType( currentPost.postType )?.viewable ?? false;\n\t\t\tconst canEditTemplate = canUser( 'create', 'templates' );\n\t\t\treturn {\n\t\t\t\ttemplate:\n\t\t\t\t\tsupportsTemplateMode &&\n\t\t\t\t\tisViewable &&\n\t\t\t\t\tcanEditTemplate &&\n\t\t\t\t\tcurrentPost.postType !== 'wp_template'\n\t\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t\t: null,\n\t\t\t\tpost: postObject,\n\t\t\t};\n\t\t},\n\t\t[ currentPost.postType, currentPost.postId ]\n\t);\n\n\tconst editorSettings = useMemo(\n\t\t() => ( {\n\t\t\t...settings,\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t\tdefaultRenderingMode: 'post-only',\n\t\t} ),\n\t\t[ settings, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord ]\n\t);\n\n\tif ( ! post ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<ExperimentalEditorProvider\n\t\t\t\tsettings={ editorSettings }\n\t\t\t\tpost={ post }\n\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t__unstableTemplate={ template }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t<CommandMenu />\n\t\t\t\t\t<EditorInitialization />\n\t\t\t\t\t<Layout initialPost={ initialPost } />\n\t\t\t\t</ErrorBoundary>\n\t\t\t\t<PostLockedModal />\n\t\t\t</ExperimentalEditorProvider>\n\t\t</SlotFillProvider>\n\t);\n}\n\nexport default Editor;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAMA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAKA,IAAAM,OAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,qBAAA,GAAAD,sBAAA,CAAAP,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,WAAA,GAAAV,OAAA;AACA,IAAAW,0BAAA,GAAAJ,sBAAA,CAAAP,OAAA;AAtBA;AACA;AACA;;AAaA;AACA;AACA;;AAOA,MAAM;EAAEY;AAA2B,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAElE,SAASC,MAAMA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OAAQ;IACP,GAAG3B,QAAQ;IACXK,wBAAwB;IACxBC,gCAAgC;IAChCsB,oBAAoB,EAAE;EACvB,CAAC,CAAE,EACH,CAAE5B,QAAQ,EAAEK,wBAAwB,EAAEC,gCAAgC,CACvE,CAAC;EAED,IAAK,CAAEE,IAAI,EAAG;IACb,OAAO,IAAI;EACZ;EAEA,OACC,IAAAqB,MAAA,CAAAC,aAAA,EAAC/C,WAAA,CAAAgD,gBAAgB,QAChB,IAAAF,MAAA,CAAAC,aAAA,EAACtC,0BAA0B;IAC1BQ,QAAQ,EAAG0B,cAAgB;IAC3BlB,IAAI,EAAGA,IAAM;IACbP,YAAY,EAAGA,YAAc;IAC7B+B,cAAc,EAAG,KAAO;IACxBC,kBAAkB,EAAGxB,QAAU;IAAA,GAC1BP;EAAK,GAEV,IAAA2B,MAAA,CAAAC,aAAA,EAACjD,OAAA,CAAAqD,aAAa,QACb,IAAAL,MAAA,CAAAC,aAAA,EAAC7C,SAAA,CAAAkD,WAAW,MAAE,CAAC,EACf,IAAAN,MAAA,CAAAC,aAAA,EAAC1C,qBAAA,CAAAgD,OAAoB,MAAE,CAAC,EACxB,IAAAP,MAAA,CAAAC,aAAA,EAAC5C,OAAA,CAAAkD,OAAM;IAACjC,WAAW,EAAGA;EAAa,CAAE,CACvB,CAAC,EAChB,IAAA0B,MAAA,CAAAC,aAAA,EAACjD,OAAA,CAAAwD,eAAe,MAAE,CACS,CACX,CAAC;AAErB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAH,OAAA,GAEczC,MAAM"}
@@ -480,7 +480,7 @@ const isEditingTemplate = exports.isEditingTemplate = (0, _data.createRegistrySe
480
480
  since: '6.5',
481
481
  alternative: `select( 'core/editor' ).getRenderingMode`
482
482
  });
483
- return select(_editor.store).getCurrentPostType() !== 'post-only';
483
+ return select(_editor.store).getCurrentPostType() === 'wp_template';
484
484
  });
485
485
 
486
486
  /**