@wordpress/edit-site 4.13.1-next.957ca95e4c.0 → 4.14.1

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 (77) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-editor/index.js +20 -10
  3. package/build/components/block-editor/index.js.map +1 -1
  4. package/build/components/block-editor/resizable-editor.js +8 -1
  5. package/build/components/block-editor/resizable-editor.js.map +1 -1
  6. package/build/components/editor/index.js +9 -4
  7. package/build/components/editor/index.js.map +1 -1
  8. package/build/components/global-styles/gradients-palette-panel.js +6 -2
  9. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  10. package/build/components/global-styles/hooks.js +5 -3
  11. package/build/components/global-styles/hooks.js.map +1 -1
  12. package/build/components/global-styles/typography-panel.js +40 -4
  13. package/build/components/global-styles/typography-panel.js.map +1 -1
  14. package/build/components/global-styles/use-global-styles-output.js +41 -29
  15. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  16. package/build/components/header/document-actions/index.js +11 -8
  17. package/build/components/header/document-actions/index.js.map +1 -1
  18. package/build/components/header/index.js +41 -5
  19. package/build/components/header/index.js.map +1 -1
  20. package/build/components/list/header.js +15 -2
  21. package/build/components/list/header.js.map +1 -1
  22. package/build/components/navigation-sidebar/navigation-panel/index.js +10 -4
  23. package/build/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
  24. package/build/components/sidebar/index.js +8 -3
  25. package/build/components/sidebar/index.js.map +1 -1
  26. package/build/components/template-part-converter/convert-to-template-part.js +16 -0
  27. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  28. package/build/index.js +4 -1
  29. package/build/index.js.map +1 -1
  30. package/build-module/components/block-editor/index.js +20 -9
  31. package/build-module/components/block-editor/index.js.map +1 -1
  32. package/build-module/components/block-editor/resizable-editor.js +9 -2
  33. package/build-module/components/block-editor/resizable-editor.js.map +1 -1
  34. package/build-module/components/editor/index.js +10 -5
  35. package/build-module/components/editor/index.js.map +1 -1
  36. package/build-module/components/global-styles/gradients-palette-panel.js +6 -2
  37. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  38. package/build-module/components/global-styles/hooks.js +6 -4
  39. package/build-module/components/global-styles/hooks.js.map +1 -1
  40. package/build-module/components/global-styles/typography-panel.js +41 -5
  41. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  42. package/build-module/components/global-styles/use-global-styles-output.js +42 -30
  43. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  44. package/build-module/components/header/document-actions/index.js +12 -9
  45. package/build-module/components/header/document-actions/index.js.map +1 -1
  46. package/build-module/components/header/index.js +42 -7
  47. package/build-module/components/header/index.js.map +1 -1
  48. package/build-module/components/list/header.js +14 -2
  49. package/build-module/components/list/header.js.map +1 -1
  50. package/build-module/components/navigation-sidebar/navigation-panel/index.js +11 -5
  51. package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
  52. package/build-module/components/sidebar/index.js +7 -3
  53. package/build-module/components/sidebar/index.js.map +1 -1
  54. package/build-module/components/template-part-converter/convert-to-template-part.js +16 -1
  55. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  56. package/build-module/index.js +4 -1
  57. package/build-module/index.js.map +1 -1
  58. package/build-style/style-rtl.css +28 -16
  59. package/build-style/style.css +28 -16
  60. package/package.json +29 -29
  61. package/src/components/block-editor/index.js +34 -16
  62. package/src/components/block-editor/resizable-editor.js +10 -3
  63. package/src/components/code-editor/style.scss +2 -3
  64. package/src/components/editor/index.js +12 -5
  65. package/src/components/global-styles/gradients-palette-panel.js +25 -12
  66. package/src/components/global-styles/hooks.js +5 -4
  67. package/src/components/global-styles/typography-panel.js +40 -6
  68. package/src/components/global-styles/use-global-styles-output.js +66 -57
  69. package/src/components/header/document-actions/index.js +16 -9
  70. package/src/components/header/index.js +61 -21
  71. package/src/components/header/style.scss +9 -0
  72. package/src/components/list/header.js +15 -5
  73. package/src/components/navigation-sidebar/navigation-panel/index.js +30 -24
  74. package/src/components/sidebar/index.js +23 -20
  75. package/src/components/template-part-converter/convert-to-template-part.js +14 -1
  76. package/src/index.js +4 -0
  77. package/src/style.scss +1 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/header/document-actions/index.js"],"names":["getBlockDisplayText","block","blockType","name","attributes","useSecondaryText","getBlock","blockEditorStore","activeEntityBlockId","select","__experimentalGetActiveBlockIdByBlockNames","label","isActive","DocumentActions","entityTitle","entityLabel","isLoaded","children","dropdownContent","showIconLabels","titleRef","anchorRef","current","isOpen","onToggle","chevronDown","undefined"],"mappings":";;;;;;;;;AAqBA;;AAlBA;;AAKA;;AACA;;AAIA;;AACA;;AAMA;;AAEA;;AAtBA;AACA;AACA;;AAGA;AACA;AACA;AAiBA,SAASA,mBAAT,CAA8BC,KAA9B,EAAsC;AACrC,MAAKA,KAAL,EAAa;AACZ,UAAMC,SAAS,GAAG,0BAAcD,KAAK,CAACE,IAApB,CAAlB;AACA,WAAOD,SAAS,GAAG,yCAAeA,SAAf,EAA0BD,KAAK,CAACG,UAAhC,CAAH,GAAkD,IAAlE;AACA;;AACD,SAAO,IAAP;AACA;;AAED,SAASC,gBAAT,GAA4B;AAC3B,QAAM;AAAEC,IAAAA;AAAF,MAAe,qBAAWC,kBAAX,CAArB;AACA,QAAMC,mBAAmB,GAAG,qBACzBC,MAAF,IACCA,MAAM,CACLF,kBADK,CAAN,CAEEG,0CAFF,CAE8C,CAC7C,oBAD6C,CAF9C,CAF0B,EAO3B,EAP2B,CAA5B;;AAUA,MAAKF,mBAAL,EAA2B;AAC1B,WAAO;AACNG,MAAAA,KAAK,EAAEX,mBAAmB,CAAEM,QAAQ,CAAEE,mBAAF,CAAV,CADpB;AAENI,MAAAA,QAAQ,EAAE;AAFJ,KAAP;AAIA;;AAED,SAAO,EAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACe,SAASC,eAAT,OAMX;AAAA,MANqC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C,QAAAA;AAAV,OAAF;AAAA,aACd,4BAAC,kBAAD;AACC,QAAA,SAAS,EAAC,sCADX;AAEC,QAAA,IAAI,EAAGC,kBAFR;AAGC,yBAAgBF,MAHjB;AAIC,yBAAc,MAJf;AAKC,QAAA,OAAO,EAAGC,QALX;AAMC,QAAA,OAAO,EACNL,cAAc,GAAG,UAAH,GAAgBO,SAPhC;AASC,QAAA,KAAK,EAAG;AACP;AACA,sBAAI,iBAAJ,CAFO,EAGPX,WAHO;AATT,SAeGI,cAAc,IAAI,cAAI,SAAJ,CAfrB,CADc;AAAA,KALhB;AAwBC,IAAA,gBAAgB,EAAC,2CAxBlB;AAyBC,IAAA,aAAa,EAAGD;AAzBjB,IA3BF,CALD,CADD;AAgEA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { sprintf, __ } from '@wordpress/i18n';\nimport {\n\t__experimentalGetBlockLabel as getBlockLabel,\n\tgetBlockType,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tDropdown,\n\tButton,\n\tVisuallyHidden,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { chevronDown } from '@wordpress/icons';\nimport { useRef } from '@wordpress/element';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nfunction getBlockDisplayText( block ) {\n\tif ( block ) {\n\t\tconst blockType = getBlockType( block.name );\n\t\treturn blockType ? getBlockLabel( blockType, block.attributes ) : null;\n\t}\n\treturn null;\n}\n\nfunction useSecondaryText() {\n\tconst { getBlock } = useSelect( blockEditorStore );\n\tconst activeEntityBlockId = useSelect(\n\t\t( select ) =>\n\t\t\tselect(\n\t\t\t\tblockEditorStore\n\t\t\t).__experimentalGetActiveBlockIdByBlockNames( [\n\t\t\t\t'core/template-part',\n\t\t\t] ),\n\t\t[]\n\t);\n\n\tif ( activeEntityBlockId ) {\n\t\treturn {\n\t\t\tlabel: getBlockDisplayText( getBlock( activeEntityBlockId ) ),\n\t\t\tisActive: true,\n\t\t};\n\t}\n\n\treturn {};\n}\n\n/**\n * @param {Object} props Props for the DocumentActions component.\n * @param {string} props.entityTitle The title to display.\n * @param {string} props.entityLabel A label to use for entity-related options.\n * E.g. \"template\" would be used for \"edit\n * template\" and \"show template details\".\n * @param {boolean} props.isLoaded Whether the data is available.\n * @param {Function} props.children React component to use for the\n * information dropdown area. Should be a\n * function which accepts dropdown props.\n * @param {boolean} props.showIconLabels Whether buttons display icons or text labels.\n */\nexport default function DocumentActions( {\n\tentityTitle,\n\tentityLabel,\n\tisLoaded,\n\tchildren: dropdownContent,\n\tshowIconLabels,\n} ) {\n\tconst { label } = useSecondaryText();\n\n\t// The title ref is passed to the popover as the anchorRef so that the\n\t// dropdown is centered over the whole title area rather than just one\n\t// part of it.\n\tconst titleRef = useRef();\n\n\t// Return a simple loading indicator until we have information to show.\n\tif ( ! isLoaded ) {\n\t\treturn (\n\t\t\t<div className=\"edit-site-document-actions\">\n\t\t\t\t{ __( 'Loading…' ) }\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Return feedback that the template does not seem to exist.\n\tif ( ! entityTitle ) {\n\t\treturn (\n\t\t\t<div className=\"edit-site-document-actions\">\n\t\t\t\t{ __( 'Template not found' ) }\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames( 'edit-site-document-actions', {\n\t\t\t\t'has-secondary-label': !! label,\n\t\t\t} ) }\n\t\t>\n\t\t\t<div\n\t\t\t\tref={ titleRef }\n\t\t\t\tclassName=\"edit-site-document-actions__title-wrapper\"\n\t\t\t>\n\t\t\t\t<Text\n\t\t\t\t\tsize=\"body\"\n\t\t\t\t\tclassName=\"edit-site-document-actions__title\"\n\t\t\t\t\tas=\"h1\"\n\t\t\t\t>\n\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t/* translators: %s: the entity being edited, like \"template\"*/\n\t\t\t\t\t\t\t__( 'Editing %s: ' ),\n\t\t\t\t\t\t\tentityLabel\n\t\t\t\t\t\t) }\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t{ entityTitle }\n\t\t\t\t</Text>\n\n\t\t\t\t<Text\n\t\t\t\t\tsize=\"body\"\n\t\t\t\t\tclassName=\"edit-site-document-actions__secondary-item\"\n\t\t\t\t>\n\t\t\t\t\t{ label ?? '' }\n\t\t\t\t</Text>\n\n\t\t\t\t{ dropdownContent && (\n\t\t\t\t\t<Dropdown\n\t\t\t\t\t\tpopoverProps={ {\n\t\t\t\t\t\t\tanchorRef: titleRef.current,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tposition=\"bottom center\"\n\t\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tclassName=\"edit-site-document-actions__get-info\"\n\t\t\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: the entity to see details about, like \"template\"*/\n\t\t\t\t\t\t\t\t\t__( 'Show %s details' ),\n\t\t\t\t\t\t\t\t\tentityLabel\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ showIconLabels && __( 'Details' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tcontentClassName=\"edit-site-document-actions__info-dropdown\"\n\t\t\t\t\t\trenderContent={ dropdownContent }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/header/document-actions/index.js"],"names":["getBlockDisplayText","block","blockType","name","attributes","useSecondaryText","getBlock","blockEditorStore","activeEntityBlockId","select","__experimentalGetActiveBlockIdByBlockNames","label","isActive","DocumentActions","entityTitle","entityLabel","isLoaded","children","dropdownContent","showIconLabels","popoverAnchor","setPopoverAnchor","popoverProps","anchor","isOpen","onToggle","chevronDown","undefined"],"mappings":";;;;;;;;;AAqBA;;AAlBA;;AAKA;;AACA;;AAIA;;AACA;;AAMA;;AAEA;;AAtBA;AACA;AACA;;AAGA;AACA;AACA;AAiBA,SAASA,mBAAT,CAA8BC,KAA9B,EAAsC;AACrC,MAAKA,KAAL,EAAa;AACZ,UAAMC,SAAS,GAAG,0BAAcD,KAAK,CAACE,IAApB,CAAlB;AACA,WAAOD,SAAS,GAAG,yCAAeA,SAAf,EAA0BD,KAAK,CAACG,UAAhC,CAAH,GAAkD,IAAlE;AACA;;AACD,SAAO,IAAP;AACA;;AAED,SAASC,gBAAT,GAA4B;AAC3B,QAAM;AAAEC,IAAAA;AAAF,MAAe,qBAAWC,kBAAX,CAArB;AACA,QAAMC,mBAAmB,GAAG,qBACzBC,MAAF,IACCA,MAAM,CACLF,kBADK,CAAN,CAEEG,0CAFF,CAE8C,CAC7C,oBAD6C,CAF9C,CAF0B,EAO3B,EAP2B,CAA5B;;AAUA,MAAKF,mBAAL,EAA2B;AAC1B,WAAO;AACNG,MAAAA,KAAK,EAAEX,mBAAmB,CAAEM,QAAQ,CAAEE,mBAAF,CAAV,CADpB;AAENI,MAAAA,QAAQ,EAAE;AAFJ,KAAP;AAIA;;AAED,SAAO,EAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACe,SAASC,eAAT,OAMX;AAAA,MANqC;AACxCC,IAAAA,WADwC;AAExCC,IAAAA,WAFwC;AAGxCC,IAAAA,QAHwC;AAIxCC,IAAAA,QAAQ,EAAEC,eAJ8B;AAKxCC,IA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A,MAAF;AAAUC,QAAAA;AAAV,OAAF;AAAA,aACd,4BAAC,kBAAD;AACC,QAAA,SAAS,EAAC,sCADX;AAEC,QAAA,IAAI,EAAGC,kBAFR;AAGC,yBAAgBF,MAHjB;AAIC,yBAAc,MAJf;AAKC,QAAA,OAAO,EAAGC,QALX;AAMC,QAAA,OAAO,EACNN,cAAc,GAAG,UAAH,GAAgBQ,SAPhC;AASC,QAAA,KAAK,EAAG;AACP;AACA,sBAAI,iBAAJ,CAFO,EAGPZ,WAHO;AATT,SAeGI,cAAc,IAAI,cAAI,SAAJ,CAfrB,CADc;AAAA,KAHhB;AAsBC,IAAA,gBAAgB,EAAC,2CAtBlB;AAuBC,IAAA,aAAa,EAAGD;AAvBjB,IA3BF,CALD,CADD;AA8DA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { sprintf, __ } from '@wordpress/i18n';\nimport {\n\t__experimentalGetBlockLabel as getBlockLabel,\n\tgetBlockType,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tDropdown,\n\tButton,\n\tVisuallyHidden,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { chevronDown } from '@wordpress/icons';\nimport { useState, useMemo } from '@wordpress/element';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nfunction getBlockDisplayText( block ) {\n\tif ( block ) {\n\t\tconst blockType = getBlockType( block.name );\n\t\treturn blockType ? getBlockLabel( blockType, block.attributes ) : null;\n\t}\n\treturn null;\n}\n\nfunction useSecondaryText() {\n\tconst { getBlock } = useSelect( blockEditorStore );\n\tconst activeEntityBlockId = useSelect(\n\t\t( select ) =>\n\t\t\tselect(\n\t\t\t\tblockEditorStore\n\t\t\t).__experimentalGetActiveBlockIdByBlockNames( [\n\t\t\t\t'core/template-part',\n\t\t\t] ),\n\t\t[]\n\t);\n\n\tif ( activeEntityBlockId ) {\n\t\treturn {\n\t\t\tlabel: getBlockDisplayText( getBlock( activeEntityBlockId ) ),\n\t\t\tisActive: true,\n\t\t};\n\t}\n\n\treturn {};\n}\n\n/**\n * @param {Object} props Props for the DocumentActions component.\n * @param {string} props.entityTitle The title to display.\n * @param {string} props.entityLabel A label to use for entity-related options.\n * E.g. \"template\" would be used for \"edit\n * template\" and \"show template details\".\n * @param {boolean} props.isLoaded Whether the data is available.\n * @param {Function} props.children React component to use for the\n * information dropdown area. Should be a\n * function which accepts dropdown props.\n * @param {boolean} props.showIconLabels Whether buttons display icons or text labels.\n */\nexport default function DocumentActions( {\n\tentityTitle,\n\tentityLabel,\n\tisLoaded,\n\tchildren: dropdownContent,\n\tshowIconLabels,\n} ) {\n\tconst { label } = useSecondaryText();\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Use the title wrapper as the popover anchor so that the dropdown is\n\t\t\t// centered over the whole title area rather than just one part of it.\n\t\t\tanchor: popoverAnchor,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\t// Return a simple loading indicator until we have information to show.\n\tif ( ! isLoaded ) {\n\t\treturn (\n\t\t\t<div className=\"edit-site-document-actions\">\n\t\t\t\t{ __( 'Loading…' ) }\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Return feedback that the template does not seem to exist.\n\tif ( ! entityTitle ) {\n\t\treturn (\n\t\t\t<div className=\"edit-site-document-actions\">\n\t\t\t\t{ __( 'Template not found' ) }\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames( 'edit-site-document-actions', {\n\t\t\t\t'has-secondary-label': !! label,\n\t\t\t} ) }\n\t\t>\n\t\t\t<div\n\t\t\t\tref={ setPopoverAnchor }\n\t\t\t\tclassName=\"edit-site-document-actions__title-wrapper\"\n\t\t\t>\n\t\t\t\t<Text\n\t\t\t\t\tsize=\"body\"\n\t\t\t\t\tclassName=\"edit-site-document-actions__title\"\n\t\t\t\t\tas=\"h1\"\n\t\t\t\t>\n\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t/* translators: %s: the entity being edited, like \"template\"*/\n\t\t\t\t\t\t\t__( 'Editing %s: ' ),\n\t\t\t\t\t\t\tentityLabel\n\t\t\t\t\t\t) }\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t{ entityTitle }\n\t\t\t\t</Text>\n\n\t\t\t\t<Text\n\t\t\t\t\tsize=\"body\"\n\t\t\t\t\tclassName=\"edit-site-document-actions__secondary-item\"\n\t\t\t\t>\n\t\t\t\t\t{ label ?? '' }\n\t\t\t\t</Text>\n\n\t\t\t\t{ dropdownContent && (\n\t\t\t\t\t<Dropdown\n\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t\tposition=\"bottom center\"\n\t\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tclassName=\"edit-site-document-actions__get-info\"\n\t\t\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: the entity to see details about, like \"template\"*/\n\t\t\t\t\t\t\t\t\t__( 'Show %s details' ),\n\t\t\t\t\t\t\t\t\tentityLabel\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ showIconLabels && __( 'Details' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tcontentClassName=\"edit-site-document-actions__info-dropdown\"\n\t\t\t\t\t\trenderContent={ dropdownContent }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
@@ -9,6 +9,8 @@ exports.default = Header;
9
9
 
10
10
  var _element = require("@wordpress/element");
11
11
 
12
+ var _classnames = _interopRequireDefault(require("classnames"));
13
+
12
14
  var _compose = require("@wordpress/compose");
13
15
 
14
16
  var _blockEditor = require("@wordpress/block-editor");
@@ -43,6 +45,10 @@ var _templateDetails = _interopRequireDefault(require("../template-details"));
43
45
 
44
46
  var _store = require("../../store");
45
47
 
48
+ /**
49
+ * External dependencies
50
+ */
51
+
46
52
  /**
47
53
  * WordPress dependencies
48
54
  */
@@ -55,6 +61,8 @@ const preventDefault = event => {
55
61
  };
56
62
 
57
63
  function Header(_ref) {
64
+ var _window;
65
+
58
66
  let {
59
67
  openEntitiesSavedStates,
60
68
  isEntitiesSavedStatesOpen,
@@ -71,7 +79,8 @@ function Header(_ref) {
71
79
  listViewShortcut,
72
80
  isLoaded,
73
81
  isVisualMode,
74
- settings
82
+ settings,
83
+ blockEditorMode
75
84
  } = (0, _data.useSelect)(select => {
76
85
  const {
77
86
  __experimentalGetPreviewDeviceType,
@@ -91,6 +100,9 @@ function Header(_ref) {
91
100
  const {
92
101
  getShortcutRepresentation
93
102
  } = select(_keyboardShortcuts.store);
103
+ const {
104
+ __unstableGetEditorMode
105
+ } = select(_blockEditor.store);
94
106
  const postType = getEditedPostType();
95
107
  const postId = getEditedPostId();
96
108
  const record = getEditedEntityRecord('postType', postType, postId);
@@ -107,7 +119,8 @@ function Header(_ref) {
107
119
  isListViewOpen: isListViewOpened(),
108
120
  listViewShortcut: getShortcutRepresentation('core/edit-site/toggle-list-view'),
109
121
  isVisualMode: getEditorMode() === 'visual',
110
- settings: getSettings()
122
+ settings: getSettings(),
123
+ blockEditorMode: __unstableGetEditorMode()
111
124
  };
112
125
  }, []);
113
126
  const {
@@ -115,6 +128,9 @@ function Header(_ref) {
115
128
  setIsInserterOpened,
116
129
  setIsListViewOpened
117
130
  } = (0, _data.useDispatch)(_store.store);
131
+ const {
132
+ __unstableSetEditorMode
133
+ } = (0, _data.useDispatch)(_blockEditor.store);
118
134
  const isLargeViewport = (0, _compose.useViewportMatch)('medium');
119
135
  const openInserter = (0, _element.useCallback)(() => {
120
136
  if (isInserterOpen) {
@@ -130,6 +146,8 @@ function Header(_ref) {
130
146
 
131
147
  const longLabel = (0, _i18n._x)('Toggle block inserter', 'Generic label for block inserter button');
132
148
  const shortLabel = !isInserterOpen ? (0, _i18n.__)('Add') : (0, _i18n.__)('Close');
149
+ const isZoomedOutViewExperimentEnabled = ((_window = window) === null || _window === void 0 ? void 0 : _window.__experimentalEnableZoomedOutView) && isVisualMode;
150
+ const isZoomedOutView = blockEditorMode === 'zoom-out';
133
151
  return (0, _element.createElement)("div", {
134
152
  className: "edit-site-header"
135
153
  }, (0, _element.createElement)(_blockEditor.NavigableToolbar, {
@@ -165,8 +183,8 @@ function Header(_ref) {
165
183
  }), (0, _element.createElement)(_components.ToolbarItem, {
166
184
  as: _components.Button,
167
185
  className: "edit-site-header-toolbar__list-view-toggle",
186
+ disabled: !isVisualMode && isZoomedOutView,
168
187
  icon: _icons.listView,
169
- disabled: !isVisualMode,
170
188
  isPressed: isListViewOpen
171
189
  /* translators: button label text should, if possible, be under 16 characters. */
172
190
  ,
@@ -175,6 +193,20 @@ function Header(_ref) {
175
193
  shortcut: listViewShortcut,
176
194
  showTooltip: !showIconLabels,
177
195
  variant: showIconLabels ? 'tertiary' : undefined
196
+ }), isZoomedOutViewExperimentEnabled && (0, _element.createElement)(_components.ToolbarItem, {
197
+ as: _components.Button,
198
+ className: "edit-site-header-toolbar__zoom-out-view-toggle",
199
+ icon: _icons.chevronUpDown,
200
+ isPressed: isZoomedOutView
201
+ /* translators: button label text should, if possible, be under 16 characters. */
202
+ ,
203
+ label: (0, _i18n.__)('Zoom-out View'),
204
+ onClick: () => {
205
+ setPreviewDeviceType('desktop');
206
+ setIsListViewOpened(false);
207
+
208
+ __unstableSetEditorMode(isZoomedOutView ? 'edit' : 'zoom-out');
209
+ }
178
210
  })))), (0, _element.createElement)("div", {
179
211
  className: "edit-site-header_center"
180
212
  }, (0, _element.createElement)(_documentActions.default, {
@@ -194,7 +226,11 @@ function Header(_ref) {
194
226
  className: "edit-site-header_end"
195
227
  }, (0, _element.createElement)("div", {
196
228
  className: "edit-site-header__actions"
197
- }, !isFocusMode && (0, _element.createElement)(_blockEditor.__experimentalPreviewOptions, {
229
+ }, !isFocusMode && (0, _element.createElement)("div", {
230
+ className: (0, _classnames.default)('edit-site-header__actions__preview-options', {
231
+ 'is-zoomed-out': isZoomedOutView
232
+ })
233
+ }, (0, _element.createElement)(_blockEditor.__experimentalPreviewOptions, {
198
234
  deviceType: deviceType,
199
235
  setDeviceType: setPreviewDeviceType
200
236
  }, (0, _element.createElement)(_components.MenuGroup, null, (0, _element.createElement)(_components.MenuItem, {
@@ -205,7 +241,7 @@ function Header(_ref) {
205
241
  as: "span"
206
242
  },
207
243
  /* translators: accessibility text */
208
- (0, _i18n.__)('(opens in a new tab)'))))), (0, _element.createElement)(_saveButton.default, {
244
+ (0, _i18n.__)('(opens in a new tab)')))))), (0, _element.createElement)(_saveButton.default, {
209
245
  openEntitiesSavedStates: openEntitiesSavedStates,
210
246
  isEntitiesSavedStatesOpen: isEntitiesSavedStatesOpen
211
247
  }), (0, _element.createElement)(_interface.PinnedItems.Slot, {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/header/index.js"],"names":["preventDefault","event","Header","openEntitiesSavedStates","isEntitiesSavedStatesOpen","showIconLabels","inserterButton","deviceType","entityTitle","template","templateType","isInserterOpen","isListViewOpen","listViewShortcut","isLoaded","isVisualMode","settings","select","__experimentalGetPreviewDeviceType","getEditedPostType","getEditedPostId","isInserterOpened","isListViewOpened","getEditorMode","getSettings","editSiteStore","getEditedEntityRecord","coreStore","__experimentalGetTemplateInfo","getTemplateInfo","editorStore","getShortcutRepresentation","keyboardShortcutsStore","postType","postId","record","_isLoaded","title","__experimentalSetPreviewDeviceType","setPreviewDeviceType","setIsInserterOpened","setIsListViewOpened","isLargeViewport","openInserter","current","focus","toggleListView","isFocusMode","longLabel","shortLabel","Button","plus","ToolSelector","undefined","UndoButton","RedoButton","listView","onClose","siteUrl","external"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAlCA;AACA;AACA;;AAuBA;AACA;AACA;AASA,MAAMA,cAAc,GAAKC,KAAF,IAAa;AACnCA,EAAAA,KAAK,CAACD,cAAN;AACA,CAFD;;AAIe,SAASE,MAAT,OAIX;AAAA,MAJ4B;AAC/BC,IAAAA,uBAD+B;AAE/BC,IAAAA,yBAF+B;AAG/BC,IAAAA;AAH+B,GAI5B;AACH,QAAMC,cAAc,GAAG,sBAAvB;AACA,QAAM;AACLC,IAAAA,UADK;AAELC,IAAAA,WAFK;AAGLC,IAAAA,QAHK;AAILC,IAAAA,YAJK;AAKLC,IAAAA,cALK;AAMLC,IAAAA,cANK;AAOLC,IAAAA,gBAPK;AAQLC,IAAAA,QARK;AASLC,IAAAA,YATK;AAULC,IAAAA;AAVK,MAWF,qBAAaC,MAAF,IAAc;AAC5B,UAAM;AACLC,MAAAA,kCADK;AAELC,MAAAA,iBAFK;AAGLC,MAAAA,eAHK;AAILC,MAAAA,gBAJK;AAKLC,MAAAA,gBALK;AAMLC,MAAAA,aANK;AAOLC,MAAAA;AAPK,QAQFP,MAAM,CAAEQ,YAAF,CARV;AASA,UAAM;AAAEC,MAAAA;AAAF,QAA4BT,MAAM,CAAEU,eAAF,CAAxC;AACA,UAAM;AAAEC,MAAAA,6BAA6B,EAAEC;AAAjC,QACLZ,MAAM,CAAEa,aAAF,C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,uBAAGA,QAAQ,CAAE0C,OADlB;AAEC,IAAA,MAAM,EAAC,QAFR;AAGC,IAAA,IAAI,EAAGC;AAHR,KAKG,cAAI,WAAJ,CALH,EAMC,4BAAC,0BAAD;AAAgB,IAAA,EAAE,EAAC;AAAnB;AAEE;AACA,gBAAI,sBAAJ,CAHF,CAND,CADD,CAJD,CAFF,EAuBC,4BAAC,mBAAD;AACC,IAAA,uBAAuB,EAAGxD,uBAD3B;AAEC,IAAA,yBAAyB,EAAGC;AAF7B,IAvBD,EA2BC,4BAAC,sBAAD,CAAa,IAAb;AAAkB,IAAA,KAAK,EAAC;AAAxB,IA3BD,EA4BC,4BAAC,iBAAD;AAAU,IAAA,cAAc,EAAGC;AAA3B,IA5BD,CADD,CAnFD,CADD;AAsHA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tToolSelector,\n\t__experimentalPreviewOptions as PreviewOptions,\n\tNavigableToolbar,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { PinnedItems } from '@wordpress/interface';\nimport { _x, __ } from '@wordpress/i18n';\nimport { listView, plus, external } from '@wordpress/icons';\nimport {\n\tButton,\n\tToolbarItem,\n\tMenuGroup,\n\tMenuItem,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport MoreMenu from './more-menu';\nimport SaveButton from '../save-button';\nimport UndoButton from './undo-redo/undo';\nimport RedoButton from './undo-redo/redo';\nimport DocumentActions from './document-actions';\nimport TemplateDetails from '../template-details';\nimport { store as editSiteStore } from '../../store';\n\nconst preventDefault = ( event ) => {\n\tevent.preventDefault();\n};\n\nexport default function Header( {\n\topenEntitiesSavedStates,\n\tisEntitiesSavedStatesOpen,\n\tshowIconLabels,\n} ) {\n\tconst inserterButton = useRef();\n\tconst {\n\t\tdeviceType,\n\t\tentityTitle,\n\t\ttemplate,\n\t\ttemplateType,\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tlistViewShortcut,\n\t\tisLoaded,\n\t\tisVisualMode,\n\t\tsettings,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t\tgetEditedPostType,\n\t\t\tgetEditedPostId,\n\t\t\tisInserterOpened,\n\t\t\tisListViewOpened,\n\t\t\tgetEditorMode,\n\t\t\tgetSettings,\n\t\t} = select( editSiteStore );\n\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\tconst { __experimentalGetTemplateInfo: getTemplateInfo } =\n\t\t\tselect( editorStore );\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\n\t\tconst postType = getEditedPostType();\n\t\tconst postId = getEditedPostId();\n\t\tconst record = getEditedEntityRecord( 'postType', postType, postId );\n\t\tconst _isLoaded = !! postId;\n\n\t\treturn {\n\t\t\tdeviceType: __experimentalGetPreviewDeviceType(),\n\t\t\tentityTitle: getTemplateInfo( record ).title,\n\t\t\tisLoaded: _isLoaded,\n\t\t\ttemplate: record,\n\t\t\ttemplateType: postType,\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tlistViewShortcut: getShortcutRepresentation(\n\t\t\t\t'core/edit-site/toggle-list-view'\n\t\t\t),\n\t\t\tisVisualMode: getEditorMode() === 'visual',\n\t\t\tsettings: getSettings(),\n\t\t};\n\t}, [] );\n\n\tconst {\n\t\t__experimentalSetPreviewDeviceType: setPreviewDeviceType,\n\t\tsetIsInserterOpened,\n\t\tsetIsListViewOpened,\n\t} = useDispatch( editSiteStore );\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\n\tconst openInserter = useCallback( () => {\n\t\tif ( isInserterOpen ) {\n\t\t\t// Focusing the inserter button closes the inserter popover.\n\t\t\tinserterButton.current.focus();\n\t\t} else {\n\t\t\tsetIsInserterOpened( true );\n\t\t}\n\t}, [ isInserterOpen, setIsInserterOpened ] );\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\tconst isFocusMode = templateType === 'wp_template_part';\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst longLabel = _x(\n\t\t'Toggle block inserter',\n\t\t'Generic label for block inserter button'\n\t);\n\tconst shortLabel = ! isInserterOpen ? __( 'Add' ) : __( 'Close' );\n\n\treturn (\n\t\t<div className=\"edit-site-header\">\n\t\t\t<NavigableToolbar\n\t\t\t\tclassName=\"edit-site-header_start\"\n\t\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\t>\n\t\t\t\t<div className=\"edit-site-header__toolbar\">\n\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\tref={ inserterButton }\n\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\tclassName=\"edit-site-header-toolbar__inserter-toggle\"\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tisPressed={ isInserterOpen }\n\t\t\t\t\t\tonMouseDown={ preventDefault }\n\t\t\t\t\t\tonClick={ openInserter }\n\t\t\t\t\t\tdisabled={ ! isVisualMode }\n\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\tlabel={ showIconLabels ? shortLabel : longLabel }\n\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t/>\n\t\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ ToolSelector }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdisabled={ ! isVisualMode }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ UndoButton }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ RedoButton }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\tclassName=\"edit-site-header-toolbar__list-view-toggle\"\n\t\t\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\t\t\tdisabled={ ! isVisualMode }\n\t\t\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\tlabel={ __( 'List View' ) }\n\t\t\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\t\t\tshortcut={ listViewShortcut }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\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</div>\n\t\t\t</NavigableToolbar>\n\n\t\t\t<div className=\"edit-site-header_center\">\n\t\t\t\t<DocumentActions\n\t\t\t\t\tentityTitle={ entityTitle }\n\t\t\t\t\tentityLabel={\n\t\t\t\t\t\ttemplateType === 'wp_template_part'\n\t\t\t\t\t\t\t? 'template part'\n\t\t\t\t\t\t\t: 'template'\n\t\t\t\t\t}\n\t\t\t\t\tisLoaded={ isLoaded }\n\t\t\t\t\tshowIconLabels={ showIconLabels }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<TemplateDetails\n\t\t\t\t\t\t\ttemplate={ template }\n\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</DocumentActions>\n\t\t\t</div>\n\n\t\t\t<div className=\"edit-site-header_end\">\n\t\t\t\t<div className=\"edit-site-header__actions\">\n\t\t\t\t\t{ ! isFocusMode && (\n\t\t\t\t\t\t<PreviewOptions\n\t\t\t\t\t\t\tdeviceType={ deviceType }\n\t\t\t\t\t\t\tsetDeviceType={ setPreviewDeviceType }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\thref={ settings?.siteUrl }\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'View site' ) }\n\t\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t</PreviewOptions>\n\t\t\t\t\t) }\n\t\t\t\t\t<SaveButton\n\t\t\t\t\t\topenEntitiesSavedStates={ openEntitiesSavedStates }\n\t\t\t\t\t\tisEntitiesSavedStatesOpen={ isEntitiesSavedStatesOpen }\n\t\t\t\t\t/>\n\t\t\t\t\t<PinnedItems.Slot scope=\"core/edit-site\" />\n\t\t\t\t\t<MoreMenu showIconLabels={ showIconLabels } />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/header/index.js"],"names":["preventDefault","event","Header","openEntitiesSavedStates","isEntitiesSavedStatesOpen","showIconLabels","inserterButton","deviceType","entityTitle","template","templateType","isInserterOpen","isListViewOpen","listViewShortcut","isLoaded","isVisualMode","settings","blockEditorMode","select","__experimentalGetPreviewDeviceType","getEditedPostType","getEditedPostId","isInserterOpened","isListViewOpened","getEditorMode","getSettings","editSiteStore","getEditedEntityRecord","coreStore","__experimentalGetTemplateInfo","getTemplateInfo","editorStore","getShortcutRepresentation","keyboardShortcutsStore","__unstableGetEditorMode","blockEditorStore","postType","postId","record","_isLoaded","title","__experimentalSetPreviewDeviceType","setPreviewDeviceType","setIsInserterOpened","setIsListViewOpened","__unstableSetEditorMode","isLargeViewport","openInserter","current","focus","toggleListView","isFocusMode","longLabel","shortLabel","isZoomedOutViewExperimentEnabled","window","__experimentalEnableZoomedOutView","isZoomedOutView","Button","plus","ToolSelector","undefined","UndoButton","RedoButton","listView","chevronUpDown","onClose","siteUrl","external"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAxCA;AACA;AACA;;AAGA;AACA;AACA;;AAwBA;AACA;AACA;AASA,MAAMA,cAAc,GAAKC,KAAF,IAAa;AACnCA,EAAAA,KAAK,CAACD,cAAN;AACA,CAFD;;AAIe,SAASE,MAAT,OAIX;AAAA;;AAAA,MAJ4B;AAC/BC,IAAAA,uBAD+B;AAE/BC,IAAAA,yBAF+B;AAG/BC,IAAAA;AAH+B,GAI5B;AACH,QAAMC,cAAc,GAAG,sBAAvB;AACA,QA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AAD;AACC,IAAA,UAAU,EAAGlD,UADd;AAEC,IAAA,aAAa,EAAGmC;AAFjB,KAIC,4BAAC,qBAAD,QACC,4BAAC,oBAAD;AACC,IAAA,IAAI,EAAG1B,QAAH,aAAGA,QAAH,uBAAGA,QAAQ,CAAEmD,OADlB;AAEC,IAAA,MAAM,EAAC,QAFR;AAGC,IAAA,IAAI,EAAGC;AAHR,KAKG,cAAI,WAAJ,CALH,EAMC,4BAAC,0BAAD;AAAgB,IAAA,EAAE,EAAC;AAAnB;AAEE;AACA,gBAAI,sBAAJ,CAHF,CAND,CADD,CAJD,CAND,CAFF,EA8BC,4BAAC,mBAAD;AACC,IAAA,uBAAuB,EAAGjE,uBAD3B;AAEC,IAAA,yBAAyB,EAAGC;AAF7B,IA9BD,EAkCC,4BAAC,sBAAD,CAAa,IAAb;AAAkB,IAAA,KAAK,EAAC;AAAxB,IAlCD,EAmCC,4BAAC,iBAAD;AAAU,IAAA,cAAc,EAAGC;AAA3B,IAnCD,CADD,CAtGD,CADD;AAgJA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tToolSelector,\n\t__experimentalPreviewOptions as PreviewOptions,\n\tNavigableToolbar,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { PinnedItems } from '@wordpress/interface';\nimport { _x, __ } from '@wordpress/i18n';\nimport { listView, plus, external, chevronUpDown } from '@wordpress/icons';\nimport {\n\tButton,\n\tToolbarItem,\n\tMenuGroup,\n\tMenuItem,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport MoreMenu from './more-menu';\nimport SaveButton from '../save-button';\nimport UndoButton from './undo-redo/undo';\nimport RedoButton from './undo-redo/redo';\nimport DocumentActions from './document-actions';\nimport TemplateDetails from '../template-details';\nimport { store as editSiteStore } from '../../store';\n\nconst preventDefault = ( event ) => {\n\tevent.preventDefault();\n};\n\nexport default function Header( {\n\topenEntitiesSavedStates,\n\tisEntitiesSavedStatesOpen,\n\tshowIconLabels,\n} ) {\n\tconst inserterButton = useRef();\n\tconst {\n\t\tdeviceType,\n\t\tentityTitle,\n\t\ttemplate,\n\t\ttemplateType,\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tlistViewShortcut,\n\t\tisLoaded,\n\t\tisVisualMode,\n\t\tsettings,\n\t\tblockEditorMode,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t\tgetEditedPostType,\n\t\t\tgetEditedPostId,\n\t\t\tisInserterOpened,\n\t\t\tisListViewOpened,\n\t\t\tgetEditorMode,\n\t\t\tgetSettings,\n\t\t} = select( editSiteStore );\n\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\tconst { __experimentalGetTemplateInfo: getTemplateInfo } =\n\t\t\tselect( editorStore );\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\n\t\tconst postType = getEditedPostType();\n\t\tconst postId = getEditedPostId();\n\t\tconst record = getEditedEntityRecord( 'postType', postType, postId );\n\t\tconst _isLoaded = !! postId;\n\n\t\treturn {\n\t\t\tdeviceType: __experimentalGetPreviewDeviceType(),\n\t\t\tentityTitle: getTemplateInfo( record ).title,\n\t\t\tisLoaded: _isLoaded,\n\t\t\ttemplate: record,\n\t\t\ttemplateType: postType,\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tlistViewShortcut: getShortcutRepresentation(\n\t\t\t\t'core/edit-site/toggle-list-view'\n\t\t\t),\n\t\t\tisVisualMode: getEditorMode() === 'visual',\n\t\t\tsettings: getSettings(),\n\t\t\tblockEditorMode: __unstableGetEditorMode(),\n\t\t};\n\t}, [] );\n\n\tconst {\n\t\t__experimentalSetPreviewDeviceType: setPreviewDeviceType,\n\t\tsetIsInserterOpened,\n\t\tsetIsListViewOpened,\n\t} = useDispatch( editSiteStore );\n\tconst { __unstableSetEditorMode } = useDispatch( blockEditorStore );\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\n\tconst openInserter = useCallback( () => {\n\t\tif ( isInserterOpen ) {\n\t\t\t// Focusing the inserter button closes the inserter popover.\n\t\t\tinserterButton.current.focus();\n\t\t} else {\n\t\t\tsetIsInserterOpened( true );\n\t\t}\n\t}, [ isInserterOpen, setIsInserterOpened ] );\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\tconst isFocusMode = templateType === 'wp_template_part';\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst longLabel = _x(\n\t\t'Toggle block inserter',\n\t\t'Generic label for block inserter button'\n\t);\n\tconst shortLabel = ! isInserterOpen ? __( 'Add' ) : __( 'Close' );\n\n\tconst isZoomedOutViewExperimentEnabled =\n\t\twindow?.__experimentalEnableZoomedOutView && isVisualMode;\n\tconst isZoomedOutView = blockEditorMode === 'zoom-out';\n\n\treturn (\n\t\t<div className=\"edit-site-header\">\n\t\t\t<NavigableToolbar\n\t\t\t\tclassName=\"edit-site-header_start\"\n\t\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\t>\n\t\t\t\t<div className=\"edit-site-header__toolbar\">\n\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\tref={ inserterButton }\n\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\tclassName=\"edit-site-header-toolbar__inserter-toggle\"\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tisPressed={ isInserterOpen }\n\t\t\t\t\t\tonMouseDown={ preventDefault }\n\t\t\t\t\t\tonClick={ openInserter }\n\t\t\t\t\t\tdisabled={ ! isVisualMode }\n\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\tlabel={ showIconLabels ? shortLabel : longLabel }\n\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t/>\n\t\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ ToolSelector }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdisabled={ ! isVisualMode }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ UndoButton }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ RedoButton }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\tclassName=\"edit-site-header-toolbar__list-view-toggle\"\n\t\t\t\t\t\t\t\tdisabled={ ! isVisualMode && isZoomedOutView }\n\t\t\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\tlabel={ __( 'List View' ) }\n\t\t\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\t\t\tshortcut={ listViewShortcut }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ isZoomedOutViewExperimentEnabled && (\n\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-header-toolbar__zoom-out-view-toggle\"\n\t\t\t\t\t\t\t\t\ticon={ chevronUpDown }\n\t\t\t\t\t\t\t\t\tisPressed={ isZoomedOutView }\n\t\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Zoom-out View' ) }\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tsetPreviewDeviceType( 'desktop' );\n\t\t\t\t\t\t\t\t\t\tsetIsListViewOpened( false );\n\t\t\t\t\t\t\t\t\t\t__unstableSetEditorMode(\n\t\t\t\t\t\t\t\t\t\t\tisZoomedOutView\n\t\t\t\t\t\t\t\t\t\t\t\t? 'edit'\n\t\t\t\t\t\t\t\t\t\t\t\t: 'zoom-out'\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</NavigableToolbar>\n\n\t\t\t<div className=\"edit-site-header_center\">\n\t\t\t\t<DocumentActions\n\t\t\t\t\tentityTitle={ entityTitle }\n\t\t\t\t\tentityLabel={\n\t\t\t\t\t\ttemplateType === 'wp_template_part'\n\t\t\t\t\t\t\t? 'template part'\n\t\t\t\t\t\t\t: 'template'\n\t\t\t\t\t}\n\t\t\t\t\tisLoaded={ isLoaded }\n\t\t\t\t\tshowIconLabels={ showIconLabels }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<TemplateDetails\n\t\t\t\t\t\t\ttemplate={ template }\n\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</DocumentActions>\n\t\t\t</div>\n\n\t\t\t<div className=\"edit-site-header_end\">\n\t\t\t\t<div className=\"edit-site-header__actions\">\n\t\t\t\t\t{ ! isFocusMode && (\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'edit-site-header__actions__preview-options',\n\t\t\t\t\t\t\t\t{ 'is-zoomed-out': isZoomedOutView }\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PreviewOptions\n\t\t\t\t\t\t\t\tdeviceType={ deviceType }\n\t\t\t\t\t\t\t\tsetDeviceType={ setPreviewDeviceType }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\thref={ settings?.siteUrl }\n\t\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'View site' ) }\n\t\t\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t</PreviewOptions>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t<SaveButton\n\t\t\t\t\t\topenEntitiesSavedStates={ openEntitiesSavedStates }\n\t\t\t\t\t\tisEntitiesSavedStatesOpen={ isEntitiesSavedStatesOpen }\n\t\t\t\t\t/>\n\t\t\t\t\t<PinnedItems.Slot scope=\"core/edit-site\" />\n\t\t\t\t\t<MoreMenu showIconLabels={ showIconLabels } />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
@@ -17,6 +17,8 @@ var _components = require("@wordpress/components");
17
17
 
18
18
  var _addNewTemplate = _interopRequireDefault(require("../add-new-template"));
19
19
 
20
+ var _store = require("../../store");
21
+
20
22
  /**
21
23
  * WordPress dependencies
22
24
  */
@@ -30,7 +32,18 @@ function Header(_ref) {
30
32
  let {
31
33
  templateType
32
34
  } = _ref;
33
- const postType = (0, _data.useSelect)(select => select(_coreData.store).getPostType(templateType), [templateType]);
35
+ const {
36
+ canCreate,
37
+ postType
38
+ } = (0, _data.useSelect)(select => {
39
+ const {
40
+ supportsTemplatePartsMode
41
+ } = select(_store.store).getSettings();
42
+ return {
43
+ postType: select(_coreData.store).getPostType(templateType),
44
+ canCreate: !supportsTemplatePartsMode
45
+ };
46
+ }, [templateType]);
34
47
 
35
48
  if (!postType) {
36
49
  return null;
@@ -41,7 +54,7 @@ function Header(_ref) {
41
54
  }, (0, _element.createElement)(_components.__experimentalHeading, {
42
55
  level: 1,
43
56
  className: "edit-site-list-header__title"
44
- }, (_postType$labels = postType.labels) === null || _postType$labels === void 0 ? void 0 : _postType$labels.name), (0, _element.createElement)("div", {
57
+ }, (_postType$labels = postType.labels) === null || _postType$labels === void 0 ? void 0 : _postType$labels.name), canCreate && (0, _element.createElement)("div", {
45
58
  className: "edit-site-list-header__right"
46
59
  }, (0, _element.createElement)(_addNewTemplate.default, {
47
60
  templateType: templateType
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/list/header.js"],"names":["Header","templateType","postType","select","coreStore","getPostType","labels","name"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAVA;AACA;AACA;;AAKA;AACA;AACA;AAGe,SAASA,MAAT,OAAoC;AAAA;;AAAA,MAAnB;AAAEC,IAAAA;AAAF,GAAmB;AAClD,QAAMC,QAAQ,GAAG,qBACdC,MAAF,IAAcA,MAAM,CAAEC,eAAF,CAAN,CAAoBC,WAApB,CAAiCJ,YAAjC,CADE,EAEhB,CAAEA,YAAF,CAFgB,CAAjB;;AAKA,MAAK,CAAEC,QAAP,EAAkB;AACjB,WAAO,IAAP;AACA;;AAED,SACC;AAAQ,IAAA,SAAS,EAAC;AAAlB,KACC,4BAAC,iCAAD;AAAS,IAAA,KAAK,EAAG,CAAjB;AAAqB,IAAA,SAAS,EAAC;AAA/B,yBACGA,QAAQ,CAACI,MADZ,qDACG,iBAAiBC,IADpB,CADD,EAKC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,uBAAD;AAAgB,IAAA,YAAY,EAAGN;AAA/B,IADD,CALD,CADD;AAWA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalHeading as Heading } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport AddNewTemplate from '../add-new-template';\n\nexport default function Header( { templateType } ) {\n\tconst postType = useSelect(\n\t\t( select ) => select( coreStore ).getPostType( templateType ),\n\t\t[ templateType ]\n\t);\n\n\tif ( ! postType ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<header className=\"edit-site-list-header\">\n\t\t\t<Heading level={ 1 } className=\"edit-site-list-header__title\">\n\t\t\t\t{ postType.labels?.name }\n\t\t\t</Heading>\n\n\t\t\t<div className=\"edit-site-list-header__right\">\n\t\t\t\t<AddNewTemplate templateType={ templateType } />\n\t\t\t</div>\n\t\t</header>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/list/header.js"],"names":["Header","templateType","canCreate","postType","select","supportsTemplatePartsMode","editSiteStore","getSettings","coreStore","getPostType","labels","name"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AAXA;AACA;AACA;;AAKA;AACA;AACA;AAIe,SAASA,MAAT,OAAoC;AAAA;;AAAA,MAAnB;AAAEC,IAAAA;AAAF,GAAmB;AAClD,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA0B,qBAC7BC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA;AAAF,QACLD,MAAM,CAAEE,YAAF,CAAN,CAAwBC,WAAxB,EADD;AAEA,WAAO;AACNJ,MAAAA,QAAQ,EAAEC,MAAM,CAAEI,eAAF,CAAN,CAAoBC,WAApB,CAAiCR,YAAjC,CADJ;AAENC,MAAAA,SAAS,EAAE,CAAEG;AAFP,KAAP;AAIA,GAR8B,EAS/B,CAAEJ,YAAF,CAT+B,CAAhC;;AAYA,MAAK,CAAEE,QAAP,EAAkB;AACjB,WAAO,IAAP;AACA;;AAED,SACC;AAAQ,IAAA,SAAS,EAAC;AAAlB,KACC,4BAAC,iCAAD;AAAS,IAAA,KAAK,EAAG,CAAjB;AAAqB,IAAA,SAAS,EAAC;AAA/B,yBACGA,QAAQ,CAACO,MADZ,qDACG,iBAAiBC,IADpB,CADD,EAKGT,SAAS,IACV;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,uBAAD;AAAgB,IAAA,YAAY,EAAGD;AAA/B,IADD,CANF,CADD;AAaA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalHeading as Heading } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport AddNewTemplate from '../add-new-template';\nimport { store as editSiteStore } from '../../store';\n\nexport default function Header( { templateType } ) {\n\tconst { canCreate, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { supportsTemplatePartsMode } =\n\t\t\t\tselect( editSiteStore ).getSettings();\n\t\t\treturn {\n\t\t\t\tpostType: select( coreStore ).getPostType( templateType ),\n\t\t\t\tcanCreate: ! supportsTemplatePartsMode,\n\t\t\t};\n\t\t},\n\t\t[ templateType ]\n\t);\n\n\tif ( ! postType ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<header className=\"edit-site-list-header\">\n\t\t\t<Heading level={ 1 } className=\"edit-site-list-header__title\">\n\t\t\t\t{ postType.labels?.name }\n\t\t\t</Heading>\n\n\t\t\t{ canCreate && (\n\t\t\t\t<div className=\"edit-site-list-header__right\">\n\t\t\t\t\t<AddNewTemplate templateType={ templateType } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</header>\n\t);\n}\n"]}
@@ -63,6 +63,7 @@ const NavigationPanel = _ref2 => {
63
63
  const {
64
64
  homeTemplate,
65
65
  isNavigationOpen,
66
+ isTemplatePartsMode,
66
67
  siteTitle
67
68
  } = (0, _data.useSelect)(select => {
68
69
  const {
@@ -73,10 +74,15 @@ const NavigationPanel = _ref2 => {
73
74
  isNavigationOpened
74
75
  } = select(_store.store);
75
76
  const siteData = getEntityRecord('root', '__unstableBase', undefined) || {};
77
+ const {
78
+ supportsTemplatePartsMode,
79
+ __unstableHomeTemplate
80
+ } = getSettings();
76
81
  return {
77
82
  siteTitle: siteData.name,
78
- homeTemplate: getSettings().__unstableHomeTemplate,
79
- isNavigationOpen: isNavigationOpened()
83
+ homeTemplate: __unstableHomeTemplate,
84
+ isNavigationOpen: isNavigationOpened(),
85
+ isTemplatePartsMode: !!supportsTemplatePartsMode
80
86
  };
81
87
  }, []);
82
88
  const {
@@ -112,7 +118,7 @@ const NavigationPanel = _ref2 => {
112
118
  href: "index.php"
113
119
  })), (0, _element.createElement)(_components.__experimentalNavigationMenu, null, (0, _element.createElement)(_components.__experimentalNavigationGroup, {
114
120
  title: (0, _i18n.__)('Editor')
115
- }, (0, _element.createElement)(NavLink, {
121
+ }, !isTemplatePartsMode && (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(NavLink, {
116
122
  icon: _icons.home,
117
123
  title: (0, _i18n.__)('Site'),
118
124
  item: SITE_EDITOR_KEY,
@@ -128,7 +134,7 @@ const NavigationPanel = _ref2 => {
128
134
  postId: undefined,
129
135
  postType: 'wp_template'
130
136
  }
131
- }), (0, _element.createElement)(NavLink, {
137
+ })), (0, _element.createElement)(NavLink, {
132
138
  icon: _icons.symbolFilled,
133
139
  title: (0, _i18n.__)('Template Parts'),
134
140
  item: "wp_template_part",
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/navigation-panel/index.js"],"names":["SITE_EDITOR_KEY","NavLink","params","replace","props","linkProps","NavigationPanel","activeItem","homeTemplate","isNavigationOpen","siteTitle","select","getEntityRecord","coreDataStore","getSettings","isNavigationOpened","editSiteStore","siteData","undefined","name","__unstableHomeTemplate","setIsNavigationPanelOpened","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","preventDefault","siteIcon","postId","postType","templateIcon","templatePartIcon"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AACA;;AASA;;AACA;;AACA;;AA/BA;AACA;AACA;;AAGA;AACA;AACA;;AAmBA;AACA;AACA;AAKA,MAAMA,eAAe,GAAG,aAAxB;;AAEA,SAASC,OAAT,OAAkD;AAAA,MAAhC;AAAEC,IAAAA,MAAF;AAAUC,IAAAA,OAAV;AAAmB,OAAGC;AAAtB,GAAgC;AACjD,QAAMC,SAAS,GAAG,mBAASH,MAAT,EAAiBC,OAAjB,CAAlB;AAEA,SAAO,4BAAC,wCAAD,6BAAqBE,SAArB,EAAsCD,KAAtC,EAAP;AACA;;AAED,MAAME,eAAe,GAAG,SAAwC;AAAA,MAAtC;AAAEC,IAAAA,UAAU,GAAGP;AAAf,GAAsC;AAC/D,Q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ACC,MAAA,eAAe,EAAG,cAAI,WAAJ,CADnB;AAEC,MAAA,SAAS,EAAC,+CAFX;AAGC,MAAA,IAAI,EAAC;AAHN,MADD,CADD,EASC,4BAAC,wCAAD,QACC,4BAAC,yCAAD;AAAiB,MAAA,KAAK,EAAG,cAAI,QAAJ;AAAzB,OACC,4BAAC,OAAD;AACC,MAAA,IAAI,EAAGqB,WADR;AAEC,MAAA,KAAK,EAAG,cAAI,MAAJ,CAFT;AAGC,MAAA,IAAI,EAAG5B,eAHR;AAIC,MAAA,MAAM,EAAG;AACR6B,QAAAA,MAAM,EAAErB,YAAF,aAAEA,YAAF,uBAAEA,YAAY,CAAEqB,MADd;AAERC,QAAAA,QAAQ,EAAEtB,YAAF,aAAEA,YAAF,uBAAEA,YAAY,CAAEsB;AAFhB;AAJV,MADD,EAUC,4BAAC,OAAD;AACC,MAAA,IAAI,EAAGC,aADR;AAEC,MAAA,KAAK,EAAG,cAAI,WAAJ,CAFT;AAGC,MAAA,IAAI,EAAC,aAHN;AAIC,MAAA,MAAM,EAAG;AACRF,QAAAA,MAAM,EAAEX,SADA;AAERY,QAAAA,QAAQ,EAAE;AAFF;AAJV,MAVD,EAmBC,4BAAC,OAAD;AACC,MAAA,IAAI,EAAGE,mBADR;AAEC,MAAA,KAAK,EAAG,cAAI,gBAAJ,CAFT;AAGC,MAAA,IAAI,EAAC,kBAHN;AAIC,MAAA,MAAM,EAAG;AACRH,QAAAA,MAAM,EAAEX,SADA;AAERY,QAAAA,QAAQ,EAAE;AAFF;AAJV,MAnBD,CADD,CATD,CADD,CAND,CAND;AAFD;AA4DA,CAtFD;;eAwFexB,e","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalNavigation as Navigation,\n\t__experimentalNavigationBackButton as NavigationBackButton,\n\t__experimentalNavigationGroup as NavigationGroup,\n\t__experimentalNavigationItem as NavigationItem,\n\t__experimentalNavigationMenu as NavigationMenu,\n} from '@wordpress/components';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport {\n\thome as siteIcon,\n\tlayout as templateIcon,\n\tsymbolFilled as templatePartIcon,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { useLink } from '../../routes/link';\nimport MainDashboardButton from '../../main-dashboard-button';\nimport { store as editSiteStore } from '../../../store';\n\nconst SITE_EDITOR_KEY = 'site-editor';\n\nfunction NavLink( { params, replace, ...props } ) {\n\tconst linkProps = useLink( params, replace );\n\n\treturn <NavigationItem { ...linkProps } { ...props } />;\n}\n\nconst NavigationPanel = ( { activeItem = SITE_EDITOR_KEY } ) => {\n\tconst { homeTemplate, isNavigationOpen, siteTitle } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord } = select( coreDataStore );\n\t\t\tconst { getSettings, isNavigationOpened } = select( editSiteStore );\n\n\t\t\tconst siteData =\n\t\t\t\tgetEntityRecord( 'root', '__unstableBase', undefined ) || {};\n\n\t\t\treturn {\n\t\t\t\tsiteTitle: siteData.name,\n\t\t\t\thomeTemplate: getSettings().__unstableHomeTemplate,\n\t\t\t\tisNavigationOpen: isNavigationOpened(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { setIsNavigationPanelOpened } = useDispatch( editSiteStore );\n\n\tconst closeOnEscape = ( event ) => {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tevent.preventDefault();\n\t\t\tsetIsNavigationPanelOpened( false );\n\t\t}\n\t};\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tclassName={ classnames( `edit-site-navigation-panel`, {\n\t\t\t\t'is-open': isNavigationOpen,\n\t\t\t} ) }\n\t\t\tonKeyDown={ closeOnEscape }\n\t\t>\n\t\t\t<div className=\"edit-site-navigation-panel__inner\">\n\t\t\t\t<div className=\"edit-site-navigation-panel__site-title-container\">\n\t\t\t\t\t<div className=\"edit-site-navigation-panel__site-title\">\n\t\t\t\t\t\t{ decodeEntities( siteTitle ) }\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"edit-site-navigation-panel__scroll-container\">\n\t\t\t\t\t<Navigation activeItem={ activeItem }>\n\t\t\t\t\t\t<MainDashboardButton.Slot>\n\t\t\t\t\t\t\t<NavigationBackButton\n\t\t\t\t\t\t\t\tbackButtonLabel={ __( 'Dashboard' ) }\n\t\t\t\t\t\t\t\tclassName=\"edit-site-navigation-panel__back-to-dashboard\"\n\t\t\t\t\t\t\t\thref=\"index.php\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MainDashboardButton.Slot>\n\n\t\t\t\t\t\t<NavigationMenu>\n\t\t\t\t\t\t\t<NavigationGroup title={ __( 'Editor' ) }>\n\t\t\t\t\t\t\t\t<NavLink\n\t\t\t\t\t\t\t\t\ticon={ siteIcon }\n\t\t\t\t\t\t\t\t\ttitle={ __( 'Site' ) }\n\t\t\t\t\t\t\t\t\titem={ SITE_EDITOR_KEY }\n\t\t\t\t\t\t\t\t\tparams={ {\n\t\t\t\t\t\t\t\t\t\tpostId: homeTemplate?.postId,\n\t\t\t\t\t\t\t\t\t\tpostType: homeTemplate?.postType,\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\t<NavLink\n\t\t\t\t\t\t\t\t\ticon={ templateIcon }\n\t\t\t\t\t\t\t\t\ttitle={ __( 'Templates' ) }\n\t\t\t\t\t\t\t\t\titem=\"wp_template\"\n\t\t\t\t\t\t\t\t\tparams={ {\n\t\t\t\t\t\t\t\t\t\tpostId: undefined,\n\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template',\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\t<NavLink\n\t\t\t\t\t\t\t\t\ticon={ templatePartIcon }\n\t\t\t\t\t\t\t\t\ttitle={ __( 'Template Parts' ) }\n\t\t\t\t\t\t\t\t\titem=\"wp_template_part\"\n\t\t\t\t\t\t\t\t\tparams={ {\n\t\t\t\t\t\t\t\t\t\tpostId: undefined,\n\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template_part',\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</NavigationGroup>\n\t\t\t\t\t\t</NavigationMenu>\n\t\t\t\t\t</Navigation>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport default NavigationPanel;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/navigation-panel/index.js"],"names":["SITE_EDITOR_KEY","NavLink","params","replace","props","linkProps","NavigationPanel","activeItem","homeTemplate","isNavigationOpen","isTemplatePartsMode","siteTitle","select","getEntityRecord","coreDataStore","getSettings","isNavigationOpened","editSiteStore","siteData","undefined","supportsTemplatePartsMode","__unstableHomeTemplate","name","setIsNavigationPanelOpened","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","preventDefault","siteIcon","postId","postType","templateIcon","templatePartIcon"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AACA;;AASA;;AACA;;AACA;;AA/BA;AACA;AACA;;AAGA;AACA;AACA;;AAmBA;AACA;AACA;AAKA,MAAMA,eAAe,GAAG,aAAxB;;AAEA,SAASC,OAAT,OAAkD;AAAA,MAAhC;AAAEC,IAAAA,MAAF;AAAUC,IAAAA,OAAV;AAAmB,OAAGC;AAAtB,GAAgC;AACjD,QAAMC,SAAS,GAAG,mBAASH,MAAT,EAAiBC,OAAjB,CAAlB;AAEA,SAAO,4BAAC,wCAAD,6BAAqBE,SAArB,EAAsCD,KAAtC,EAAP;AACA;;AAED,MAAME,eAAe,GAAG,SAAwC;A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sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalNavigation as Navigation,\n\t__experimentalNavigationBackButton as NavigationBackButton,\n\t__experimentalNavigationGroup as NavigationGroup,\n\t__experimentalNavigationItem as NavigationItem,\n\t__experimentalNavigationMenu as NavigationMenu,\n} from '@wordpress/components';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport {\n\thome as siteIcon,\n\tlayout as templateIcon,\n\tsymbolFilled as templatePartIcon,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { useLink } from '../../routes/link';\nimport MainDashboardButton from '../../main-dashboard-button';\nimport { store as editSiteStore } from '../../../store';\n\nconst SITE_EDITOR_KEY = 'site-editor';\n\nfunction NavLink( { params, replace, ...props } ) {\n\tconst linkProps = useLink( params, replace );\n\n\treturn <NavigationItem { ...linkProps } { ...props } />;\n}\n\nconst NavigationPanel = ( { activeItem = SITE_EDITOR_KEY } ) => {\n\tconst { homeTemplate, isNavigationOpen, isTemplatePartsMode, siteTitle } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getEntityRecord } = select( coreDataStore );\n\t\t\tconst { getSettings, isNavigationOpened } = select( editSiteStore );\n\n\t\t\tconst siteData =\n\t\t\t\tgetEntityRecord( 'root', '__unstableBase', undefined ) || {};\n\t\t\tconst { supportsTemplatePartsMode, __unstableHomeTemplate } =\n\t\t\t\tgetSettings();\n\n\t\t\treturn {\n\t\t\t\tsiteTitle: siteData.name,\n\t\t\t\thomeTemplate: __unstableHomeTemplate,\n\t\t\t\tisNavigationOpen: isNavigationOpened(),\n\t\t\t\tisTemplatePartsMode: !! supportsTemplatePartsMode,\n\t\t\t};\n\t\t}, [] );\n\tconst { setIsNavigationPanelOpened } = useDispatch( editSiteStore );\n\n\tconst closeOnEscape = ( event ) => {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tevent.preventDefault();\n\t\t\tsetIsNavigationPanelOpened( false );\n\t\t}\n\t};\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tclassName={ classnames( `edit-site-navigation-panel`, {\n\t\t\t\t'is-open': isNavigationOpen,\n\t\t\t} ) }\n\t\t\tonKeyDown={ closeOnEscape }\n\t\t>\n\t\t\t<div className=\"edit-site-navigation-panel__inner\">\n\t\t\t\t<div className=\"edit-site-navigation-panel__site-title-container\">\n\t\t\t\t\t<div className=\"edit-site-navigation-panel__site-title\">\n\t\t\t\t\t\t{ decodeEntities( siteTitle ) }\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"edit-site-navigation-panel__scroll-container\">\n\t\t\t\t\t<Navigation activeItem={ activeItem }>\n\t\t\t\t\t\t<MainDashboardButton.Slot>\n\t\t\t\t\t\t\t<NavigationBackButton\n\t\t\t\t\t\t\t\tbackButtonLabel={ __( 'Dashboard' ) }\n\t\t\t\t\t\t\t\tclassName=\"edit-site-navigation-panel__back-to-dashboard\"\n\t\t\t\t\t\t\t\thref=\"index.php\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MainDashboardButton.Slot>\n\n\t\t\t\t\t\t<NavigationMenu>\n\t\t\t\t\t\t\t<NavigationGroup title={ __( 'Editor' ) }>\n\t\t\t\t\t\t\t\t{ ! isTemplatePartsMode && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<NavLink\n\t\t\t\t\t\t\t\t\t\t\ticon={ siteIcon }\n\t\t\t\t\t\t\t\t\t\t\ttitle={ __( 'Site' ) }\n\t\t\t\t\t\t\t\t\t\t\titem={ SITE_EDITOR_KEY }\n\t\t\t\t\t\t\t\t\t\t\tparams={ {\n\t\t\t\t\t\t\t\t\t\t\t\tpostId: homeTemplate?.postId,\n\t\t\t\t\t\t\t\t\t\t\t\tpostType:\n\t\t\t\t\t\t\t\t\t\t\t\t\thomeTemplate?.postType,\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<NavLink\n\t\t\t\t\t\t\t\t\t\t\ticon={ templateIcon }\n\t\t\t\t\t\t\t\t\t\t\ttitle={ __( 'Templates' ) }\n\t\t\t\t\t\t\t\t\t\t\titem=\"wp_template\"\n\t\t\t\t\t\t\t\t\t\t\tparams={ {\n\t\t\t\t\t\t\t\t\t\t\t\tpostId: undefined,\n\t\t\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t/>\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\t<NavLink\n\t\t\t\t\t\t\t\t\ticon={ templatePartIcon }\n\t\t\t\t\t\t\t\t\ttitle={ __( 'Template Parts' ) }\n\t\t\t\t\t\t\t\t\titem=\"wp_template_part\"\n\t\t\t\t\t\t\t\t\tparams={ {\n\t\t\t\t\t\t\t\t\t\tpostId: undefined,\n\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template_part',\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</NavigationGroup>\n\t\t\t\t\t\t</NavigationMenu>\n\t\t\t\t\t</Navigation>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport default NavigationPanel;\n"]}
@@ -36,6 +36,8 @@ var _templateCard = _interopRequireDefault(require("./template-card"));
36
36
 
37
37
  var _constants2 = require("./constants");
38
38
 
39
+ var _store = require("../../store");
40
+
39
41
  /**
40
42
  * WordPress dependencies
41
43
  */
@@ -54,16 +56,19 @@ function SidebarComplementaryAreaFills() {
54
56
  const {
55
57
  sidebar,
56
58
  isEditorSidebarOpened,
57
- hasBlockSelection
59
+ hasBlockSelection,
60
+ supportsGlobalStyles
58
61
  } = (0, _data.useSelect)(select => {
59
62
  const _sidebar = select(_interface.store).getActiveComplementaryArea(_constants.STORE_NAME);
60
63
 
61
64
  const _isEditorSidebarOpened = [_constants2.SIDEBAR_BLOCK, _constants2.SIDEBAR_TEMPLATE].includes(_sidebar);
62
65
 
66
+ const settings = select(_store.store).getSettings();
63
67
  return {
64
68
  sidebar: _sidebar,
65
69
  isEditorSidebarOpened: _isEditorSidebarOpened,
66
- hasBlockSelection: !!select(_blockEditor.store).getBlockSelectionStart()
70
+ hasBlockSelection: !!select(_blockEditor.store).getBlockSelectionStart(),
71
+ supportsGlobalStyles: !(settings !== null && settings !== void 0 && settings.supportsTemplatePartsMode)
67
72
  };
68
73
  }, []);
69
74
  const {
@@ -104,6 +109,6 @@ function SidebarComplementaryAreaFills() {
104
109
  headerClassName: "edit-site-sidebar__panel-tabs"
105
110
  }, sidebarName === _constants2.SIDEBAR_TEMPLATE && (0, _element.createElement)(_components.PanelBody, null, (0, _element.createElement)(_templateCard.default, null)), sidebarName === _constants2.SIDEBAR_BLOCK && (0, _element.createElement)(InspectorSlot, {
106
111
  bubblesVirtually: true
107
- })), (0, _element.createElement)(_globalStylesSidebar.default, null), (0, _element.createElement)(MaybeNavigationMenuSidebar, null));
112
+ })), supportsGlobalStyles && (0, _element.createElement)(_globalStylesSidebar.default, null), (0, _element.createElement)(MaybeNavigationMenuSidebar, null));
108
113
  }
109
114
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"names":["Slot","InspectorSlot","Fill","InspectorFill","SidebarInspectorFill","SidebarComplementaryAreaFills","sidebar","isEditorSidebarOpened","hasBlockSelection","select","_sidebar","interfaceStore","getActiveComplementaryArea","STORE_NAME","_isEditorSidebarOpened","SIDEBAR_BLOCK","SIDEBAR_TEMPLATE","includes","blockEditorStore","getBlockSelectionStart","enableComplementaryArea","sidebarName","MaybeNavigationMenuSidebar","Fragment","process","env","IS_GUTENBERG_PLUGIN","NavigationMenuSidebar","cog"],"mappings":";;;;;;;;;;AAMA;;AAHA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AApBA;AACA;AACA;;AASA;AACA;AACA;AASA,MAAM;AAAEA,EAAAA,IAAI,EAAEC,aAAR;AAAuBC,EAAAA,IAAI,EAAEC;AAA7B,IAA+C,gCACpD,0BADoD,CAArD;AAGO,MAAMC,oBAAoB,GAAGD,aAA7B;;;AAEA,SAASE,6BAAT,GAAyC;AAC/C,QAAM;AAAEC,IAAAA,OAAF;AAAWC,IAAAA,qBAAX;AAAkCC,IAAAA;AAAlC,MAAwD,qBAC3DC,MAAF,IAAc;AACb,UAAMC,QAAQ,GACbD,MAAM,CAAEE,gBAAF,CAAN,CAAyBC,0BAAzB,CACCC,qBADD,CADD;;AAIA,UAAMC,sBAAsB,GAAG,CAC9BC,yBAD8B,EAE9BC,4BAF8B,EAG7BC,QAH6B,CAGnBP,QAHmB,CAA/B;;AAIA,WAAO;AACNJ,MAAAA,OAAO,EAAEI,QADH;AAENH,MAAAA,qBAAqB,EAAEO,sBAFjB;AAGNN,MAAAA,iBAAiB,EAChB,CAAC,CAAEC,MAAM,CAAES,kBAAF,CAAN,CAA2BC,sBAA3B;AAJE,KAAP;AAMA,GAhB4D,EAiB7D,EAjB6D,CAA9D;AAmBA,QAAM;AAAEC,IAAAA;AAAF,MAA8B,uBAAaT,gBAAb,CAApC;AAEA,0BAAW,MAAM;AAChB,QAAK,CAAEJ,qBAAP,EAA+B;;AAC/B,QAAKC,iBAAL,EAAyB;AACxBY,MAAAA,uBAAuB,CAAEP,qBAAF,EAAcE,yBAAd,CAAvB;AACA,KAFD,MAEO;AACNK,MAAAA,uBAAuB,CAAEP,qBAAF,EAAcG,4BAAd,CAAvB;AACA;AACD,GAPD,EAOG,CAAER,iBAAF,EAAqBD,qBAArB,CAPH;AASA,MAAIc,WAAW,GAAGf,OAAlB;;AACA,MAAK,CAAEC,qBAAP,EAA+B;AAC9Bc,IAAAA,WAAW,GAAGb,iBAAiB,GAAGO,yBAAH,GAAmBC,4BAAlD;AACA,GAlC8C,CAoC/C;AACA;AACA;;;AACA,MAAIM,0BAA0B,GAAGC,iBAAjC;;AAEA,MAAKC,OAAO,CAACC,GAAR,CAAYC,mBAAjB,EAAuC;AACtCJ,IAAAA,0BAA0B,GAAGK,8BAA7B;AACA;;AAED,SACC,qDACC,4BAAC,uBAAD;AACC,IAAA,UAAU,EAAGN,WADd;AAEC,IAAA,KAAK,EAAG,cAAI,UAAJ,CAFT;AAGC,IAAA,IAAI,EAAGO,UAHR;AAIC,IAAA,UAAU,EAAG,cAAI,wBAAJ,CAJd;AAKC,IAAA,MAAM,EAAG,4BAAC,uBAAD;AAAgB,MAAA,WAAW,EAAGP;AAA9B,MALV;AAMC,IAAA,eAAe,EAAC;AANjB,KAQGA,WAAW,KAAKL,4BAAhB,IACD,4BAAC,qBAAD,QACC,4BAAC,qBAAD,OADD,CATF,EAaGK,WAAW,KAAKN,yBAAhB,IACD,4BAAC,aAAD;AAAe,IAAA,gBAAgB;AAA/B,IAdF,CADD,EAkBC,4BAAC,4BAAD,OAlBD,EAmBC,4BAAC,0BAAD,OAnBD,CADD;AAuBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill, PanelBody } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { cog } from '@wordpress/icons';\nimport { useEffect, Fragment } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport DefaultSidebar from './default-sidebar';\nimport GlobalStylesSidebar from './global-styles-sidebar';\nimport NavigationMenuSidebar from './navigation-menu-sidebar';\nimport { STORE_NAME } from '../../store/constants';\nimport SettingsHeader from './settings-header';\nimport TemplateCard from './template-card';\nimport { SIDEBAR_BLOCK, SIDEBAR_TEMPLATE } from './constants';\n\nconst { Slot: InspectorSlot, Fill: InspectorFill } = createSlotFill(\n\t'EditSiteSidebarInspector'\n);\nexport const SidebarInspectorFill = InspectorFill;\n\nexport function SidebarComplementaryAreaFills() {\n\tconst { sidebar, isEditorSidebarOpened, hasBlockSelection } = useSelect(\n\t\t( select ) => {\n\t\t\tconst _sidebar =\n\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\t\tSTORE_NAME\n\t\t\t\t);\n\t\t\tconst _isEditorSidebarOpened = [\n\t\t\t\tSIDEBAR_BLOCK,\n\t\t\t\tSIDEBAR_TEMPLATE,\n\t\t\t].includes( _sidebar );\n\t\t\treturn {\n\t\t\t\tsidebar: _sidebar,\n\t\t\t\tisEditorSidebarOpened: _isEditorSidebarOpened,\n\t\t\t\thasBlockSelection:\n\t\t\t\t\t!! select( blockEditorStore ).getBlockSelectionStart(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tuseEffect( () => {\n\t\tif ( ! isEditorSidebarOpened ) return;\n\t\tif ( hasBlockSelection ) {\n\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_BLOCK );\n\t\t} else {\n\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_TEMPLATE );\n\t\t}\n\t}, [ hasBlockSelection, isEditorSidebarOpened ] );\n\n\tlet sidebarName = sidebar;\n\tif ( ! isEditorSidebarOpened ) {\n\t\tsidebarName = hasBlockSelection ? SIDEBAR_BLOCK : SIDEBAR_TEMPLATE;\n\t}\n\n\t// Conditionally include NavMenu sidebar in Plugin only.\n\t// Optimise for dead code elimination.\n\t// See https://github.com/WordPress/gutenberg/blob/trunk/docs/how-to-guides/feature-flags.md#dead-code-elimination.\n\tlet MaybeNavigationMenuSidebar = Fragment;\n\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\tMaybeNavigationMenuSidebar = NavigationMenuSidebar;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<DefaultSidebar\n\t\t\t\tidentifier={ sidebarName }\n\t\t\t\ttitle={ __( 'Settings' ) }\n\t\t\t\ticon={ cog }\n\t\t\t\tcloseLabel={ __( 'Close settings sidebar' ) }\n\t\t\t\theader={ <SettingsHeader sidebarName={ sidebarName } /> }\n\t\t\t\theaderClassName=\"edit-site-sidebar__panel-tabs\"\n\t\t\t>\n\t\t\t\t{ sidebarName === SIDEBAR_TEMPLATE && (\n\t\t\t\t\t<PanelBody>\n\t\t\t\t\t\t<TemplateCard />\n\t\t\t\t\t</PanelBody>\n\t\t\t\t) }\n\t\t\t\t{ sidebarName === SIDEBAR_BLOCK && (\n\t\t\t\t\t<InspectorSlot bubblesVirtually />\n\t\t\t\t) }\n\t\t\t</DefaultSidebar>\n\t\t\t<GlobalStylesSidebar />\n\t\t\t<MaybeNavigationMenuSidebar />\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"names":["Slot","InspectorSlot","Fill","InspectorFill","SidebarInspectorFill","SidebarComplementaryAreaFills","sidebar","isEditorSidebarOpened","hasBlockSelection","supportsGlobalStyles","select","_sidebar","interfaceStore","getActiveComplementaryArea","STORE_NAME","_isEditorSidebarOpened","SIDEBAR_BLOCK","SIDEBAR_TEMPLATE","includes","settings","editSiteStore","getSettings","blockEditorStore","getBlockSelectionStart","supportsTemplatePartsMode","enableComplementaryArea","sidebarName","MaybeNavigationMenuSidebar","Fragment","process","env","IS_GUTENBERG_PLUGIN","NavigationMenuSidebar","cog"],"mappings":";;;;;;;;;;AAMA;;AAHA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AArBA;AACA;AACA;;AASA;AACA;AACA;AAUA,MAAM;AAAEA,EAAAA,IAAI,EAAEC,aAAR;AAAuBC,EAAAA,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AGlB,iBAAiB,GAAGQ,yBAAH,GAAmBC,4BAAlD;AACA,GApC8C,CAsC/C;AACA;AACA;;;AACA,MAAIU,0BAA0B,GAAGC,iBAAjC;;AAEA,MAAKC,OAAO,CAACC,GAAR,CAAYC,mBAAjB,EAAuC;AACtCJ,IAAAA,0BAA0B,GAAGK,8BAA7B;AACA;;AAED,SACC,qDACC,4BAAC,uBAAD;AACC,IAAA,UAAU,EAAGN,WADd;AAEC,IAAA,KAAK,EAAG,cAAI,UAAJ,CAFT;AAGC,IAAA,IAAI,EAAGO,UAHR;AAIC,IAAA,UAAU,EAAG,cAAI,wBAAJ,CAJd;AAKC,IAAA,MAAM,EAAG,4BAAC,uBAAD;AAAgB,MAAA,WAAW,EAAGP;AAA9B,MALV;AAMC,IAAA,eAAe,EAAC;AANjB,KAQGA,WAAW,KAAKT,4BAAhB,IACD,4BAAC,qBAAD,QACC,4BAAC,qBAAD,OADD,CATF,EAaGS,WAAW,KAAKV,yBAAhB,IACD,4BAAC,aAAD;AAAe,IAAA,gBAAgB;AAA/B,IAdF,CADD,EAkBGP,oBAAoB,IAAI,4BAAC,4BAAD,OAlB3B,EAmBC,4BAAC,0BAAD,OAnBD,CADD;AAuBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill, PanelBody } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { cog } from '@wordpress/icons';\nimport { useEffect, Fragment } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport DefaultSidebar from './default-sidebar';\nimport GlobalStylesSidebar from './global-styles-sidebar';\nimport NavigationMenuSidebar from './navigation-menu-sidebar';\nimport { STORE_NAME } from '../../store/constants';\nimport SettingsHeader from './settings-header';\nimport TemplateCard from './template-card';\nimport { SIDEBAR_BLOCK, SIDEBAR_TEMPLATE } from './constants';\nimport { store as editSiteStore } from '../../store';\n\nconst { Slot: InspectorSlot, Fill: InspectorFill } = createSlotFill(\n\t'EditSiteSidebarInspector'\n);\nexport const SidebarInspectorFill = InspectorFill;\n\nexport function SidebarComplementaryAreaFills() {\n\tconst {\n\t\tsidebar,\n\t\tisEditorSidebarOpened,\n\t\thasBlockSelection,\n\t\tsupportsGlobalStyles,\n\t} = useSelect( ( select ) => {\n\t\tconst _sidebar =\n\t\t\tselect( interfaceStore ).getActiveComplementaryArea( STORE_NAME );\n\t\tconst _isEditorSidebarOpened = [\n\t\t\tSIDEBAR_BLOCK,\n\t\t\tSIDEBAR_TEMPLATE,\n\t\t].includes( _sidebar );\n\t\tconst settings = select( editSiteStore ).getSettings();\n\t\treturn {\n\t\t\tsidebar: _sidebar,\n\t\t\tisEditorSidebarOpened: _isEditorSidebarOpened,\n\t\t\thasBlockSelection:\n\t\t\t\t!! select( blockEditorStore ).getBlockSelectionStart(),\n\t\t\tsupportsGlobalStyles: ! settings?.supportsTemplatePartsMode,\n\t\t};\n\t}, [] );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tuseEffect( () => {\n\t\tif ( ! isEditorSidebarOpened ) return;\n\t\tif ( hasBlockSelection ) {\n\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_BLOCK );\n\t\t} else {\n\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_TEMPLATE );\n\t\t}\n\t}, [ hasBlockSelection, isEditorSidebarOpened ] );\n\n\tlet sidebarName = sidebar;\n\tif ( ! isEditorSidebarOpened ) {\n\t\tsidebarName = hasBlockSelection ? SIDEBAR_BLOCK : SIDEBAR_TEMPLATE;\n\t}\n\n\t// Conditionally include NavMenu sidebar in Plugin only.\n\t// Optimise for dead code elimination.\n\t// See https://github.com/WordPress/gutenberg/blob/trunk/docs/how-to-guides/feature-flags.md#dead-code-elimination.\n\tlet MaybeNavigationMenuSidebar = Fragment;\n\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\tMaybeNavigationMenuSidebar = NavigationMenuSidebar;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<DefaultSidebar\n\t\t\t\tidentifier={ sidebarName }\n\t\t\t\ttitle={ __( 'Settings' ) }\n\t\t\t\ticon={ cog }\n\t\t\t\tcloseLabel={ __( 'Close settings sidebar' ) }\n\t\t\t\theader={ <SettingsHeader sidebarName={ sidebarName } /> }\n\t\t\t\theaderClassName=\"edit-site-sidebar__panel-tabs\"\n\t\t\t>\n\t\t\t\t{ sidebarName === SIDEBAR_TEMPLATE && (\n\t\t\t\t\t<PanelBody>\n\t\t\t\t\t\t<TemplateCard />\n\t\t\t\t\t</PanelBody>\n\t\t\t\t) }\n\t\t\t\t{ sidebarName === SIDEBAR_BLOCK && (\n\t\t\t\t\t<InspectorSlot bubblesVirtually />\n\t\t\t\t) }\n\t\t\t</DefaultSidebar>\n\t\t\t{ supportsGlobalStyles && <GlobalStylesSidebar /> }\n\t\t\t<MaybeNavigationMenuSidebar />\n\t\t</>\n\t);\n}\n"]}
@@ -29,6 +29,8 @@ var _icons = require("@wordpress/icons");
29
29
 
30
30
  var _createTemplatePartModal = _interopRequireDefault(require("../create-template-part-modal"));
31
31
 
32
+ var _store = require("../../store");
33
+
32
34
  /**
33
35
  * External dependencies
34
36
  */
@@ -55,6 +57,20 @@ function ConvertToTemplatePart(_ref) {
55
57
  const {
56
58
  createSuccessNotice
57
59
  } = (0, _data.useDispatch)(_notices.store);
60
+ const {
61
+ canCreate
62
+ } = (0, _data.useSelect)(select => {
63
+ const {
64
+ supportsTemplatePartsMode
65
+ } = select(_store.store).getSettings();
66
+ return {
67
+ canCreate: !supportsTemplatePartsMode
68
+ };
69
+ }, []);
70
+
71
+ if (!canCreate) {
72
+ return null;
73
+ }
58
74
 
59
75
  const onConvert = async _ref2 => {
60
76
  let {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/template-part-converter/convert-to-template-part.js"],"names":["ConvertToTemplatePart","clientIds","blocks","isModalOpen","setIsModalOpen","replaceBlocks","blockEditorStore","saveEntityRecord","coreStore","createSuccessNotice","noticesStore","onConvert","title","area","cleanSlug","replace","templatePart","slug","content","theme","type","symbolFilled"],"mappings":";;;;;;;;;AAgBA;;AAbA;;AAKA;;AACA;;AAIA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AAKA;;AAxBA;AACA;AACA;;AAGA;AACA;AACA;;AAcA;AACA;AACA;AAGe,SAASA,qBAAT,OAAwD;AAAA,MAAxB;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,GAAwB;AACtE,QAAM,CAAEC,WAAF,EAAeC,cAAf,IAAkC,uBAAU,KAAV,CAAxC;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAoB,uBAAaC,kBAAb,CAA1B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAuB,uBAAaC,eAAb,CAA7B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAA0B,uBAAaC,cAAb,CAAhC;;AAEA,QAAMC,SAAS,GAAG,eAA6B;AAAA,QAArB;AAAEC,MAAAA,KAAF;AAASC,MAAAA;AAAT,KAAqB;AAC9C;AACA;AACA,UAAMC,SAAS,GACd,uBAAWF,KAAX,EAAmBG,OAAnB,CAA4B,UAA5B,EAAwC,EAAxC,KAAgD,gBADjD;AAGA,UAAMC,YAAY,GAAG,MAAMT,gBAAgB,CAC1C,UAD0C,EAE1C,kBAF0C,EAG1C;AACCU,MAAAA,IAAI,EAAEH,SADP;AAECF,MAAAA,KAFD;AAGCM,MAAAA,OAAO,EAAE,uBAAWhB,MAAX,CAHV;AAICW,MAAAA;AAJD,KAH0C,CAA3C;AAUAR,IAAAA,aAAa,CACZJ,SADY,EAEZ,yBAAa,oBAAb,EAAmC;AAClCgB,MAAAA,IAAI,EAAED,YAAY,CAACC,IADe;AAElCE,MAAAA,KAAK,EAAEH,YAAY,CAACG;AAFc,KAAnC,CAFY,CAAb;AAOAV,IAAAA,mBAAmB,CAAE,cAAI,wBAAJ,CAAF,EAAkC;AACpDW,MAAAA,IAAI,EAAE;AAD8C,KAAlC,CAAnB,CAvB8C,CA2B9C;AACA;AACA,GA7BD;;AA+BA,SACC,qDACC,4BAAC,sCAAD,QACG,MACD,4BAAC,oBAAD;AACC,IAAA,IAAI,EAAGC,mBADR;AAEC,IAAA,OAAO,EAAG,MAAM;AACfjB,MAAAA,cAAc,CAAE,IAAF,CAAd;AACA;AAJF,KAMG,cAAI,sBAAJ,CANH,CAFF,CADD,EAaGD,WAAW,IACZ,4BAAC,gCAAD;AACC,IAAA,UAAU,EAAG,MAAM;AAClBC,MAAAA,cAAc,CAAE,KAAF,CAAd;AACA,KAHF;AAIC,IAAA,QAAQ,EAAGO;AAJZ,IAdF,CADD;AAwBA","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { MenuItem } from '@wordpress/components';\nimport { createBlock, serialize } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { symbolFilled } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport CreateTemplatePartModal from '../create-template-part-modal';\n\nexport default function ConvertToTemplatePart( { clientIds, blocks } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst onConvert = async ( { title, area } ) => {\n\t\t// Currently template parts only allow latin chars.\n\t\t// Fallback slug will receive suffix by default.\n\t\tconst cleanSlug =\n\t\t\tkebabCase( title ).replace( /[^\\w-]+/g, '' ) || 'wp-custom-part';\n\n\t\tconst templatePart = await saveEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\t{\n\t\t\t\tslug: cleanSlug,\n\t\t\t\ttitle,\n\t\t\t\tcontent: serialize( blocks ),\n\t\t\t\tarea,\n\t\t\t}\n\t\t);\n\t\treplaceBlocks(\n\t\t\tclientIds,\n\t\t\tcreateBlock( 'core/template-part', {\n\t\t\t\tslug: templatePart.slug,\n\t\t\t\ttheme: templatePart.theme,\n\t\t\t} )\n\t\t);\n\t\tcreateSuccessNotice( __( 'Template part created.' ), {\n\t\t\ttype: 'snackbar',\n\t\t} );\n\n\t\t// The modal and this component will be unmounted because of `replaceBlocks` above,\n\t\t// so no need to call `closeModal` or `onClose`.\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t{ () => (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\ticon={ symbolFilled }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetIsModalOpen( true );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Create Template part' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t) }\n\t\t\t</BlockSettingsMenuControls>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<CreateTemplatePartModal\n\t\t\t\t\tcloseModal={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\tonCreate={ onConvert }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/template-part-converter/convert-to-template-part.js"],"names":["ConvertToTemplatePart","clientIds","blocks","isModalOpen","setIsModalOpen","replaceBlocks","blockEditorStore","saveEntityRecord","coreStore","createSuccessNotice","noticesStore","canCreate","select","supportsTemplatePartsMode","editSiteStore","getSettings","onConvert","title","area","cleanSlug","replace","templatePart","slug","content","theme","type","symbolFilled"],"mappings":";;;;;;;;;AAgBA;;AAbA;;AAKA;;AACA;;AAIA;;A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,IADe;AAElCE,MAAAA,KAAK,EAAEH,YAAY,CAACG;AAFc,KAAnC,CAFY,CAAb;AAOAf,IAAAA,mBAAmB,CAAE,cAAI,wBAAJ,CAAF,EAAkC;AACpDgB,MAAAA,IAAI,EAAE;AAD8C,KAAlC,CAAnB,CAvB8C,CA2B9C;AACA;AACA,GA7BD;;AA+BA,SACC,qDACC,4BAAC,sCAAD,QACG,MACD,4BAAC,oBAAD;AACC,IAAA,IAAI,EAAGC,mBADR;AAEC,IAAA,OAAO,EAAG,MAAM;AACftB,MAAAA,cAAc,CAAE,IAAF,CAAd;AACA;AAJF,KAMG,cAAI,sBAAJ,CANH,CAFF,CADD,EAaGD,WAAW,IACZ,4BAAC,gCAAD;AACC,IAAA,UAAU,EAAG,MAAM;AAClBC,MAAAA,cAAc,CAAE,KAAF,CAAd;AACA,KAHF;AAIC,IAAA,QAAQ,EAAGY;AAJZ,IAdF,CADD;AAwBA","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { MenuItem } from '@wordpress/components';\nimport { createBlock, serialize } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { symbolFilled } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport CreateTemplatePartModal from '../create-template-part-modal';\nimport { store as editSiteStore } from '../../store';\n\nexport default function ConvertToTemplatePart( { clientIds, blocks } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst { canCreate } = useSelect( ( select ) => {\n\t\tconst { supportsTemplatePartsMode } =\n\t\t\tselect( editSiteStore ).getSettings();\n\t\treturn {\n\t\t\tcanCreate: ! supportsTemplatePartsMode,\n\t\t};\n\t}, [] );\n\n\tif ( ! canCreate ) {\n\t\treturn null;\n\t}\n\n\tconst onConvert = async ( { title, area } ) => {\n\t\t// Currently template parts only allow latin chars.\n\t\t// Fallback slug will receive suffix by default.\n\t\tconst cleanSlug =\n\t\t\tkebabCase( title ).replace( /[^\\w-]+/g, '' ) || 'wp-custom-part';\n\n\t\tconst templatePart = await saveEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\t{\n\t\t\t\tslug: cleanSlug,\n\t\t\t\ttitle,\n\t\t\t\tcontent: serialize( blocks ),\n\t\t\t\tarea,\n\t\t\t}\n\t\t);\n\t\treplaceBlocks(\n\t\t\tclientIds,\n\t\t\tcreateBlock( 'core/template-part', {\n\t\t\t\tslug: templatePart.slug,\n\t\t\t\ttheme: templatePart.theme,\n\t\t\t} )\n\t\t);\n\t\tcreateSuccessNotice( __( 'Template part created.' ), {\n\t\t\ttype: 'snackbar',\n\t\t} );\n\n\t\t// The modal and this component will be unmounted because of `replaceBlocks` above,\n\t\t// so no need to call `closeModal` or `onClose`.\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t{ () => (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\ticon={ symbolFilled }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetIsModalOpen( true );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Create Template part' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t) }\n\t\t\t</BlockSettingsMenuControls>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<CreateTemplatePartModal\n\t\t\t\t\tcloseModal={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\tonCreate={ onConvert }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
package/build/index.js CHANGED
@@ -143,7 +143,10 @@ function reinitializeEditor(target, settings) {
143
143
  // screen and land in the list screen.
144
144
  (0, _data.dispatch)(_store.store).setIsNavigationPanelOpened((0, _data.select)(_viewport.store).isViewportMatch('medium'));
145
145
  }
146
- }
146
+ } // Prevent the default browser action for files dropped outside of dropzones.
147
+
148
+ window.addEventListener('dragover', e => e.preventDefault(), false);
149
+ window.addEventListener('drop', e => e.preventDefault(), false);
147
150
  (0, _element.render)((0, _element.createElement)(_app.default, {
148
151
  reboot: reboot
149
152
  }), target);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["reinitializeEditor","target","settings","__unstableHomeTemplate","reboot","bind","preferencesStore","setDefaults","editorMode","fixedToolbar","focusMode","keepCaretInsideBlock","welcomeGuide","welcomeGuideStyles","showListViewByDefault","get","editSiteStore","setIsListViewOpened","interfaceStore","setDefaultComplementaryArea","updateSettings","editorStore","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","isLandingOnListPage","window","location","href","setIsNavigationPanelOpened","viewportStore","isViewportMatch","initializeEditor","id","__experimentalFetchLinkSuggestions","search","searchOptions","__experimentalFetchRichUrlData","fetchUrlData","document","getElementById","blocksStore","__experimentalReapplyBlockTypeFilters","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA;;AANA;;AACA;;AAIA;;AAEA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AA4GA;;AACA;;AACA;;AACA;;AACA;;AA5IA;AACA;AACA;;AAmBA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,kBAAT,CAA6BC,MAA7B,EAAqCC,QAArC,EAAgD;AACtD;AACA,MAAK,CAAEA,QAAQ,CAACC,sBA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,CACC,kBAAQC,eAAR,EAAwBC,eAAxB,CAAyC,QAAzC,CADD;AAGA;AACD;AAED,uBAAQ,4BAAC,YAAD;AAAa,IAAA,MAAM,EAAG3B;AAAtB,IAAR,EAA2CH,MAA3C;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAAS+B,gBAAT,CAA2BC,EAA3B,EAA+B/B,QAA/B,EAA0C;AAChDA,EAAAA,QAAQ,CAACgC,kCAAT,GAA8C,CAAEC,MAAF,EAAUC,aAAV,KAC7C,kDAAsBD,MAAtB,EAA8BC,aAA9B,EAA6ClC,QAA7C,CADD;;AAEAA,EAAAA,QAAQ,CAACmC,8BAAT,GAA0CC,oCAA1C;AAEA,QAAMrC,MAAM,GAAGsC,QAAQ,CAACC,cAAT,CAAyBP,EAAzB,CAAf;;AAEA,sBAAUQ,aAAV,EAAwBC,qCAAxB;;AACA;;AACA,MAAKC,OAAO,CAACC,GAAR,CAAYC,mBAAjB,EAAuC;AACtC,oEAA8C;AAC7CC,MAAAA,eAAe,EAAE;AAD4B,KAA9C;AAGA;;AAED9C,EAAAA,kBAAkB,CAAEC,MAAF,EAAUC,QAAV,CAAlB;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch, select } from '@wordpress/data';\nimport { render, unmountComponentAtNode } from '@wordpress/element';\nimport {\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { __ } from '@wordpress/i18n';\nimport { store as viewportStore } from '@wordpress/viewport';\nimport { getQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport EditSiteApp from './components/app';\nimport getIsListPage from './utils/get-is-list-page';\nimport ErrorBoundaryWarning from './components/error-boundary/warning';\n\n/**\n * Reinitializes the editor after the user chooses to reboot the editor after\n * an unhandled error occurs, replacing previously mounted editor element using\n * an initial state from prior to the crash.\n *\n * @param {Element} target DOM node in which editor is rendered.\n * @param {?Object} settings Editor settings object.\n */\nexport function reinitializeEditor( target, settings ) {\n\t// Display warning if editor wasn't able to resolve homepage template.\n\tif ( ! settings.__unstableHomeTemplate ) {\n\t\trender(\n\t\t\t<ErrorBoundaryWarning\n\t\t\t\tmessage={ __(\n\t\t\t\t\t'The editor is unable to find a block template for the homepage.'\n\t\t\t\t) }\n\t\t\t\tdashboardLink=\"index.php\"\n\t\t\t/>,\n\t\t\ttarget\n\t\t);\n\t\treturn;\n\t}\n\n\t// This will be a no-op if the target doesn't have any React nodes.\n\tunmountComponentAtNode( target );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\t{\n\t\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\t\teditorMode: 'visual',\n\t\t\tfixedToolbar: false,\n\t\t\tfocusMode: false,\n\t\t\tkeepCaretInsideBlock: false,\n\t\t\twelcomeGuide: true,\n\t\t\twelcomeGuideStyles: true,\n\t\t\tshowListViewByDefault: false,\n\t\t} );\n\n\t\t// Check if the block list view should be open by default.\n\t\tif (\n\t\t\tselect( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showListViewByDefault'\n\t\t\t)\n\t\t) {\n\t\t\tdispatch( editSiteStore ).setIsListViewOpened( true );\n\t\t}\n\n\t\tdispatch( interfaceStore ).setDefaultComplementaryArea(\n\t\t\t'core/edit-site',\n\t\t\t'edit-site/template'\n\t\t);\n\n\t\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t\t// so that they can be selected with core/editor selectors in any editor.\n\t\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t\t// which internally uses updateEditorSettings as well.\n\t\tdispatch( editorStore ).updateEditorSettings( {\n\t\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t\t} );\n\n\t\tconst isLandingOnListPage = getIsListPage(\n\t\t\tgetQueryArgs( window.location.href )\n\t\t);\n\n\t\tif ( isLandingOnListPage ) {\n\t\t\t// Default the navigation panel to be opened when we're in a bigger\n\t\t\t// screen and land in the list screen.\n\t\t\tdispatch( editSiteStore ).setIsNavigationPanelOpened(\n\t\t\t\tselect( viewportStore ).isViewportMatch( 'medium' )\n\t\t\t);\n\t\t}\n\t}\n\n\trender( <EditSiteApp reboot={ reboot } />, target );\n}\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\tsettings.__experimentalFetchRichUrlData = fetchUrlData;\n\n\tconst target = document.getElementById( id );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tregisterCoreBlocks();\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\treinitializeEditor( target, settings );\n}\n\nexport { default as __experimentalMainDashboardButton } from './components/main-dashboard-button';\nexport { default as __experimentalNavigationToggle } from './components/navigation-sidebar/navigation-toggle';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["reinitializeEditor","target","settings","__unstableHomeTemplate","reboot","bind","preferencesStore","setDefaults","editorMode","fixedToolbar","focusMode","keepCaretInsideBlock","welcomeGuide","welcomeGuideStyles","showListViewByDefault","get","editSiteStore","setIsListViewOpened","interfaceStore","setDefaultComplementaryArea","updateSettings","editorStore","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","isLandingOnListPage","window","location","href","setIsNavigationPanelOpened","viewportStore","isViewportMatch","addEventListener","e","preventDefault","initializeEditor","id","__experimentalFetchLinkSuggestions","search","searchOptions","__experimentalFetchRichUrlData","fetchUrlData","document","getElementById","blocksStore","__experimentalReapplyBlockTypeFilters","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA;;AANA;;AACA;;AAIA;;AAEA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAgHA;;AACA;;AACA;;AACA;;AACA;;AAhJA;AACA;AACA;;AAmBA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,kBAAT,CAA6BC,MAA7B,EAAqCC,QAArC,EAAgD;AACtD;AACA,MAAK,CAAEA,QAAQ,CAACC,sBAAhB,EAAyC;AACxC,yBACC,4BAAC,gBAAD;AACC,MAAA,OAAO,EAAG,cACT,iEADS,CADX;AAIC,MAAA,aAAa,EAAC;AAJf,MADD,EAOCF,MAPD;AASA;AACA,GAbqD,CAetD;;;AACA,uCAAwBA,MAAxB;AACA,QAAMG,MAAM,GAAGJ,kBAAkB,CAACK,IAAnB,CAAyB,IAAzB,EAA+BJ,MAA/B,EAAuCC,QAAvC,CAAf,CAjBsD,CAmBtD;AACA;;AACA;AACC,wBAAUI,kBAAV,EAA6BC,WAA7B,CAA0C,gBAA1C,EAA4D;AAC3DC,MAAAA,UAAU,EAAE,QAD+C;AAE3DC,MAAAA,YAAY,EAAE,K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ASkC,gBAAT,CAA2BC,EAA3B,EAA+BlC,QAA/B,EAA0C;AAChDA,EAAAA,QAAQ,CAACmC,kCAAT,GAA8C,CAAEC,MAAF,EAAUC,aAAV,KAC7C,kDAAsBD,MAAtB,EAA8BC,aAA9B,EAA6CrC,QAA7C,CADD;;AAEAA,EAAAA,QAAQ,CAACsC,8BAAT,GAA0CC,oCAA1C;AAEA,QAAMxC,MAAM,GAAGyC,QAAQ,CAACC,cAAT,CAAyBP,EAAzB,CAAf;;AAEA,sBAAUQ,aAAV,EAAwBC,qCAAxB;;AACA;;AACA,MAAKC,OAAO,CAACC,GAAR,CAAYC,mBAAjB,EAAuC;AACtC,oEAA8C;AAC7CC,MAAAA,eAAe,EAAE;AAD4B,KAA9C;AAGA;;AAEDjD,EAAAA,kBAAkB,CAAEC,MAAF,EAAUC,QAAV,CAAlB;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch, select } from '@wordpress/data';\nimport { render, unmountComponentAtNode } from '@wordpress/element';\nimport {\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { __ } from '@wordpress/i18n';\nimport { store as viewportStore } from '@wordpress/viewport';\nimport { getQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport EditSiteApp from './components/app';\nimport getIsListPage from './utils/get-is-list-page';\nimport ErrorBoundaryWarning from './components/error-boundary/warning';\n\n/**\n * Reinitializes the editor after the user chooses to reboot the editor after\n * an unhandled error occurs, replacing previously mounted editor element using\n * an initial state from prior to the crash.\n *\n * @param {Element} target DOM node in which editor is rendered.\n * @param {?Object} settings Editor settings object.\n */\nexport function reinitializeEditor( target, settings ) {\n\t// Display warning if editor wasn't able to resolve homepage template.\n\tif ( ! settings.__unstableHomeTemplate ) {\n\t\trender(\n\t\t\t<ErrorBoundaryWarning\n\t\t\t\tmessage={ __(\n\t\t\t\t\t'The editor is unable to find a block template for the homepage.'\n\t\t\t\t) }\n\t\t\t\tdashboardLink=\"index.php\"\n\t\t\t/>,\n\t\t\ttarget\n\t\t);\n\t\treturn;\n\t}\n\n\t// This will be a no-op if the target doesn't have any React nodes.\n\tunmountComponentAtNode( target );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\t{\n\t\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\t\teditorMode: 'visual',\n\t\t\tfixedToolbar: false,\n\t\t\tfocusMode: false,\n\t\t\tkeepCaretInsideBlock: false,\n\t\t\twelcomeGuide: true,\n\t\t\twelcomeGuideStyles: true,\n\t\t\tshowListViewByDefault: false,\n\t\t} );\n\n\t\t// Check if the block list view should be open by default.\n\t\tif (\n\t\t\tselect( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showListViewByDefault'\n\t\t\t)\n\t\t) {\n\t\t\tdispatch( editSiteStore ).setIsListViewOpened( true );\n\t\t}\n\n\t\tdispatch( interfaceStore ).setDefaultComplementaryArea(\n\t\t\t'core/edit-site',\n\t\t\t'edit-site/template'\n\t\t);\n\n\t\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t\t// so that they can be selected with core/editor selectors in any editor.\n\t\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t\t// which internally uses updateEditorSettings as well.\n\t\tdispatch( editorStore ).updateEditorSettings( {\n\t\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t\t} );\n\n\t\tconst isLandingOnListPage = getIsListPage(\n\t\t\tgetQueryArgs( window.location.href )\n\t\t);\n\n\t\tif ( isLandingOnListPage ) {\n\t\t\t// Default the navigation panel to be opened when we're in a bigger\n\t\t\t// screen and land in the list screen.\n\t\t\tdispatch( editSiteStore ).setIsNavigationPanelOpened(\n\t\t\t\tselect( viewportStore ).isViewportMatch( 'medium' )\n\t\t\t);\n\t\t}\n\t}\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\trender( <EditSiteApp reboot={ reboot } />, target );\n}\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\tsettings.__experimentalFetchRichUrlData = fetchUrlData;\n\n\tconst target = document.getElementById( id );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tregisterCoreBlocks();\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\treinitializeEditor( target, settings );\n}\n\nexport { default as __experimentalMainDashboardButton } from './components/main-dashboard-button';\nexport { default as __experimentalNavigationToggle } from './components/navigation-sidebar/navigation-toggle';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\n"]}