@wordpress/edit-post 7.28.2 → 7.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/editor-initialization/listener-hooks.js +14 -6
  3. package/build/components/editor-initialization/listener-hooks.js.map +1 -1
  4. package/build/components/header/index.js +1 -1
  5. package/build/components/header/index.js.map +1 -1
  6. package/build/components/header/more-menu/index.js +6 -2
  7. package/build/components/header/more-menu/index.js.map +1 -1
  8. package/build/components/header/writing-menu/index.js +2 -6
  9. package/build/components/header/writing-menu/index.js.map +1 -1
  10. package/build/components/keyboard-shortcuts/index.js +1 -38
  11. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  12. package/build/components/layout/index.js +3 -4
  13. package/build/components/layout/index.js.map +1 -1
  14. package/build/components/layout/index.native.js +2 -5
  15. package/build/components/layout/index.native.js.map +1 -1
  16. package/build/components/text-editor/index.js +1 -1
  17. package/build/components/text-editor/index.js.map +1 -1
  18. package/build/editor.js +2 -16
  19. package/build/editor.js.map +1 -1
  20. package/build/editor.native.js +2 -3
  21. package/build/editor.native.js.map +1 -1
  22. package/build/hooks/commands/use-common-commands.js +2 -135
  23. package/build/hooks/commands/use-common-commands.js.map +1 -1
  24. package/build/index.js +3 -31
  25. package/build/index.js.map +1 -1
  26. package/build/index.native.js +0 -1
  27. package/build/index.native.js.map +1 -1
  28. package/build/store/actions.js +24 -77
  29. package/build/store/actions.js.map +1 -1
  30. package/build/store/selectors.js +0 -12
  31. package/build/store/selectors.js.map +1 -1
  32. package/build-module/components/editor-initialization/listener-hooks.js +14 -6
  33. package/build-module/components/editor-initialization/listener-hooks.js.map +1 -1
  34. package/build-module/components/header/index.js +1 -1
  35. package/build-module/components/header/index.js.map +1 -1
  36. package/build-module/components/header/more-menu/index.js +5 -1
  37. package/build-module/components/header/more-menu/index.js.map +1 -1
  38. package/build-module/components/header/writing-menu/index.js +2 -6
  39. package/build-module/components/header/writing-menu/index.js.map +1 -1
  40. package/build-module/components/keyboard-shortcuts/index.js +1 -38
  41. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  42. package/build-module/components/layout/index.js +4 -5
  43. package/build-module/components/layout/index.js.map +1 -1
  44. package/build-module/components/layout/index.native.js +2 -5
  45. package/build-module/components/layout/index.native.js.map +1 -1
  46. package/build-module/components/text-editor/index.js +1 -1
  47. package/build-module/components/text-editor/index.js.map +1 -1
  48. package/build-module/editor.js +3 -17
  49. package/build-module/editor.js.map +1 -1
  50. package/build-module/editor.native.js +3 -4
  51. package/build-module/editor.native.js.map +1 -1
  52. package/build-module/hooks/commands/use-common-commands.js +3 -136
  53. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  54. package/build-module/index.js +3 -31
  55. package/build-module/index.js.map +1 -1
  56. package/build-module/index.native.js +0 -1
  57. package/build-module/index.native.js.map +1 -1
  58. package/build-module/store/actions.js +23 -75
  59. package/build-module/store/actions.js.map +1 -1
  60. package/build-module/store/selectors.js +0 -12
  61. package/build-module/store/selectors.js.map +1 -1
  62. package/build-style/style-rtl.css +6 -6
  63. package/build-style/style.css +6 -6
  64. package/package.json +32 -32
  65. package/src/components/editor-initialization/listener-hooks.js +16 -9
  66. package/src/components/editor-initialization/test/listener-hooks.js +40 -0
  67. package/src/components/header/index.js +1 -1
  68. package/src/components/header/more-menu/index.js +4 -1
  69. package/src/components/header/writing-menu/index.js +2 -6
  70. package/src/components/keyboard-shortcuts/index.js +3 -50
  71. package/src/components/layout/index.js +4 -5
  72. package/src/components/layout/index.native.js +1 -3
  73. package/src/components/text-editor/index.js +1 -1
  74. package/src/editor.js +31 -53
  75. package/src/editor.native.js +3 -4
  76. package/src/hooks/commands/use-common-commands.js +17 -170
  77. package/src/index.js +3 -44
  78. package/src/index.native.js +0 -1
  79. package/src/store/actions.js +24 -126
  80. package/src/store/selectors.js +0 -18
  81. package/src/store/test/actions.js +0 -146
  82. package/src/style.scss +1 -2
  83. package/build/components/header/mode-switcher/index.js +0 -87
  84. package/build/components/header/mode-switcher/index.js.map +0 -1
  85. package/build-module/components/header/mode-switcher/index.js +0 -81
  86. package/build-module/components/header/mode-switcher/index.js.map +0 -1
  87. package/src/components/header/mode-switcher/index.js +0 -91
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_reactNativeSafeArea","_interopRequireDefault","_element","_data","_blockEditor","_compose","_components","_editor","_reactNativeBridge","_style","_style2","_header","_visualEditor","_store","Layout","Component","constructor","arguments","onSafeAreaInsetsUpdate","bind","onRootViewLayout","state","rootViewHeight","safeAreaInsets","top","bottom","right","left","SafeArea","getSafeAreaInsetsForRootView","then","componentDidMount","_isMounted","safeAreaSubscription","addEventListener","componentWillUnmount","remove","result","setState","event","setHeightState","height","nativeEvent","layout","sendNativeEditorDidLayout","renderHTML","globalStyles","props","_react","createElement","HTMLTextInput","parentHeight","style","renderVisual","isReady","default","setTitleRef","render","getStylesFromColorScheme","mode","isHtmlView","marginBottom","Platform","OS","headerToolbarStyles","containerStyles","styles","container","containerDark","toolbarKeyboardAvoidingViewStyle","toolbarKeyboardAvoidingView","backgroundColor","editorStyles","background","backgroundDark","Tooltip","Slot","SafeAreaView","onLayout","AutosaveMonitor","disableIntervalChecks","OfflineStatus","View","FloatingToolbar","NoticeList","flex","flexBasis","KeyboardAvoidingView","withAnimatedHeight","Fragment","__unstableAutocompletionItemsSlot","BottomSheetSettings","_default","exports","compose","withSelect","select","__unstableIsEditorReady","isEditorReady","editorStore","getEditorMode","editPostStore","getSettings","blockEditorStore","__experimentalGlobalStylesBaseStyles","color","withPreferredColorScheme"],"sources":["@wordpress/edit-post/src/components/layout/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Platform, SafeAreaView, View } from 'react-native';\nimport SafeArea from 'react-native-safe-area';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { withSelect } from '@wordpress/data';\nimport {\n\tBottomSheetSettings,\n\tFloatingToolbar,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { compose, withPreferredColorScheme } from '@wordpress/compose';\nimport {\n\tHTMLTextInput,\n\tKeyboardAvoidingView,\n\tNoticeList,\n\tTooltip,\n\t__unstableAutocompletionItemsSlot as AutocompletionItemsSlot,\n} from '@wordpress/components';\nimport {\n\tAutosaveMonitor,\n\tOfflineStatus,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { sendNativeEditorDidLayout } from '@wordpress/react-native-bridge';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport headerToolbarStyles from '../header/header-toolbar/style.scss';\nimport Header from '../header';\nimport VisualEditor from '../visual-editor';\nimport { store as editPostStore } from '../../store';\n\nclass Layout extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.onSafeAreaInsetsUpdate = this.onSafeAreaInsetsUpdate.bind( this );\n\t\tthis.onRootViewLayout = this.onRootViewLayout.bind( this );\n\n\t\tthis.state = {\n\t\t\trootViewHeight: 0,\n\t\t\tsafeAreaInsets: { top: 0, bottom: 0, right: 0, left: 0 },\n\t\t};\n\n\t\tSafeArea.getSafeAreaInsetsForRootView().then(\n\t\t\tthis.onSafeAreaInsetsUpdate\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis._isMounted = true;\n\t\tthis.safeAreaSubscription = SafeArea.addEventListener(\n\t\t\t'safeAreaInsetsForRootViewDidChange',\n\t\t\tthis.onSafeAreaInsetsUpdate\n\t\t);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tthis.safeAreaSubscription?.remove();\n\t\tthis._isMounted = false;\n\t}\n\n\tonSafeAreaInsetsUpdate( result ) {\n\t\tconst { safeAreaInsets } = result;\n\t\tif ( this._isMounted ) {\n\t\t\tthis.setState( { safeAreaInsets } );\n\t\t}\n\t}\n\n\tonRootViewLayout( event ) {\n\t\tif ( this._isMounted ) {\n\t\t\tthis.setHeightState( event );\n\t\t}\n\t}\n\n\tsetHeightState( event ) {\n\t\tconst { height } = event.nativeEvent.layout;\n\t\tif ( height !== this.state.rootViewHeight ) {\n\t\t\tthis.setState(\n\t\t\t\t{ rootViewHeight: height },\n\t\t\t\tsendNativeEditorDidLayout\n\t\t\t);\n\t\t}\n\t}\n\n\trenderHTML() {\n\t\tconst { globalStyles } = this.props;\n\t\treturn (\n\t\t\t<HTMLTextInput\n\t\t\t\tparentHeight={ this.state.rootViewHeight }\n\t\t\t\tstyle={ globalStyles }\n\t\t\t/>\n\t\t);\n\t}\n\n\trenderVisual() {\n\t\tconst { isReady } = this.props;\n\n\t\tif ( ! isReady ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn <VisualEditor setTitleRef={ this.props.setTitleRef } />;\n\t}\n\n\trender() {\n\t\tconst { getStylesFromColorScheme, mode, globalStyles } = this.props;\n\n\t\tconst isHtmlView = mode === 'text';\n\n\t\t// Add a margin view at the bottom for the header.\n\t\tconst marginBottom =\n\t\t\tPlatform.OS === 'android' && ! isHtmlView\n\t\t\t\t? headerToolbarStyles[ 'header-toolbar__container' ].height\n\t\t\t\t: 0;\n\n\t\tconst containerStyles = getStylesFromColorScheme(\n\t\t\tstyles.container,\n\t\t\tstyles.containerDark\n\t\t);\n\n\t\tconst toolbarKeyboardAvoidingViewStyle = {\n\t\t\t...styles.toolbarKeyboardAvoidingView,\n\t\t\tleft: this.state.safeAreaInsets.left,\n\t\t\tright: this.state.safeAreaInsets.right,\n\t\t\tbottom: this.state.safeAreaInsets.bottom,\n\t\t\tbackgroundColor: containerStyles.backgroundColor,\n\t\t};\n\n\t\tconst editorStyles = [\n\t\t\tgetStylesFromColorScheme(\n\t\t\t\tstyles.background,\n\t\t\t\tstyles.backgroundDark\n\t\t\t),\n\t\t\tglobalStyles?.background && {\n\t\t\t\tbackgroundColor: globalStyles.background,\n\t\t\t},\n\t\t];\n\n\t\treturn (\n\t\t\t<Tooltip.Slot>\n\t\t\t\t<SafeAreaView\n\t\t\t\t\tstyle={ containerStyles }\n\t\t\t\t\tonLayout={ this.onRootViewLayout }\n\t\t\t\t>\n\t\t\t\t\t<AutosaveMonitor disableIntervalChecks />\n\t\t\t\t\t<OfflineStatus />\n\t\t\t\t\t<View style={ editorStyles }>\n\t\t\t\t\t\t{ isHtmlView ? this.renderHTML() : this.renderVisual() }\n\t\t\t\t\t\t{ ! isHtmlView && Platform.OS === 'android' && (\n\t\t\t\t\t\t\t<FloatingToolbar />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<NoticeList />\n\t\t\t\t\t</View>\n\t\t\t\t\t<View\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\tflex: 0,\n\t\t\t\t\t\t\tflexBasis: marginBottom,\n\t\t\t\t\t\t\theight: marginBottom,\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! isHtmlView && (\n\t\t\t\t\t\t<KeyboardAvoidingView\n\t\t\t\t\t\t\tparentHeight={ this.state.rootViewHeight }\n\t\t\t\t\t\t\tstyle={ toolbarKeyboardAvoidingViewStyle }\n\t\t\t\t\t\t\twithAnimatedHeight\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ Platform.OS === 'ios' && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<AutocompletionItemsSlot />\n\t\t\t\t\t\t\t\t\t<FloatingToolbar />\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<Header />\n\t\t\t\t\t\t\t<BottomSheetSettings />\n\t\t\t\t\t\t</KeyboardAvoidingView>\n\t\t\t\t\t) }\n\t\t\t\t\t{ Platform.OS === 'android' && <AutocompletionItemsSlot /> }\n\t\t\t\t</SafeAreaView>\n\t\t\t</Tooltip.Slot>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { __unstableIsEditorReady: isEditorReady } =\n\t\t\tselect( editorStore );\n\t\tconst { getEditorMode } = select( editPostStore );\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst globalStyles =\n\t\t\tgetSettings()?.__experimentalGlobalStylesBaseStyles?.color;\n\n\t\treturn {\n\t\t\tisReady: isEditorReady(),\n\t\t\tmode: getEditorMode(),\n\t\t\tglobalStyles,\n\t\t};\n\t} ),\n\twithPreferredColorScheme,\n] )( Layout );\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAKA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AAOA,IAAAQ,OAAA,GAAAR,OAAA;AAKA,IAAAS,kBAAA,GAAAT,OAAA;AAKA,IAAAU,MAAA,GAAAR,sBAAA,CAAAF,OAAA;AACA,IAAAW,OAAA,GAAAT,sBAAA,CAAAF,OAAA;AACA,IAAAY,OAAA,GAAAV,sBAAA,CAAAF,OAAA;AACA,IAAAa,aAAA,GAAAX,sBAAA,CAAAF,OAAA;AACA,IAAAc,MAAA,GAAAd,OAAA;AAtCA;AACA;AACA;;AAIA;AACA;AACA;;AAuBA;AACA;AACA;;AAOA,MAAMe,MAAM,SAASC,kBAAS,CAAC;EAC9BC,WAAWA,CAAA,EAAG;IACb,KAAK,CAAE,GAAGC,SAAU,CAAC;IAErB,IAAI,CAACC,sBAAsB,GAAG,IAAI,CAACA,sBAAsB,CAACC,IAAI,CAAE,IAAK,CAAC;IACtE,IAAI,CAACC,gBAAgB,GAAG,IAAI,CAACA,gBAAgB,CAACD,IAAI,CAAE,IAAK,CAAC;IAE1D,IAAI,CAACE,KAAK,GAAG;MACZC,cAAc,EAAE,CAAC;MACjBC,cAAc,EAAE;QAAEC,GAAG,EAAE,CAAC;QAAEC,MAAM,EAAE,CAAC;QAAEC,KAAK,EAAE,CAAC;QAAEC,IAAI,EAAE;MAAE;IACxD,CAAC;IAEDC,4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,EAAC7C,YAAA,CAAA+E,eAAe,MAAE,CACjB,CACF,EACD,IAAAnC,MAAA,CAAAC,aAAA,EAACtC,OAAA,CAAA4C,OAAM,MAAE,CAAC,EACV,IAAAP,MAAA,CAAAC,aAAA,EAAC7C,YAAA,CAAAuF,mBAAmB,MAAE,CACD,CACtB,EACC7B,qBAAQ,CAACC,EAAE,KAAK,SAAS,IAAI,IAAAf,MAAA,CAAAC,aAAA,EAAC3C,WAAA,CAAAoF,iCAAuB,MAAE,CAC5C,CACD,CAAC;EAEjB;AACD;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAtC,OAAA,GAEc,IAAAuC,gBAAO,EAAE,CACvB,IAAAC,gBAAU,EAAIC,MAAM,IAAM;EACzB,MAAM;IAAEC,uBAAuB,EAAEC;EAAc,CAAC,GAC/CF,MAAM,CAAEG,aAAY,CAAC;EACtB,MAAM;IAAEC;EAAc,CAAC,GAAGJ,MAAM,CAAEK,YAAc,CAAC;EACjD,MAAM;IAAEC;EAAY,CAAC,GAAGN,MAAM,CAAEO,kBAAiB,CAAC;EAClD,MAAMzD,YAAY,GACjBwD,WAAW,CAAC,CAAC,EAAEE,oCAAoC,EAAEC,KAAK;EAE3D,OAAO;IACNnD,OAAO,EAAE4C,aAAa,CAAC,CAAC;IACxBvC,IAAI,EAAEyC,aAAa,CAAC,CAAC;IACrBtD;EACD,CAAC;AACF,CAAE,CAAC,EACH4D,iCAAwB,CACvB,CAAC,CAAE5F,MAAO,CAAC"}
1
+ {"version":3,"names":["_reactNative","require","_reactNativeSafeArea","_interopRequireDefault","_element","_data","_blockEditor","_compose","_components","_editor","_reactNativeBridge","_style","_style2","_header","_visualEditor","Layout","Component","constructor","arguments","onSafeAreaInsetsUpdate","bind","onRootViewLayout","state","rootViewHeight","safeAreaInsets","top","bottom","right","left","SafeArea","getSafeAreaInsetsForRootView","then","componentDidMount","_isMounted","safeAreaSubscription","addEventListener","componentWillUnmount","remove","result","setState","event","setHeightState","height","nativeEvent","layout","sendNativeEditorDidLayout","renderHTML","globalStyles","props","_react","createElement","HTMLTextInput","parentHeight","style","renderVisual","isReady","default","setTitleRef","render","getStylesFromColorScheme","mode","isHtmlView","marginBottom","Platform","OS","headerToolbarStyles","containerStyles","styles","container","containerDark","toolbarKeyboardAvoidingViewStyle","toolbarKeyboardAvoidingView","backgroundColor","editorStyles","background","backgroundDark","Tooltip","Slot","SafeAreaView","onLayout","AutosaveMonitor","disableIntervalChecks","OfflineStatus","View","FloatingToolbar","NoticeList","flex","flexBasis","KeyboardAvoidingView","withAnimatedHeight","Fragment","__unstableAutocompletionItemsSlot","BottomSheetSettings","_default","exports","compose","withSelect","select","__unstableIsEditorReady","isEditorReady","getEditorMode","editorStore","getSettings","blockEditorStore","__experimentalGlobalStylesBaseStyles","color","withPreferredColorScheme"],"sources":["@wordpress/edit-post/src/components/layout/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Platform, SafeAreaView, View } from 'react-native';\nimport SafeArea from 'react-native-safe-area';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { withSelect } from '@wordpress/data';\nimport {\n\tBottomSheetSettings,\n\tFloatingToolbar,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { compose, withPreferredColorScheme } from '@wordpress/compose';\nimport {\n\tHTMLTextInput,\n\tKeyboardAvoidingView,\n\tNoticeList,\n\tTooltip,\n\t__unstableAutocompletionItemsSlot as AutocompletionItemsSlot,\n} from '@wordpress/components';\nimport {\n\tAutosaveMonitor,\n\tOfflineStatus,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { sendNativeEditorDidLayout } from '@wordpress/react-native-bridge';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport headerToolbarStyles from '../header/header-toolbar/style.scss';\nimport Header from '../header';\nimport VisualEditor from '../visual-editor';\n\nclass Layout extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.onSafeAreaInsetsUpdate = this.onSafeAreaInsetsUpdate.bind( this );\n\t\tthis.onRootViewLayout = this.onRootViewLayout.bind( this );\n\n\t\tthis.state = {\n\t\t\trootViewHeight: 0,\n\t\t\tsafeAreaInsets: { top: 0, bottom: 0, right: 0, left: 0 },\n\t\t};\n\n\t\tSafeArea.getSafeAreaInsetsForRootView().then(\n\t\t\tthis.onSafeAreaInsetsUpdate\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tthis._isMounted = true;\n\t\tthis.safeAreaSubscription = SafeArea.addEventListener(\n\t\t\t'safeAreaInsetsForRootViewDidChange',\n\t\t\tthis.onSafeAreaInsetsUpdate\n\t\t);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tthis.safeAreaSubscription?.remove();\n\t\tthis._isMounted = false;\n\t}\n\n\tonSafeAreaInsetsUpdate( result ) {\n\t\tconst { safeAreaInsets } = result;\n\t\tif ( this._isMounted ) {\n\t\t\tthis.setState( { safeAreaInsets } );\n\t\t}\n\t}\n\n\tonRootViewLayout( event ) {\n\t\tif ( this._isMounted ) {\n\t\t\tthis.setHeightState( event );\n\t\t}\n\t}\n\n\tsetHeightState( event ) {\n\t\tconst { height } = event.nativeEvent.layout;\n\t\tif ( height !== this.state.rootViewHeight ) {\n\t\t\tthis.setState(\n\t\t\t\t{ rootViewHeight: height },\n\t\t\t\tsendNativeEditorDidLayout\n\t\t\t);\n\t\t}\n\t}\n\n\trenderHTML() {\n\t\tconst { globalStyles } = this.props;\n\t\treturn (\n\t\t\t<HTMLTextInput\n\t\t\t\tparentHeight={ this.state.rootViewHeight }\n\t\t\t\tstyle={ globalStyles }\n\t\t\t/>\n\t\t);\n\t}\n\n\trenderVisual() {\n\t\tconst { isReady } = this.props;\n\n\t\tif ( ! isReady ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn <VisualEditor setTitleRef={ this.props.setTitleRef } />;\n\t}\n\n\trender() {\n\t\tconst { getStylesFromColorScheme, mode, globalStyles } = this.props;\n\n\t\tconst isHtmlView = mode === 'text';\n\n\t\t// Add a margin view at the bottom for the header.\n\t\tconst marginBottom =\n\t\t\tPlatform.OS === 'android' && ! isHtmlView\n\t\t\t\t? headerToolbarStyles[ 'header-toolbar__container' ].height\n\t\t\t\t: 0;\n\n\t\tconst containerStyles = getStylesFromColorScheme(\n\t\t\tstyles.container,\n\t\t\tstyles.containerDark\n\t\t);\n\n\t\tconst toolbarKeyboardAvoidingViewStyle = {\n\t\t\t...styles.toolbarKeyboardAvoidingView,\n\t\t\tleft: this.state.safeAreaInsets.left,\n\t\t\tright: this.state.safeAreaInsets.right,\n\t\t\tbottom: this.state.safeAreaInsets.bottom,\n\t\t\tbackgroundColor: containerStyles.backgroundColor,\n\t\t};\n\n\t\tconst editorStyles = [\n\t\t\tgetStylesFromColorScheme(\n\t\t\t\tstyles.background,\n\t\t\t\tstyles.backgroundDark\n\t\t\t),\n\t\t\tglobalStyles?.background && {\n\t\t\t\tbackgroundColor: globalStyles.background,\n\t\t\t},\n\t\t];\n\n\t\treturn (\n\t\t\t<Tooltip.Slot>\n\t\t\t\t<SafeAreaView\n\t\t\t\t\tstyle={ containerStyles }\n\t\t\t\t\tonLayout={ this.onRootViewLayout }\n\t\t\t\t>\n\t\t\t\t\t<AutosaveMonitor disableIntervalChecks />\n\t\t\t\t\t<OfflineStatus />\n\t\t\t\t\t<View style={ editorStyles }>\n\t\t\t\t\t\t{ isHtmlView ? this.renderHTML() : this.renderVisual() }\n\t\t\t\t\t\t{ ! isHtmlView && Platform.OS === 'android' && (\n\t\t\t\t\t\t\t<FloatingToolbar />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<NoticeList />\n\t\t\t\t\t</View>\n\t\t\t\t\t<View\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\tflex: 0,\n\t\t\t\t\t\t\tflexBasis: marginBottom,\n\t\t\t\t\t\t\theight: marginBottom,\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! isHtmlView && (\n\t\t\t\t\t\t<KeyboardAvoidingView\n\t\t\t\t\t\t\tparentHeight={ this.state.rootViewHeight }\n\t\t\t\t\t\t\tstyle={ toolbarKeyboardAvoidingViewStyle }\n\t\t\t\t\t\t\twithAnimatedHeight\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ Platform.OS === 'ios' && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<AutocompletionItemsSlot />\n\t\t\t\t\t\t\t\t\t<FloatingToolbar />\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<Header />\n\t\t\t\t\t\t\t<BottomSheetSettings />\n\t\t\t\t\t\t</KeyboardAvoidingView>\n\t\t\t\t\t) }\n\t\t\t\t\t{ Platform.OS === 'android' && <AutocompletionItemsSlot /> }\n\t\t\t\t</SafeAreaView>\n\t\t\t</Tooltip.Slot>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { __unstableIsEditorReady: isEditorReady, getEditorMode } =\n\t\t\tselect( editorStore );\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst globalStyles =\n\t\t\tgetSettings()?.__experimentalGlobalStylesBaseStyles?.color;\n\n\t\treturn {\n\t\t\tisReady: isEditorReady(),\n\t\t\tmode: getEditorMode(),\n\t\t\tglobalStyles,\n\t\t};\n\t} ),\n\twithPreferredColorScheme,\n] )( Layout );\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAKA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AAOA,IAAAQ,OAAA,GAAAR,OAAA;AAKA,IAAAS,kBAAA,GAAAT,OAAA;AAKA,IAAAU,MAAA,GAAAR,sBAAA,CAAAF,O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,GAAGL,MAAM,CAAEM,kBAAiB,CAAC;EAClD,MAAMxD,YAAY,GACjBuD,WAAW,CAAC,CAAC,EAAEE,oCAAoC,EAAEC,KAAK;EAE3D,OAAO;IACNlD,OAAO,EAAE4C,aAAa,CAAC,CAAC;IACxBvC,IAAI,EAAEwC,aAAa,CAAC,CAAC;IACrBrD;EACD,CAAC;AACF,CAAE,CAAC,EACH2D,iCAAwB,CACvB,CAAC,CAAE3F,MAAO,CAAC"}
@@ -26,7 +26,7 @@ function TextEditor() {
26
26
  }, []);
27
27
  const {
28
28
  switchEditorMode
29
- } = (0, _data.useDispatch)(_store.store);
29
+ } = (0, _data.useDispatch)(_editor.store);
30
30
  const {
31
31
  isWelcomeGuideVisible
32
32
  } = (0, _data.useSelect)(select => {
@@ -1 +1 @@
1
- {"version":3,"names":["_editor","require","_components","_data","_i18n","_keycodes","_element","_store","TextEditor","isRichEditingEnabled","useSelect","select","editorStore","getEditorSettings","richEditingEnabled","switchEditorMode","useDispatch","editPostStore","isWelcomeGuideVisible","isFeatureActive","titleRef","useRef","useEffect","current","focus","_react","createElement","className","__","Button","variant","onClick","shortcut","displayShortcut","secondary","PostTitleRaw","ref","PostTextEditor"],"sources":["@wordpress/edit-post/src/components/text-editor/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tPostTextEditor,\n\tPostTitleRaw,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { Button } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nexport default function TextEditor() {\n\tconst isRichEditingEnabled = useSelect( ( select ) => {\n\t\treturn select( editorStore ).getEditorSettings().richEditingEnabled;\n\t}, [] );\n\tconst { switchEditorMode } = useDispatch( editPostStore );\n\n\tconst { isWelcomeGuideVisible } = useSelect( ( select ) => {\n\t\tconst { isFeatureActive } = select( editPostStore );\n\n\t\treturn {\n\t\t\tisWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),\n\t\t};\n\t}, [] );\n\n\tconst titleRef = useRef();\n\n\tuseEffect( () => {\n\t\tif ( isWelcomeGuideVisible ) {\n\t\t\treturn;\n\t\t}\n\t\ttitleRef?.current?.focus();\n\t}, [ isWelcomeGuideVisible ] );\n\n\treturn (\n\t\t<div className=\"edit-post-text-editor\">\n\t\t\t{ isRichEditingEnabled && (\n\t\t\t\t<div className=\"edit-post-text-editor__toolbar\">\n\t\t\t\t\t<h2>{ __( 'Editing code' ) }</h2>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => switchEditorMode( 'visual' ) }\n\t\t\t\t\t\tshortcut={ displayShortcut.secondary( 'm' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Exit code editor' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<div className=\"edit-post-text-editor__body\">\n\t\t\t\t<PostTitleRaw ref={ titleRef } />\n\t\t\t\t<PostTextEditor />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AAjBA;AACA;AACA;;AAYA;AACA;AACA;;AAGe,SAASO,UAAUA,CAAA,EAAG;EACpC,MAAMC,oBAAoB,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACrD,OAAOA,MAAM,CAAEC,aAAY,CAAC,CAACC,iBAAiB,CAAC,CAAC,CAACC,kBAAkB;EACpE,CAAC,EAAE,EA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Ac,MAAE,CACb,CACD,CAAC;AAER"}
1
+ {"version":3,"names":["_editor","require","_components","_data","_i18n","_keycodes","_element","_store","TextEditor","isRichEditingEnabled","useSelect","select","editorStore","getEditorSettings","richEditingEnabled","switchEditorMode","useDispatch","isWelcomeGuideVisible","isFeatureActive","editPostStore","titleRef","useRef","useEffect","current","focus","_react","createElement","className","__","Button","variant","onClick","shortcut","displayShortcut","secondary","PostTitleRaw","ref","PostTextEditor"],"sources":["@wordpress/edit-post/src/components/text-editor/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tPostTextEditor,\n\tPostTitleRaw,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { Button } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nexport default function TextEditor() {\n\tconst isRichEditingEnabled = useSelect( ( select ) => {\n\t\treturn select( editorStore ).getEditorSettings().richEditingEnabled;\n\t}, [] );\n\tconst { switchEditorMode } = useDispatch( editorStore );\n\n\tconst { isWelcomeGuideVisible } = useSelect( ( select ) => {\n\t\tconst { isFeatureActive } = select( editPostStore );\n\n\t\treturn {\n\t\t\tisWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),\n\t\t};\n\t}, [] );\n\n\tconst titleRef = useRef();\n\n\tuseEffect( () => {\n\t\tif ( isWelcomeGuideVisible ) {\n\t\t\treturn;\n\t\t}\n\t\ttitleRef?.current?.focus();\n\t}, [ isWelcomeGuideVisible ] );\n\n\treturn (\n\t\t<div className=\"edit-post-text-editor\">\n\t\t\t{ isRichEditingEnabled && (\n\t\t\t\t<div className=\"edit-post-text-editor__toolbar\">\n\t\t\t\t\t<h2>{ __( 'Editing code' ) }</h2>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => switchEditorMode( 'visual' ) }\n\t\t\t\t\t\tshortcut={ displayShortcut.secondary( 'm' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Exit code editor' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<div className=\"edit-post-text-editor__body\">\n\t\t\t\t<PostTitleRaw ref={ titleRef } />\n\t\t\t\t<PostTextEditor />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AAjBA;AACA;AACA;;AAYA;AACA;AACA;;AAGe,SAASO,UAAUA,CAAA,EAAG;EACpC,MAAMC,oBAAoB,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACrD,OAAOA,MAAM,CAAEC,aAAY,CAAC,CAACC,iBAAiB,CAAC,CAAC,CAACC,kBAAkB;EACpE,CAAC,EAAE,EAAG,CAAC;EACP,MAAM;IAAEC;EAAiB,CAAC,GAAG,IAAAC,iBAAW,EAAEJ,aAAY,CAAC;EAEvD,MAAM;IAAEK;EAAsB,CAAC,GAAG,IAAAP,eAAS,EAAIC,MAAM,IAAM;IAC1D,MAAM;MAAEO;IAAgB,CAAC,GAAGP,MAAM,CAAEQ,YAAc,CAAC;IAEnD,OAAO;MACNF,qBAAqB,EAAEC,eAAe,CAAE,cAAe;IACxD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAME,QAAQ,GAAG,IAAAC,eAAM,EAAC,CAAC;EAEzB,IAAAC,kBAAS,EAAE,MAAM;IAChB,IAAKL,qBAAqB,EAAG;MAC5B;IACD;IACAG,QAAQ,EAAEG,OAAO,EAAEC,KAAK,CAAC,CAAC;EAC3B,CAAC,EAAE,CAAEP,qBAAqB,CAAG,CAAC;EAE9B,OACC,IAAAQ,MAAA,CAAAC,aAAA;IAAKC,SAAS,EAAC;EAAuB,GACnClB,oBAAoB,IACrB,IAAAgB,MAAA,CAAAC,aAAA;IAAKC,SAAS,EAAC;EAAgC,GAC9C,IAAAF,MAAA,CAAAC,aAAA,cAAM,IAAAE,QAAE,EAAE,cAAe,CAAO,CAAC,EACjC,IAAAH,MAAA,CAAAC,aAAA,EAACxB,WAAA,CAAA2B,MAAM;IACNC,OAAO,EAAC,UAAU;IAClBC,OAAO,EAAGA,CAAA,KAAMhB,gBAAgB,CAAE,QAAS,CAAG;IAC9CiB,QAAQ,EAAGC,yBAAe,CAACC,SAAS,CAAE,GAAI;EAAG,GAE3C,IAAAN,QAAE,EAAE,kBAAmB,CAClB,CACJ,CACL,EACD,IAAAH,MAAA,CAAAC,aAAA;IAAKC,SAAS,EAAC;EAA6B,GAC3C,IAAAF,MAAA,CAAAC,aAAA,EAAC1B,OAAA,CAAAmC,YAAY;IAACC,GAAG,EAAGhB;EAAU,CAAE,CAAC,EACjC,IAAAK,MAAA,CAAAC,aAAA,EAAC1B,OAAA,CAAAqC,cAAc,MAAE,CACb,CACD,CAAC;AAER"}
package/build/editor.js CHANGED
@@ -11,7 +11,6 @@ var _editor = require("@wordpress/editor");
11
11
  var _element = require("@wordpress/element");
12
12
  var _components = require("@wordpress/components");
13
13
  var _coreData = require("@wordpress/core-data");
14
- var _preferences = require("@wordpress/preferences");
15
14
  var _commands = require("@wordpress/commands");
16
15
  var _blockEditor = require("@wordpress/block-editor");
17
16
  var _i18n = require("@wordpress/i18n");
@@ -53,14 +52,11 @@ function Editor({
53
52
  onNavigateToPreviousEntityRecord
54
53
  } = (0, _useNavigateToEntityRecord.default)(initialPostId, initialPostType);
55
54
  const {
56
- hasInlineToolbar,
57
55
  post,
58
- preferredStyleVariations,
59
56
  template
60
57
  } = (0, _data.useSelect)(select => {
61
58
  var _getPostType$viewable;
62
59
  const {
63
- isFeatureActive,
64
60
  getEditedPostTemplate
65
61
  } = select(_store.store);
66
62
  const {
@@ -76,26 +72,16 @@ function Editor({
76
72
  const isViewable = (_getPostType$viewable = getPostType(currentPost.postType)?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false;
77
73
  const canEditTemplate = canUser('create', 'templates');
78
74
  return {
79
- hasInlineToolbar: isFeatureActive('inlineToolbar'),
80
- preferredStyleVariations: select(_preferences.store).get('core/edit-post', 'preferredStyleVariations'),
81
75
  template: supportsTemplateMode && isViewable && canEditTemplate && currentPost.postType !== 'wp_template' ? getEditedPostTemplate() : null,
82
76
  post: postObject
83
77
  };
84
78
  }, [currentPost.postType, currentPost.postId]);
85
- const {
86
- updatePreferredStyleVariations
87
- } = (0, _data.useDispatch)(_store.store);
88
79
  const editorSettings = (0, _element.useMemo)(() => ({
89
80
  ...settings,
90
81
  onNavigateToEntityRecord,
91
82
  onNavigateToPreviousEntityRecord,
92
- defaultRenderingMode: 'post-only',
93
- __experimentalPreferredStyleVariations: {
94
- value: preferredStyleVariations,
95
- onChange: updatePreferredStyleVariations
96
- },
97
- hasInlineToolbar
98
- }), [settings, hasInlineToolbar, preferredStyleVariations, updatePreferredStyleVariations, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord]);
83
+ defaultRenderingMode: 'post-only'
84
+ }), [settings, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord]);
99
85
  if (!post) {
100
86
  return null;
101
87
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_editor","_element","_components","_coreData","_preferences","_commands","_blockEditor","_i18n","_layout","_interopRequireDefault","_editorInitialization","_store","_lockUnlock","_useNavigateToEntityRecord","ExperimentalEditorProvider","unlock","editorPrivateApis","BlockRemovalWarningModal","blockEditorPrivateApis","blockRemovalRules","__","Editor","postId","initialPostId","postType","initialPostType","settings","initialEdits","props","initialPost","currentPost","onNavigateToEntityRecord","onNavigateToPreviousEntityRecord","useNavigateToEntityRecord","hasInlineToolbar","post","preferredStyleVariations","template","useSelect","select","_getPostType$viewable","isFeatureActive","getEditedPostTemplate","editPostStore","getEntityRecord","getPostType","canUser","coreStore","getEditorSettings","editorStore","postObject","supportsTemplateMode","isViewable","viewable","canEditTemplate","preferencesStore","get","updatePreferredStyleVariations","useDispatch","editorSettings","useMemo","defaultRenderingMode","__experimentalPreferredStyleVariations","value","onChange","_react","createElement","SlotFillProvider","useSubRegistry","__unstableTemplate","ErrorBoundary","CommandMenu","default","rules","PostLockedModal","_default","exports"],"sources":["@wordpress/edit-post/src/editor.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useMemo } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { CommandMenu } from '@wordpress/commands';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport EditorInitialization from './components/editor-initialization';\nimport { store as editPostStore } from './store';\nimport { unlock } from './lock-unlock';\nimport useNavigateToEntityRecord from './hooks/use-navigate-to-entity-record';\n\nconst { ExperimentalEditorProvider } = unlock( editorPrivateApis );\nconst { BlockRemovalWarningModal } = unlock( blockEditorPrivateApis );\n// Prevent accidental removal of certain blocks, asking the user for\n// confirmation.\nconst blockRemovalRules = {\n\t'bindings/core/pattern-overrides': __(\n\t\t'Blocks from synced patterns that can have overriden content.'\n\t),\n};\n\nfunction Editor( {\n\tpostId: initialPostId,\n\tpostType: initialPostType,\n\tsettings,\n\tinitialEdits,\n\t...props\n} ) {\n\tconst {\n\t\tinitialPost,\n\t\tcurrentPost,\n\t\tonNavigateToEntityRecord,\n\t\tonNavigateToPreviousEntityRecord,\n\t} = useNavigateToEntityRecord( initialPostId, initialPostType );\n\n\tconst { hasInlineToolbar, post, preferredStyleVariations, template } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst { isFeatureActive, getEditedPostTemplate } =\n\t\t\t\t\tselect( editPostStore );\n\t\t\t\tconst { getEntityRecord, getPostType, canUser } =\n\t\t\t\t\tselect( coreStore );\n\t\t\t\tconst { getEditorSettings } = select( editorStore );\n\n\t\t\t\tconst postObject = getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tcurrentPost.postType,\n\t\t\t\t\tcurrentPost.postId\n\t\t\t\t);\n\n\t\t\t\tconst supportsTemplateMode =\n\t\t\t\t\tgetEditorSettings().supportsTemplateMode;\n\t\t\t\tconst isViewable =\n\t\t\t\t\tgetPostType( currentPost.postType )?.viewable ?? false;\n\t\t\t\tconst canEditTemplate = canUser( 'create', 'templates' );\n\t\t\t\treturn {\n\t\t\t\t\thasInlineToolbar: isFeatureActive( 'inlineToolbar' ),\n\t\t\t\t\tpreferredStyleVariations: select( preferencesStore ).get(\n\t\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t\t'preferredStyleVariations'\n\t\t\t\t\t),\n\t\t\t\t\ttemplate:\n\t\t\t\t\t\tsupportsTemplateMode &&\n\t\t\t\t\t\tisViewable &&\n\t\t\t\t\t\tcanEditTemplate &&\n\t\t\t\t\t\tcurrentPost.postType !== 'wp_template'\n\t\t\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t\t\t: null,\n\t\t\t\t\tpost: postObject,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ currentPost.postType, currentPost.postId ]\n\t\t);\n\n\tconst { updatePreferredStyleVariations } = useDispatch( editPostStore );\n\n\tconst editorSettings = useMemo(\n\t\t() => ( {\n\t\t\t...settings,\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t\tdefaultRenderingMode: 'post-only',\n\t\t\t__experimentalPreferredStyleVariations: {\n\t\t\t\tvalue: preferredStyleVariations,\n\t\t\t\tonChange: updatePreferredStyleVariations,\n\t\t\t},\n\t\t\thasInlineToolbar,\n\t\t} ),\n\t\t[\n\t\t\tsettings,\n\t\t\thasInlineToolbar,\n\t\t\tpreferredStyleVariations,\n\t\t\tupdatePreferredStyleVariations,\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t]\n\t);\n\n\tif ( ! post ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<ExperimentalEditorProvider\n\t\t\t\tsettings={ editorSettings }\n\t\t\t\tpost={ post }\n\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t__unstableTemplate={ template }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t<CommandMenu />\n\t\t\t\t\t<EditorInitialization postId={ currentPost.postId } />\n\t\t\t\t\t<Layout initialPost={ initialPost } />\n\t\t\t\t\t<BlockRemovalWarningModal rules={ blockRemovalRules } />\n\t\t\t\t</ErrorBoundary>\n\t\t\t\t<PostLockedModal />\n\t\t\t</ExperimentalEditorProvider>\n\t\t</SlotFillProvider>\n\t);\n}\n\nexport default Editor;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAMA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAR,OAAA;AAKA,IAAAS,OAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,qBAAA,GAAAD,sBAAA,CAAAV,O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EAAGA,YAAc;IAC7ByC,cAAc,EAAG,KAAO;IACxBC,kBAAkB,EAAGhC,QAAU;IAAA,GAC1BT;EAAK,GAEV,IAAAqC,MAAA,CAAAC,aAAA,EAAClE,OAAA,CAAAsE,aAAa,QACb,IAAAL,MAAA,CAAAC,aAAA,EAAC7D,SAAA,CAAAkE,WAAW,MAAE,CAAC,EACf,IAAAN,MAAA,CAAAC,aAAA,EAACxD,qBAAA,CAAA8D,OAAoB;IAAClD,MAAM,EAAGQ,WAAW,CAACR;EAAQ,CAAE,CAAC,EACtD,IAAA2C,MAAA,CAAAC,aAAA,EAAC1D,OAAA,CAAAgE,OAAM;IAAC3C,WAAW,EAAGA;EAAa,CAAE,CAAC,EACtC,IAAAoC,MAAA,CAAAC,aAAA,EAACjD,wBAAwB;IAACwD,KAAK,EAAGtD;EAAmB,CAAE,CACzC,CAAC,EAChB,IAAA8C,MAAA,CAAAC,aAAA,EAAClE,OAAA,CAAA0E,eAAe,MAAE,CACS,CACX,CAAC;AAErB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAJ,OAAA,GAEcnD,MAAM"}
1
+ {"version":3,"names":["_data","require","_editor","_element","_components","_coreData","_commands","_blockEditor","_i18n","_layout","_interopRequireDefault","_editorInitialization","_store","_lockUnlock","_useNavigateToEntityRecord","ExperimentalEditorProvider","unlock","editorPrivateApis","BlockRemovalWarningModal","blockEditorPrivateApis","blockRemovalRules","__","Editor","postId","initialPostId","postType","initialPostType","settings","initialEdits","props","initialPost","currentPost","onNavigateToEntityRecord","onNavigateToPreviousEntityRecord","useNavigateToEntityRecord","post","template","useSelect","select","_getPostType$viewable","getEditedPostTemplate","editPostStore","getEntityRecord","getPostType","canUser","coreStore","getEditorSettings","editorStore","postObject","supportsTemplateMode","isViewable","viewable","canEditTemplate","editorSettings","useMemo","defaultRenderingMode","_react","createElement","SlotFillProvider","useSubRegistry","__unstableTemplate","ErrorBoundary","CommandMenu","default","rules","PostLockedModal","_default","exports"],"sources":["@wordpress/edit-post/src/editor.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useMemo } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { CommandMenu } from '@wordpress/commands';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport EditorInitialization from './components/editor-initialization';\nimport { store as editPostStore } from './store';\nimport { unlock } from './lock-unlock';\nimport useNavigateToEntityRecord from './hooks/use-navigate-to-entity-record';\n\nconst { ExperimentalEditorProvider } = unlock( editorPrivateApis );\nconst { BlockRemovalWarningModal } = unlock( blockEditorPrivateApis );\n// Prevent accidental removal of certain blocks, asking the user for\n// confirmation.\nconst blockRemovalRules = {\n\t'bindings/core/pattern-overrides': __(\n\t\t'Blocks from synced patterns that can have overriden content.'\n\t),\n};\n\nfunction Editor( {\n\tpostId: initialPostId,\n\tpostType: initialPostType,\n\tsettings,\n\tinitialEdits,\n\t...props\n} ) {\n\tconst {\n\t\tinitialPost,\n\t\tcurrentPost,\n\t\tonNavigateToEntityRecord,\n\t\tonNavigateToPreviousEntityRecord,\n\t} = useNavigateToEntityRecord( initialPostId, initialPostType );\n\n\tconst { post, template } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostTemplate } = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, canUser } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\n\t\t\tconst postObject = getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tcurrentPost.postType,\n\t\t\t\tcurrentPost.postId\n\t\t\t);\n\n\t\t\tconst supportsTemplateMode =\n\t\t\t\tgetEditorSettings().supportsTemplateMode;\n\t\t\tconst isViewable =\n\t\t\t\tgetPostType( currentPost.postType )?.viewable ?? false;\n\t\t\tconst canEditTemplate = canUser( 'create', 'templates' );\n\t\t\treturn {\n\t\t\t\ttemplate:\n\t\t\t\t\tsupportsTemplateMode &&\n\t\t\t\t\tisViewable &&\n\t\t\t\t\tcanEditTemplate &&\n\t\t\t\t\tcurrentPost.postType !== 'wp_template'\n\t\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t\t: null,\n\t\t\t\tpost: postObject,\n\t\t\t};\n\t\t},\n\t\t[ currentPost.postType, currentPost.postId ]\n\t);\n\n\tconst editorSettings = useMemo(\n\t\t() => ( {\n\t\t\t...settings,\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t\tdefaultRenderingMode: 'post-only',\n\t\t} ),\n\t\t[ settings, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord ]\n\t);\n\n\tif ( ! post ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<ExperimentalEditorProvider\n\t\t\t\tsettings={ editorSettings }\n\t\t\t\tpost={ post }\n\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t__unstableTemplate={ template }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t<CommandMenu />\n\t\t\t\t\t<EditorInitialization postId={ currentPost.postId } />\n\t\t\t\t\t<Layout initialPost={ initialPost } />\n\t\t\t\t\t<BlockRemovalWarningModal rules={ blockRemovalRules } />\n\t\t\t\t</ErrorBoundary>\n\t\t\t\t<PostLockedModal />\n\t\t\t</ExperimentalEditorProvider>\n\t\t</SlotFillProvider>\n\t);\n}\n\nexport default Editor;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAMA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,W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AA,EAACnD,SAAA,CAAAwD,WAAW,MAAE,CAAC,EACf,IAAAN,MAAA,CAAAC,aAAA,EAAC9C,qBAAA,CAAAoD,OAAoB;IAACxC,MAAM,EAAGQ,WAAW,CAACR;EAAQ,CAAE,CAAC,EACtD,IAAAiC,MAAA,CAAAC,aAAA,EAAChD,OAAA,CAAAsD,OAAM;IAACjC,WAAW,EAAGA;EAAa,CAAE,CAAC,EACtC,IAAA0B,MAAA,CAAAC,aAAA,EAACvC,wBAAwB;IAAC8C,KAAK,EAAG5C;EAAmB,CAAE,CACzC,CAAC,EAChB,IAAAoC,MAAA,CAAAC,aAAA,EAACvD,OAAA,CAAA+D,eAAe,MAAE,CACS,CACX,CAAC;AAErB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAJ,OAAA,GAEczC,MAAM"}
@@ -18,7 +18,6 @@ var _reactNativeBridge = require("@wordpress/react-native-bridge");
18
18
  var _components = require("@wordpress/components");
19
19
  var _coreData = require("@wordpress/core-data");
20
20
  var _layout = _interopRequireDefault(require("./components/layout"));
21
- var _store = require("./store");
22
21
  /**
23
22
  * External dependencies
24
23
  */
@@ -140,14 +139,14 @@ class Editor extends _element.Component {
140
139
  var _default = exports.default = (0, _compose.compose)([(0, _data.withSelect)(select => {
141
140
  const {
142
141
  getEditorMode
143
- } = select(_store.store);
142
+ } = select(_editor.store);
144
143
  return {
145
144
  mode: getEditorMode()
146
145
  };
147
146
  }), (0, _data.withDispatch)(dispatch => {
148
147
  const {
149
148
  switchEditorMode
150
- } = dispatch(_store.store);
149
+ } = dispatch(_editor.store);
151
150
  const {
152
151
  editEntityRecord
153
152
  } = dispatch(_coreData.store);
@@ -1 +1 @@
1
- {"version":3,"names":["_memize","_interopRequireDefault","require","_reactNative","_reactNativeGestureHandler","_element","_editor","_blocks","_data","_compose","_reactNativeBridge","_components","_coreData","_layout","_store","Editor","Component","constructor","props","arguments","galleryWithImageBlocks","window","wp","galleryBlockV2Enabled","initialHtmlModeEnabled","mode","switchEditorMode","getEditorSettings","memize","maxSize","setTitleRef","bind","settings","isRTL","I18nManager","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","type","status","meta","_react","createElement","GestureHandlerRootView","style","flex","SlotFillProvider","EditorProvider","useSubRegistry","default","_default","exports","compose","withSelect","select","getEditorMode","editPostStore","withDispatch","dispatch","coreStore"],"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 } 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( settings ) {\n\t\tsettings = {\n\t\t\t...settings,\n\t\t\tisRTL: I18nManager.isRTL,\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\tinitialEdits,\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( settings );\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 { getEditorMode } = select( editPostStore );\n\n\t\treturn {\n\t\t\tmode: getEditorMode(),\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,I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M;EAC7B,MAAM;IAAE5D;EAAiB,CAAC,GAAG4D,QAAQ,CAAEF,YAAc,CAAC;EACtD,MAAM;IAAEhD;EAAiB,CAAC,GAAGkD,QAAQ,CAAEC,eAAU,CAAC;EAClD,OAAO;IACN7D,gBAAgB;IAChBU;EACD,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAErB,MAAO,CAAC"}
1
+ {"version":3,"names":["_memize","_interopRequireDefault","require","_reactNative","_reactNativeGestureHandler","_element","_editor","_blocks","_data","_compose","_reactNativeBridge","_components","_coreData","_layout","Editor","Component","constructor","props","arguments","galleryWithImageBlocks","window","wp","galleryBlockV2Enabled","initialHtmlModeEnabled","mode","switchEditorMode","getEditorSettings","memize","maxSize","setTitleRef","bind","settings","isRTL","I18nManager","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","type","status","meta","_react","createElement","GestureHandlerRootView","style","flex","SlotFillProvider","EditorProvider","useSubRegistry","default","_default","exports","compose","withSelect","select","getEditorMode","editorStore","withDispatch","dispatch","coreStore"],"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, store as editorStore } from '@wordpress/editor';\nimport { parse, serialize } 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';\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( settings ) {\n\t\tsettings = {\n\t\t\t...settings,\n\t\t\tisRTL: I18nManager.isRTL,\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\tinitialEdits,\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( settings );\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 { getEditorMode } = select( editorStore );\n\n\t\treturn {\n\t\t\tmode: getEditorMode(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { switchEditorMode } = dispatch( editorStore );\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;AAzBA;AACA;AACA;;AAKA;AACA;AACA;;AAaA;AACA;AACA;;AAGA,MAAMY,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,C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+D,OAAM;MAAC/C,WAAW,EAAG,IAAI,CAACA;IAAa,CAAE,CAC3B,CACC,CACK,CAAC;EAE3B;AACD;AAAC,IAAAgD,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAEc,IAAAG,gBAAO,EAAE,CACvB,IAAAC,gBAAU,EAAIC,MAAM,IAAM;EACzB,MAAM;IAAEC;EAAc,CAAC,GAAGD,MAAM,CAAEE,aAAY,CAAC;EAE/C,OAAO;IACN3D,IAAI,EAAE0D,aAAa,CAAC;EACrB,CAAC;AACF,CAAE,CAAC,EACH,IAAAE,kBAAY,EAAIC,QAAQ,IAAM;EAC7B,MAAM;IAAE5D;EAAiB,CAAC,GAAG4D,QAAQ,CAAEF,aAAY,CAAC;EACpD,MAAM;IAAEhD;EAAiB,CAAC,GAAGkD,QAAQ,CAAEC,eAAU,CAAC;EAClD,OAAO;IACN7D,gBAAgB;IAChBU;EACD,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAErB,MAAO,CAAC"}
@@ -26,42 +26,22 @@ var _store = require("../../store");
26
26
  function useCommonCommands() {
27
27
  const {
28
28
  openGeneralSidebar,
29
- closeGeneralSidebar,
30
- switchEditorMode,
31
- toggleDistractionFree
29
+ closeGeneralSidebar
32
30
  } = (0, _data.useDispatch)(_store.store);
33
31
  const {
34
32
  openModal
35
33
  } = (0, _data.useDispatch)(_interface.store);
36
34
  const {
37
- editorMode,
38
35
  activeSidebar,
39
- isListViewOpen,
40
36
  isFullscreen,
41
- isPublishSidebarEnabled,
42
- showBlockBreadcrumbs,
43
- isDistractionFree,
44
- isTopToolbar,
45
- isFocusMode
37
+ isPublishSidebarEnabled
46
38
  } = (0, _data.useSelect)(select => {
47
39
  const {
48
40
  get
49
41
  } = select(_preferences.store);
50
- const {
51
- getEditorMode
52
- } = select(_store.store);
53
- const {
54
- isListViewOpened
55
- } = select(_editor.store);
56
42
  return {
57
43
  activeSidebar: select(_interface.store).getActiveComplementaryArea(_store.store.name),
58
- editorMode: getEditorMode(),
59
- isListViewOpen: isListViewOpened(),
60
44
  isPublishSidebarEnabled: select(_editor.store).isPublishSidebarEnabled(),
61
- showBlockBreadcrumbs: get('core', 'showBlockBreadcrumbs'),
62
- isDistractionFree: get('core', 'distractionFree'),
63
- isFocusMode: get('core', 'focusMode'),
64
- isTopToolbar: get('core', 'fixedToolbar'),
65
45
  isFullscreen: get('core/edit-post', 'fullscreenMode')
66
46
  };
67
47
  }, []);
@@ -71,13 +51,6 @@ function useCommonCommands() {
71
51
  const {
72
52
  createInfoNotice
73
53
  } = (0, _data.useDispatch)(_notices.store);
74
- const {
75
- __unstableSaveForPreview,
76
- setIsListViewOpened
77
- } = (0, _data.useDispatch)(_editor.store);
78
- const {
79
- getCurrentPostId
80
- } = (0, _data.useSelect)(_editor.store);
81
54
  (0, _commands.useCommand)({
82
55
  name: 'core/open-settings-sidebar',
83
56
  label: (0, _i18n.__)('Toggle settings sidebar'),
@@ -108,36 +81,6 @@ function useCommonCommands() {
108
81
  }
109
82
  }
110
83
  });
111
- (0, _commands.useCommand)({
112
- name: 'core/toggle-distraction-free',
113
- label: isDistractionFree ? (0, _i18n.__)('Exit Distraction Free') : (0, _i18n.__)('Enter Distraction Free '),
114
- callback: ({
115
- close
116
- }) => {
117
- toggleDistractionFree();
118
- close();
119
- }
120
- });
121
- (0, _commands.useCommand)({
122
- name: 'core/toggle-spotlight-mode',
123
- label: (0, _i18n.__)('Toggle spotlight'),
124
- callback: ({
125
- close
126
- }) => {
127
- toggle('core', 'focusMode');
128
- close();
129
- createInfoNotice(isFocusMode ? (0, _i18n.__)('Spotlight off.') : (0, _i18n.__)('Spotlight on.'), {
130
- id: 'core/edit-post/toggle-spotlight-mode/notice',
131
- type: 'snackbar',
132
- actions: [{
133
- label: (0, _i18n.__)('Undo'),
134
- onClick: () => {
135
- toggle('core', 'focusMode');
136
- }
137
- }]
138
- });
139
- }
140
- });
141
84
  (0, _commands.useCommand)({
142
85
  name: 'core/toggle-fullscreen-mode',
143
86
  label: isFullscreen ? (0, _i18n.__)('Exit fullscreen') : (0, _i18n.__)('Enter fullscreen'),
@@ -159,55 +102,6 @@ function useCommonCommands() {
159
102
  });
160
103
  }
161
104
  });
162
- (0, _commands.useCommand)({
163
- name: 'core/toggle-list-view',
164
- label: isListViewOpen ? (0, _i18n.__)('Close List View') : (0, _i18n.__)('Open List View'),
165
- icon: _icons.listView,
166
- callback: ({
167
- close
168
- }) => {
169
- setIsListViewOpened(!isListViewOpen);
170
- close();
171
- createInfoNotice(isListViewOpen ? (0, _i18n.__)('List View off.') : (0, _i18n.__)('List View on.'), {
172
- id: 'core/edit-post/toggle-list-view/notice',
173
- type: 'snackbar'
174
- });
175
- }
176
- });
177
- (0, _commands.useCommand)({
178
- name: 'core/toggle-top-toolbar',
179
- label: (0, _i18n.__)('Toggle top toolbar'),
180
- callback: ({
181
- close
182
- }) => {
183
- toggle('core', 'fixedToolbar');
184
- if (isDistractionFree) {
185
- toggleDistractionFree();
186
- }
187
- close();
188
- createInfoNotice(isTopToolbar ? (0, _i18n.__)('Top toolbar off.') : (0, _i18n.__)('Top toolbar on.'), {
189
- id: 'core/edit-post/toggle-top-toolbar/notice',
190
- type: 'snackbar',
191
- actions: [{
192
- label: (0, _i18n.__)('Undo'),
193
- onClick: () => {
194
- toggle('core', 'fixedToolbar');
195
- }
196
- }]
197
- });
198
- }
199
- });
200
- (0, _commands.useCommand)({
201
- name: 'core/toggle-code-editor',
202
- label: editorMode === 'visual' ? (0, _i18n.__)('Open code editor') : (0, _i18n.__)('Exit code editor'),
203
- icon: _icons.code,
204
- callback: ({
205
- close
206
- }) => {
207
- switchEditorMode(editorMode === 'visual' ? 'text' : 'visual');
208
- close();
209
- }
210
- });
211
105
  (0, _commands.useCommand)({
212
106
  name: 'core/open-preferences',
213
107
  label: (0, _i18n.__)('Editor preferences'),
@@ -223,20 +117,6 @@ function useCommonCommands() {
223
117
  openModal(_keyboardShortcutHelpModal.KEYBOARD_SHORTCUT_HELP_MODAL_NAME);
224
118
  }
225
119
  });
226
- (0, _commands.useCommand)({
227
- name: 'core/toggle-breadcrumbs',
228
- label: showBlockBreadcrumbs ? (0, _i18n.__)('Hide block breadcrumbs') : (0, _i18n.__)('Show block breadcrumbs'),
229
- callback: ({
230
- close
231
- }) => {
232
- toggle('core', 'showBlockBreadcrumbs');
233
- close();
234
- createInfoNotice(showBlockBreadcrumbs ? (0, _i18n.__)('Breadcrumbs hidden.') : (0, _i18n.__)('Breadcrumbs visible.'), {
235
- id: 'core/edit-post/toggle-breadcrumbs/notice',
236
- type: 'snackbar'
237
- });
238
- }
239
- });
240
120
  (0, _commands.useCommand)({
241
121
  name: 'core/toggle-publish-sidebar',
242
122
  label: isPublishSidebarEnabled ? (0, _i18n.__)('Disable pre-publish checks') : (0, _i18n.__)('Enable pre-publish checks'),
@@ -252,18 +132,5 @@ function useCommonCommands() {
252
132
  });
253
133
  }
254
134
  });
255
- (0, _commands.useCommand)({
256
- name: 'core/preview-link',
257
- label: (0, _i18n.__)('Preview in a new tab'),
258
- icon: _icons.external,
259
- callback: async ({
260
- close
261
- }) => {
262
- close();
263
- const postId = getCurrentPostId();
264
- const link = await __unstableSaveForPreview();
265
- window.open(link, `wp-preview-${postId}`);
266
- }
267
- });
268
135
  }
269
136
  //# sourceMappingURL=use-common-commands.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_i18n","_icons","_commands","_preferences","_interface","_editor","_notices","_keyboardShortcutHelpModal","_preferencesModal","_store","useCommonCommands","openGeneralSidebar","closeGeneralSidebar","switchEditorMode","toggleDistractionFree","useDispatch","editPostStore","openModal","interfaceStore","editorMode","activeSidebar","isListViewOpen","isFullscreen","isPublishSidebarEnabled","showBlockBreadcrumbs","isDistractionFree","isTopToolbar","isFocusMode","useSelect","select","get","preferencesStore","getEditorMode","isListViewOpened","editorStore","getActiveComplementaryArea","name","toggle","createInfoNotice","noticesStore","__unstableSaveForPreview","setIsListViewOpened","getCurrentPostId","useCommand","label","__","icon","isRTL","drawerLeft","drawerRight","callback","close","blockDefault","id","type","actions","onClick","fullscreen","listView","code","PREFERENCES_MODAL_NAME","keyboard","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","formatListBullets","external","postId","link","window","open"],"sources":["@wordpress/edit-post/src/hooks/commands/use-common-commands.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\tcode,\n\tdrawerLeft,\n\tdrawerRight,\n\tblockDefault,\n\tkeyboard,\n\tfullscreen,\n\tlistView,\n\texternal,\n\tformatListBullets,\n} from '@wordpress/icons';\nimport { useCommand } from '@wordpress/commands';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { KEYBOARD_SHORTCUT_HELP_MODAL_NAME } from '../../components/keyboard-shortcut-help-modal';\nimport { PREFERENCES_MODAL_NAME } from '../../components/preferences-modal';\nimport { store as editPostStore } from '../../store';\n\nexport default function useCommonCommands() {\n\tconst {\n\t\topenGeneralSidebar,\n\t\tcloseGeneralSidebar,\n\t\tswitchEditorMode,\n\t\ttoggleDistractionFree,\n\t} = useDispatch( editPostStore );\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst {\n\t\teditorMode,\n\t\tactiveSidebar,\n\t\tisListViewOpen,\n\t\tisFullscreen,\n\t\tisPublishSidebarEnabled,\n\t\tshowBlockBreadcrumbs,\n\t\tisDistractionFree,\n\t\tisTopToolbar,\n\t\tisFocusMode,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getEditorMode } = select( editPostStore );\n\t\tconst { isListViewOpened } = select( editorStore );\n\n\t\treturn {\n\t\t\tactiveSidebar: select( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\teditPostStore.name\n\t\t\t),\n\t\t\teditorMode: getEditorMode(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tisPublishSidebarEnabled:\n\t\t\t\tselect( editorStore ).isPublishSidebarEnabled(),\n\t\t\tshowBlockBreadcrumbs: get( 'core', 'showBlockBreadcrumbs' ),\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\tisFocusMode: get( 'core', 'focusMode' ),\n\t\t\tisTopToolbar: get( 'core', 'fixedToolbar' ),\n\t\t\tisFullscreen: get( 'core/edit-post', 'fullscreenMode' ),\n\t\t};\n\t}, [] );\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst { createInfoNotice } = useDispatch( noticesStore );\n\tconst { __unstableSaveForPreview, setIsListViewOpened } =\n\t\tuseDispatch( editorStore );\n\tconst { getCurrentPostId } = useSelect( editorStore );\n\n\tuseCommand( {\n\t\tname: 'core/open-settings-sidebar',\n\t\tlabel: __( 'Toggle settings sidebar' ),\n\t\ticon: isRTL() ? drawerLeft : drawerRight,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/document' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-post/document' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-block-inspector',\n\t\tlabel: __( 'Toggle block inspector' ),\n\t\ticon: blockDefault,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/block' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-post/block' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-distraction-free',\n\t\tlabel: isDistractionFree\n\t\t\t? __( 'Exit Distraction Free' )\n\t\t\t: __( 'Enter Distraction Free ' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggleDistractionFree();\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-spotlight-mode',\n\t\tlabel: __( 'Toggle spotlight' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core', 'focusMode' );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisFocusMode ? __( 'Spotlight off.' ) : __( 'Spotlight on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-post/toggle-spotlight-mode/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\ttoggle( 'core', 'focusMode' );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-fullscreen-mode',\n\t\tlabel: isFullscreen\n\t\t\t? __( 'Exit fullscreen' )\n\t\t\t: __( 'Enter fullscreen' ),\n\t\ticon: fullscreen,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'fullscreenMode' );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisFullscreen ? __( 'Fullscreen off.' ) : __( 'Fullscreen on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-post/toggle-fullscreen-mode/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\ttoggle( 'core/edit-post', 'fullscreenMode' );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-list-view',\n\t\tlabel: isListViewOpen\n\t\t\t? __( 'Close List View' )\n\t\t\t: __( 'Open List View' ),\n\t\ticon: listView,\n\t\tcallback: ( { close } ) => {\n\t\t\tsetIsListViewOpened( ! isListViewOpen );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisListViewOpen ? __( 'List View off.' ) : __( 'List View on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-post/toggle-list-view/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-top-toolbar',\n\t\tlabel: __( 'Toggle top toolbar' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core', 'fixedToolbar' );\n\t\t\tif ( isDistractionFree ) {\n\t\t\t\ttoggleDistractionFree();\n\t\t\t}\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisTopToolbar\n\t\t\t\t\t? __( 'Top toolbar off.' )\n\t\t\t\t\t: __( 'Top toolbar on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-post/toggle-top-toolbar/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\ttoggle( 'core', 'fixedToolbar' );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-code-editor',\n\t\tlabel:\n\t\t\teditorMode === 'visual'\n\t\t\t\t? __( 'Open code editor' )\n\t\t\t\t: __( 'Exit code editor' ),\n\t\ticon: code,\n\t\tcallback: ( { close } ) => {\n\t\t\tswitchEditorMode( editorMode === 'visual' ? 'text' : 'visual' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-preferences',\n\t\tlabel: __( 'Editor preferences' ),\n\t\tcallback: () => {\n\t\t\topenModal( PREFERENCES_MODAL_NAME );\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-shortcut-help',\n\t\tlabel: __( 'Keyboard shortcuts' ),\n\t\ticon: keyboard,\n\t\tcallback: () => {\n\t\t\topenModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-breadcrumbs',\n\t\tlabel: showBlockBreadcrumbs\n\t\t\t? __( 'Hide block breadcrumbs' )\n\t\t\t: __( 'Show block breadcrumbs' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core', 'showBlockBreadcrumbs' );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tshowBlockBreadcrumbs\n\t\t\t\t\t? __( 'Breadcrumbs hidden.' )\n\t\t\t\t\t: __( 'Breadcrumbs visible.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-post/toggle-breadcrumbs/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-publish-sidebar',\n\t\tlabel: isPublishSidebarEnabled\n\t\t\t? __( 'Disable pre-publish checks' )\n\t\t\t: __( 'Enable pre-publish checks' ),\n\t\ticon: formatListBullets,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\ttoggle( 'core/edit-post', 'isPublishSidebarEnabled' );\n\t\t\tcreateInfoNotice(\n\t\t\t\tisPublishSidebarEnabled\n\t\t\t\t\t? __( 'Pre-publish checks disabled.' )\n\t\t\t\t\t: __( 'Pre-publish checks enabled.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-post/publish-sidebar/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/preview-link',\n\t\tlabel: __( 'Preview in a new tab' ),\n\t\ticon: external,\n\t\tcallback: async ( { close } ) => {\n\t\t\tclose();\n\t\t\tconst postId = getCurrentPostId();\n\t\t\tconst link = await __unstableSaveForPreview();\n\t\t\twindow.open( link, `wp-preview-${ postId }` );\n\t\t},\n\t} );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAWA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAKA,IAAAQ,0BAAA,GAAAR,OAAA;AACA,IAAAS,iBAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AA3BA;AACA;AACA;;AAoBA;AACA;AACA;;AAKe,SAASW,iBAAiBA,CAAA,EAAG;EAC3C,MAAM;IACLC,kBAAkB;IAClBC,mBAAmB;IACnBC,gBAAgB;IAChBC;EACD,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAc,CAAC;EAChC,MAAM;IAAEC;EAAU,CAAC,GAAG,IAAAF,iBAAW,EAAEG,gBAAe,CAAC;EACnD,MAAM;IACLC,UAAU;IACVC,aAAa;IACbC,cAAc;IACdC,YAAY;IACZC,uBAAuB;IACvBC,oBAAoB;IACpBC,iBAAiB;IACjBC,YAAY;IACZC;EACD,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC5B,MAAM;MAAEC;IAAI,CAAC,GAAGD,MAAM,CAAEE,kBAAiB,CAAC;IAC1C,MAAM;MAAEC;IAAc,CAAC,GAAGH,MAAM,CAAEb,YAAc,CAAC;IACjD,MAAM;MAAEiB;IAAiB,CAAC,GAAGJ,MAAM,CAAEK,aAAY,CAAC;IAElD,OAAO;MACNd,aAAa,EAAES,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E,6BAA8B,CAAC,EACtC;QACCQ,EAAE,EAAE,uCAAuC;QAC3CC,IAAI,EAAE;MACP,CACD,CAAC;IACF;EACD,CAAE,CAAC;EAEH,IAAAX,oBAAU,EAAE;IACXP,IAAI,EAAE,mBAAmB;IACzBQ,KAAK,EAAE,IAAAC,QAAE,EAAE,sBAAuB,CAAC;IACnCC,IAAI,EAAEkB,eAAQ;IACdd,QAAQ,EAAE,MAAAA,CAAQ;MAAEC;IAAM,CAAC,KAAM;MAChCA,KAAK,CAAC,CAAC;MACP,MAAMc,MAAM,GAAGvB,gBAAgB,CAAC,CAAC;MACjC,MAAMwB,IAAI,GAAG,MAAM1B,wBAAwB,CAAC,CAAC;MAC7C2B,MAAM,CAACC,IAAI,CAAEF,IAAI,EAAG,cAAcD,MAAQ,EAAE,CAAC;IAC9C;EACD,CAAE,CAAC;AACJ"}
1
+ {"version":3,"names":["_data","require","_i18n","_icons","_commands","_preferences","_interface","_editor","_notices","_keyboardShortcutHelpModal","_preferencesModal","_store","useCommonCommands","openGeneralSidebar","closeGeneralSidebar","useDispatch","editPostStore","openModal","interfaceStore","activeSidebar","isFullscreen","isPublishSidebarEnabled","useSelect","select","get","preferencesStore","getActiveComplementaryArea","name","editorStore","toggle","createInfoNotice","noticesStore","useCommand","label","__","icon","isRTL","drawerLeft","drawerRight","callback","close","blockDefault","fullscreen","id","type","actions","onClick","PREFERENCES_MODAL_NAME","keyboard","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","formatListBullets"],"sources":["@wordpress/edit-post/src/hooks/commands/use-common-commands.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\tdrawerLeft,\n\tdrawerRight,\n\tblockDefault,\n\tkeyboard,\n\tfullscreen,\n\tformatListBullets,\n} from '@wordpress/icons';\nimport { useCommand } from '@wordpress/commands';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { KEYBOARD_SHORTCUT_HELP_MODAL_NAME } from '../../components/keyboard-shortcut-help-modal';\nimport { PREFERENCES_MODAL_NAME } from '../../components/preferences-modal';\nimport { store as editPostStore } from '../../store';\n\nexport default function useCommonCommands() {\n\tconst { openGeneralSidebar, closeGeneralSidebar } =\n\t\tuseDispatch( editPostStore );\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst { activeSidebar, isFullscreen, isPublishSidebarEnabled } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { get } = select( preferencesStore );\n\n\t\t\treturn {\n\t\t\t\tactiveSidebar: select(\n\t\t\t\t\tinterfaceStore\n\t\t\t\t).getActiveComplementaryArea( editPostStore.name ),\n\t\t\t\tisPublishSidebarEnabled:\n\t\t\t\t\tselect( editorStore ).isPublishSidebarEnabled(),\n\t\t\t\tisFullscreen: get( 'core/edit-post', 'fullscreenMode' ),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst { createInfoNotice } = useDispatch( noticesStore );\n\n\tuseCommand( {\n\t\tname: 'core/open-settings-sidebar',\n\t\tlabel: __( 'Toggle settings sidebar' ),\n\t\ticon: isRTL() ? drawerLeft : drawerRight,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/document' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-post/document' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-block-inspector',\n\t\tlabel: __( 'Toggle block inspector' ),\n\t\ticon: blockDefault,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/block' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-post/block' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-fullscreen-mode',\n\t\tlabel: isFullscreen\n\t\t\t? __( 'Exit fullscreen' )\n\t\t\t: __( 'Enter fullscreen' ),\n\t\ticon: fullscreen,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'fullscreenMode' );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisFullscreen ? __( 'Fullscreen off.' ) : __( 'Fullscreen on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-post/toggle-fullscreen-mode/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\ttoggle( 'core/edit-post', 'fullscreenMode' );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-preferences',\n\t\tlabel: __( 'Editor preferences' ),\n\t\tcallback: () => {\n\t\t\topenModal( PREFERENCES_MODAL_NAME );\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-shortcut-help',\n\t\tlabel: __( 'Keyboard shortcuts' ),\n\t\ticon: keyboard,\n\t\tcallback: () => {\n\t\t\topenModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-publish-sidebar',\n\t\tlabel: isPublishSidebarEnabled\n\t\t\t? __( 'Disable pre-publish checks' )\n\t\t\t: __( 'Enable pre-publish checks' ),\n\t\ticon: formatListBullets,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\ttoggle( 'core/edit-post', 'isPublishSidebarEnabled' );\n\t\t\tcreateInfoNotice(\n\t\t\t\tisPublishSidebarEnabled\n\t\t\t\t\t? __( 'Pre-publish checks disabled.' )\n\t\t\t\t\t: __( 'Pre-publish checks enabled.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-post/publish-sidebar/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAQA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAKA,IAAAQ,0BAAA,GAAAR,OAAA;AACA,IAAAS,iBAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AAxBA;AACA;AACA;;AAiBA;AACA;AACA;;AAKe,SAASW,iBAAiBA,CAAA,EAAG;EAC3C,MAAM;IAAEC,kBAAkB;IAAEC;EAAoB,CAAC,GAChD,IAAAC,iBAAW,EAAEC,YAAc,CAAC;EAC7B,MAAM;IAAEC;EAAU,CAAC,GAAG,IAAAF,iBAAW,EAAEG,gBAAe,CAAC;EACnD,MAAM;IAAEC,aAAa;IAAEC,YAAY;IAAEC;EAAwB,CAAC,GAAG,IAAAC,eAAS,EACvEC,MAAM,IAAM;IACb,MAAM;MAAEC;IAAI,CAAC,GAAGD,MAAM,CAAEE,kBAAiB,CAAC;IAE1C,OAAO;MACNN,aAAa,EAAEI,MAAM,CACpBL,gBACD,CAAC,CAACQ,0BAA0B,CAAEV,YAAa,CAACW,IAAK,CAAC;MAClDN,uBAAuB,EACtBE,MAAM,CAAEK,aAAY,CAAC,CAACP,uBAAuB,CAAC,CAAC;MAChDD,YAAY,EAAEI,GAAG,CAAE,gBAAgB,EAAE,gBAAi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,GACpC,IAAAA,QAAE,EAAE,6BAA8B,CAAC,EACtC;QACCS,EAAE,EAAE,uCAAuC;QAC3CC,IAAI,EAAE;MACP,CACD,CAAC;IACF;EACD,CAAE,CAAC;AACJ"}
package/build/index.js CHANGED
@@ -79,7 +79,6 @@ var _blockLibrary = require("@wordpress/block-library");
79
79
  var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
80
80
  var _element = require("@wordpress/element");
81
81
  var _data = require("@wordpress/data");
82
- var _hooks = require("@wordpress/hooks");
83
82
  var _preferences = require("@wordpress/preferences");
84
83
  var _widgets = require("@wordpress/widgets");
85
84
  var _editor = require("@wordpress/editor");
@@ -123,12 +122,12 @@ const {
123
122
  */
124
123
  exports.__experimentalPluginPostExcerpt = __experimentalPluginPostExcerpt;
125
124
  function initializeEditor(id, postType, postId, settings, initialEdits) {
125
+ const isMediumOrBigger = window.matchMedia('(min-width: 782px)').matches;
126
126
  const target = document.getElementById(id);
127
127
  const root = (0, _element.createRoot)(target);
128
128
  (0, _data.dispatch)(_preferences.store).setDefaults('core/edit-post', {
129
129
  fullscreenMode: true,
130
130
  isPublishSidebarEnabled: true,
131
- preferredStyleVariations: {},
132
131
  themeStyles: true,
133
132
  welcomeGuide: true,
134
133
  welcomeGuideTemplate: true
@@ -148,7 +147,8 @@ function initializeEditor(id, postType, postId, settings, initialEdits) {
148
147
 
149
148
  // Check if the block list view should be open by default.
150
149
  // If `distractionFree` mode is enabled, the block list view should not be open.
151
- if ((0, _data.select)(_preferences.store).get('core', 'showListViewByDefault') && !(0, _data.select)(_preferences.store).get('core', 'distractionFree')) {
150
+ // This behavior is disabled for small viewports.
151
+ if (isMediumOrBigger && (0, _data.select)(_preferences.store).get('core', 'showListViewByDefault') && !(0, _data.select)(_preferences.store).get('core', 'distractionFree')) {
152
152
  (0, _data.dispatch)(_editor.store).setIsListViewOpened(true);
153
153
  }
154
154
  (0, _blockLibrary.registerCoreBlocks)();
@@ -164,34 +164,6 @@ function initializeEditor(id, postType, postId, settings, initialEdits) {
164
164
  });
165
165
  }
166
166
 
167
- /*
168
- * Prevent adding template part in the post editor.
169
- * Only add the filter when the post editor is initialized, not imported.
170
- * Also only add the filter(s) after registerCoreBlocks()
171
- * so that common filters in the block library are not overwritten.
172
- */
173
- (0, _hooks.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removeTemplatePartsFromInserter', (canInsert, blockType) => {
174
- if (blockType.name === 'core/template-part') {
175
- return false;
176
- }
177
- return canInsert;
178
- });
179
-
180
- /*
181
- * Prevent adding post content block (except in query block) in the post editor.
182
- * Only add the filter when the post editor is initialized, not imported.
183
- * Also only add the filter(s) after registerCoreBlocks()
184
- * so that common filters in the block library are not overwritten.
185
- */
186
- (0, _hooks.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removePostContentFromInserter', (canInsert, blockType, rootClientId, {
187
- getBlockParentsByBlockName
188
- }) => {
189
- if (blockType.name === 'core/post-content') {
190
- return getBlockParentsByBlockName(rootClientId, 'core/query').length > 0;
191
- }
192
- return canInsert;
193
- });
194
-
195
167
  // Show a console log warning if the browser is not in Standards rendering mode.
196
168
  const documentMode = document.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';
197
169
  if (documentMode !== 'Standards') {