@wordpress/edit-post 7.19.3 → 7.20.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.
- package/CHANGELOG.md +2 -0
- package/README.md +22 -22
- package/build/components/block-manager/category.js +5 -4
- package/build/components/block-manager/category.js.map +1 -1
- package/build/components/block-manager/checklist.js +5 -5
- package/build/components/block-manager/checklist.js.map +1 -1
- package/build/components/block-manager/index.js +10 -9
- package/build/components/block-manager/index.js.map +1 -1
- package/build/components/block-settings-menu/plugin-block-settings-menu-item.js +5 -5
- package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
- package/build/components/device-preview/index.js +5 -5
- package/build/components/device-preview/index.js.map +1 -1
- package/build/components/header/document-actions/index.js +9 -9
- package/build/components/header/document-actions/index.js.map +1 -1
- package/build/components/header/fullscreen-mode-close/index.js +6 -6
- package/build/components/header/fullscreen-mode-close/index.js.map +1 -1
- package/build/components/header/header-toolbar/index.js +9 -8
- package/build/components/header/header-toolbar/index.js.map +1 -1
- package/build/components/header/header-toolbar/index.native.js +12 -11
- package/build/components/header/header-toolbar/index.native.js.map +1 -1
- package/build/components/header/index.js +14 -14
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/index.native.js +3 -2
- package/build/components/header/index.native.js.map +1 -1
- package/build/components/header/main-dashboard-button/index.js +2 -2
- package/build/components/header/main-dashboard-button/index.js.map +1 -1
- package/build/components/header/mode-switcher/index.js +3 -3
- package/build/components/header/mode-switcher/index.js.map +1 -1
- package/build/components/header/more-menu/index.js +6 -6
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/header/plugin-more-menu-item/index.js +3 -3
- package/build/components/header/plugin-more-menu-item/index.js.map +1 -1
- package/build/components/header/plugin-sidebar-more-menu-item/index.js +5 -5
- package/build/components/header/plugin-sidebar-more-menu-item/index.js.map +1 -1
- package/build/components/header/post-publish-button-or-toggle.js +2 -2
- package/build/components/header/post-publish-button-or-toggle.js.map +1 -1
- package/build/components/header/preferences-menu-item/index.js +2 -2
- package/build/components/header/preferences-menu-item/index.js.map +1 -1
- package/build/components/header/tools-more-menu-group/index.js +3 -3
- package/build/components/header/tools-more-menu-group/index.js.map +1 -1
- package/build/components/header/writing-menu/index.js +6 -6
- package/build/components/header/writing-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +2 -2
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +15 -15
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +8 -7
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build/components/layout/actions-panel.js +9 -8
- package/build/components/layout/actions-panel.js.map +1 -1
- package/build/components/layout/index.js +22 -21
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/index.native.js +10 -9
- package/build/components/layout/index.native.js.map +1 -1
- package/build/components/meta-boxes/index.js +5 -4
- package/build/components/meta-boxes/index.js.map +1 -1
- package/build/components/meta-boxes/meta-boxes-area/index.js +6 -5
- package/build/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +27 -26
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preferences-modal/meta-boxes-section.js +4 -4
- package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build/components/preferences-modal/options/enable-custom-fields.js +5 -4
- package/build/components/preferences-modal/options/enable-custom-fields.js.map +1 -1
- package/build/components/preferences-modal/options/enable-plugin-document-setting-panel.js +2 -2
- package/build/components/preferences-modal/options/enable-plugin-document-setting-panel.js.map +1 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +7 -6
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-outline.js +18 -18
- package/build/components/secondary-sidebar/list-view-outline.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +9 -8
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/discussion-panel/index.js +6 -6
- package/build/components/sidebar/discussion-panel/index.js.map +1 -1
- package/build/components/sidebar/featured-image/index.js +3 -3
- package/build/components/sidebar/featured-image/index.js.map +1 -1
- package/build/components/sidebar/last-revision/index.js +3 -3
- package/build/components/sidebar/last-revision/index.js.map +1 -1
- package/build/components/sidebar/page-attributes/index.js +3 -3
- package/build/components/sidebar/page-attributes/index.js.map +1 -1
- package/build/components/sidebar/plugin-document-setting-panel/index.js +6 -6
- package/build/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
- package/build/components/sidebar/plugin-post-publish-panel/index.js +5 -5
- package/build/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
- package/build/components/sidebar/plugin-post-status-info/index.js +7 -7
- package/build/components/sidebar/plugin-post-status-info/index.js.map +1 -1
- package/build/components/sidebar/plugin-pre-publish-panel/index.js +5 -5
- package/build/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
- package/build/components/sidebar/plugin-sidebar/index.js +4 -4
- package/build/components/sidebar/plugin-sidebar/index.js.map +1 -1
- package/build/components/sidebar/post-author/index.js +3 -3
- package/build/components/sidebar/post-author/index.js.map +1 -1
- package/build/components/sidebar/post-excerpt/index.js +3 -3
- package/build/components/sidebar/post-excerpt/index.js.map +1 -1
- package/build/components/sidebar/post-format/index.js +3 -3
- package/build/components/sidebar/post-format/index.js.map +1 -1
- package/build/components/sidebar/post-pending-status/index.js +2 -2
- package/build/components/sidebar/post-pending-status/index.js.map +1 -1
- package/build/components/sidebar/post-schedule/index.js +7 -6
- package/build/components/sidebar/post-schedule/index.js.map +1 -1
- package/build/components/sidebar/post-slug/index.js +3 -3
- package/build/components/sidebar/post-slug/index.js.map +1 -1
- package/build/components/sidebar/post-status/index.js +28 -30
- package/build/components/sidebar/post-status/index.js.map +1 -1
- package/build/components/sidebar/post-sticky/index.js +2 -2
- package/build/components/sidebar/post-sticky/index.js.map +1 -1
- package/build/components/sidebar/post-taxonomies/index.js +3 -3
- package/build/components/sidebar/post-taxonomies/index.js.map +1 -1
- package/build/components/sidebar/post-taxonomies/taxonomy-panel.js +2 -2
- package/build/components/sidebar/post-taxonomies/taxonomy-panel.js.map +1 -1
- package/build/components/sidebar/post-template/create-modal.js +9 -8
- package/build/components/sidebar/post-template/create-modal.js.map +1 -1
- package/build/components/sidebar/post-template/form.js +7 -6
- package/build/components/sidebar/post-template/form.js.map +1 -1
- package/build/components/sidebar/post-template/index.js +6 -5
- package/build/components/sidebar/post-template/index.js.map +1 -1
- package/build/components/sidebar/post-trash/index.js +2 -2
- package/build/components/sidebar/post-trash/index.js.map +1 -1
- package/build/components/sidebar/post-url/index.js +6 -5
- package/build/components/sidebar/post-url/index.js.map +1 -1
- package/build/components/sidebar/post-visibility/index.js +8 -7
- package/build/components/sidebar/post-visibility/index.js.map +1 -1
- package/build/components/sidebar/settings-header/index.js +4 -4
- package/build/components/sidebar/settings-header/index.js.map +1 -1
- package/build/components/sidebar/settings-sidebar/index.js +6 -5
- package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build/components/sidebar/template-summary/index.js +5 -5
- package/build/components/sidebar/template-summary/index.js.map +1 -1
- package/build/components/start-page-options/index.js +7 -6
- package/build/components/start-page-options/index.js.map +1 -1
- package/build/components/text-editor/index.js +6 -6
- package/build/components/text-editor/index.js.map +1 -1
- package/build/components/view-link/index.js +2 -2
- package/build/components/view-link/index.js.map +1 -1
- package/build/components/visual-editor/block-inspector-button.js +2 -2
- package/build/components/visual-editor/block-inspector-button.js.map +1 -1
- package/build/components/visual-editor/header.native.js +4 -3
- package/build/components/visual-editor/header.native.js.map +1 -1
- package/build/components/visual-editor/index.js +14 -13
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/components/visual-editor/index.native.js +3 -2
- package/build/components/visual-editor/index.native.js.map +1 -1
- package/build/components/welcome-guide/default.js +17 -16
- package/build/components/welcome-guide/default.js.map +1 -1
- package/build/components/welcome-guide/image.js +4 -4
- package/build/components/welcome-guide/image.js.map +1 -1
- package/build/components/welcome-guide/index.js +2 -2
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/welcome-guide/template.js +5 -5
- package/build/components/welcome-guide/template.js.map +1 -1
- package/build/editor.js +5 -4
- package/build/editor.js.map +1 -1
- package/build/editor.native.js +5 -4
- package/build/editor.native.js.map +1 -1
- package/build/hooks/validate-multiple-use/index.js +11 -11
- package/build/hooks/validate-multiple-use/index.js.map +1 -1
- package/build/index.js +3 -2
- package/build/index.js.map +1 -1
- package/build/index.native.js +2 -2
- package/build/index.native.js.map +1 -1
- package/build/plugins/copy-content-menu-item/index.js +2 -2
- package/build/plugins/copy-content-menu-item/index.js.map +1 -1
- package/build/plugins/index.js +6 -6
- package/build/plugins/index.js.map +1 -1
- package/build/plugins/keyboard-shortcuts-help-menu-item/index.js +2 -2
- package/build/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
- package/build/plugins/welcome-guide-menu-item/index.js +2 -2
- package/build/plugins/welcome-guide-menu-item/index.js.map +1 -1
- package/build-module/components/block-manager/category.js +1 -1
- package/build-module/components/block-manager/checklist.js +1 -1
- package/build-module/components/block-manager/index.js +1 -1
- package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js +3 -3
- package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
- package/build-module/components/device-preview/index.js +1 -1
- package/build-module/components/header/document-actions/index.js +1 -1
- package/build-module/components/header/fullscreen-mode-close/index.js +1 -1
- package/build-module/components/header/header-toolbar/index.js +1 -1
- package/build-module/components/header/header-toolbar/index.native.js +1 -1
- package/build-module/components/header/index.js +1 -1
- package/build-module/components/header/index.native.js +1 -1
- package/build-module/components/header/main-dashboard-button/index.js +1 -1
- package/build-module/components/header/mode-switcher/index.js +1 -1
- package/build-module/components/header/more-menu/index.js +1 -1
- package/build-module/components/header/plugin-more-menu-item/index.js +3 -3
- package/build-module/components/header/plugin-more-menu-item/index.js.map +1 -1
- package/build-module/components/header/plugin-sidebar-more-menu-item/index.js +4 -4
- package/build-module/components/header/plugin-sidebar-more-menu-item/index.js.map +1 -1
- package/build-module/components/header/post-publish-button-or-toggle.js +1 -1
- package/build-module/components/header/preferences-menu-item/index.js +1 -1
- package/build-module/components/header/tools-more-menu-group/index.js +1 -1
- package/build-module/components/header/writing-menu/index.js +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +1 -1
- package/build-module/components/layout/actions-panel.js +1 -1
- package/build-module/components/layout/index.js +1 -1
- package/build-module/components/layout/index.native.js +1 -1
- package/build-module/components/meta-boxes/index.js +1 -1
- package/build-module/components/meta-boxes/meta-boxes-area/index.js +2 -2
- package/build-module/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +1 -1
- package/build-module/components/preferences-modal/meta-boxes-section.js +1 -1
- package/build-module/components/preferences-modal/options/enable-custom-fields.js +1 -1
- package/build-module/components/preferences-modal/options/enable-plugin-document-setting-panel.js +1 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +1 -1
- package/build-module/components/secondary-sidebar/list-view-outline.js +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +1 -1
- package/build-module/components/sidebar/discussion-panel/index.js +1 -1
- package/build-module/components/sidebar/featured-image/index.js +1 -1
- package/build-module/components/sidebar/last-revision/index.js +1 -1
- package/build-module/components/sidebar/page-attributes/index.js +1 -1
- package/build-module/components/sidebar/plugin-document-setting-panel/index.js +4 -4
- package/build-module/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
- package/build-module/components/sidebar/plugin-post-publish-panel/index.js +4 -4
- package/build-module/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
- package/build-module/components/sidebar/plugin-post-status-info/index.js +6 -6
- package/build-module/components/sidebar/plugin-post-status-info/index.js.map +1 -1
- package/build-module/components/sidebar/plugin-pre-publish-panel/index.js +4 -4
- package/build-module/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
- package/build-module/components/sidebar/plugin-sidebar/index.js +3 -3
- package/build-module/components/sidebar/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/post-author/index.js +1 -1
- package/build-module/components/sidebar/post-excerpt/index.js +1 -1
- package/build-module/components/sidebar/post-format/index.js +1 -1
- package/build-module/components/sidebar/post-pending-status/index.js +1 -1
- package/build-module/components/sidebar/post-schedule/index.js +1 -1
- package/build-module/components/sidebar/post-slug/index.js +1 -1
- package/build-module/components/sidebar/post-status/index.js +25 -26
- package/build-module/components/sidebar/post-status/index.js.map +1 -1
- package/build-module/components/sidebar/post-sticky/index.js +1 -1
- package/build-module/components/sidebar/post-taxonomies/index.js +1 -1
- package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js +1 -1
- package/build-module/components/sidebar/post-template/create-modal.js +1 -1
- package/build-module/components/sidebar/post-template/form.js +1 -1
- package/build-module/components/sidebar/post-template/index.js +1 -1
- package/build-module/components/sidebar/post-trash/index.js +1 -1
- package/build-module/components/sidebar/post-url/index.js +1 -1
- package/build-module/components/sidebar/post-visibility/index.js +1 -1
- package/build-module/components/sidebar/settings-header/index.js +1 -1
- package/build-module/components/sidebar/settings-sidebar/index.js +1 -1
- package/build-module/components/sidebar/template-summary/index.js +1 -1
- package/build-module/components/start-page-options/index.js +1 -1
- package/build-module/components/text-editor/index.js +1 -1
- package/build-module/components/view-link/index.js +1 -1
- package/build-module/components/visual-editor/block-inspector-button.js +1 -1
- package/build-module/components/visual-editor/header.native.js +1 -1
- package/build-module/components/visual-editor/index.js +1 -1
- package/build-module/components/visual-editor/index.native.js +1 -1
- package/build-module/components/welcome-guide/default.js +1 -1
- package/build-module/components/welcome-guide/image.js +1 -1
- package/build-module/components/welcome-guide/index.js +1 -1
- package/build-module/components/welcome-guide/template.js +1 -1
- package/build-module/editor.js +1 -1
- package/build-module/editor.native.js +1 -1
- package/build-module/hooks/validate-multiple-use/index.js +3 -3
- package/build-module/hooks/validate-multiple-use/index.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.native.js +1 -1
- package/build-module/plugins/copy-content-menu-item/index.js +1 -1
- package/build-module/plugins/index.js +1 -1
- package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js +1 -1
- package/build-module/plugins/welcome-guide-menu-item/index.js +1 -1
- package/build-style/classic-rtl.css +1 -1
- package/build-style/classic.css +1 -1
- package/build-style/style-rtl.css +13 -17
- package/build-style/style.css +13 -17
- package/package.json +32 -32
- package/src/components/block-settings-menu/plugin-block-settings-menu-item.js +2 -2
- package/src/components/header/plugin-more-menu-item/index.js +3 -3
- package/src/components/header/plugin-sidebar-more-menu-item/index.js +3 -3
- package/src/components/meta-boxes/meta-boxes-area/index.js +1 -1
- package/src/components/sidebar/plugin-document-setting-panel/index.js +3 -3
- package/src/components/sidebar/plugin-post-publish-panel/index.js +3 -3
- package/src/components/sidebar/plugin-post-status-info/index.js +5 -5
- package/src/components/sidebar/plugin-pre-publish-panel/index.js +3 -3
- package/src/components/sidebar/plugin-sidebar/index.js +2 -2
- package/src/components/sidebar/post-status/index.js +19 -25
- package/src/hooks/validate-multiple-use/index.js +2 -2
- package/src/style.scss +0 -1
- package/src/components/sidebar/post-status/style.scss +0 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_memize","_interopRequireDefault","_reactNative","_reactNativeGestureHandler","_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","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":";;;;;;;AAUA,IAAAA,QAAA,GAAAC,OAAA;AAPA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH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Handler","_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,iBAAiB,GAAG,IAAAC,eAAM,EAAE,IAAI,CAACD,iBAAiB,EAAE;MACxDE,OAAO,EAAE;IACV,CAAE,CAAC;IAEH,IAAI,CAACC,WAA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B,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,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _react = require("react");
|
|
4
4
|
var _blocks = require("@wordpress/blocks");
|
|
5
5
|
var _components = require("@wordpress/components");
|
|
6
6
|
var _data = require("@wordpress/data");
|
|
@@ -20,9 +20,9 @@ const enhance = (0, _compose.compose)(
|
|
|
20
20
|
* "original" block is not the current one. Thus, an inexisting
|
|
21
21
|
* `originalBlockClientId` prop signals that the block is valid.
|
|
22
22
|
*
|
|
23
|
-
* @param {
|
|
23
|
+
* @param {Component} WrappedBlockEdit A filtered BlockEdit instance.
|
|
24
24
|
*
|
|
25
|
-
* @return {
|
|
25
|
+
* @return {Component} Enhanced component with merged state data props.
|
|
26
26
|
*/
|
|
27
27
|
(0, _data.withSelect)((select, block) => {
|
|
28
28
|
const multiple = (0, _blocks.hasBlockSupport)(block.name, 'multiple', true);
|
|
@@ -55,36 +55,36 @@ const withMultipleValidation = (0, _compose.createHigherOrderComponent)(BlockEdi
|
|
|
55
55
|
...props
|
|
56
56
|
}) => {
|
|
57
57
|
if (!originalBlockClientId) {
|
|
58
|
-
return (0,
|
|
58
|
+
return (0, _react.createElement)(BlockEdit, {
|
|
59
59
|
...props
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
const blockType = (0, _blocks.getBlockType)(props.name);
|
|
63
63
|
const outboundType = getOutboundType(props.name);
|
|
64
|
-
return [(0,
|
|
64
|
+
return [(0, _react.createElement)("div", {
|
|
65
65
|
key: "invalid-preview",
|
|
66
66
|
style: {
|
|
67
67
|
minHeight: '60px'
|
|
68
68
|
}
|
|
69
|
-
}, (0,
|
|
69
|
+
}, (0, _react.createElement)(BlockEdit, {
|
|
70
70
|
key: "block-edit",
|
|
71
71
|
...props
|
|
72
|
-
})), (0,
|
|
72
|
+
})), (0, _react.createElement)(_blockEditor.Warning, {
|
|
73
73
|
key: "multiple-use-warning",
|
|
74
|
-
actions: [(0,
|
|
74
|
+
actions: [(0, _react.createElement)(_components.Button, {
|
|
75
75
|
key: "find-original",
|
|
76
76
|
variant: "secondary",
|
|
77
77
|
onClick: selectFirst
|
|
78
|
-
}, (0, _i18n.__)('Find original')), (0,
|
|
78
|
+
}, (0, _i18n.__)('Find original')), (0, _react.createElement)(_components.Button, {
|
|
79
79
|
key: "remove",
|
|
80
80
|
variant: "secondary",
|
|
81
81
|
onClick: () => props.onReplace([])
|
|
82
|
-
}, (0, _i18n.__)('Remove')), outboundType && (0,
|
|
82
|
+
}, (0, _i18n.__)('Remove')), outboundType && (0, _react.createElement)(_components.Button, {
|
|
83
83
|
key: "transform",
|
|
84
84
|
variant: "secondary",
|
|
85
85
|
onClick: () => props.onReplace((0, _blocks.createBlock)(outboundType.name, props.attributes))
|
|
86
86
|
}, (0, _i18n.__)('Transform into:'), " ", outboundType.title)]
|
|
87
|
-
}, (0,
|
|
87
|
+
}, (0, _react.createElement)("strong", null, blockType?.title, ": "), (0, _i18n.__)('This block can only be used once.'))];
|
|
88
88
|
});
|
|
89
89
|
}, 'withMultipleValidation');
|
|
90
90
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blocks","require","_components","_data","_blockEditor","_hooks","_i18n","_compose","enhance","compose","withSelect","select","block","multiple","hasBlockSupport","name","blocks","blockEditorStore","getBlocks","firstOfSameType","find","isInvalid","clientId","originalBlockClientId","withDispatch","dispatch","selectFirst","selectBlock","withMultipleValidation","createHigherOrderComponent","BlockEdit","props","
|
|
1
|
+
{"version":3,"names":["_blocks","require","_components","_data","_blockEditor","_hooks","_i18n","_compose","enhance","compose","withSelect","select","block","multiple","hasBlockSupport","name","blocks","blockEditorStore","getBlocks","firstOfSameType","find","isInvalid","clientId","originalBlockClientId","withDispatch","dispatch","selectFirst","selectBlock","withMultipleValidation","createHigherOrderComponent","BlockEdit","props","_react","createElement","blockType","getBlockType","outboundType","getOutboundType","key","style","minHeight","Warning","actions","Button","variant","onClick","__","onReplace","createBlock","attributes","title","blockName","transform","findTransform","getBlockTransforms","type","length","addFilter"],"sources":["@wordpress/edit-post/src/hooks/validate-multiple-use/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateBlock,\n\tfindTransform,\n\tgetBlockTransforms,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { Button } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { Warning, store as blockEditorStore } from '@wordpress/block-editor';\nimport { addFilter } from '@wordpress/hooks';\nimport { __ } from '@wordpress/i18n';\nimport { compose, createHigherOrderComponent } from '@wordpress/compose';\n\nconst enhance = compose(\n\t/**\n\t * For blocks whose block type doesn't support `multiple`, provides the\n\t * wrapped component with `originalBlockClientId` -- a reference to the\n\t * first block of the same type in the content -- if and only if that\n\t * \"original\" block is not the current one. Thus, an inexisting\n\t * `originalBlockClientId` prop signals that the block is valid.\n\t *\n\t * @param {Component} WrappedBlockEdit A filtered BlockEdit instance.\n\t *\n\t * @return {Component} Enhanced component with merged state data props.\n\t */\n\twithSelect( ( select, block ) => {\n\t\tconst multiple = hasBlockSupport( block.name, 'multiple', true );\n\n\t\t// For block types with `multiple` support, there is no \"original\n\t\t// block\" to be found in the content, as the block itself is valid.\n\t\tif ( multiple ) {\n\t\t\treturn {};\n\t\t}\n\n\t\t// Otherwise, only pass `originalBlockClientId` if it refers to a different\n\t\t// block from the current one.\n\t\tconst blocks = select( blockEditorStore ).getBlocks();\n\t\tconst firstOfSameType = blocks.find(\n\t\t\t( { name } ) => block.name === name\n\t\t);\n\t\tconst isInvalid =\n\t\t\tfirstOfSameType && firstOfSameType.clientId !== block.clientId;\n\t\treturn {\n\t\t\toriginalBlockClientId: isInvalid && firstOfSameType.clientId,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, { originalBlockClientId } ) => ( {\n\t\tselectFirst: () =>\n\t\t\tdispatch( blockEditorStore ).selectBlock( originalBlockClientId ),\n\t} ) )\n);\n\nconst withMultipleValidation = createHigherOrderComponent( ( BlockEdit ) => {\n\treturn enhance( ( { originalBlockClientId, selectFirst, ...props } ) => {\n\t\tif ( ! originalBlockClientId ) {\n\t\t\treturn <BlockEdit { ...props } />;\n\t\t}\n\n\t\tconst blockType = getBlockType( props.name );\n\t\tconst outboundType = getOutboundType( props.name );\n\n\t\treturn [\n\t\t\t<div key=\"invalid-preview\" style={ { minHeight: '60px' } }>\n\t\t\t\t<BlockEdit key=\"block-edit\" { ...props } />\n\t\t\t</div>,\n\t\t\t<Warning\n\t\t\t\tkey=\"multiple-use-warning\"\n\t\t\t\tactions={ [\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey=\"find-original\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tonClick={ selectFirst }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Find original' ) }\n\t\t\t\t\t</Button>,\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey=\"remove\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tonClick={ () => props.onReplace( [] ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Remove' ) }\n\t\t\t\t\t</Button>,\n\t\t\t\t\toutboundType && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tkey=\"transform\"\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\tprops.onReplace(\n\t\t\t\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t\t\t\toutboundType.name,\n\t\t\t\t\t\t\t\t\t\tprops.attributes\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Transform into:' ) } { outboundType.title }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t),\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t<strong>{ blockType?.title }: </strong>\n\t\t\t\t{ __( 'This block can only be used once.' ) }\n\t\t\t</Warning>,\n\t\t];\n\t} );\n}, 'withMultipleValidation' );\n\n/**\n * Given a base block name, returns the default block type to which to offer\n * transforms.\n *\n * @param {string} blockName Base block name.\n *\n * @return {?Object} The chosen default block type.\n */\nfunction getOutboundType( blockName ) {\n\t// Grab the first outbound transform.\n\tconst transform = findTransform(\n\t\tgetBlockTransforms( 'to', blockName ),\n\t\t( { type, blocks } ) => type === 'block' && blocks.length === 1 // What about when .length > 1?\n\t);\n\n\tif ( ! transform ) {\n\t\treturn null;\n\t}\n\n\treturn getBlockType( transform.blocks[ 0 ] );\n}\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-post/validate-multiple-use/with-multiple-validation',\n\twithMultipleValidation\n);\n"],"mappings":";;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAOA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAfA;AACA;AACA;;AAeA,MAAMO,OAAO,GAAG,IAAAC,gBAAO;AACtB;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACC,IAAAC,gBAAU,EAAE,CAAEC,MAAM,EAAEC,KAAK,KAAM;EAChC,MAAMC,QAAQ,GAAG,IAAAC,uBAAe,EAAEF,KAAK,CAACG,IAAI,EAAE,UAAU,EAAE,IAAK,CAAC;;EAEhE;EACA;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I,EAAEH,SAAU,CAAC,EACrC,CAAE;IAAEI,IAAI;IAAEvC;EAAO,CAAC,KAAMuC,IAAI,KAAK,OAAO,IAAIvC,MAAM,CAACwC,MAAM,KAAK,CAAC,CAAC;EACjE,CAAC;;EAED,IAAK,CAAEJ,SAAS,EAAG;IAClB,OAAO,IAAI;EACZ;EAEA,OAAO,IAAAjB,oBAAY,EAAEiB,SAAS,CAACpC,MAAM,CAAE,CAAC,CAAG,CAAC;AAC7C;AAEA,IAAAyC,gBAAS,EACR,kBAAkB,EAClB,+DAA+D,EAC/D7B,sBACD,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -72,10 +72,11 @@ Object.defineProperty(exports, "store", {
|
|
|
72
72
|
return _store.store;
|
|
73
73
|
}
|
|
74
74
|
});
|
|
75
|
-
var
|
|
75
|
+
var _react = require("react");
|
|
76
76
|
var _blocks = require("@wordpress/blocks");
|
|
77
77
|
var _blockLibrary = require("@wordpress/block-library");
|
|
78
78
|
var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
|
|
79
|
+
var _element = require("@wordpress/element");
|
|
79
80
|
var _data = require("@wordpress/data");
|
|
80
81
|
var _hooks = require("@wordpress/hooks");
|
|
81
82
|
var _preferences = require("@wordpress/preferences");
|
|
@@ -215,7 +216,7 @@ function initializeEditor(id, postType, postId, settings, initialEdits) {
|
|
|
215
216
|
// Prevent the default browser action for files dropped outside of dropzones.
|
|
216
217
|
window.addEventListener('dragover', e => e.preventDefault(), false);
|
|
217
218
|
window.addEventListener('drop', e => e.preventDefault(), false);
|
|
218
|
-
root.render((0,
|
|
219
|
+
root.render((0, _react.createElement)(_editor.default, {
|
|
219
220
|
settings: settings,
|
|
220
221
|
postId: postId,
|
|
221
222
|
postType: postType,
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_blocks","_blockLibrary","_deprecated","_interopRequireDefault","_data","_hooks","_preferences","_widgets","_editor","_store","_pluginBlockSettingsMenuItem","_pluginDocumentSettingPanel","_pluginMoreMenuItem","_pluginPostPublishPanel","_pluginPostStatusInfo","_pluginPrePublishPanel","_pluginSidebar","_pluginSidebarMoreMenuItem","_fullscreenModeClose","_mainDashboardButton","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","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 { store } from './store';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,IAAAA,QAAA,GAAAC,OAAA;AANA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AAIA,IAAAG,WAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAEA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AAQAA,OAAA;AACAA,OAAA;AACA,IAAAS,OAAA,GAAAL,sBAAA,CAAAJ,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AA8KA,IAAAW,4BAAA,GAAAP,sBAAA,CAAAJ,OAAA;AACA,IAAAY,2BAAA,GAAAR,sBAAA,CAAAJ,OAAA;AACA,IAAAa,mBAAA,GAAAT,sBAAA,CAAAJ,OAAA;AACA,IAAAc,uBAAA,GAAAV,sBAAA,CAAAJ,OAAA;AACA,IAAAe,qBAAA,GAAAX,sBAAA,CAAAJ,OAAA;AACA,IAAAgB,sBAAA,GAAAZ,sBAAA,CAAAJ,OAAA;AACA,IAAAiB,cAAA,GAAAb,sBAAA,CAAAJ,OAAA;AACA,IAAAkB,0BAAA,GAAAd,sBAAA,CAAAJ,OAAA;AACA,IAAAm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J"}
|
|
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","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 { 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;AAQAA,OAAA;AACAA,OAAA;AACA,IAAAS,OAAA,GAAAN,sBAAA,CAAAH,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AA8KA,IAAAW,4BAAA,GAAAR,sBAAA,CAAAH,OAAA;AACA,IAAAY,2BAAA,GAAAT,sBAAA,CAAAH,OAAA;AACA,IAAAa,mBAAA,GAAAV,sBAAA,CAAAH,OAAA;AACA,IAAAc,uBAAA,GAAAX,sBAAA,CAAAH,OAAA;AACA,IAAAe,qBAAA,GAAAZ,sBAAA,CAAAH,OAAA;AACA,IAAAgB,sBAAA,GAAAb,sBAAA,CAAAH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AAG;EACpC,IAAAC,mBAAU,EAAE,gCAAgC,EAAE;IAC7CC,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;AACJ"}
|
package/build/index.native.js
CHANGED
|
@@ -11,7 +11,7 @@ Object.defineProperty(exports, "store", {
|
|
|
11
11
|
return _store.store;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
var
|
|
14
|
+
var _react = require("react");
|
|
15
15
|
require("@wordpress/core-data");
|
|
16
16
|
require("@wordpress/format-library");
|
|
17
17
|
var _data = require("@wordpress/data");
|
|
@@ -46,7 +46,7 @@ function initializeEditor(id, postType, postId) {
|
|
|
46
46
|
preferredStyleVariations: {},
|
|
47
47
|
welcomeGuide: true
|
|
48
48
|
});
|
|
49
|
-
return (0,
|
|
49
|
+
return (0, _react.createElement)(_editor.default, {
|
|
50
50
|
postId: postId,
|
|
51
51
|
postType: postType
|
|
52
52
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["require","_data","_preferences","_store","_editor","_interopRequireDefault","initializeEditor","id","postType","postId","dispatch","preferencesStore","setDefaults","editorMode","fixedToolbar","fullscreenMode","hiddenBlockTypes","inactivePanels","isPublishSidebarEnabled","openPanels","preferredStyleVariations","welcomeGuide","
|
|
1
|
+
{"version":3,"names":["require","_data","_preferences","_store","_editor","_interopRequireDefault","initializeEditor","id","postType","postId","dispatch","preferencesStore","setDefaults","editorMode","fixedToolbar","fullscreenMode","hiddenBlockTypes","inactivePanels","isPublishSidebarEnabled","openPanels","preferredStyleVariations","welcomeGuide","_react","createElement","default"],"sources":["@wordpress/edit-post/src/index.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport '@wordpress/core-data';\nimport '@wordpress/format-library';\nimport { dispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nexport { store } from './store';\nimport Editor from './editor';\n\n/**\n * Initializes the Editor and returns a componentProvider\n * that can be registered with `AppRegistry.registerComponent`\n *\n * @param {string} id Unique identifier for editor instance.\n * @param {Object} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit (unused right now)\n */\nexport function initializeEditor( id, postType, postId ) {\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\twelcomeGuide: true,\n\t} );\n\n\treturn <Editor postId={ postId } postType={ postType } />;\n}\n"],"mappings":";;;;;;;;;;;;;;AAGAA,OAAA;AACAA,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAC,sBAAA,CAAAL,OAAA;AAZA;AACA;AACA;;AAMA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASM,gBAAgBA,CAAEC,EAAE,EAAEC,QAAQ,EAAEC,MAAM,EAAG;EACxD,IAAAC,cAAQ,EAAEC,kBAAiB,CAAC,CAACC,WAAW,CAAE,gBAAgB,EAAE;IAC3DC,UAAU,EAAE,QAAQ;IACpBC,YAAY,EAAE,KAAK;IACnBC,cAAc,EAAE,IAAI;IACpBC,gBAAgB,EAAE,EAAE;IACpBC,cAAc,EAAE,EAAE;IAClBC,uBAAuB,EAAE,IAAI;IAC7BC,UAAU,EAAE,CAAE,aAAa,CAAE;IAC7BC,wBAAwB,EAAE,CAAC,CAAC;IAC5BC,YAAY,EAAE;EACf,CAAE,CAAC;EAEH,OAAO,IAAAC,MAAA,CAAAC,aAAA,EAACnB,OAAA,CAAAoB,OAAM;IAACf,MAAM,EAAGA,MAAQ;IAACD,QAAQ,EAAGA;EAAU,CAAE,CAAC;AAC1D"}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = CopyContentMenuItem;
|
|
7
|
-
var
|
|
7
|
+
var _react = require("react");
|
|
8
8
|
var _components = require("@wordpress/components");
|
|
9
9
|
var _data = require("@wordpress/data");
|
|
10
10
|
var _i18n = require("@wordpress/i18n");
|
|
@@ -32,7 +32,7 @@ function CopyContentMenuItem() {
|
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
const ref = (0, _compose.useCopyToClipboard)(getText, onSuccess);
|
|
35
|
-
return (0,
|
|
35
|
+
return (0, _react.createElement)(_components.MenuItem, {
|
|
36
36
|
ref: ref
|
|
37
37
|
}, (0, _i18n.__)('Copy all blocks'));
|
|
38
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_data","_i18n","_compose","_notices","_editor","CopyContentMenuItem","createNotice","useDispatch","noticesStore","getEditedPostAttribute","useSelect","editorStore","getText","onSuccess","__","isDismissible","type","ref","useCopyToClipboard","
|
|
1
|
+
{"version":3,"names":["_components","require","_data","_i18n","_compose","_notices","_editor","CopyContentMenuItem","createNotice","useDispatch","noticesStore","getEditedPostAttribute","useSelect","editorStore","getText","onSuccess","__","isDismissible","type","ref","useCopyToClipboard","_react","createElement","MenuItem"],"sources":["@wordpress/edit-post/src/plugins/copy-content-menu-item/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as editorStore } from '@wordpress/editor';\n\nexport default function CopyContentMenuItem() {\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst { getEditedPostAttribute } = useSelect( editorStore );\n\n\tfunction getText() {\n\t\treturn getEditedPostAttribute( 'content' );\n\t}\n\n\tfunction onSuccess() {\n\t\tcreateNotice( 'info', __( 'All content copied.' ), {\n\t\t\tisDismissible: true,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t}\n\n\tconst ref = useCopyToClipboard( getText, onSuccess );\n\n\treturn <MenuItem ref={ ref }>{ __( 'Copy all blocks' ) }</MenuItem>;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AARA;AACA;AACA;;AAQe,SAASM,mBAAmBA,CAAA,EAAG;EAC7C,MAAM;IAAEC;EAAa,CAAC,GAAG,IAAAC,iBAAW,EAAEC,cAAa,CAAC;EACpD,MAAM;IAAEC;EAAuB,CAAC,GAAG,IAAAC,eAAS,EAAEC,aAAY,CAAC;EAE3D,SAASC,OAAOA,CAAA,EAAG;IAClB,OAAOH,sBAAsB,CAAE,SAAU,CAAC;EAC3C;EAEA,SAASI,SAASA,CAAA,EAAG;IACpBP,YAAY,CAAE,MAAM,EAAE,IAAAQ,QAAE,EAAE,qBAAsB,CAAC,EAAE;MAClDC,aAAa,EAAE,IAAI;MACnBC,IAAI,EAAE;IACP,CAAE,CAAC;EACJ;EAEA,MAAMC,GAAG,GAAG,IAAAC,2BAAkB,EAAEN,OAAO,EAAEC,SAAU,CAAC;EAEpD,OAAO,IAAAM,MAAA,CAAAC,aAAA,EAACtB,WAAA,CAAAuB,QAAQ;IAACJ,GAAG,EAAGA;EAAK,GAAG,IAAAH,QAAE,EAAE,iBAAkB,CAAa,CAAC;AACpE"}
|
package/build/plugins/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var
|
|
4
|
+
var _react = require("react");
|
|
5
5
|
var _components = require("@wordpress/components");
|
|
6
6
|
var _coreData = require("@wordpress/core-data");
|
|
7
7
|
var _editor = require("@wordpress/editor");
|
|
@@ -43,24 +43,24 @@ function ManagePatternsMenuItem() {
|
|
|
43
43
|
// display the manage patterns link if the user can't access it.
|
|
44
44
|
return canUser('read', 'templates') && isBlockTheme ? patternsUrl : defaultUrl;
|
|
45
45
|
}, []);
|
|
46
|
-
return (0,
|
|
46
|
+
return (0, _react.createElement)(_components.MenuItem, {
|
|
47
47
|
role: "menuitem",
|
|
48
48
|
href: url
|
|
49
49
|
}, (0, _i18n.__)('Manage patterns'));
|
|
50
50
|
}
|
|
51
51
|
(0, _plugins.registerPlugin)('edit-post', {
|
|
52
52
|
render() {
|
|
53
|
-
return (0,
|
|
53
|
+
return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_toolsMoreMenuGroup.default, null, ({
|
|
54
54
|
onClose
|
|
55
|
-
}) => (0,
|
|
55
|
+
}) => (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(ManagePatternsMenuItem, null), (0, _react.createElement)(_keyboardShortcutsHelpMenuItem.default, {
|
|
56
56
|
onSelect: onClose
|
|
57
|
-
}), (0,
|
|
57
|
+
}), (0, _react.createElement)(_welcomeGuideMenuItem.default, null), (0, _react.createElement)(_copyContentMenuItem.default, null), (0, _react.createElement)(_components.MenuItem, {
|
|
58
58
|
role: "menuitem",
|
|
59
59
|
icon: _icons.external,
|
|
60
60
|
href: (0, _i18n.__)('https://wordpress.org/documentation/article/wordpress-block-editor/'),
|
|
61
61
|
target: "_blank",
|
|
62
62
|
rel: "noopener noreferrer"
|
|
63
|
-
}, (0, _i18n.__)('Help'), (0,
|
|
63
|
+
}, (0, _i18n.__)('Help'), (0, _react.createElement)(_components.VisuallyHidden, {
|
|
64
64
|
as: "span"
|
|
65
65
|
}, /* translators: accessibility text */
|
|
66
66
|
(0, _i18n.__)('(opens in a new tab)'))))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_coreData","_editor","_data","_icons","_i18n","_plugins","_url","_copyContentMenuItem","_interopRequireDefault","_keyboardShortcutsHelpMenuItem","_toolsMoreMenuGroup","_welcomeGuideMenuItem","ManagePatternsMenuItem","url","useSelect","select","canUser","coreStore","getEditorSettings","editorStore","isBlockTheme","__unstableIsBlockBasedTheme","defaultUrl","addQueryArgs","post_type","patternsUrl","path","
|
|
1
|
+
{"version":3,"names":["_components","require","_coreData","_editor","_data","_icons","_i18n","_plugins","_url","_copyContentMenuItem","_interopRequireDefault","_keyboardShortcutsHelpMenuItem","_toolsMoreMenuGroup","_welcomeGuideMenuItem","ManagePatternsMenuItem","url","useSelect","select","canUser","coreStore","getEditorSettings","editorStore","isBlockTheme","__unstableIsBlockBasedTheme","defaultUrl","addQueryArgs","post_type","patternsUrl","path","_react","createElement","MenuItem","role","href","__","registerPlugin","render","Fragment","default","onClose","onSelect","icon","external","target","rel","VisuallyHidden","as"],"sources":["@wordpress/edit-post/src/plugins/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem, VisuallyHidden } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\nimport { external } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { registerPlugin } from '@wordpress/plugins';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport CopyContentMenuItem from './copy-content-menu-item';\nimport KeyboardShortcutsHelpMenuItem from './keyboard-shortcuts-help-menu-item';\nimport ToolsMoreMenuGroup from '../components/header/tools-more-menu-group';\nimport WelcomeGuideMenuItem from './welcome-guide-menu-item';\n\nfunction ManagePatternsMenuItem() {\n\tconst url = useSelect( ( select ) => {\n\t\tconst { canUser } = select( coreStore );\n\t\tconst { getEditorSettings } = select( editorStore );\n\n\t\tconst isBlockTheme = getEditorSettings().__unstableIsBlockBasedTheme;\n\t\tconst defaultUrl = addQueryArgs( 'edit.php', {\n\t\t\tpost_type: 'wp_block',\n\t\t} );\n\t\tconst patternsUrl = addQueryArgs( 'site-editor.php', {\n\t\t\tpath: '/patterns',\n\t\t} );\n\n\t\t// The site editor and templates both check whether the user has\n\t\t// edit_theme_options capabilities. We can leverage that here and not\n\t\t// display the manage patterns link if the user can't access it.\n\t\treturn canUser( 'read', 'templates' ) && isBlockTheme\n\t\t\t? patternsUrl\n\t\t\t: defaultUrl;\n\t}, [] );\n\n\treturn (\n\t\t<MenuItem role=\"menuitem\" href={ url }>\n\t\t\t{ __( 'Manage patterns' ) }\n\t\t</MenuItem>\n\t);\n}\n\nregisterPlugin( 'edit-post', {\n\trender() {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<ToolsMoreMenuGroup>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ManagePatternsMenuItem />\n\t\t\t\t\t\t\t<KeyboardShortcutsHelpMenuItem\n\t\t\t\t\t\t\t\tonSelect={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<WelcomeGuideMenuItem />\n\t\t\t\t\t\t\t<CopyContentMenuItem />\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/wordpress-block-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Help' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t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C"}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.KeyboardShortcutsHelpMenuItem = KeyboardShortcutsHelpMenuItem;
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var
|
|
8
|
+
var _react = require("react");
|
|
9
9
|
var _components = require("@wordpress/components");
|
|
10
10
|
var _data = require("@wordpress/data");
|
|
11
11
|
var _i18n = require("@wordpress/i18n");
|
|
@@ -23,7 +23,7 @@ var _keyboardShortcutHelpModal = require("../../components/keyboard-shortcut-hel
|
|
|
23
23
|
function KeyboardShortcutsHelpMenuItem({
|
|
24
24
|
openModal
|
|
25
25
|
}) {
|
|
26
|
-
return (0,
|
|
26
|
+
return (0, _react.createElement)(_components.MenuItem, {
|
|
27
27
|
onClick: () => {
|
|
28
28
|
openModal(_keyboardShortcutHelpModal.KEYBOARD_SHORTCUT_HELP_MODAL_NAME);
|
|
29
29
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_data","_i18n","_keycodes","_interface","_keyboardShortcutHelpModal","KeyboardShortcutsHelpMenuItem","openModal","
|
|
1
|
+
{"version":3,"names":["_components","require","_data","_i18n","_keycodes","_interface","_keyboardShortcutHelpModal","KeyboardShortcutsHelpMenuItem","openModal","_react","createElement","MenuItem","onClick","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","shortcut","displayShortcut","access","__","_default","withDispatch","dispatch","interfaceStore","exports","default"],"sources":["@wordpress/edit-post/src/plugins/keyboard-shortcuts-help-menu-item/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { withDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { KEYBOARD_SHORTCUT_HELP_MODAL_NAME } from '../../components/keyboard-shortcut-help-modal';\n\nexport function KeyboardShortcutsHelpMenuItem( { openModal } ) {\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\topenModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );\n\t\t\t} }\n\t\t\tshortcut={ displayShortcut.access( 'h' ) }\n\t\t>\n\t\t\t{ __( 'Keyboard shortcuts' ) }\n\t\t</MenuItem>\n\t);\n}\n\nexport default withDispatch( ( dispatch ) => {\n\tconst { openModal } = dispatch( interfaceStore );\n\n\treturn {\n\t\topenModal,\n\t};\n} )( KeyboardShortcutsHelpMenuItem );\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AAKA,IAAAK,0BAAA,GAAAL,OAAA;AAZA;AACA;AACA;;AAOA;AACA;AACA;;AAGO,SAASM,6BAA6BA,CAAE;EAAEC;AAAU,CAAC,EAAG;EAC9D,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACV,WAAA,CAAAW,QAAQ;IACRC,OAAO,EAAGA,CAAA,KAAM;MACfJ,SAAS,CAAEK,4DAAkC,CAAC;IAC/C,CAAG;IACHC,QAAQ,EAAGC,yBAAe,CAACC,MAAM,CAAE,GAAI;EAAG,GAExC,IAAAC,QAAE,EAAE,oBAAqB,CAClB,CAAC;AAEb;AAAC,IAAAC,QAAA,GAEc,IAAAC,kBAAY,EAAIC,QAAQ,IAAM;EAC5C,MAAM;IAAEZ;EAAU,CAAC,GAAGY,QAAQ,CAAEC,gBAAe,CAAC;EAEhD,OAAO;IACNb;EACD,CAAC;AACF,CAAE,CAAC,CAAED,6BAA8B,CAAC;AAAAe,OAAA,CAAAC,OAAA,GAAAL,QAAA"}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = WelcomeGuideMenuItem;
|
|
7
|
-
var
|
|
7
|
+
var _react = require("react");
|
|
8
8
|
var _data = require("@wordpress/data");
|
|
9
9
|
var _preferences = require("@wordpress/preferences");
|
|
10
10
|
var _i18n = require("@wordpress/i18n");
|
|
@@ -19,7 +19,7 @@ var _store = require("../../store");
|
|
|
19
19
|
|
|
20
20
|
function WelcomeGuideMenuItem() {
|
|
21
21
|
const isTemplateMode = (0, _data.useSelect)(select => select(_store.store).isEditingTemplate(), []);
|
|
22
|
-
return (0,
|
|
22
|
+
return (0, _react.createElement)(_preferences.PreferenceToggleMenuItem, {
|
|
23
23
|
scope: "core/edit-post",
|
|
24
24
|
name: isTemplateMode ? 'welcomeGuideTemplate' : 'welcomeGuide',
|
|
25
25
|
label: (0, _i18n.__)('Welcome Guide')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_preferences","_i18n","_store","WelcomeGuideMenuItem","isTemplateMode","useSelect","select","editPostStore","isEditingTemplate","
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import { createElement } from "
|
|
1
|
+
import { createElement } from "react";
|
|
2
2
|
/**
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
@@ -42,7 +42,7 @@ const shouldRenderItem = (selectedBlocks, allowedBlocks) => !Array.isArray(allow
|
|
|
42
42
|
* }
|
|
43
43
|
*
|
|
44
44
|
* function MyPluginBlockSettingsMenuItem() {
|
|
45
|
-
* return
|
|
45
|
+
* return React.createElement(
|
|
46
46
|
* PluginBlockSettingsMenuItem,
|
|
47
47
|
* {
|
|
48
48
|
* allowedBlocks: [ 'core/paragraph' ],
|
|
@@ -73,7 +73,7 @@ const shouldRenderItem = (selectedBlocks, allowedBlocks) => !Array.isArray(allow
|
|
|
73
73
|
* );
|
|
74
74
|
* ```
|
|
75
75
|
*
|
|
76
|
-
* @return {
|
|
76
|
+
* @return {Component} The component to be rendered.
|
|
77
77
|
*/
|
|
78
78
|
const PluginBlockSettingsMenuItem = ({
|
|
79
79
|
allowedBlocks,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BlockSettingsMenuControls","MenuItem","compose","isEverySelectedBlockAllowed","selected","allowed","filter","id","includes","length","shouldRenderItem","selectedBlocks","allowedBlocks","Array","isArray","PluginBlockSettingsMenuItem","icon","label","onClick","small","role","createElement","onClose","undefined"],"sources":["@wordpress/edit-post/src/components/block-settings-menu/plugin-block-settings-menu-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockSettingsMenuControls } from '@wordpress/block-editor';\nimport { MenuItem } from '@wordpress/components';\nimport { compose } from '@wordpress/compose';\n\nconst isEverySelectedBlockAllowed = ( selected, allowed ) =>\n\tselected.filter( ( id ) => ! allowed.includes( id ) ).length === 0;\n\n/**\n * Plugins may want to add an item to the menu either for every block\n * or only for the specific ones provided in the `allowedBlocks` component property.\n *\n * If there are multiple blocks selected the item will be rendered if every block\n * is of one allowed type (not necessarily the same).\n *\n * @param {string[]} selectedBlocks Array containing the names of the blocks selected\n * @param {string[]} allowedBlocks Array containing the names of the blocks allowed\n * @return {boolean} Whether the item will be rendered or not.\n */\nconst shouldRenderItem = ( selectedBlocks, allowedBlocks ) =>\n\t! Array.isArray( allowedBlocks ) ||\n\tisEverySelectedBlockAllowed( selectedBlocks, allowedBlocks );\n\n/**\n * Renders a new item in the block settings menu.\n *\n * @param {Object} props Component props.\n * @param {Array} [props.allowedBlocks] An array containing a list of block names for which the item should be shown. If not present, it'll be rendered for any block. If multiple blocks are selected, it'll be shown if and only if all of them are in the allowed list.\n * @param {WPBlockTypeIconRender} [props.icon] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element.\n * @param {string} props.label The menu item text.\n * @param {Function} props.onClick Callback function to be executed when the user click the menu item.\n * @param {boolean} [props.small] Whether to render the label or not.\n * @param {string} [props.role] The ARIA role for the menu item.\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var __ = wp.i18n.__;\n * var PluginBlockSettingsMenuItem = wp.editPost.PluginBlockSettingsMenuItem;\n *\n * function doOnClick(){\n * \t// To be called when the user clicks the menu item.\n * }\n *\n * function MyPluginBlockSettingsMenuItem() {\n * \treturn
|
|
1
|
+
{"version":3,"names":["BlockSettingsMenuControls","MenuItem","compose","isEverySelectedBlockAllowed","selected","allowed","filter","id","includes","length","shouldRenderItem","selectedBlocks","allowedBlocks","Array","isArray","PluginBlockSettingsMenuItem","icon","label","onClick","small","role","createElement","onClose","undefined"],"sources":["@wordpress/edit-post/src/components/block-settings-menu/plugin-block-settings-menu-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockSettingsMenuControls } from '@wordpress/block-editor';\nimport { MenuItem } from '@wordpress/components';\nimport { compose } from '@wordpress/compose';\n\nconst isEverySelectedBlockAllowed = ( selected, allowed ) =>\n\tselected.filter( ( id ) => ! allowed.includes( id ) ).length === 0;\n\n/**\n * Plugins may want to add an item to the menu either for every block\n * or only for the specific ones provided in the `allowedBlocks` component property.\n *\n * If there are multiple blocks selected the item will be rendered if every block\n * is of one allowed type (not necessarily the same).\n *\n * @param {string[]} selectedBlocks Array containing the names of the blocks selected\n * @param {string[]} allowedBlocks Array containing the names of the blocks allowed\n * @return {boolean} Whether the item will be rendered or not.\n */\nconst shouldRenderItem = ( selectedBlocks, allowedBlocks ) =>\n\t! Array.isArray( allowedBlocks ) ||\n\tisEverySelectedBlockAllowed( selectedBlocks, allowedBlocks );\n\n/**\n * Renders a new item in the block settings menu.\n *\n * @param {Object} props Component props.\n * @param {Array} [props.allowedBlocks] An array containing a list of block names for which the item should be shown. If not present, it'll be rendered for any block. If multiple blocks are selected, it'll be shown if and only if all of them are in the allowed list.\n * @param {WPBlockTypeIconRender} [props.icon] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element.\n * @param {string} props.label The menu item text.\n * @param {Function} props.onClick Callback function to be executed when the user click the menu item.\n * @param {boolean} [props.small] Whether to render the label or not.\n * @param {string} [props.role] The ARIA role for the menu item.\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var __ = wp.i18n.__;\n * var PluginBlockSettingsMenuItem = wp.editPost.PluginBlockSettingsMenuItem;\n *\n * function doOnClick(){\n * \t// To be called when the user clicks the menu item.\n * }\n *\n * function MyPluginBlockSettingsMenuItem() {\n * \treturn React.createElement(\n * \t\tPluginBlockSettingsMenuItem,\n * \t\t{\n * \t\t\tallowedBlocks: [ 'core/paragraph' ],\n * \t\t\ticon: 'dashicon-name',\n * \t\t\tlabel: __( 'Menu item text' ),\n * \t\t\tonClick: doOnClick,\n * \t\t}\n * \t);\n * }\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { __ } from '@wordpress/i18n';\n * import { PluginBlockSettingsMenuItem } from '@wordpress/edit-post';\n *\n * const doOnClick = ( ) => {\n * // To be called when the user clicks the menu item.\n * };\n *\n * const MyPluginBlockSettingsMenuItem = () => (\n * <PluginBlockSettingsMenuItem\n * \t\tallowedBlocks={ [ 'core/paragraph' ] }\n * \t\ticon='dashicon-name'\n * \t\tlabel={ __( 'Menu item text' ) }\n * \t\tonClick={ doOnClick } />\n * );\n * ```\n *\n * @return {Component} The component to be rendered.\n */\nconst PluginBlockSettingsMenuItem = ( {\n\tallowedBlocks,\n\ticon,\n\tlabel,\n\tonClick,\n\tsmall,\n\trole,\n} ) => (\n\t<BlockSettingsMenuControls>\n\t\t{ ( { selectedBlocks, onClose } ) => {\n\t\t\tif ( ! shouldRenderItem( selectedBlocks, allowedBlocks ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn (\n\t\t\t\t<MenuItem\n\t\t\t\t\tonClick={ compose( onClick, onClose ) }\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tlabel={ small ? label : undefined }\n\t\t\t\t\trole={ role }\n\t\t\t\t>\n\t\t\t\t\t{ ! small && label }\n\t\t\t\t</MenuItem>\n\t\t\t);\n\t\t} }\n\t</BlockSettingsMenuControls>\n);\n\nexport default PluginBlockSettingsMenuItem;\n"],"mappings":";AAAA;AAC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