@wordpress/edit-post 7.24.0 → 7.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/header/header-toolbar/index.js +8 -4
  3. package/build/components/header/header-toolbar/index.js.map +1 -1
  4. package/build/components/header/index.js +13 -11
  5. package/build/components/header/index.js.map +1 -1
  6. package/build/components/header/mode-switcher/index.js +1 -1
  7. package/build/components/header/mode-switcher/index.js.map +1 -1
  8. package/build/components/header/more-menu/index.js +2 -1
  9. package/build/components/header/more-menu/index.js.map +1 -1
  10. package/build/components/header/writing-menu/index.js +13 -12
  11. package/build/components/header/writing-menu/index.js.map +1 -1
  12. package/build/components/layout/index.js +12 -12
  13. package/build/components/layout/index.js.map +1 -1
  14. package/build/components/preferences-modal/index.js +65 -49
  15. package/build/components/preferences-modal/index.js.map +1 -1
  16. package/build/components/sidebar/post-status/index.js +1 -2
  17. package/build/components/sidebar/post-status/index.js.map +1 -1
  18. package/build/components/sidebar/settings-header/index.js +17 -43
  19. package/build/components/sidebar/settings-header/index.js.map +1 -1
  20. package/build/components/sidebar/settings-sidebar/index.js +80 -20
  21. package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
  22. package/build/components/start-page-options/index.js +3 -3
  23. package/build/components/start-page-options/index.js.map +1 -1
  24. package/build/components/visual-editor/index.js +20 -257
  25. package/build/components/visual-editor/index.js.map +1 -1
  26. package/build/components/welcome-guide/index.js +6 -3
  27. package/build/components/welcome-guide/index.js.map +1 -1
  28. package/build/editor.js +5 -6
  29. package/build/editor.js.map +1 -1
  30. package/build/editor.native.js +1 -2
  31. package/build/editor.native.js.map +1 -1
  32. package/build/index.js +5 -4
  33. package/build/index.js.map +1 -1
  34. package/build/plugins/welcome-guide-menu-item/index.js +2 -6
  35. package/build/plugins/welcome-guide-menu-item/index.js.map +1 -1
  36. package/build/store/actions.js +35 -39
  37. package/build/store/actions.js.map +1 -1
  38. package/build/store/reducer.js +1 -34
  39. package/build/store/reducer.js.map +1 -1
  40. package/build/store/selectors.js +22 -12
  41. package/build/store/selectors.js.map +1 -1
  42. package/build-module/components/header/header-toolbar/index.js +8 -4
  43. package/build-module/components/header/header-toolbar/index.js.map +1 -1
  44. package/build-module/components/header/index.js +15 -13
  45. package/build-module/components/header/index.js.map +1 -1
  46. package/build-module/components/header/mode-switcher/index.js +1 -1
  47. package/build-module/components/header/mode-switcher/index.js.map +1 -1
  48. package/build-module/components/header/more-menu/index.js +2 -1
  49. package/build-module/components/header/more-menu/index.js.map +1 -1
  50. package/build-module/components/header/writing-menu/index.js +14 -13
  51. package/build-module/components/header/writing-menu/index.js.map +1 -1
  52. package/build-module/components/layout/index.js +13 -13
  53. package/build-module/components/layout/index.js.map +1 -1
  54. package/build-module/components/preferences-modal/index.js +65 -49
  55. package/build-module/components/preferences-modal/index.js.map +1 -1
  56. package/build-module/components/sidebar/post-status/index.js +2 -3
  57. package/build-module/components/sidebar/post-status/index.js.map +1 -1
  58. package/build-module/components/sidebar/settings-header/index.js +20 -46
  59. package/build-module/components/sidebar/settings-header/index.js.map +1 -1
  60. package/build-module/components/sidebar/settings-sidebar/index.js +80 -21
  61. package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
  62. package/build-module/components/start-page-options/index.js +3 -3
  63. package/build-module/components/start-page-options/index.js.map +1 -1
  64. package/build-module/components/visual-editor/index.js +24 -261
  65. package/build-module/components/visual-editor/index.js.map +1 -1
  66. package/build-module/components/welcome-guide/index.js +6 -3
  67. package/build-module/components/welcome-guide/index.js.map +1 -1
  68. package/build-module/editor.js +5 -6
  69. package/build-module/editor.js.map +1 -1
  70. package/build-module/editor.native.js +1 -2
  71. package/build-module/editor.native.js.map +1 -1
  72. package/build-module/index.js +3 -2
  73. package/build-module/index.js.map +1 -1
  74. package/build-module/plugins/welcome-guide-menu-item/index.js +2 -6
  75. package/build-module/plugins/welcome-guide-menu-item/index.js.map +1 -1
  76. package/build-module/store/actions.js +31 -36
  77. package/build-module/store/actions.js.map +1 -1
  78. package/build-module/store/reducer.js +1 -33
  79. package/build-module/store/reducer.js.map +1 -1
  80. package/build-module/store/selectors.js +18 -9
  81. package/build-module/store/selectors.js.map +1 -1
  82. package/build-style/style-rtl.css +63 -200
  83. package/build-style/style.css +63 -200
  84. package/package.json +32 -32
  85. package/src/components/header/header-toolbar/index.js +4 -0
  86. package/src/components/header/header-toolbar/style.scss +15 -13
  87. package/src/components/header/index.js +28 -13
  88. package/src/components/header/mode-switcher/index.js +2 -1
  89. package/src/components/header/more-menu/index.js +1 -0
  90. package/src/components/header/style.scss +60 -34
  91. package/src/components/header/writing-menu/index.js +16 -18
  92. package/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap +1 -1
  93. package/src/components/layout/index.js +13 -12
  94. package/src/components/preferences-modal/index.js +109 -96
  95. package/src/components/preferences-modal/test/index.js +1 -52
  96. package/src/components/sidebar/post-status/index.js +2 -2
  97. package/src/components/sidebar/settings-header/index.js +19 -71
  98. package/src/components/sidebar/settings-sidebar/index.js +117 -54
  99. package/src/components/sidebar/style.scss +4 -12
  100. package/src/components/start-page-options/index.js +3 -3
  101. package/src/components/visual-editor/index.js +26 -359
  102. package/src/components/visual-editor/style.scss +0 -15
  103. package/src/components/welcome-guide/index.js +4 -2
  104. package/src/editor.js +7 -7
  105. package/src/editor.native.js +3 -9
  106. package/src/index.js +3 -2
  107. package/src/plugins/welcome-guide-menu-item/index.js +3 -6
  108. package/src/store/actions.js +32 -46
  109. package/src/store/reducer.js +0 -33
  110. package/src/store/selectors.js +23 -9
  111. package/src/store/test/actions.js +0 -28
  112. package/src/style.scss +0 -3
  113. package/src/test/__snapshots__/editor.native.js.snap +21 -0
  114. package/src/test/editor.native.js +90 -56
  115. package/build/components/device-preview/index.js +0 -72
  116. package/build/components/device-preview/index.js.map +0 -1
  117. package/build/components/header/document-actions/index.js +0 -82
  118. package/build/components/header/document-actions/index.js.map +0 -1
  119. package/build/components/sidebar/post-template/create-modal.js +0 -99
  120. package/build/components/sidebar/post-template/create-modal.js.map +0 -1
  121. package/build/components/sidebar/post-template/form.js +0 -110
  122. package/build/components/sidebar/post-template/form.js.map +0 -1
  123. package/build/components/sidebar/post-template/index.js +0 -106
  124. package/build/components/sidebar/post-template/index.js.map +0 -1
  125. package/build-module/components/device-preview/index.js +0 -65
  126. package/build-module/components/device-preview/index.js.map +0 -1
  127. package/build-module/components/header/document-actions/index.js +0 -74
  128. package/build-module/components/header/document-actions/index.js.map +0 -1
  129. package/build-module/components/sidebar/post-template/create-modal.js +0 -92
  130. package/build-module/components/sidebar/post-template/create-modal.js.map +0 -1
  131. package/build-module/components/sidebar/post-template/form.js +0 -102
  132. package/build-module/components/sidebar/post-template/form.js.map +0 -1
  133. package/build-module/components/sidebar/post-template/index.js +0 -98
  134. package/build-module/components/sidebar/post-template/index.js.map +0 -1
  135. package/src/components/device-preview/index.js +0 -73
  136. package/src/components/header/document-actions/index.js +0 -82
  137. package/src/components/header/document-actions/style.scss +0 -64
  138. package/src/components/sidebar/post-template/create-modal.js +0 -140
  139. package/src/components/sidebar/post-template/form.js +0 -141
  140. package/src/components/sidebar/post-template/index.js +0 -120
  141. package/src/components/sidebar/post-template/style.scss +0 -22
  142. package/src/components/sidebar/settings-header/style.scss +0 -74
  143. package/src/components/sidebar/template/style.scss +0 -35
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_editor","_blockEditor","_element","_components","_data","_compose","_blocks","_coreData","_store","_lockUnlock","LayoutStyle","useLayoutClasses","useLayoutStyles","ExperimentalBlockCanvas","BlockCanvas","unlock","blockEditorPrivateApis","isGutenbergPlugin","process","env","IS_GUTENBERG_PLUGIN","getPostContentAttributes","blocks","i","length","name","attributes","innerBlocks","nestedPostContent","checkForPostContentAtRootLevel","VisualEditor","styles","deviceType","isWelcomeGuideVisible","isTemplateMode","postContentAttributes","editedPostTemplate","wrapperBlockName","wrapperUniqueId","isBlockBasedTheme","hasV3BlocksOnly","useSelect","select","isFeatureActive","isEditingTemplate","getEditedPostTemplate","__experimentalGetPreviewDeviceType","editPostStore","getCurrentPostId","getCurrentPostType","getEditorSettings","editorStore","getBlockTypes","blocksStore","_isTemplateMode","postTypeSlug","_wrapperBlockName","editorSettings","supportsTemplateMode","postType","coreStore","getPostType","canEditTemplate","canUser","viewable","undefined","__unstableIsBlockBasedTheme","every","type","apiVersion","isCleanNewPost","hasMetaBoxes","hasRootPaddingAwareAlignments","isFocusMode","themeHasDisabledLayoutStyles","themeSupportsLayout","_settings","blockEditorStore","getSettings","disableLayoutStyles","supportsLayout","focusMode","__experimentalFeatures","useRootPaddingAwareAlignments","desktopCanvasStyles","height","width","marginLeft","marginRight","display","flexFlow","background","templateModeStyles","borderRadius","border","borderBottom","resizedCanvasStyles","useResizeCanvas","globalLayoutSettings","useSettings","previewMode","toLowerCase","animatedStyles","paddingBottom","ref","useRef","contentRef","useMergeRefs","useTypewriter","fallbackLayout","useMemo","newestPostContentAttributes","content","parseableContent","parse","hasPostContentAtRootLevel","layout","align","postContentLayoutClasses","blockListLayoutClass","classnames","postContentLayoutStyles","postContentLayout","inherit","contentSize","wideSize","blockListLayout","postEditorLayout","observeTypingRef","useTypingObserver","titleRef","useEffect","current","focus","css","alignCSS","isToBeIframed","_react","createElement","BlockTools","__unstableContentRef","className","__unstableMotion","div","animate","padding","initial","shouldIframe","Fragment","selector","contentEditable","PostTitle","__experimentalRecursionProvider","blockName","uniqueId","BlockList","dropZoneElement","parentNode"],"sources":["@wordpress/edit-post/src/components/visual-editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { PostTitle, store as editorStore } from '@wordpress/editor';\nimport {\n\tBlockList,\n\tBlockTools,\n\tstore as blockEditorStore,\n\t__unstableUseTypewriter as useTypewriter,\n\t__unstableUseTypingObserver as useTypingObserver,\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\tuseSettings,\n\t__experimentalRecursionProvider as RecursionProvider,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useEffect, useRef, useMemo } from '@wordpress/element';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { parse, store as blocksStore } from '@wordpress/blocks';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst {\n\tLayoutStyle,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n\tExperimentalBlockCanvas: BlockCanvas,\n} = unlock( blockEditorPrivateApis );\n\nconst isGutenbergPlugin = process.env.IS_GUTENBERG_PLUGIN ? true : false;\n\n/**\n * Given an array of nested blocks, find the first Post Content\n * block inside it, recursing through any nesting levels,\n * and return its attributes.\n *\n * @param {Array} blocks A list of blocks.\n *\n * @return {Object | undefined} The Post Content block.\n */\nfunction getPostContentAttributes( blocks ) {\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( blocks[ i ].name === 'core/post-content' ) {\n\t\t\treturn blocks[ i ].attributes;\n\t\t}\n\t\tif ( blocks[ i ].innerBlocks.length ) {\n\t\t\tconst nestedPostContent = getPostContentAttributes(\n\t\t\t\tblocks[ i ].innerBlocks\n\t\t\t);\n\n\t\t\tif ( nestedPostContent ) {\n\t\t\t\treturn nestedPostContent;\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction checkForPostContentAtRootLevel( blocks ) {\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( blocks[ i ].name === 'core/post-content' ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\nexport default function VisualEditor( { styles } ) {\n\tconst {\n\t\tdeviceType,\n\t\tisWelcomeGuideVisible,\n\t\tisTemplateMode,\n\t\tpostContentAttributes,\n\t\teditedPostTemplate = {},\n\t\twrapperBlockName,\n\t\twrapperUniqueId,\n\t\tisBlockBasedTheme,\n\t\thasV3BlocksOnly,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisFeatureActive,\n\t\t\tisEditingTemplate,\n\t\t\tgetEditedPostTemplate,\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t} = select( editPostStore );\n\t\tconst { getCurrentPostId, getCurrentPostType, getEditorSettings } =\n\t\t\tselect( editorStore );\n\t\tconst { getBlockTypes } = select( blocksStore );\n\t\tconst _isTemplateMode = isEditingTemplate();\n\t\tconst postTypeSlug = getCurrentPostType();\n\t\tlet _wrapperBlockName;\n\n\t\tif ( postTypeSlug === 'wp_block' ) {\n\t\t\t_wrapperBlockName = 'core/block';\n\t\t} else if ( ! _isTemplateMode ) {\n\t\t\t_wrapperBlockName = 'core/post-content';\n\t\t}\n\n\t\tconst editorSettings = getEditorSettings();\n\t\tconst supportsTemplateMode = editorSettings.supportsTemplateMode;\n\t\tconst postType = select( coreStore ).getPostType( postTypeSlug );\n\t\tconst canEditTemplate = select( coreStore ).canUser(\n\t\t\t'create',\n\t\t\t'templates'\n\t\t);\n\n\t\treturn {\n\t\t\tdeviceType: __experimentalGetPreviewDeviceType(),\n\t\t\tisWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),\n\t\t\tisTemplateMode: _isTemplateMode,\n\t\t\tpostContentAttributes: getEditorSettings().postContentAttributes,\n\t\t\t// Post template fetch returns a 404 on classic themes, which\n\t\t\t// messes with e2e tests, so check it's a block theme first.\n\t\t\teditedPostTemplate:\n\t\t\t\tpostType?.viewable && supportsTemplateMode && canEditTemplate\n\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t: undefined,\n\t\t\twrapperBlockName: _wrapperBlockName,\n\t\t\twrapperUniqueId: getCurrentPostId(),\n\t\t\tisBlockBasedTheme: editorSettings.__unstableIsBlockBasedTheme,\n\t\t\thasV3BlocksOnly: getBlockTypes().every( ( type ) => {\n\t\t\t\treturn type.apiVersion >= 3;\n\t\t\t} ),\n\t\t};\n\t}, [] );\n\tconst { isCleanNewPost } = useSelect( editorStore );\n\tconst hasMetaBoxes = useSelect(\n\t\t( select ) => select( editPostStore ).hasMetaBoxes(),\n\t\t[]\n\t);\n\tconst {\n\t\thasRootPaddingAwareAlignments,\n\t\tisFocusMode,\n\t\tthemeHasDisabledLayoutStyles,\n\t\tthemeSupportsLayout,\n\t} = useSelect( ( select ) => {\n\t\tconst _settings = select( blockEditorStore ).getSettings();\n\t\treturn {\n\t\t\tthemeHasDisabledLayoutStyles: _settings.disableLayoutStyles,\n\t\t\tthemeSupportsLayout: _settings.supportsLayout,\n\t\t\tisFocusMode: _settings.focusMode,\n\t\t\thasRootPaddingAwareAlignments:\n\t\t\t\t_settings.__experimentalFeatures?.useRootPaddingAwareAlignments,\n\t\t};\n\t}, [] );\n\tconst desktopCanvasStyles = {\n\t\theight: '100%',\n\t\twidth: '100%',\n\t\tmarginLeft: 'auto',\n\t\tmarginRight: 'auto',\n\t\tdisplay: 'flex',\n\t\tflexFlow: 'column',\n\t\t// Default background color so that grey\n\t\t// .edit-post-editor-regions__content color doesn't show through.\n\t\tbackground: 'white',\n\t};\n\tconst templateModeStyles = {\n\t\t...desktopCanvasStyles,\n\t\tborderRadius: '2px 2px 0 0',\n\t\tborder: '1px solid #ddd',\n\t\tborderBottom: 0,\n\t};\n\tconst resizedCanvasStyles = useResizeCanvas( deviceType, isTemplateMode );\n\tconst [ globalLayoutSettings ] = useSettings( 'layout' );\n\tconst previewMode = 'is-' + deviceType.toLowerCase() + '-preview';\n\n\tlet animatedStyles = isTemplateMode\n\t\t? templateModeStyles\n\t\t: desktopCanvasStyles;\n\tif ( resizedCanvasStyles ) {\n\t\tanimatedStyles = resizedCanvasStyles;\n\t}\n\n\tlet paddingBottom;\n\n\t// Add a constant padding for the typewritter effect. When typing at the\n\t// bottom, there needs to be room to scroll up.\n\tif ( ! hasMetaBoxes && ! resizedCanvasStyles && ! isTemplateMode ) {\n\t\tpaddingBottom = '40vh';\n\t}\n\n\tconst ref = useRef();\n\tconst contentRef = useMergeRefs( [ ref, useTypewriter() ] );\n\n\t// fallbackLayout is used if there is no Post Content,\n\t// and for Post Title.\n\tconst fallbackLayout = useMemo( () => {\n\t\tif ( isTemplateMode ) {\n\t\t\treturn { type: 'default' };\n\t\t}\n\n\t\tif ( themeSupportsLayout ) {\n\t\t\t// We need to ensure support for wide and full alignments,\n\t\t\t// so we add the constrained type.\n\t\t\treturn { ...globalLayoutSettings, type: 'constrained' };\n\t\t}\n\t\t// Set default layout for classic themes so all alignments are supported.\n\t\treturn { type: 'default' };\n\t}, [ isTemplateMode, themeSupportsLayout, globalLayoutSettings ] );\n\n\tconst newestPostContentAttributes = useMemo( () => {\n\t\tif ( ! editedPostTemplate?.content && ! editedPostTemplate?.blocks ) {\n\t\t\treturn postContentAttributes;\n\t\t}\n\t\t// When in template editing mode, we can access the blocks directly.\n\t\tif ( editedPostTemplate?.blocks ) {\n\t\t\treturn getPostContentAttributes( editedPostTemplate?.blocks );\n\t\t}\n\t\t// If there are no blocks, we have to parse the content string.\n\t\t// Best double-check it's a string otherwise the parse function gets unhappy.\n\t\tconst parseableContent =\n\t\t\ttypeof editedPostTemplate?.content === 'string'\n\t\t\t\t? editedPostTemplate?.content\n\t\t\t\t: '';\n\n\t\treturn getPostContentAttributes( parse( parseableContent ) ) || {};\n\t}, [\n\t\teditedPostTemplate?.content,\n\t\teditedPostTemplate?.blocks,\n\t\tpostContentAttributes,\n\t] );\n\n\tconst hasPostContentAtRootLevel = useMemo( () => {\n\t\tif ( ! editedPostTemplate?.content && ! editedPostTemplate?.blocks ) {\n\t\t\treturn false;\n\t\t}\n\t\t// When in template editing mode, we can access the blocks directly.\n\t\tif ( editedPostTemplate?.blocks ) {\n\t\t\treturn checkForPostContentAtRootLevel( editedPostTemplate?.blocks );\n\t\t}\n\t\t// If there are no blocks, we have to parse the content string.\n\t\t// Best double-check it's a string otherwise the parse function gets unhappy.\n\t\tconst parseableContent =\n\t\t\ttypeof editedPostTemplate?.content === 'string'\n\t\t\t\t? editedPostTemplate?.content\n\t\t\t\t: '';\n\n\t\treturn (\n\t\t\tcheckForPostContentAtRootLevel( parse( parseableContent ) ) || false\n\t\t);\n\t}, [ editedPostTemplate?.content, editedPostTemplate?.blocks ] );\n\n\tconst { layout = {}, align = '' } = newestPostContentAttributes || {};\n\n\tconst postContentLayoutClasses = useLayoutClasses(\n\t\tnewestPostContentAttributes,\n\t\t'core/post-content'\n\t);\n\n\tconst blockListLayoutClass = classnames(\n\t\t{\n\t\t\t'is-layout-flow': ! themeSupportsLayout,\n\t\t},\n\t\tthemeSupportsLayout && postContentLayoutClasses,\n\t\talign && `align${ align }`\n\t);\n\n\tconst postContentLayoutStyles = useLayoutStyles(\n\t\tnewestPostContentAttributes,\n\t\t'core/post-content',\n\t\t'.block-editor-block-list__layout.is-root-container'\n\t);\n\n\t// Update type for blocks using legacy layouts.\n\tconst postContentLayout = useMemo( () => {\n\t\treturn layout &&\n\t\t\t( layout?.type === 'constrained' ||\n\t\t\t\tlayout?.inherit ||\n\t\t\t\tlayout?.contentSize ||\n\t\t\t\tlayout?.wideSize )\n\t\t\t? { ...globalLayoutSettings, ...layout, type: 'constrained' }\n\t\t\t: { ...globalLayoutSettings, ...layout, type: 'default' };\n\t}, [\n\t\tlayout?.type,\n\t\tlayout?.inherit,\n\t\tlayout?.contentSize,\n\t\tlayout?.wideSize,\n\t\tglobalLayoutSettings,\n\t] );\n\n\t// If there is a Post Content block we use its layout for the block list;\n\t// if not, this must be a classic theme, in which case we use the fallback layout.\n\tconst blockListLayout = postContentAttributes\n\t\t? postContentLayout\n\t\t: fallbackLayout;\n\n\tconst postEditorLayout =\n\t\tblockListLayout?.type === 'default' && ! hasPostContentAtRootLevel\n\t\t\t? fallbackLayout\n\t\t\t: blockListLayout;\n\n\tconst observeTypingRef = useTypingObserver();\n\tconst titleRef = useRef();\n\tuseEffect( () => {\n\t\tif ( isWelcomeGuideVisible || ! isCleanNewPost() ) {\n\t\t\treturn;\n\t\t}\n\t\ttitleRef?.current?.focus();\n\t}, [ isWelcomeGuideVisible, isCleanNewPost ] );\n\n\tstyles = useMemo(\n\t\t() => [\n\t\t\t...styles,\n\t\t\t{\n\t\t\t\t// We should move this in to future to the body.\n\t\t\t\tcss:\n\t\t\t\t\t`.edit-post-visual-editor__post-title-wrapper{margin-top:4rem}` +\n\t\t\t\t\t( paddingBottom\n\t\t\t\t\t\t? `body{padding-bottom:${ paddingBottom }}`\n\t\t\t\t\t\t: '' ),\n\t\t\t},\n\t\t],\n\t\t[ styles ]\n\t);\n\n\t// Add some styles for alignwide/alignfull Post Content and its children.\n\tconst alignCSS = `.is-root-container.alignwide { max-width: var(--wp--style--global--wide-size); margin-left: auto; margin-right: auto;}\n\t\t.is-root-container.alignwide:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: var(--wp--style--global--wide-size);}\n\t\t.is-root-container.alignfull { max-width: none; margin-left: auto; margin-right: auto;}\n\t\t.is-root-container.alignfull:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: none;}`;\n\n\tconst isToBeIframed =\n\t\t( ( hasV3BlocksOnly || ( isGutenbergPlugin && isBlockBasedTheme ) ) &&\n\t\t\t! hasMetaBoxes ) ||\n\t\tisTemplateMode ||\n\t\tdeviceType === 'Tablet' ||\n\t\tdeviceType === 'Mobile';\n\n\treturn (\n\t\t<BlockTools\n\t\t\t__unstableContentRef={ ref }\n\t\t\tclassName={ classnames( 'edit-post-visual-editor', {\n\t\t\t\t'is-template-mode': isTemplateMode,\n\t\t\t\t'has-inline-canvas': ! isToBeIframed,\n\t\t\t} ) }\n\t\t>\n\t\t\t<motion.div\n\t\t\t\tclassName=\"edit-post-visual-editor__content-area\"\n\t\t\t\tanimate={ {\n\t\t\t\t\tpadding: isTemplateMode ? '48px 48px 0' : 0,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<motion.div\n\t\t\t\t\tanimate={ animatedStyles }\n\t\t\t\t\tinitial={ desktopCanvasStyles }\n\t\t\t\t\tclassName={ previewMode }\n\t\t\t\t>\n\t\t\t\t\t<BlockCanvas\n\t\t\t\t\t\tshouldIframe={ isToBeIframed }\n\t\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\t\tstyles={ styles }\n\t\t\t\t\t\theight=\"100%\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ themeSupportsLayout &&\n\t\t\t\t\t\t\t! themeHasDisabledLayoutStyles &&\n\t\t\t\t\t\t\t! isTemplateMode && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\t\tselector=\".edit-post-visual-editor__post-title-wrapper\"\n\t\t\t\t\t\t\t\t\t\tlayout={ fallbackLayout }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\t\tselector=\".block-editor-block-list__layout.is-root-container\"\n\t\t\t\t\t\t\t\t\t\tlayout={ postEditorLayout }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{ align && (\n\t\t\t\t\t\t\t\t\t\t<LayoutStyle css={ alignCSS } />\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ postContentLayoutStyles && (\n\t\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\t\t\tlayout={ postContentLayout }\n\t\t\t\t\t\t\t\t\t\t\tcss={ postContentLayoutStyles }\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{ ! isTemplateMode && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t'edit-post-visual-editor__post-title-wrapper',\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t'is-focus-mode': isFocusMode,\n\t\t\t\t\t\t\t\t\t\t'has-global-padding':\n\t\t\t\t\t\t\t\t\t\t\thasRootPaddingAwareAlignments,\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\tcontentEditable={ false }\n\t\t\t\t\t\t\t\tref={ observeTypingRef }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<PostTitle ref={ titleRef } />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<RecursionProvider\n\t\t\t\t\t\t\tblockName={ wrapperBlockName }\n\t\t\t\t\t\t\tuniqueId={ wrapperUniqueId }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\tisTemplateMode\n\t\t\t\t\t\t\t\t\t\t? 'wp-site-blocks'\n\t\t\t\t\t\t\t\t\t\t: `${ blockListLayoutClass } wp-block-post-content` // Ensure root level blocks receive default/flow blockGap styling rules.\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tlayout={ blockListLayout }\n\t\t\t\t\t\t\t\tdropZoneElement={\n\t\t\t\t\t\t\t\t\t// When iframed, pass in the html element of the iframe to\n\t\t\t\t\t\t\t\t\t// ensure the drop zone extends to the edges of the iframe.\n\t\t\t\t\t\t\t\t\tisToBeIframed\n\t\t\t\t\t\t\t\t\t\t? ref.current?.parentNode\n\t\t\t\t\t\t\t\t\t\t: ref.current\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</RecursionProvider>\n\t\t\t\t\t</BlockCanvas>\n\t\t\t\t</motion.div>\n\t\t\t</motion.div>\n\t\t</BlockTools>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAWA,IAAAG,QAAA,GAAAH,O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AA,EAACzI,YAAA,CAAA0J,SAAS;IACTd,SAAS,EACR3G,cAAc,GACX,gBAAgB,GACf,GAAGqF,oBAAsB,wBAAuB,CAAC;IACrD;;IACDH,MAAM,EAAGU,eAAiB;IAC1B8B,eAAe;IACd;IACA;IACApB,aAAa,GACVhC,GAAG,CAAC4B,OAAO,EAAEyB,UAAU,GACvBrD,GAAG,CAAC4B;EACP,CACD,CACiB,CACP,CACF,CACD,CACD,CAAC;AAEf"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_editor","_element","_data","_blocks","_store","_lockUnlock","EditorCanvas","unlock","editorPrivateApis","isGutenbergPlugin","process","env","IS_GUTENBERG_PLUGIN","VisualEditor","styles","isWelcomeGuideVisible","renderingMode","isBlockBasedTheme","hasV3BlocksOnly","useSelect","select","isFeatureActive","editPostStore","getEditorSettings","getRenderingMode","editorStore","getBlockTypes","blocksStore","editorSettings","__unstableIsBlockBasedTheme","every","type","apiVersion","hasMetaBoxes","paddingBottom","useMemo","css","isToBeIframed","_react","createElement","className","classnames","disableIframe","autoFocus"],"sources":["@wordpress/edit-post/src/components/visual-editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as blocksStore } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { EditorCanvas } = unlock( editorPrivateApis );\n\nconst isGutenbergPlugin = process.env.IS_GUTENBERG_PLUGIN ? true : false;\n\nexport default function VisualEditor( { styles } ) {\n\tconst {\n\t\tisWelcomeGuideVisible,\n\t\trenderingMode,\n\t\tisBlockBasedTheme,\n\t\thasV3BlocksOnly,\n\t} = useSelect( ( select ) => {\n\t\tconst { isFeatureActive } = select( editPostStore );\n\t\tconst { getEditorSettings, getRenderingMode } = select( editorStore );\n\t\tconst { getBlockTypes } = select( blocksStore );\n\t\tconst editorSettings = getEditorSettings();\n\n\t\treturn {\n\t\t\tisWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),\n\t\t\trenderingMode: getRenderingMode(),\n\t\t\tisBlockBasedTheme: editorSettings.__unstableIsBlockBasedTheme,\n\t\t\thasV3BlocksOnly: getBlockTypes().every( ( type ) => {\n\t\t\t\treturn type.apiVersion >= 3;\n\t\t\t} ),\n\t\t};\n\t}, [] );\n\tconst hasMetaBoxes = useSelect(\n\t\t( select ) => select( editPostStore ).hasMetaBoxes(),\n\t\t[]\n\t);\n\n\tlet paddingBottom;\n\n\t// Add a constant padding for the typewritter effect. When typing at the\n\t// bottom, there needs to be room to scroll up.\n\tif ( ! hasMetaBoxes && renderingMode === 'post-only' ) {\n\t\tpaddingBottom = '40vh';\n\t}\n\n\tstyles = useMemo(\n\t\t() => [\n\t\t\t...styles,\n\t\t\t{\n\t\t\t\t// We should move this in to future to the body.\n\t\t\t\tcss: paddingBottom\n\t\t\t\t\t? `body{padding-bottom:${ paddingBottom }}`\n\t\t\t\t\t: '',\n\t\t\t},\n\t\t],\n\t\t[ styles, paddingBottom ]\n\t);\n\n\tconst isToBeIframed =\n\t\t( ( hasV3BlocksOnly || ( isGutenbergPlugin && isBlockBasedTheme ) ) &&\n\t\t\t! hasMetaBoxes ) ||\n\t\trenderingMode === 'template-only';\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames( 'edit-post-visual-editor', {\n\t\t\t\t'is-template-mode': renderingMode === 'template-only',\n\t\t\t\t'has-inline-canvas': ! isToBeIframed,\n\t\t\t} ) }\n\t\t>\n\t\t\t<EditorCanvas\n\t\t\t\tdisableIframe={ ! isToBeIframed }\n\t\t\t\tstyles={ styles }\n\t\t\t\t// We should auto-focus the canvas (title) on load.\n\t\t\t\t// eslint-disable-next-line jsx-a11y/no-autofocus\n\t\t\t\tautoFocus={ ! isWel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AAE,EAAG,CAAC;EACP,MAAMC,YAAY,GAAG,IAAAd,eAAS,EAC3BC,MAAM,IAAMA,MAAM,CAAEE,YAAc,CAAC,CAACW,YAAY,CAAC,CAAC,EACpD,EACD,CAAC;EAED,IAAIC,aAAa;;EAEjB;EACA;EACA,IAAK,CAAED,YAAY,IAAIjB,aAAa,KAAK,WAAW,EAAG;IACtDkB,aAAa,GAAG,MAAM;EACvB;EAEApB,MAAM,GAAG,IAAAqB,gBAAO,EACf,MAAM,CACL,GAAGrB,MAAM,EACT;IACC;IACAsB,GAAG,EAAEF,aAAa,GACd,uBAAuBA,aAAe,GAAE,GACzC;EACJ,CAAC,CACD,EACD,CAAEpB,MAAM,EAAEoB,aAAa,CACxB,CAAC;EAED,MAAMG,aAAa,GAChB,CAAEnB,eAAe,IAAMT,iBAAiB,IAAIQ,iBAAmB,KAChE,CAAEgB,YAAY,IACfjB,aAAa,KAAK,eAAe;EAElC,OACC,IAAAsB,MAAA,CAAAC,aAAA;IACCC,SAAS,EAAG,IAAAC,mBAAU,EAAE,yBAAyB,EAAE;MAClD,kBAAkB,EAAEzB,aAAa,KAAK,eAAe;MACrD,mBAAmB,EAAE,CAAEqB;IACxB,CAAE;EAAG,GAEL,IAAAC,MAAA,CAAAC,aAAA,EAACjC,YAAY;IACZoC,aAAa,EAAG,CAAEL,aAAe;IACjCvB,MAAM,EAAGA;IACT;IACA;IAAA;IACA6B,SAAS,EAAG,CAAE5B;EAAuB,CACrC,CACG,CAAC;AAER"}
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = WelcomeGuide;
8
8
  var _react = require("react");
9
9
  var _data = require("@wordpress/data");
10
+ var _editor = require("@wordpress/editor");
10
11
  var _default = _interopRequireDefault(require("./default"));
11
12
  var _template = _interopRequireDefault(require("./template"));
12
13
  var _store = require("../../store");
@@ -24,10 +25,12 @@ function WelcomeGuide() {
24
25
  isTemplateMode
25
26
  } = (0, _data.useSelect)(select => {
26
27
  const {
27
- isFeatureActive,
28
- isEditingTemplate
28
+ isFeatureActive
29
29
  } = select(_store.store);
30
- const _isTemplateMode = isEditingTemplate();
30
+ const {
31
+ getRenderingMode
32
+ } = select(_editor.store);
33
+ const _isTemplateMode = getRenderingMode() === 'template-only';
31
34
  const feature = _isTemplateMode ? 'welcomeGuideTemplate' : 'welcomeGuide';
32
35
  return {
33
36
  isActive: isFeatureActive(feature),
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_default","_interopRequireDefault","_template","_store","WelcomeGuide","isActive","isTemplateMode","useSelect","select","isFeatureActive","isEditingTemplate","editPostStore","_isTemplateMode","feature","_react","createElement","default"],"sources":["@wordpress/edit-post/src/components/welcome-guide/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuideDefault from './default';\nimport WelcomeGuideTemplate from './template';\nimport { store as editPostStore } from '../../store';\n\nexport default function WelcomeGuide() {\n\tconst { isActive, isTemplateMode } = useSelect( ( select ) => {\n\t\tconst { isFeatureActive, isEditingTemplate } = select( editPostStore );\n\t\tconst _isTemplateMode = isEditingTemplate();\n\t\tconst feature = _isTemplateMode\n\t\t\t? 'welcomeGuideTemplate'\n\t\t\t: 'welcomeGuide';\n\n\t\treturn {\n\t\t\tisActive: isFeatureActive( feature ),\n\t\t\tisTemplateMode: _isTemplateMode,\n\t\t};\n\t}, [] );\n\n\tif ( ! isActive ) {\n\t\treturn null;\n\t}\n\n\treturn isTemplateMode ? <WelcomeGuideTemplate /> : <WelcomeGuideDefault />;\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,SAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAVA;AACA;AACA;;AAGA;AACA;AACA;;AAKe,SAASK,YAAYA,CAAA,EAAG;EACtC,MAAM;IAAEC,QAAQ;IAAEC;EAAe,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC7D,MAAM;MAAEC,eAAe;MAAEC;IAAkB,CAAC,GAAGF,MAAM,CAAEG,YAAc,CAAC;IACtE,MAAMC,eAAe,GAAGF,iBAAiB,CAAC,CAAC;IAC3C,MAAMG,OAAO,GAAGD,eAAe,GAC5B,sBAAsB,GACtB,cAAc;IAEjB,OAAO;MACNP,QAAQ,EAAEI,eAAe,CAAEI,OAAQ,CAAC;MACpCP,cAAc,EAAEM;IACjB,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAEP,QAAQ,EAAG;IACjB,OAAO,IAAI;EACZ;EAEA,OAAOC,cAAc,GAAG,IAAAQ,MAAA,CAAAC,aAAA,EAACb,SAAA,CAAAc,OAAoB,MAAE,CAAC,GAAG,IAAAF,MAAA,CAAAC,aAAA,EAACf,QAAA,CAAAgB,OAAmB,MAAE,CAAC;AAC3E"}
1
+ {"version":3,"names":["_data","require","_editor","_default","_interopRequireDefault","_template","_store","WelcomeGuide","isActive","isTemplateMode","useSelect","select","isFeatureActive","editPostStore","getRenderingMode","editorStore","_isTemplateMode","feature","_react","createElement","default"],"sources":["@wordpress/edit-post/src/components/welcome-guide/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuideDefault from './default';\nimport WelcomeGuideTemplate from './template';\nimport { store as editPostStore } from '../../store';\n\nexport default function WelcomeGuide() {\n\tconst { isActive, isTemplateMode } = useSelect( ( select ) => {\n\t\tconst { isFeatureActive } = select( editPostStore );\n\t\tconst { getRenderingMode } = select( editorStore );\n\t\tconst _isTemplateMode = getRenderingMode() === 'template-only';\n\t\tconst feature = _isTemplateMode\n\t\t\t? 'welcomeGuideTemplate'\n\t\t\t: 'welcomeGuide';\n\n\t\treturn {\n\t\t\tisActive: isFeatureActive( feature ),\n\t\t\tisTemplateMode: _isTemplateMode,\n\t\t};\n\t}, [] );\n\n\tif ( ! isActive ) {\n\t\treturn null;\n\t}\n\n\treturn isTemplateMode ? <WelcomeGuideTemplate /> : <WelcomeGuideDefault />;\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,SAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAXA;AACA;AACA;;AAIA;AACA;AACA;;AAKe,SAASM,YAAYA,CAAA,EAAG;EACtC,MAAM;IAAEC,QAAQ;IAAEC;EAAe,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC7D,MAAM;MAAEC;IAAgB,CAAC,GAAGD,MAAM,CAAEE,YAAc,CAAC;IACnD,MAAM;MAAEC;IAAiB,CAAC,GAAGH,MAAM,CAAEI,aAAY,CAAC;IAClD,MAAMC,eAAe,GAAGF,gBAAgB,CAAC,CAAC,KAAK,eAAe;IAC9D,MAAMG,OAAO,GAAGD,eAAe,GAC5B,sBAAsB,GACtB,cAAc;IAEjB,OAAO;MACNR,QAAQ,EAAEI,eAAe,CAAEK,OAAQ,CAAC;MACpCR,cAAc,EAAEO;IACjB,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAER,QAAQ,EAAG;IACjB,OAAO,IAAI;EACZ;EAEA,OAAOC,cAAc,GAAG,IAAAS,MAAA,CAAAC,aAAA,EAACd,SAAA,CAAAe,OAAoB,MAAE,CAAC,GAAG,IAAAF,MAAA,CAAAC,aAAA,EAAChB,QAAA,CAAAiB,OAAmB,MAAE,CAAC;AAC3E"}
package/build/editor.js CHANGED
@@ -14,6 +14,7 @@ var _components = require("@wordpress/components");
14
14
  var _coreData = require("@wordpress/core-data");
15
15
  var _preferences = require("@wordpress/preferences");
16
16
  var _commands = require("@wordpress/commands");
17
+ var _compose = require("@wordpress/compose");
17
18
  var _layout = _interopRequireDefault(require("./components/layout"));
18
19
  var _editorInitialization = _interopRequireDefault(require("./components/editor-initialization"));
19
20
  var _store = require("./store");
@@ -36,6 +37,7 @@ function Editor({
36
37
  initialEdits,
37
38
  ...props
38
39
  }) {
40
+ const isLargeViewport = (0, _compose.useViewportMatch)('medium');
39
41
  const {
40
42
  hasFixedToolbar,
41
43
  focusMode,
@@ -46,13 +48,11 @@ function Editor({
46
48
  hiddenBlockTypes,
47
49
  blockTypes,
48
50
  keepCaretInsideBlock,
49
- isTemplateMode,
50
51
  template
51
52
  } = (0, _data.useSelect)(select => {
52
53
  var _getPostType$viewable;
53
54
  const {
54
55
  isFeatureActive,
55
- isEditingTemplate,
56
56
  getEditedPostTemplate,
57
57
  getHiddenBlockTypes
58
58
  } = select(_store.store);
@@ -84,7 +84,7 @@ function Editor({
84
84
  const isViewable = (_getPostType$viewable = getPostType(postType)?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false;
85
85
  const canEditTemplate = canUser('create', 'templates');
86
86
  return {
87
- hasFixedToolbar: isFeatureActive('fixedToolbar'),
87
+ hasFixedToolbar: isFeatureActive('fixedToolbar') || !isLargeViewport,
88
88
  focusMode: isFeatureActive('focusMode'),
89
89
  isDistractionFree: isFeatureActive('distractionFree'),
90
90
  hasInlineToolbar: isFeatureActive('inlineToolbar'),
@@ -92,11 +92,10 @@ function Editor({
92
92
  hiddenBlockTypes: getHiddenBlockTypes(),
93
93
  blockTypes: getBlockTypes(),
94
94
  keepCaretInsideBlock: isFeatureActive('keepCaretInsideBlock'),
95
- isTemplateMode: isEditingTemplate(),
96
95
  template: supportsTemplateMode && isViewable && canEditTemplate ? getEditedPostTemplate() : null,
97
96
  post: postObject
98
97
  };
99
- }, [postType, postId]);
98
+ }, [postType, postId, isLargeViewport]);
100
99
  const {
101
100
  updatePreferredStyleVariations,
102
101
  setIsInserterOpened
@@ -140,7 +139,7 @@ function Editor({
140
139
  post: post,
141
140
  initialEdits: initialEdits,
142
141
  useSubRegistry: false,
143
- __unstableTemplate: isTemplateMode ? template : undefined,
142
+ __unstableTemplate: template,
144
143
  ...props
145
144
  }, (0, _react.createElement)(_editor.ErrorBoundary, null, (0, _react.createElement)(_commands.CommandMenu, null), (0, _react.createElement)(_editorInitialization.default, {
146
145
  postId: postId
@@ -1 +1 @@
1
- {"version":3,"names":["_blocks","require","_data","_editor","_element","_components","_coreData","_preferences","_commands","_layout","_interopRequireDefault","_editorInitialization","_store","_lockUnlock","ExperimentalEditorProvider","unlock","editorPrivateApis","Editor","postId","postType","settings","initialEdits","props","hasFixedToolbar","focusMode","isDistractionFree","hasInlineToolbar","post","preferredStyleVariations","hiddenBlockTypes","blockTypes","keepCaretInsideBlock","isTemplateMode","template","useSelect","select","_getPostType$viewable","isFeatureActive","isEditingTemplate","getEditedPostTemplate","getHiddenBlockTypes","editPostStore","getEntityRecord","getPostType","getEntityRecords","canUser","coreStore","getEditorSettings","editorStore","getBlockTypes","blocksStore","isTemplate","includes","postObject","posts","wp_id","supportsTemplateMode","isViewable","viewable","canEditTemplate","preferencesStore","get","updatePreferredStyleVariations","setIsInserterOpened","useDispatch","editorSettings","useMemo","result","__experimentalPreferredStyleVariations","value","onChange","__experimentalSetIsInserterOpened","defaultAllowedBlockTypes","allowedBlockTypes","length","map","name","filter","type","_react","createElement","SlotFillProvider","useSubRegistry","__unstableTemplate","undefined","ErrorBoundary","CommandMenu","default","PostLockedModal","_default","exports"],"sources":["@wordpress/edit-post/src/editor.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useMemo } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { CommandMenu } from '@wordpress/commands';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport EditorInitialization from './components/editor-initialization';\nimport { store as editPostStore } from './store';\nimport { unlock } from './lock-unlock';\n\nconst { ExperimentalEditorProvider } = unlock( editorPrivateApis );\n\nfunction Editor( { postId, postType, settings, initialEdits, ...props } ) {\n\tconst {\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\tisDistractionFree,\n\t\thasInlineToolbar,\n\t\tpost,\n\t\tpreferredStyleVariations,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tkeepCaretInsideBlock,\n\t\tisTemplateMode,\n\t\ttemplate,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisFeatureActive,\n\t\t\t\tisEditingTemplate,\n\t\t\t\tgetEditedPostTemplate,\n\t\t\t\tgetHiddenBlockTypes,\n\t\t\t} = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, getEntityRecords, canUser } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\t\tpostType\n\t\t\t);\n\t\t\t// Ideally the initializeEditor function should be called using the ID of the REST endpoint.\n\t\t\t// to avoid the special case.\n\t\t\tlet postObject;\n\t\t\tif ( isTemplate ) {\n\t\t\t\tconst posts = getEntityRecords( 'postType', postType, {\n\t\t\t\t\twp_id: postId,\n\t\t\t\t} );\n\t\t\t\tpostObject = posts?.[ 0 ];\n\t\t\t} else {\n\t\t\t\tpostObject = getEntityRecord( 'postType', postType, postId );\n\t\t\t}\n\t\t\tconst supportsTemplateMode =\n\t\t\t\tgetEditorSettings().supportsTemplateMode;\n\t\t\tconst isViewable = getPostType( postType )?.viewable ?? false;\n\t\t\tconst canEditTemplate = canUser( 'create', 'templates' );\n\n\t\t\treturn {\n\t\t\t\thasFixedToolbar: isFeatureActive( 'fixedToolbar' ),\n\t\t\t\tfocusMode: isFeatureActive( 'focusMode' ),\n\t\t\t\tisDistractionFree: isFeatureActive( 'distractionFree' ),\n\t\t\t\thasInlineToolbar: isFeatureActive( 'inlineToolbar' ),\n\t\t\t\tpreferredStyleVariations: select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t'preferredStyleVariations'\n\t\t\t\t),\n\t\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\t\tblockTypes: getBlockTypes(),\n\t\t\t\tkeepCaretInsideBlock: isFeatureActive( 'keepCaretInsideBlock' ),\n\t\t\t\tisTemplateMode: isEditingTemplate(),\n\t\t\t\ttemplate:\n\t\t\t\t\tsupportsTemplateMode && isViewable && canEditTemplate\n\t\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t\t: null,\n\t\t\t\tpost: postObject,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst { updatePreferredStyleVariations, setIsInserterOpened } =\n\t\tuseDispatch( editPostStore );\n\n\tconst editorSettings = useMemo( () => {\n\t\tconst result = {\n\t\t\t...settings,\n\t\t\t__experimentalPreferredStyleVariations: {\n\t\t\t\tvalue: preferredStyleVariations,\n\t\t\t\tonChange: updatePreferredStyleVariations,\n\t\t\t},\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\tisDistractionFree,\n\t\t\thasInlineToolbar,\n\n\t\t\t// This is marked as experimental to give time for the quick inserter to mature.\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t// Keep a reference of the `allowedBlockTypes` from the server to handle use cases\n\t\t\t// where we need to differentiate if a block is disabled by the user or some plugin.\n\t\t\tdefaultAllowedBlockTypes: settings.allowedBlockTypes,\n\t\t};\n\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes.length > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\tresult.allowedBlockTypes = defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn result;\n\t}, [\n\t\tsettings,\n\t\thasFixedToolbar,\n\t\thasInlineToolbar,\n\t\tfocusMode,\n\t\tisDistractionFree,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tpreferredStyleVariations,\n\t\tsetIsInserterOpened,\n\t\tupdatePreferredStyleVariations,\n\t\tkeepCaretInsideBlock,\n\t] );\n\n\tif ( ! post ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<ExperimentalEditorProvider\n\t\t\t\tsettings={ editorSettings }\n\t\t\t\tpost={ post }\n\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t__unstableTemplate={ isTemplateMode ? template : undefined }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t<CommandMenu />\n\t\t\t\t\t<EditorInitialization postId={ postId } />\n\t\t\t\t\t<Layout />\n\t\t\t\t</ErrorBoundary>\n\t\t\t\t<PostLockedModal />\n\t\t\t</ExperimentalEditorProvider>\n\t\t</SlotFillProvider>\n\t);\n}\n\nexport default Editor;\n"],"mappings":";;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAMA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAC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BAAkB,EAAGnD,cAAc,GAAGC,QAAQ,GAAGmD,SAAW;IAAA,GACvD9D;EAAK,GAEV,IAAAyD,MAAA,CAAAC,aAAA,EAAC7E,OAAA,CAAAkF,aAAa,QACb,IAAAN,MAAA,CAAAC,aAAA,EAACxE,SAAA,CAAA8E,WAAW,MAAE,CAAC,EACf,IAAAP,MAAA,CAAAC,aAAA,EAACrE,qBAAA,CAAA4E,OAAoB;IAACrE,MAAM,EAAGA;EAAQ,CAAE,CAAC,EAC1C,IAAA6D,MAAA,CAAAC,aAAA,EAACvE,OAAA,CAAA8E,OAAM,MAAE,CACK,CAAC,EAChB,IAAAR,MAAA,CAAAC,aAAA,EAAC7E,OAAA,CAAAqF,eAAe,MAAE,CACS,CACX,CAAC;AAErB;AAAC,IAAAC,QAAA,GAEcxE,MAAM;AAAAyE,OAAA,CAAAH,OAAA,GAAAE,QAAA"}
1
+ {"version":3,"names":["_blocks","require","_data","_editor","_element","_components","_coreData","_preferences","_commands","_compose","_layout","_interopRequireDefault","_editorInitialization","_store","_lockUnlock","ExperimentalEditorProvider","unlock","editorPrivateApis","Editor","postId","postType","settings","initialEdits","props","isLargeViewport","useViewportMatch","hasFixedToolbar","focusMode","isDistractionFree","hasInlineToolbar","post","preferredStyleVariations","hiddenBlockTypes","blockTypes","keepCaretInsideBlock","template","useSelect","select","_getPostType$viewable","isFeatureActive","getEditedPostTemplate","getHiddenBlockTypes","editPostStore","getEntityRecord","getPostType","getEntityRecords","canUser","coreStore","getEditorSettings","editorStore","getBlockTypes","blocksStore","isTemplate","includes","postObject","posts","wp_id","supportsTemplateMode","isViewable","viewable","canEditTemplate","preferencesStore","get","updatePreferredStyleVariations","setIsInserterOpened","useDispatch","editorSettings","useMemo","result","__experimentalPreferredStyleVariations","value","onChange","__experimentalSetIsInserterOpened","defaultAllowedBlockTypes","allowedBlockTypes","length","map","name","filter","type","_react","createElement","SlotFillProvider","useSubRegistry","__unstableTemplate","ErrorBoundary","CommandMenu","default","PostLockedModal","_default","exports"],"sources":["@wordpress/edit-post/src/editor.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useMemo } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { CommandMenu } from '@wordpress/commands';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport EditorInitialization from './components/editor-initialization';\nimport { store as editPostStore } from './store';\nimport { unlock } from './lock-unlock';\n\nconst { ExperimentalEditorProvider } = unlock( editorPrivateApis );\n\nfunction Editor( { postId, postType, settings, initialEdits, ...props } ) {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\n\tconst {\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\tisDistractionFree,\n\t\thasInlineToolbar,\n\t\tpost,\n\t\tpreferredStyleVariations,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tkeepCaretInsideBlock,\n\t\ttemplate,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisFeatureActive,\n\t\t\t\tgetEditedPostTemplate,\n\t\t\t\tgetHiddenBlockTypes,\n\t\t\t} = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, getEntityRecords, canUser } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\t\tpostType\n\t\t\t);\n\t\t\t// Ideally the initializeEditor function should be called using the ID of the REST endpoint.\n\t\t\t// to avoid the special case.\n\t\t\tlet postObject;\n\t\t\tif ( isTemplate ) {\n\t\t\t\tconst posts = getEntityRecords( 'postType', postType, {\n\t\t\t\t\twp_id: postId,\n\t\t\t\t} );\n\t\t\t\tpostObject = posts?.[ 0 ];\n\t\t\t} else {\n\t\t\t\tpostObject = getEntityRecord( 'postType', postType, postId );\n\t\t\t}\n\t\t\tconst supportsTemplateMode =\n\t\t\t\tgetEditorSettings().supportsTemplateMode;\n\t\t\tconst isViewable = getPostType( postType )?.viewable ?? false;\n\t\t\tconst canEditTemplate = canUser( 'create', 'templates' );\n\t\t\treturn {\n\t\t\t\thasFixedToolbar:\n\t\t\t\t\tisFeatureActive( 'fixedToolbar' ) || ! isLargeViewport,\n\t\t\t\tfocusMode: isFeatureActive( 'focusMode' ),\n\t\t\t\tisDistractionFree: isFeatureActive( 'distractionFree' ),\n\t\t\t\thasInlineToolbar: isFeatureActive( 'inlineToolbar' ),\n\t\t\t\tpreferredStyleVariations: select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t'preferredStyleVariations'\n\t\t\t\t),\n\t\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\t\tblockTypes: getBlockTypes(),\n\t\t\t\tkeepCaretInsideBlock: isFeatureActive( 'keepCaretInsideBlock' ),\n\t\t\t\ttemplate:\n\t\t\t\t\tsupportsTemplateMode && isViewable && canEditTemplate\n\t\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t\t: null,\n\t\t\t\tpost: postObject,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId, isLargeViewport ]\n\t);\n\n\tconst { updatePreferredStyleVariations, setIsInserterOpened } =\n\t\tuseDispatch( editPostStore );\n\n\tconst editorSettings = useMemo( () => {\n\t\tconst result = {\n\t\t\t...settings,\n\t\t\t__experimentalPreferredStyleVariations: {\n\t\t\t\tvalue: preferredStyleVariations,\n\t\t\t\tonChange: updatePreferredStyleVariations,\n\t\t\t},\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\tisDistractionFree,\n\t\t\thasInlineToolbar,\n\n\t\t\t// This is marked as experimental to give time for the quick inserter to mature.\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t// Keep a reference of the `allowedBlockTypes` from the server to handle use cases\n\t\t\t// where we need to differentiate if a block is disabled by the user or some plugin.\n\t\t\tdefaultAllowedBlockTypes: settings.allowedBlockTypes,\n\t\t};\n\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes.length > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\tresult.allowedBlockTypes = defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn result;\n\t}, [\n\t\tsettings,\n\t\thasFixedToolbar,\n\t\thasInlineToolbar,\n\t\tfocusMode,\n\t\tisDistractionFree,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tpreferredStyleVariations,\n\t\tsetIsInserterOpened,\n\t\tupdatePreferredStyleVariations,\n\t\tkeepCaretInsideBlock,\n\t] );\n\n\tif ( ! post ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<ExperimentalEditorProvider\n\t\t\t\tsettings={ editorSettings }\n\t\t\t\tpost={ post }\n\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t__unstableTemplate={ template }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t<CommandMenu />\n\t\t\t\t\t<EditorInitialization postId={ postId } />\n\t\t\t\t\t<Layout />\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AAmB,EACnBD,8BAA8B,EAC9B7B,oBAAoB,CACnB,CAAC;EAEH,IAAK,CAAEJ,IAAI,EAAG;IACb,OAAO,IAAI;EACZ;EAEA,OACC,IAAAkD,MAAA,CAAAC,aAAA,EAAC5E,WAAA,CAAA6E,gBAAgB,QAChB,IAAAF,MAAA,CAAAC,aAAA,EAAClE,0BAA0B;IAC1BM,QAAQ,EAAG6C,cAAgB;IAC3BpC,IAAI,EAAGA,IAAM;IACbR,YAAY,EAAGA,YAAc;IAC7B6D,cAAc,EAAG,KAAO;IACxBC,kBAAkB,EAAGjD,QAAU;IAAA,GAC1BZ;EAAK,GAEV,IAAAyD,MAAA,CAAAC,aAAA,EAAC9E,OAAA,CAAAkF,aAAa,QACb,IAAAL,MAAA,CAAAC,aAAA,EAACzE,SAAA,CAAA8E,WAAW,MAAE,CAAC,EACf,IAAAN,MAAA,CAAAC,aAAA,EAACrE,qBAAA,CAAA2E,OAAoB;IAACpE,MAAM,EAAGA;EAAQ,CAAE,CAAC,EAC1C,IAAA6D,MAAA,CAAAC,aAAA,EAACvE,OAAA,CAAA6E,OAAM,MAAE,CACK,CAAC,EAChB,IAAAP,MAAA,CAAAC,aAAA,EAAC9E,OAAA,CAAAqF,eAAe,MAAE,CACS,CACX,CAAC;AAErB;AAAC,IAAAC,QAAA,GAEcvE,MAAM;AAAAwE,OAAA,CAAAH,OAAA,GAAAE,QAAA"}
@@ -163,14 +163,13 @@ var _default = (0, _compose.compose)([(0, _data.withSelect)(select => {
163
163
  const {
164
164
  isFeatureActive,
165
165
  getEditorMode,
166
- __experimentalGetPreviewDeviceType,
167
166
  getHiddenBlockTypes
168
167
  } = select(_store.store);
169
168
  const {
170
169
  getBlockTypes
171
170
  } = select(_blocks.store);
172
171
  return {
173
- hasFixedToolbar: isFeatureActive('fixedToolbar') || __experimentalGetPreviewDeviceType() !== 'Desktop',
172
+ hasFixedToolbar: isFeatureActive('fixedToolbar'),
174
173
  focusMode: isFeatureActive('focusMode'),
175
174
  mode: getEditorMode(),
176
175
  hiddenBlockTypes: getHiddenBlockTypes(),
@@ -1 +1 @@
1
- {"version":3,"names":["_memize","_interopRequireDefault","require","_reactNative","_reactNativeGestureHandler","_element","_editor","_blocks","_data","_compose","_reactNativeBridge","_components","_coreData","_layout","_store","Editor","Component","constructor","props","arguments","galleryWithImageBlocks","window","wp","galleryBlockV2Enabled","initialHtmlModeEnabled","mode","switchEditorMode","getEditorSettings","memize","maxSize","setTitleRef","bind","settings","hasFixedToolbar","focusMode","hiddenBlockTypes","blockTypes","isRTL","I18nManager","length","allowedBlockTypes","undefined","defaultAllowedBlockTypes","map","name","filter","type","includes","componentDidMount","editEntityRecord","postType","postId","subscriptionParentSetFocusOnTitle","subscribeSetFocusOnTitle","postTitleRef","focus","focusTitleWhenAvailable","subscriptionParentFeaturedImageIdNativeUpdated","subscribeFeaturedImageIdNativeUpdated","payload","featured_media","featuredImageId","undoIgnore","componentWillUnmount","remove","titleRef","render","initialEdits","post","initialHtml","editorSettings","normalizedPost","id","title","raw","initialTitle","content","serialize","parse","status","meta","_react","createElement","GestureHandlerRootView","style","flex","SlotFillProvider","EditorProvider","useSubRegistry","default","_default","compose","withSelect","select","isFeatureActive","getEditorMode","__experimentalGetPreviewDeviceType","getHiddenBlockTypes","editPostStore","getBlockTypes","blocksStore","withDispatch","dispatch","coreStore","exports"],"sources":["@wordpress/edit-post/src/editor.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport memize from 'memize';\nimport { I18nManager } from 'react-native';\nimport { GestureHandlerRootView } from 'react-native-gesture-handler';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { EditorProvider } from '@wordpress/editor';\nimport { parse, serialize, store as blocksStore } from '@wordpress/blocks';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport {\n\tsubscribeSetFocusOnTitle,\n\tsubscribeFeaturedImageIdNativeUpdated,\n} from '@wordpress/react-native-bridge';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport { store as editPostStore } from './store';\n\nclass Editor extends Component {\n\tconstructor( props ) {\n\t\tsuper( ...arguments );\n\n\t\t// need to set this globally to avoid race with deprecations\n\t\t// defaulting to true to avoid issues with a not-yet-cached value\n\t\tconst { galleryWithImageBlocks = true } = props;\n\t\twindow.wp.galleryBlockV2Enabled = galleryWithImageBlocks;\n\n\t\tif ( props.initialHtmlModeEnabled && props.mode === 'visual' ) {\n\t\t\t// Enable html mode if the initial mode the parent wants it but we're not already in it.\n\t\t\tthis.props.switchEditorMode( 'text' );\n\t\t}\n\n\t\tthis.getEditorSettings = memize( this.getEditorSettings, {\n\t\t\tmaxSize: 1,\n\t\t} );\n\n\t\tthis.setTitleRef = this.setTitleRef.bind( this );\n\t}\n\n\tgetEditorSettings(\n\t\tsettings,\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\thiddenBlockTypes,\n\t\tblockTypes\n\t) {\n\t\tsettings = {\n\t\t\t...settings,\n\t\t\tisRTL: I18nManager.isRTL,\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t};\n\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes.length > 0 ) {\n\t\t\tif ( settings.allowedBlockTypes === undefined ) {\n\t\t\t\t// If no specific flags for allowedBlockTypes are set, assume `true`\n\t\t\t\t// meaning allow all block types.\n\t\t\t\tsettings.allowedBlockTypes = true;\n\t\t\t}\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\tsettings.allowedBlockTypes = defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn settings;\n\t}\n\n\tcomponentDidMount() {\n\t\tconst { editEntityRecord, postType, postId } = this.props;\n\n\t\tthis.subscriptionParentSetFocusOnTitle = subscribeSetFocusOnTitle(\n\t\t\t() => {\n\t\t\t\tif ( this.postTitleRef ) {\n\t\t\t\t\tthis.postTitleRef.focus();\n\t\t\t\t} else {\n\t\t\t\t\t// If the post title ref is not available, we postpone setting focus to when it's available.\n\t\t\t\t\tthis.focusTitleWhenAvailable = true;\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentFeaturedImageIdNativeUpdated =\n\t\t\tsubscribeFeaturedImageIdNativeUpdated( ( payload ) => {\n\t\t\t\teditEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId,\n\t\t\t\t\t{ featured_media: payload.featuredImageId },\n\t\t\t\t\t{\n\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} );\n\t}\n\n\tcomponentWillUnmount() {\n\t\tif ( this.subscriptionParentSetFocusOnTitle ) {\n\t\t\tthis.subscriptionParentSetFocusOnTitle.remove();\n\t\t}\n\n\t\tif ( this.subscribeFeaturedImageIdNativeUpdated ) {\n\t\t\tthis.subscribeFeaturedImageIdNativeUpdated.remove();\n\t\t}\n\t}\n\n\tsetTitleRef( titleRef ) {\n\t\tif ( this.focusTitleWhenAvailable && ! this.postTitleRef ) {\n\t\t\tthis.focusTitleWhenAvailable = false;\n\t\t\ttitleRef.focus();\n\t\t}\n\n\t\tthis.postTitleRef = titleRef;\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tsettings,\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\tinitialEdits,\n\t\t\thiddenBlockTypes,\n\t\t\tblockTypes,\n\t\t\tpost,\n\t\t\tpostId,\n\t\t\tpostType,\n\t\t\tfeaturedImageId,\n\t\t\tinitialHtml,\n\t\t\t...props\n\t\t} = this.props;\n\n\t\tconst editorSettings = this.getEditorSettings(\n\t\t\tsettings,\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\thiddenBlockTypes,\n\t\t\tblockTypes\n\t\t);\n\n\t\tconst normalizedPost = post || {\n\t\t\tid: postId,\n\t\t\ttitle: {\n\t\t\t\traw: props.initialTitle || '',\n\t\t\t},\n\t\t\tfeatured_media: featuredImageId,\n\t\t\tcontent: {\n\t\t\t\t// Make sure the post content is in sync with gutenberg store\n\t\t\t\t// to avoid marking the post as modified when simply loaded\n\t\t\t\t// For now, let's assume: serialize( parse( html ) ) !== html.\n\t\t\t\traw: serialize( parse( initialHtml || '' ) ),\n\t\t\t},\n\t\t\ttype: postType,\n\t\t\tstatus: 'draft',\n\t\t\tmeta: [],\n\t\t};\n\n\t\treturn (\n\t\t\t<GestureHandlerRootView style={ { flex: 1 } }>\n\t\t\t\t<SlotFillProvider>\n\t\t\t\t\t<EditorProvider\n\t\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\t\tpost={ normalizedPost }\n\t\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Layout setTitleRef={ this.setTitleRef } />\n\t\t\t\t\t</EditorProvider>\n\t\t\t\t</SlotFillProvider>\n\t\t\t</GestureHandlerRootView>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tisFeatureActive,\n\t\t\tgetEditorMode,\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t\tgetHiddenBlockTypes,\n\t\t} = select( editPostStore );\n\t\tconst { getBlockTypes } = select( blocksStore );\n\n\t\treturn {\n\t\t\thasFixedToolbar:\n\t\t\t\tisFeatureActive( 'fixedToolbar' ) ||\n\t\t\t\t__experimentalGetPreviewDeviceType() !== 'Desktop',\n\t\t\tfocusMode: isFeatureActive( 'focusMode' ),\n\t\t\tmode: getEditorMode(),\n\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\tblockTypes: getBlockTypes(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { switchEditorMode } = dispatch( editPostStore );\n\t\tconst { editEntityRecord } = dispatch( coreStore );\n\t\treturn {\n\t\t\tswitchEditorMode,\n\t\t\teditEntityRecord,\n\t\t};\n\t} ),\n] )( Editor );\n"],"mappings":";;;;;;;;AAGA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,0BAAA,GAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,kBAAA,GAAAR,OAAA;AAIA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,SAAA,GAAAV,OAAA;AAKA,IAAAW,OAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AA1BA;AACA;AACA;;AAKA;AACA;AACA;;AAaA;AACA;AACA;;AAIA,MAAMa,MAAM,SAASC,kBAAS,CAAC;EAC9BC,WAAWA,CAAEC,KAAK,EAAG;IACpB,KAAK,CAAE,GAAGC,SAAU,CAAC;;IAErB;IACA;IACA,MAAM;MAAEC,sBAAsB,GAAG;IAAK,CAAC,GAAGF,KAAK;IAC/CG,MAAM,CAACC,EAAE,CAACC,qBAAqB,GAAGH,sBAAsB;IAExD,IAAKF,KAAK,CAACM,sBAAsB,IAAIN,KAAK,CAACO,IAAI,KAAK,QAAQ,EAAG;MAC9D;MACA,IAAI,CAACP,KAAK,CAACQ,gBAAgB,CAAE,MAAO,CAAC;IACtC;IAEA,IAAI,CAACC,i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EAAE+D,aAAa,CAAC;EAC3B,CAAC;AACF,CAAE,CAAC,EACH,IAAAE,kBAAY,EAAIC,QAAQ,IAAM;EAC7B,MAAM;IAAE5E;EAAiB,CAAC,GAAG4E,QAAQ,CAAEJ,YAAc,CAAC;EACtD,MAAM;IAAEjD;EAAiB,CAAC,GAAGqD,QAAQ,CAAEC,eAAU,CAAC;EAClD,OAAO;IACN7E,gBAAgB;IAChBuB;EACD,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAElC,MAAO,CAAC;AAAAyF,OAAA,CAAAf,OAAA,GAAAC,QAAA"}
1
+ {"version":3,"names":["_memize","_interopRequireDefault","require","_reactNative","_reactNativeGestureHandler","_element","_editor","_blocks","_data","_compose","_reactNativeBridge","_components","_coreData","_layout","_store","Editor","Component","constructor","props","arguments","galleryWithImageBlocks","window","wp","galleryBlockV2Enabled","initialHtmlModeEnabled","mode","switchEditorMode","getEditorSettings","memize","maxSize","setTitleRef","bind","settings","hasFixedToolbar","focusMode","hiddenBlockTypes","blockTypes","isRTL","I18nManager","length","allowedBlockTypes","undefined","defaultAllowedBlockTypes","map","name","filter","type","includes","componentDidMount","editEntityRecord","postType","postId","subscriptionParentSetFocusOnTitle","subscribeSetFocusOnTitle","postTitleRef","focus","focusTitleWhenAvailable","subscriptionParentFeaturedImageIdNativeUpdated","subscribeFeaturedImageIdNativeUpdated","payload","featured_media","featuredImageId","undoIgnore","componentWillUnmount","remove","titleRef","render","initialEdits","post","initialHtml","editorSettings","normalizedPost","id","title","raw","initialTitle","content","serialize","parse","status","meta","_react","createElement","GestureHandlerRootView","style","flex","SlotFillProvider","EditorProvider","useSubRegistry","default","_default","compose","withSelect","select","isFeatureActive","getEditorMode","getHiddenBlockTypes","editPostStore","getBlockTypes","blocksStore","withDispatch","dispatch","coreStore","exports"],"sources":["@wordpress/edit-post/src/editor.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport memize from 'memize';\nimport { I18nManager } from 'react-native';\nimport { GestureHandlerRootView } from 'react-native-gesture-handler';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { EditorProvider } from '@wordpress/editor';\nimport { parse, serialize, store as blocksStore } from '@wordpress/blocks';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport {\n\tsubscribeSetFocusOnTitle,\n\tsubscribeFeaturedImageIdNativeUpdated,\n} from '@wordpress/react-native-bridge';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport { store as editPostStore } from './store';\n\nclass Editor extends Component {\n\tconstructor( props ) {\n\t\tsuper( ...arguments );\n\n\t\t// need to set this globally to avoid race with deprecations\n\t\t// defaulting to true to avoid issues with a not-yet-cached value\n\t\tconst { galleryWithImageBlocks = true } = props;\n\t\twindow.wp.galleryBlockV2Enabled = galleryWithImageBlocks;\n\n\t\tif ( props.initialHtmlModeEnabled && props.mode === 'visual' ) {\n\t\t\t// Enable html mode if the initial mode the parent wants it but we're not already in it.\n\t\t\tthis.props.switchEditorMode( 'text' );\n\t\t}\n\n\t\tthis.getEditorSettings = memize( this.getEditorSettings, {\n\t\t\tmaxSize: 1,\n\t\t} );\n\n\t\tthis.setTitleRef = this.setTitleRef.bind( this );\n\t}\n\n\tgetEditorSettings(\n\t\tsettings,\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\thiddenBlockTypes,\n\t\tblockTypes\n\t) {\n\t\tsettings = {\n\t\t\t...settings,\n\t\t\tisRTL: I18nManager.isRTL,\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t};\n\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes.length > 0 ) {\n\t\t\tif ( settings.allowedBlockTypes === undefined ) {\n\t\t\t\t// If no specific flags for allowedBlockTypes are set, assume `true`\n\t\t\t\t// meaning allow all block types.\n\t\t\t\tsettings.allowedBlockTypes = true;\n\t\t\t}\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\tsettings.allowedBlockTypes = defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn settings;\n\t}\n\n\tcomponentDidMount() {\n\t\tconst { editEntityRecord, postType, postId } = this.props;\n\n\t\tthis.subscriptionParentSetFocusOnTitle = subscribeSetFocusOnTitle(\n\t\t\t() => {\n\t\t\t\tif ( this.postTitleRef ) {\n\t\t\t\t\tthis.postTitleRef.focus();\n\t\t\t\t} else {\n\t\t\t\t\t// If the post title ref is not available, we postpone setting focus to when it's available.\n\t\t\t\t\tthis.focusTitleWhenAvailable = true;\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentFeaturedImageIdNativeUpdated =\n\t\t\tsubscribeFeaturedImageIdNativeUpdated( ( payload ) => {\n\t\t\t\teditEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId,\n\t\t\t\t\t{ featured_media: payload.featuredImageId },\n\t\t\t\t\t{\n\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} );\n\t}\n\n\tcomponentWillUnmount() {\n\t\tif ( this.subscriptionParentSetFocusOnTitle ) {\n\t\t\tthis.subscriptionParentSetFocusOnTitle.remove();\n\t\t}\n\n\t\tif ( this.subscribeFeaturedImageIdNativeUpdated ) {\n\t\t\tthis.subscribeFeaturedImageIdNativeUpdated.remove();\n\t\t}\n\t}\n\n\tsetTitleRef( titleRef ) {\n\t\tif ( this.focusTitleWhenAvailable && ! this.postTitleRef ) {\n\t\t\tthis.focusTitleWhenAvailable = false;\n\t\t\ttitleRef.focus();\n\t\t}\n\n\t\tthis.postTitleRef = titleRef;\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tsettings,\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\tinitialEdits,\n\t\t\thiddenBlockTypes,\n\t\t\tblockTypes,\n\t\t\tpost,\n\t\t\tpostId,\n\t\t\tpostType,\n\t\t\tfeaturedImageId,\n\t\t\tinitialHtml,\n\t\t\t...props\n\t\t} = this.props;\n\n\t\tconst editorSettings = this.getEditorSettings(\n\t\t\tsettings,\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\thiddenBlockTypes,\n\t\t\tblockTypes\n\t\t);\n\n\t\tconst normalizedPost = post || {\n\t\t\tid: postId,\n\t\t\ttitle: {\n\t\t\t\traw: props.initialTitle || '',\n\t\t\t},\n\t\t\tfeatured_media: featuredImageId,\n\t\t\tcontent: {\n\t\t\t\t// Make sure the post content is in sync with gutenberg store\n\t\t\t\t// to avoid marking the post as modified when simply loaded\n\t\t\t\t// For now, let's assume: serialize( parse( html ) ) !== html.\n\t\t\t\traw: serialize( parse( initialHtml || '' ) ),\n\t\t\t},\n\t\t\ttype: postType,\n\t\t\tstatus: 'draft',\n\t\t\tmeta: [],\n\t\t};\n\n\t\treturn (\n\t\t\t<GestureHandlerRootView style={ { flex: 1 } }>\n\t\t\t\t<SlotFillProvider>\n\t\t\t\t\t<EditorProvider\n\t\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\t\tpost={ normalizedPost }\n\t\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Layout setTitleRef={ this.setTitleRef } />\n\t\t\t\t\t</EditorProvider>\n\t\t\t\t</SlotFillProvider>\n\t\t\t</GestureHandlerRootView>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { isFeatureActive, getEditorMode, getHiddenBlockTypes } =\n\t\t\tselect( editPostStore );\n\t\tconst { getBlockTypes } = select( blocksStore );\n\n\t\treturn {\n\t\t\thasFixedToolbar: isFeatureActive( 'fixedToolbar' ),\n\t\t\tfocusMode: isFeatureActive( 'focusMode' ),\n\t\t\tmode: getEditorMode(),\n\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\tblockTypes: getBlockTypes(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { switchEditorMode } = dispatch( editPostStore );\n\t\tconst { editEntityRecord } = dispatch( coreStore );\n\t\treturn {\n\t\t\tswitchEditorMode,\n\t\t\teditEntityRecord,\n\t\t};\n\t} ),\n] )( Editor );\n"],"mappings":";;;;;;;;AAGA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,0BAAA,GAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,kBAAA,GAAAR,OAAA;AAIA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,SAAA,GAAAV,OAAA;AAKA,IAAAW,OAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AA1BA;AACA;AACA;;AAKA;AACA;AACA;;AAaA;AACA;AACA;;AAIA,MAAMa,MAAM,SAASC,kBAAS,CAAC;EAC9BC,WAAWA,CAAEC,KAAK,EAAG;IACpB,KAAK,CAAE,GAAGC,SAAU,CAAC;;IAErB;IACA;IACA,MAAM;MAAEC,sBAAsB,GAAG;IAAK,CAAC,GAAGF,KAAK;IAC/CG,MAAM,CAACC,EAAE,CAACC,qBAAqB,GAAGH,sBAAsB;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AAE,WAAY,CAAC;IACzCrE,IAAI,EAAEsE,aAAa,CAAC,CAAC;IACrB5D,gBAAgB,EAAE6D,mBAAmB,CAAC,CAAC;IACvC5D,UAAU,EAAE8D,aAAa,CAAC;EAC3B,CAAC;AACF,CAAE,CAAC,EACH,IAAAE,kBAAY,EAAIC,QAAQ,IAAM;EAC7B,MAAM;IAAE3E;EAAiB,CAAC,GAAG2E,QAAQ,CAAEJ,YAAc,CAAC;EACtD,MAAM;IAAEhD;EAAiB,CAAC,GAAGoD,QAAQ,CAAEC,eAAU,CAAC;EAClD,OAAO;IACN5E,gBAAgB;IAChBuB;EACD,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAElC,MAAO,CAAC;AAAAwF,OAAA,CAAAd,OAAA,GAAAC,QAAA"}
package/build/index.js CHANGED
@@ -87,9 +87,10 @@ var _data = require("@wordpress/data");
87
87
  var _hooks = require("@wordpress/hooks");
88
88
  var _preferences = require("@wordpress/preferences");
89
89
  var _widgets = require("@wordpress/widgets");
90
+ var _editor = require("@wordpress/editor");
90
91
  require("./hooks");
91
92
  require("./plugins");
92
- var _editor = _interopRequireDefault(require("./editor"));
93
+ var _editor2 = _interopRequireDefault(require("./editor"));
93
94
  var _store = require("./store");
94
95
  var _pluginBlockSettingsMenuItem = _interopRequireDefault(require("./components/block-settings-menu/plugin-block-settings-menu-item"));
95
96
  var _pluginDocumentSettingPanel = _interopRequireDefault(require("./components/sidebar/plugin-document-setting-panel"));
@@ -167,7 +168,7 @@ function initializeEditor(id, postType, postId, settings, initialEdits) {
167
168
  * so that common filters in the block library are not overwritten.
168
169
  */
169
170
  (0, _hooks.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removeTemplatePartsFromInserter', (canInsert, blockType) => {
170
- if (!(0, _data.select)(_store.store).isEditingTemplate() && blockType.name === 'core/template-part') {
171
+ if ((0, _data.select)(_editor.store).getRenderingMode() === 'post-only' && blockType.name === 'core/template-part') {
171
172
  return false;
172
173
  }
173
174
  return canInsert;
@@ -182,7 +183,7 @@ function initializeEditor(id, postType, postId, settings, initialEdits) {
182
183
  (0, _hooks.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removePostContentFromInserter', (canInsert, blockType, rootClientId, {
183
184
  getBlockParentsByBlockName
184
185
  }) => {
185
- if (!(0, _data.select)(_store.store).isEditingTemplate() && blockType.name === 'core/post-content') {
186
+ if ((0, _data.select)(_editor.store).getRenderingMode() === 'post-only' && blockType.name === 'core/post-content') {
186
187
  return getBlockParentsByBlockName(rootClientId, 'core/query').length > 0;
187
188
  }
188
189
  return canInsert;
@@ -223,7 +224,7 @@ function initializeEditor(id, postType, postId, settings, initialEdits) {
223
224
  // Prevent the default browser action for files dropped outside of dropzones.
224
225
  window.addEventListener('dragover', e => e.preventDefault(), false);
225
226
  window.addEventListener('drop', e => e.preventDefault(), false);
226
- root.render((0, _react.createElement)(_editor.default, {
227
+ root.render((0, _react.createElement)(_editor2.default, {
227
228
  settings: settings,
228
229
  postId: postId,
229
230
  postType: postType,
@@ -1 +1 @@
1
- {"version":3,"names":["_blocks","require","_blockLibrary","_deprecated","_interopRequireDefault","_element","_data","_hooks","_preferences","_widgets","_editor","_store","_pluginBlockSettingsMenuItem","_pluginDocumentSettingPanel","_pluginMoreMenuItem","_pluginPostPublishPanel","_pluginPostStatusInfo","_pluginPrePublishPanel","_pluginSidebar","_pluginSidebarMoreMenuItem","_fullscreenModeClose","_mainDashboardButton","_pluginPostExcerpt","initializeEditor","id","postType","postId","settings","initialEdits","target","document","getElementById","root","createRoot","dispatch","preferencesStore","setDefaults","editorMode","fixedToolbar","fullscreenMode","hiddenBlockTypes","inactivePanels","isPublishSidebarEnabled","openPanels","preferredStyleVariations","showBlockBreadcrumbs","showIconLabels","showListViewByDefault","themeStyles","welcomeGuide","welcomeGuideTemplate","blocksStore","reapplyBlockTypeFilters","select","editPostStore","isFeatureActive","setIsListViewOpened","registerCoreBlocks","registerLegacyWidgetBlock","inserter","registerWidgetGroupBlock","process","env","IS_GUTENBERG_PLUGIN","__experimentalRegisterExperimentalCoreBlocks","enableFSEBlocks","__unstableEnableFullSiteEditingBlocks","addFilter","canInsert","blockType","isEditingTemplate","name","rootClientId","getBlockParentsByBlockName","length","documentMode","compatMode","console","warn","isIphone","window","navigator","userAgent","indexOf","addEventListener","event","editorScrollContainer","getElementsByClassName","scrollY","scrollTop","scrollTo","e","preventDefault","render","_react","createElement","default","reinitializeEditor","deprecated","since","version"],"sources":["@wordpress/edit-post/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport { dispatch, select } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport './plugins';\nimport Editor from './editor';\nimport { store as editPostStore } from './store';\n\n/**\n * Initializes and returns an instance of Editor.\n *\n * @param {string} id Unique identifier for editor instance.\n * @param {string} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit.\n * @param {?Object} settings Editor settings object.\n * @param {Object} initialEdits Programmatic edits to apply initially, to be\n * considered as non-user-initiated (bypass for\n * unsaved changes prompt).\n */\nexport function initializeEditor(\n\tid,\n\tpostType,\n\tpostId,\n\tsettings,\n\tinitialEdits\n) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-post', {\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfullscreenMode: true,\n\t\thiddenBlockTypes: [],\n\t\tinactivePanels: [],\n\t\tisPublishSidebarEnabled: true,\n\t\topenPanels: [ 'post-status' ],\n\t\tpreferredStyleVariations: {},\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowIconLabels: false,\n\t\tshowListViewByDefault: false,\n\t\tthemeStyles: true,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\n\t// Check if the block list view should be open by default.\n\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\tif (\n\t\tselect( editPostStore ).isFeatureActive( 'showListViewByDefault' ) &&\n\t\t! select( editPostStore ).isFeatureActive( 'distractionFree' )\n\t) {\n\t\tdispatch( editPostStore ).setIsListViewOpened( true );\n\t}\n\n\tregisterCoreBlocks();\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks,\n\t\t} );\n\t}\n\n\t/*\n\t * Prevent adding template part in the post editor.\n\t * Only add the filter when the post editor is initialized, not imported.\n\t * Also only add the filter(s) after registerCoreBlocks()\n\t * so that common filters in the block library are not overwritten.\n\t */\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'removeTemplatePartsFromInserter',\n\t\t( canInsert, blockType ) => {\n\t\t\tif (\n\t\t\t\t! select( editPostStore ).isEditingTemplate() &&\n\t\t\t\tblockType.name === 'core/template-part'\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn canInsert;\n\t\t}\n\t);\n\n\t/*\n\t * Prevent adding post content block (except in query block) in the post editor.\n\t * Only add the filter when the post editor is initialized, not imported.\n\t * Also only add the filter(s) after registerCoreBlocks()\n\t * so that common filters in the block library are not overwritten.\n\t */\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'removePostContentFromInserter',\n\t\t(\n\t\t\tcanInsert,\n\t\t\tblockType,\n\t\t\trootClientId,\n\t\t\t{ getBlockParentsByBlockName }\n\t\t) => {\n\t\t\tif (\n\t\t\t\t! select( editPostStore ).isEditingTemplate() &&\n\t\t\t\tblockType.name === 'core/post-content'\n\t\t\t) {\n\t\t\t\treturn (\n\t\t\t\t\tgetBlockParentsByBlockName( rootClientId, 'core/query' )\n\t\t\t\t\t\t.length > 0\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn canInsert;\n\t\t}\n\t);\n\n\t// Show a console log warning if the browser is not in Standards rendering mode.\n\tconst documentMode =\n\t\tdocument.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';\n\tif ( documentMode !== 'Standards' ) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t\"Your browser is using Quirks Mode. \\nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins.\"\n\t\t);\n\t}\n\n\t// This is a temporary fix for a couple of issues specific to Webkit on iOS.\n\t// Without this hack the browser scrolls the mobile toolbar off-screen.\n\t// Once supported in Safari we can replace this in favor of preventScroll.\n\t// For details see issue #18632 and PR #18686\n\t// Specifically, we scroll `interface-interface-skeleton__body` to enable a fixed top toolbar.\n\t// But Mobile Safari forces the `html` element to scroll upwards, hiding the toolbar.\n\n\tconst isIphone = window.navigator.userAgent.indexOf( 'iPhone' ) !== -1;\n\tif ( isIphone ) {\n\t\twindow.addEventListener( 'scroll', ( event ) => {\n\t\t\tconst editorScrollContainer = document.getElementsByClassName(\n\t\t\t\t'interface-interface-skeleton__body'\n\t\t\t)[ 0 ];\n\t\t\tif ( event.target === document ) {\n\t\t\t\t// Scroll element into view by scrolling the editor container by the same amount\n\t\t\t\t// that Mobile Safari tried to scroll the html element upwards.\n\t\t\t\tif ( window.scrollY > 100 ) {\n\t\t\t\t\teditorScrollContainer.scrollTop =\n\t\t\t\t\t\teditorScrollContainer.scrollTop + window.scrollY;\n\t\t\t\t}\n\t\t\t\t// Undo unwanted scroll on html element, but only in the visual editor.\n\t\t\t\tif (\n\t\t\t\t\tdocument.getElementsByClassName( 'is-mode-visual' )[ 0 ]\n\t\t\t\t) {\n\t\t\t\t\twindow.scrollTo( 0, 0 );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t}\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(\n\t\t<Editor\n\t\t\tsettings={ settings }\n\t\t\tpostId={ postId }\n\t\t\tpostType={ postType }\n\t\t\tinitialEdits={ initialEdits }\n\t\t/>\n\t);\n\n\treturn root;\n}\n\n/**\n * Used to reinitialize the editor after an error. Now it's a deprecated noop function.\n */\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editPost.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginBlockSettingsMenuItem } from './components/block-settings-menu/plugin-block-settings-menu-item';\nexport { default as PluginDocumentSettingPanel } from './components/sidebar/plugin-document-setting-panel';\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\nexport { default as PluginPostPublishPanel } from './components/sidebar/plugin-post-publish-panel';\nexport { default as PluginPostStatusInfo } from './components/sidebar/plugin-post-status-info';\nexport { default as PluginPrePublishPanel } from './components/sidebar/plugin-pre-publish-panel';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as __experimentalFullscreenModeClose } from './components/header/fullscreen-mode-close';\nexport { default as __experimentalMainDashboardButton } from './components/header/main-dashboard-button';\nexport { default as __experimentalPluginPostExcerpt } from './components/sidebar/plugin-post-excerpt';\nexport { store } from './store';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AC9BH,qBAAqB,CAACG,SAAS,GAAGT,MAAM,CAACQ,OAAO;QAClD;QACA;QACA,IACC1D,QAAQ,CAACyD,sBAAsB,CAAE,gBAAiB,CAAC,CAAE,CAAC,CAAE,EACvD;UACDP,MAAM,CAACU,QAAQ,CAAE,CAAC,EAAE,CAAE,CAAC;QACxB;MACD;IACD,CAAE,CAAC;EACJ;;EAEA;EACAV,MAAM,CAACI,gBAAgB,CAAE,UAAU,EAAIO,CAAC,IAAMA,CAAC,CAACC,cAAc,CAAC,CAAC,EAAE,KAAM,CAAC;EACzEZ,MAAM,CAACI,gBAAgB,CAAE,MAAM,EAAIO,CAAC,IAAMA,CAAC,CAACC,cAAc,CAAC,CAAC,EAAE,KAAM,CAAC;EAErE5D,IAAI,CAAC6D,MAAM,CACV,IAAAC,MAAA,CAAAC,aAAA,EAACrF,OAAA,CAAAsF,OAAM;IACNrE,QAAQ,EAAGA,QAAU;IACrBD,MAAM,EAAGA,MAAQ;IACjBD,QAAQ,EAAGA,QAAU;IACrBG,YAAY,EAAGA;EAAc,CAC7B,CACF,CAAC;EAED,OAAOI,IAAI;AACZ;;AAEA;AACA;AACA;AACO,SAASiE,kBAAkBA,CAAA,EAAG;EACpC,IAAAC,mBAAU,EAAE,gCAAgC,EAAE;IAC7CC,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;AACJ"}
1
+ {"version":3,"names":["_blocks","require","_blockLibrary","_deprecated","_interopRequireDefault","_element","_data","_hooks","_preferences","_widgets","_editor","_editor2","_store","_pluginBlockSettingsMenuItem","_pluginDocumentSettingPanel","_pluginMoreMenuItem","_pluginPostPublishPanel","_pluginPostStatusInfo","_pluginPrePublishPanel","_pluginSidebar","_pluginSidebarMoreMenuItem","_fullscreenModeClose","_mainDashboardButton","_pluginPostExcerpt","initializeEditor","id","postType","postId","settings","initialEdits","target","document","getElementById","root","createRoot","dispatch","preferencesStore","setDefaults","editorMode","fixedToolbar","fullscreenMode","hiddenBlockTypes","inactivePanels","isPublishSidebarEnabled","openPanels","preferredStyleVariations","showBlockBreadcrumbs","showIconLabels","showListViewByDefault","themeStyles","welcomeGuide","welcomeGuideTemplate","blocksStore","reapplyBlockTypeFilters","select","editPostStore","isFeatureActive","setIsListViewOpened","registerCoreBlocks","registerLegacyWidgetBlock","inserter","registerWidgetGroupBlock","process","env","IS_GUTENBERG_PLUGIN","__experimentalRegisterExperimentalCoreBlocks","enableFSEBlocks","__unstableEnableFullSiteEditingBlocks","addFilter","canInsert","blockType","editorStore","getRenderingMode","name","rootClientId","getBlockParentsByBlockName","length","documentMode","compatMode","console","warn","isIphone","window","navigator","userAgent","indexOf","addEventListener","event","editorScrollContainer","getElementsByClassName","scrollY","scrollTop","scrollTo","e","preventDefault","render","_react","createElement","default","reinitializeEditor","deprecated","since","version"],"sources":["@wordpress/edit-post/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport { dispatch, select } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport './plugins';\nimport Editor from './editor';\nimport { store as editPostStore } from './store';\n\n/**\n * Initializes and returns an instance of Editor.\n *\n * @param {string} id Unique identifier for editor instance.\n * @param {string} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit.\n * @param {?Object} settings Editor settings object.\n * @param {Object} initialEdits Programmatic edits to apply initially, to be\n * considered as non-user-initiated (bypass for\n * unsaved changes prompt).\n */\nexport function initializeEditor(\n\tid,\n\tpostType,\n\tpostId,\n\tsettings,\n\tinitialEdits\n) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-post', {\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfullscreenMode: true,\n\t\thiddenBlockTypes: [],\n\t\tinactivePanels: [],\n\t\tisPublishSidebarEnabled: true,\n\t\topenPanels: [ 'post-status' ],\n\t\tpreferredStyleVariations: {},\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowIconLabels: false,\n\t\tshowListViewByDefault: false,\n\t\tthemeStyles: true,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\n\t// Check if the block list view should be open by default.\n\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\tif (\n\t\tselect( editPostStore ).isFeatureActive( 'showListViewByDefault' ) &&\n\t\t! select( editPostStore ).isFeatureActive( 'distractionFree' )\n\t) {\n\t\tdispatch( editPostStore ).setIsListViewOpened( true );\n\t}\n\n\tregisterCoreBlocks();\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks,\n\t\t} );\n\t}\n\n\t/*\n\t * Prevent adding template part in the post editor.\n\t * Only add the filter when the post editor is initialized, not imported.\n\t * Also only add the filter(s) after registerCoreBlocks()\n\t * so that common filters in the block library are not overwritten.\n\t */\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'removeTemplatePartsFromInserter',\n\t\t( canInsert, blockType ) => {\n\t\t\tif (\n\t\t\t\tselect( editorStore ).getRenderingMode() === 'post-only' &&\n\t\t\t\tblockType.name === 'core/template-part'\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn canInsert;\n\t\t}\n\t);\n\n\t/*\n\t * Prevent adding post content block (except in query block) in the post editor.\n\t * Only add the filter when the post editor is initialized, not imported.\n\t * Also only add the filter(s) after registerCoreBlocks()\n\t * so that common filters in the block library are not overwritten.\n\t */\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'removePostContentFromInserter',\n\t\t(\n\t\t\tcanInsert,\n\t\t\tblockType,\n\t\t\trootClientId,\n\t\t\t{ getBlockParentsByBlockName }\n\t\t) => {\n\t\t\tif (\n\t\t\t\tselect( editorStore ).getRenderingMode() === 'post-only' &&\n\t\t\t\tblockType.name === 'core/post-content'\n\t\t\t) {\n\t\t\t\treturn (\n\t\t\t\t\tgetBlockParentsByBlockName( rootClientId, 'core/query' )\n\t\t\t\t\t\t.length > 0\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn canInsert;\n\t\t}\n\t);\n\n\t// Show a console log warning if the browser is not in Standards rendering mode.\n\tconst documentMode =\n\t\tdocument.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';\n\tif ( documentMode !== 'Standards' ) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t\"Your browser is using Quirks Mode. \\nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins.\"\n\t\t);\n\t}\n\n\t// This is a temporary fix for a couple of issues specific to Webkit on iOS.\n\t// Without this hack the browser scrolls the mobile toolbar off-screen.\n\t// Once supported in Safari we can replace this in favor of preventScroll.\n\t// For details see issue #18632 and PR #18686\n\t// Specifically, we scroll `interface-interface-skeleton__body` to enable a fixed top toolbar.\n\t// But Mobile Safari forces the `html` element to scroll upwards, hiding the toolbar.\n\n\tconst isIphone = window.navigator.userAgent.indexOf( 'iPhone' ) !== -1;\n\tif ( isIphone ) {\n\t\twindow.addEventListener( 'scroll', ( event ) => {\n\t\t\tconst editorScrollContainer = document.getElementsByClassName(\n\t\t\t\t'interface-interface-skeleton__body'\n\t\t\t)[ 0 ];\n\t\t\tif ( event.target === document ) {\n\t\t\t\t// Scroll element into view by scrolling the editor container by the same amount\n\t\t\t\t// that Mobile Safari tried to scroll the html element upwards.\n\t\t\t\tif ( window.scrollY > 100 ) {\n\t\t\t\t\teditorScrollContainer.scrollTop =\n\t\t\t\t\t\teditorScrollContainer.scrollTop + window.scrollY;\n\t\t\t\t}\n\t\t\t\t// Undo unwanted scroll on html element, but only in the visual editor.\n\t\t\t\tif (\n\t\t\t\t\tdocument.getElementsByClassName( 'is-mode-visual' )[ 0 ]\n\t\t\t\t) {\n\t\t\t\t\twindow.scrollTo( 0, 0 );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t}\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(\n\t\t<Editor\n\t\t\tsettings={ settings }\n\t\t\tpostId={ postId }\n\t\t\tpostType={ postType }\n\t\t\tinitialEdits={ initialEdits }\n\t\t/>\n\t);\n\n\treturn root;\n}\n\n/**\n * Used to reinitialize the editor after an error. Now it's a deprecated noop function.\n */\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editPost.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginBlockSettingsMenuItem } from './components/block-settings-menu/plugin-block-settings-menu-item';\nexport { default as PluginDocumentSettingPanel } from './components/sidebar/plugin-document-setting-panel';\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\nexport { default as PluginPostPublishPanel } from './components/sidebar/plugin-post-publish-panel';\nexport { default as PluginPostStatusInfo } from './components/sidebar/plugin-post-status-info';\nexport { default as PluginPrePublishPanel } from './components/sidebar/plugin-pre-publish-panel';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as __experimentalFullscreenModeClose } from './components/header/fullscreen-mode-close';\nexport { default as __experimentalMainDashboardButton } from './components/header/main-dashboard-button';\nexport { default as __experimentalPluginPostExcerpt } from './components/sidebar/plugin-post-excerpt';\nexport { store } from './store';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAIA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AAIA,IAAAS,OAAA,GAAAT,OAAA;AAKAA,OAAA;AACAA,OAAA;AACA,IAAAU,QAAA,GAAAP,sBAAA,CAAAH,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AA8KA,IAAAY,4BAAA,GAAAT,sBAAA,CAAAH,OAAA;AACA,IAAAa,2BAAA,GAAAV,sBAAA,CAAAH,OAAA;AACA,IAAAc,mBAAA,GAAAX,sBAAA,CAAAH,OAAA;AACA,IAAAe,uBAAA,GAAAZ,sBAAA,CAAAH,OAAA;AACA,IAAAgB,qBAAA,GAAAb,sBAAA,CAAAH,OAAA;AACA,IAAAiB,sBAAA,GAAAd,sBAAA,CAAAH,OAAA;AACA,IAAAkB,cAAA,GAAAf,sBAAA,CAAAH,OAAA;AACA,IAAAmB,0BAAA,GAAAhB,sBAAA,CAAAH,OAAA;AACA,IAAAoB,oBAAA,GAAAjB,sBAAA,CAAAH,OAAA;AACA,IAAAqB,oBAAA,GAAAlB,sBAAA,CAAAH,OAAA;AACA,IAAAsB,kBAAA,GAAAnB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ress/data");
9
9
  var _preferences = require("@wordpress/preferences");
10
10
  var _i18n = require("@wordpress/i18n");
11
- var _store = require("../../store");
11
+ var _editor = require("@wordpress/editor");
12
12
  /**
13
13
  * WordPress dependencies
14
14
  */
15
15
 
16
- /**
17
- * Internal dependencies
18
- */
19
-
20
16
  function WelcomeGuideMenuItem() {
21
- const isTemplateMode = (0, _data.useSelect)(select => select(_store.store).isEditingTemplate(), []);
17
+ const isTemplateMode = (0, _data.useSelect)(select => select(_editor.store).getRenderingMode() === 'template-only', []);
22
18
  return (0, _react.createElement)(_preferences.PreferenceToggleMenuItem, {
23
19
  scope: "core/edit-post",
24
20
  name: isTemplateMode ? 'welcomeGuideTemplate' : 'welcomeGuide',
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_preferences","_i18n","_store","WelcomeGuideMenuItem","isTemplateMode","useSelect","select","editPostStore","isEditingTemplate","_react","createElement","PreferenceToggleMenuItem","scope","name","label","__"],"sources":["@wordpress/edit-post/src/plugins/welcome-guide-menu-item/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { PreferenceToggleMenuItem } from '@wordpress/preferences';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nexport default function WelcomeGuideMenuItem() {\n\tconst isTemplateMode = useSelect(\n\t\t( select ) => select( editPostStore ).isEditingTemplate(),\n\t\t[]\n\t);\n\n\treturn (\n\t\t<PreferenceToggleMenuItem\n\t\t\tscope=\"core/edit-post\"\n\t\t\tname={ isTemplateMode ? 'welcomeGuideTemplate' : 'welcomeGuide' }\n\t\t\tlabel={ __( 'Welcome Guide' ) }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AAVA;AACA;AACA;;AAKA;AACA;AACA;;AAGe,SAASI,oBAAoBA,CAAA,EAAG;EAC9C,MAAMC,cAAc,GAAG,IAAAC,eAAS,EAC7BC,MAAM,IAAMA,MAAM,CAAEC,YAAc,CAAC,CAACC,iBAAiB,CAAC,CAAC,EACzD,EACD,CAAC;EAED,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACV,YAAA,CAAAW,wBAAwB;IACxBC,KAAK,EAAC,gBAAgB;IACtBC,IAAI,EAAGT,cAAc,GAAG,sBAAsB,GAAG,cAAgB;IACjEU,KAAK,EAAG,IAAAC,QAAE,EAAE,eAAgB;EAAG,CAC/B,CAAC;AAEJ"}
1
+ {"version":3,"names":["_data","require","_preferences","_i18n","_editor","WelcomeGuideMenuItem","isTemplateMode","useSelect","select","editorStore","getRenderingMode","_react","createElement","PreferenceToggleMenuItem","scope","name","label","__"],"sources":["@wordpress/edit-post/src/plugins/welcome-guide-menu-item/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { PreferenceToggleMenuItem } from '@wordpress/preferences';\nimport { __ } from '@wordpress/i18n';\nimport { store as editorStore } from '@wordpress/editor';\n\nexport default function WelcomeGuideMenuItem() {\n\tconst isTemplateMode = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getRenderingMode() === 'template-only',\n\t\t[]\n\t);\n\n\treturn (\n\t\t<PreferenceToggleMenuItem\n\t\t\tscope=\"core/edit-post\"\n\t\t\tname={ isTemplateMode ? 'welcomeGuideTemplate' : 'welcomeGuide' }\n\t\t\tlabel={ __( 'Welcome Guide' ) }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AANA;AACA;AACA;;AAMe,SAASI,oBAAoBA,CAAA,EAAG;EAC9C,MAAMC,cAAc,GAAG,IAAAC,eAAS,EAC7BC,MAAM,IACPA,MAAM,CAAEC,aAAY,CAAC,CAACC,gBAAgB,CAAC,CAAC,KAAK,eAAe,EAC7D,EACD,CAAC;EAED,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACV,YAAA,CAAAW,wBAAwB;IACxBC,KAAK,EAAC,gBAAgB;IACtBC,IAAI,EAAGT,cAAc,GAAG,sBAAsB,GAAG,cAAgB;IACjEU,KAAK,EAAG,IAAAC,QAAE,EAAE,eAAgB;EAAG,CAC/B,CAAC;AAEJ"}
@@ -4,8 +4,9 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.__experimentalSetPreviewDeviceType = __experimentalSetPreviewDeviceType;
8
- exports.closeModal = exports.closeGeneralSidebar = exports.__unstableSwitchToTemplateMode = exports.__unstableCreateTemplate = void 0;
7
+ exports.__experimentalSetPreviewDeviceType = void 0;
8
+ exports.__unstableCreateTemplate = __unstableCreateTemplate;
9
+ exports.closeModal = exports.closeGeneralSidebar = exports.__unstableSwitchToTemplateMode = void 0;
9
10
  exports.closePublishSidebar = closePublishSidebar;
10
11
  exports.initializeMetaBoxes = exports.hideBlockTypes = void 0;
11
12
  exports.metaBoxUpdatesFailure = metaBoxUpdatesFailure;
@@ -26,7 +27,6 @@ var _interface = require("@wordpress/interface");
26
27
  var _preferences = require("@wordpress/preferences");
27
28
  var _a11y = require("@wordpress/a11y");
28
29
  var _notices = require("@wordpress/notices");
29
- var _coreData = require("@wordpress/core-data");
30
30
  var _blockEditor = require("@wordpress/block-editor");
31
31
  var _editor = require("@wordpress/editor");
32
32
  var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
@@ -397,18 +397,24 @@ function metaBoxUpdatesFailure() {
397
397
  }
398
398
 
399
399
  /**
400
- * Returns an action object used to toggle the width of the editing canvas.
400
+ * Action that changes the width of the editing canvas.
401
+ *
402
+ * @deprecated
401
403
  *
402
404
  * @param {string} deviceType
403
405
  *
404
406
  * @return {Object} Action object.
405
407
  */
406
- function __experimentalSetPreviewDeviceType(deviceType) {
407
- return {
408
- type: 'SET_PREVIEW_DEVICE_TYPE',
409
- deviceType
410
- };
411
- }
408
+ const __experimentalSetPreviewDeviceType = deviceType => ({
409
+ registry
410
+ }) => {
411
+ (0, _deprecated.default)("dispatch( 'core/edit-post' ).__experimentalSetPreviewDeviceType", {
412
+ since: '6.5',
413
+ version: '6.7',
414
+ hint: 'registry.dispatch( editorStore ).setDeviceType'
415
+ });
416
+ registry.dispatch(_editor.store).setDeviceType(deviceType);
417
+ };
412
418
 
413
419
  /**
414
420
  * Returns an action object used to open/close the inserter.
@@ -422,6 +428,7 @@ function __experimentalSetPreviewDeviceType(deviceType) {
422
428
  *
423
429
  * @return {Object} Action object.
424
430
  */
431
+ exports.__experimentalSetPreviewDeviceType = __experimentalSetPreviewDeviceType;
425
432
  function setIsInserterOpened(value) {
426
433
  return {
427
434
  type: 'SET_IS_INSERTER_OPENED',
@@ -452,53 +459,42 @@ const setIsListViewOpened = isOpen => ({
452
459
  /**
453
460
  * Returns an action object used to switch to template editing.
454
461
  *
455
- * @param {boolean} value Is editing template.
456
- * @return {Object} Action object.
462
+ * @deprecated
457
463
  */
458
464
  exports.setIsListViewOpened = setIsListViewOpened;
459
- function setIsEditingTemplate(value) {
465
+ function setIsEditingTemplate() {
466
+ (0, _deprecated.default)("dispatch( 'core/edit-post' ).setIsEditingTemplate", {
467
+ since: '6.5',
468
+ alternative: "dispatch( 'core/editor').setRenderingMode"
469
+ });
460
470
  return {
461
- type: 'SET_IS_EDITING_TEMPLATE',
462
- value
471
+ type: 'NOTHING'
463
472
  };
464
473
  }
465
474
 
466
475
  /**
467
476
  * Switches to the template mode.
468
- *
469
- * @param {boolean} newTemplate Is new template.
470
477
  */
471
- const __unstableSwitchToTemplateMode = (newTemplate = false) => ({
472
- registry,
473
- select,
474
- dispatch
478
+ const __unstableSwitchToTemplateMode = () => ({
479
+ registry
475
480
  }) => {
476
- dispatch(setIsEditingTemplate(true));
477
- const isWelcomeGuideActive = select.isFeatureActive('welcomeGuideTemplate');
478
- if (!isWelcomeGuideActive) {
479
- const message = newTemplate ? (0, _i18n.__)("Custom template created. You're in template mode now.") : (0, _i18n.__)('Editing template. Changes made here affect all posts and pages that use the template.');
480
- registry.dispatch(_notices.store).createSuccessNotice(message, {
481
- type: 'snackbar'
482
- });
483
- }
481
+ registry.dispatch(_editor.store).setRenderingMode('template-only');
484
482
  };
485
483
 
486
484
  /**
487
485
  * Create a block based template.
488
486
  *
489
- * @param {Object?} template Template to create and assign.
487
+ * @deprecated
490
488
  */
491
489
  exports.__unstableSwitchToTemplateMode = __unstableSwitchToTemplateMode;
492
- const __unstableCreateTemplate = template => async ({
493
- registry
494
- }) => {
495
- const savedTemplate = await registry.dispatch(_coreData.store).saveEntityRecord('postType', 'wp_template', template);
496
- const post = registry.select(_editor.store).getCurrentPost();
497
- registry.dispatch(_coreData.store).editEntityRecord('postType', post.type, post.id, {
498
- template: savedTemplate.slug
490
+ function __unstableCreateTemplate() {
491
+ (0, _deprecated.default)("dispatch( 'core/edit-post' ).__unstableCreateTemplate", {
492
+ since: '6.5'
499
493
  });
500
- };
501
- exports.__unstableCreateTemplate = __unstableCreateTemplate;
494
+ return {
495
+ type: 'NOTHING'
496
+ };
497
+ }
502
498
  let metaBoxesInitialized = false;
503
499
 
504
500
  /**