@wordpress/edit-post 7.28.3 → 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 (81) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/header/index.js +1 -1
  3. package/build/components/header/index.js.map +1 -1
  4. package/build/components/header/more-menu/index.js +6 -2
  5. package/build/components/header/more-menu/index.js.map +1 -1
  6. package/build/components/header/writing-menu/index.js +2 -6
  7. package/build/components/header/writing-menu/index.js.map +1 -1
  8. package/build/components/keyboard-shortcuts/index.js +1 -38
  9. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  10. package/build/components/layout/index.js +2 -3
  11. package/build/components/layout/index.js.map +1 -1
  12. package/build/components/layout/index.native.js +2 -5
  13. package/build/components/layout/index.native.js.map +1 -1
  14. package/build/components/text-editor/index.js +1 -1
  15. package/build/components/text-editor/index.js.map +1 -1
  16. package/build/editor.js +2 -16
  17. package/build/editor.js.map +1 -1
  18. package/build/editor.native.js +2 -3
  19. package/build/editor.native.js.map +1 -1
  20. package/build/hooks/commands/use-common-commands.js +2 -135
  21. package/build/hooks/commands/use-common-commands.js.map +1 -1
  22. package/build/index.js +0 -30
  23. package/build/index.js.map +1 -1
  24. package/build/index.native.js +0 -1
  25. package/build/index.native.js.map +1 -1
  26. package/build/store/actions.js +24 -77
  27. package/build/store/actions.js.map +1 -1
  28. package/build/store/selectors.js +0 -12
  29. package/build/store/selectors.js.map +1 -1
  30. package/build-module/components/header/index.js +1 -1
  31. package/build-module/components/header/index.js.map +1 -1
  32. package/build-module/components/header/more-menu/index.js +5 -1
  33. package/build-module/components/header/more-menu/index.js.map +1 -1
  34. package/build-module/components/header/writing-menu/index.js +2 -6
  35. package/build-module/components/header/writing-menu/index.js.map +1 -1
  36. package/build-module/components/keyboard-shortcuts/index.js +1 -38
  37. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  38. package/build-module/components/layout/index.js +3 -4
  39. package/build-module/components/layout/index.js.map +1 -1
  40. package/build-module/components/layout/index.native.js +2 -5
  41. package/build-module/components/layout/index.native.js.map +1 -1
  42. package/build-module/components/text-editor/index.js +1 -1
  43. package/build-module/components/text-editor/index.js.map +1 -1
  44. package/build-module/editor.js +3 -17
  45. package/build-module/editor.js.map +1 -1
  46. package/build-module/editor.native.js +3 -4
  47. package/build-module/editor.native.js.map +1 -1
  48. package/build-module/hooks/commands/use-common-commands.js +3 -136
  49. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  50. package/build-module/index.js +0 -30
  51. package/build-module/index.js.map +1 -1
  52. package/build-module/index.native.js +0 -1
  53. package/build-module/index.native.js.map +1 -1
  54. package/build-module/store/actions.js +23 -75
  55. package/build-module/store/actions.js.map +1 -1
  56. package/build-module/store/selectors.js +0 -12
  57. package/build-module/store/selectors.js.map +1 -1
  58. package/build-style/style-rtl.css +6 -6
  59. package/build-style/style.css +6 -6
  60. package/package.json +32 -32
  61. package/src/components/header/index.js +1 -1
  62. package/src/components/header/more-menu/index.js +4 -1
  63. package/src/components/header/writing-menu/index.js +2 -6
  64. package/src/components/keyboard-shortcuts/index.js +3 -50
  65. package/src/components/layout/index.js +3 -4
  66. package/src/components/layout/index.native.js +1 -3
  67. package/src/components/text-editor/index.js +1 -1
  68. package/src/editor.js +31 -53
  69. package/src/editor.native.js +3 -4
  70. package/src/hooks/commands/use-common-commands.js +17 -170
  71. package/src/index.js +0 -44
  72. package/src/index.native.js +0 -1
  73. package/src/store/actions.js +24 -126
  74. package/src/store/selectors.js +0 -18
  75. package/src/store/test/actions.js +0 -146
  76. package/src/style.scss +1 -2
  77. package/build/components/header/mode-switcher/index.js +0 -87
  78. package/build/components/header/mode-switcher/index.js.map +0 -1
  79. package/build-module/components/header/mode-switcher/index.js +0 -81
  80. package/build-module/components/header/mode-switcher/index.js.map +0 -1
  81. package/src/components/header/mode-switcher/index.js +0 -91
@@ -10,7 +10,7 @@ import { GestureHandlerRootView } from 'react-native-gesture-handler';
10
10
  * WordPress dependencies
11
11
  */
12
12
  import { Component } from '@wordpress/element';
13
- import { EditorProvider } from '@wordpress/editor';
13
+ import { EditorProvider, store as editorStore } from '@wordpress/editor';
14
14
  import { parse, serialize } from '@wordpress/blocks';
15
15
  import { withDispatch, withSelect } from '@wordpress/data';
16
16
  import { compose } from '@wordpress/compose';
@@ -22,7 +22,6 @@ import { store as coreStore } from '@wordpress/core-data';
22
22
  * Internal dependencies
23
23
  */
24
24
  import Layout from './components/layout';
25
- import { store as editPostStore } from './store';
26
25
  class Editor extends Component {
27
26
  constructor(props) {
28
27
  super(...arguments);
@@ -132,14 +131,14 @@ class Editor extends Component {
132
131
  export default compose([withSelect(select => {
133
132
  const {
134
133
  getEditorMode
135
- } = select(editPostStore);
134
+ } = select(editorStore);
136
135
  return {
137
136
  mode: getEditorMode()
138
137
  };
139
138
  }), withDispatch(dispatch => {
140
139
  const {
141
140
  switchEditorMode
142
- } = dispatch(editPostStore);
141
+ } = dispatch(editorStore);
143
142
  const {
144
143
  editEntityRecord
145
144
  } = dispatch(coreStore);
@@ -1 +1 @@
1
- {"version":3,"names":["memize","I18nManager","GestureHandlerRootView","Component","EditorProvider","parse","serialize","withDispatch","withSelect","compose","subscribeSetFocusOnTitle","subscribeFeaturedImageIdNativeUpdated","SlotFillProvider","store","coreStore","Layout","editPostStore","Editor","constructor","props","arguments","galleryWithImageBlocks","window","wp","galleryBlockV2Enabled","initialHtmlModeEnabled","mode","switchEditorMode","getEditorSettings","maxSize","setTitleRef","bind","settings","isRTL","componentDidMount","editEntityRecord","postType","postId","subscriptionParentSetFocusOnTitle","postTitleRef","focus","focusTitleWhenAvailable","subscriptionParentFeaturedImageIdNativeUpdated","payload","featured_media","featuredImageId","undoIgnore","componentWillUnmount","remove","titleRef","render","initialEdits","post","initialHtml","editorSettings","normalizedPost","id","title","raw","initialTitle","content","type","status","meta","createElement","style","flex","useSubRegistry","select","getEditorMode","dispatch"],"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":";AAAA;AACA;AACA;AACA,OAAOA,MAAM,MAAM,QAAQ;AAC3B,SAASC,WAAW,QAAQ,cAAc;AAC1C,SAASC,sBAAsB,QAAQ,8BAA8B;;AAErE;AACA;AACA;AACA,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,KAAK,EAAEC,SAAS,QAAQ,mBAAmB;AACpD,SAASC,YAAY,EAAEC,UAAU,QAAQ,iBAAiB;AAC1D,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SACCC,wBAAwB,EACxBC,qCAAqC,QAC/B,gCAAgC;AACvC,SAASC,gBAAgB,QAAQ,uBAAuB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,OAAOC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,CAAC9D,sBAAsB;MAAC+D,KAAK,EAAG;QAAEC,IAAI,EAAE;MAAE;IAAG,GAC5CF,aAAA,CAACpD,gBAAgB,QAChBoD,aAAA,CAAC5D,cAAc;MACd4B,QAAQ,EAAGsB,cAAgB;MAC3BF,IAAI,EAAGG,cAAgB;MACvBJ,YAAY,EAAGA,YAAc;MAC7BgB,cAAc,EAAG,KAAO;MAAA,GACnBhD;IAAK,GAEV6C,aAAA,CAACjD,MAAM;MAACe,WAAW,EAAG,IAAI,CAACA;IAAa,CAAE,CAC3B,CACC,CACK,CAAC;EAE3B;AACD;AAEA,eAAerB,OAAO,CAAE,CACvBD,UAAU,CAAI4D,MAAM,IAAM;EACzB,MAAM;IAAEC;EAAc,CAAC,GAAGD,MAAM,CAAEpD,aAAc,CAAC;EAEjD,OAAO;IACNU,IAAI,EAAE2C,aAAa,CAAC;EACrB,CAAC;AACF,CAAE,CAAC,EACH9D,YAAY,CAAI+D,QAAQ,IAAM;EAC7B,MAAM;IAAE3C;EAAiB,CAAC,GAAG2C,QAAQ,CAAEtD,aAAc,CAAC;EACtD,MAAM;IAAEmB;EAAiB,CAAC,GAAGmC,QAAQ,CAAExD,SAAU,CAAC;EAClD,OAAO;IACNa,gBAAgB;IAChBQ;EACD,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAElB,MAAO,CAAC"}
1
+ {"version":3,"names":["memize","I18nManager","GestureHandlerRootView","Component","EditorProvider","store","editorStore","parse","serialize","withDispatch","withSelect","compose","subscribeSetFocusOnTitle","subscribeFeaturedImageIdNativeUpdated","SlotFillProvider","coreStore","Layout","Editor","constructor","props","arguments","galleryWithImageBlocks","window","wp","galleryBlockV2Enabled","initialHtmlModeEnabled","mode","switchEditorMode","getEditorSettings","maxSize","setTitleRef","bind","settings","isRTL","componentDidMount","editEntityRecord","postType","postId","subscriptionParentSetFocusOnTitle","postTitleRef","focus","focusTitleWhenAvailable","subscriptionParentFeaturedImageIdNativeUpdated","payload","featured_media","featuredImageId","undoIgnore","componentWillUnmount","remove","titleRef","render","initialEdits","post","initialHtml","editorSettings","normalizedPost","id","title","raw","initialTitle","content","type","status","meta","createElement","style","flex","useSubRegistry","select","getEditorMode","dispatch"],"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":";AAAA;AACA;AACA;AACA,OAAOA,MAAM,MAAM,QAAQ;AAC3B,SAASC,WAAW,QAAQ,cAAc;AAC1C,SAASC,sBAAsB,QAAQ,8BAA8B;;AAErE;AACA;AACA;AACA,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,cAAc,EAAEC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxE,SAASC,KAAK,EAAEC,SAAS,QAAQ,mBAAmB;AACpD,SAASC,YAAY,EAAEC,UAAU,QAAQ,iBAAiB;AAC1D,SAASC,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8C,WAAW,IAAI,EAAG,CAAE;MAC5C,CAAC;MACDQ,IAAI,EAAEzB,QAAQ;MACd0B,MAAM,EAAE,OAAO;MACfC,IAAI,EAAE;IACP,CAAC;IAED,OACCC,aAAA,CAAC9D,sBAAsB;MAAC+D,KAAK,EAAG;QAAEC,IAAI,EAAE;MAAE;IAAG,GAC5CF,aAAA,CAAClD,gBAAgB,QAChBkD,aAAA,CAAC5D,cAAc;MACd4B,QAAQ,EAAGsB,cAAgB;MAC3BF,IAAI,EAAGG,cAAgB;MACvBJ,YAAY,EAAGA,YAAc;MAC7BgB,cAAc,EAAG,KAAO;MAAA,GACnBhD;IAAK,GAEV6C,aAAA,CAAChD,MAAM;MAACc,WAAW,EAAG,IAAI,CAACA;IAAa,CAAE,CAC3B,CACC,CACK,CAAC;EAE3B;AACD;AAEA,eAAenB,OAAO,CAAE,CACvBD,UAAU,CAAI0D,MAAM,IAAM;EACzB,MAAM;IAAEC;EAAc,CAAC,GAAGD,MAAM,CAAE9D,WAAY,CAAC;EAE/C,OAAO;IACNoB,IAAI,EAAE2C,aAAa,CAAC;EACrB,CAAC;AACF,CAAE,CAAC,EACH5D,YAAY,CAAI6D,QAAQ,IAAM;EAC7B,MAAM;IAAE3C;EAAiB,CAAC,GAAG2C,QAAQ,CAAEhE,WAAY,CAAC;EACpD,MAAM;IAAE6B;EAAiB,CAAC,GAAGmC,QAAQ,CAAEvD,SAAU,CAAC;EAClD,OAAO;IACNY,gBAAgB;IAChBQ;EACD,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAElB,MAAO,CAAC"}
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { useSelect, useDispatch } from '@wordpress/data';
5
5
  import { __, isRTL } from '@wordpress/i18n';
6
- import { code, drawerLeft, drawerRight, blockDefault, keyboard, fullscreen, listView, external, formatListBullets } from '@wordpress/icons';
6
+ import { drawerLeft, drawerRight, blockDefault, keyboard, fullscreen, formatListBullets } from '@wordpress/icons';
7
7
  import { useCommand } from '@wordpress/commands';
8
8
  import { store as preferencesStore } from '@wordpress/preferences';
9
9
  import { store as interfaceStore } from '@wordpress/interface';
@@ -19,42 +19,22 @@ import { store as editPostStore } from '../../store';
19
19
  export default function useCommonCommands() {
20
20
  const {
21
21
  openGeneralSidebar,
22
- closeGeneralSidebar,
23
- switchEditorMode,
24
- toggleDistractionFree
22
+ closeGeneralSidebar
25
23
  } = useDispatch(editPostStore);
26
24
  const {
27
25
  openModal
28
26
  } = useDispatch(interfaceStore);
29
27
  const {
30
- editorMode,
31
28
  activeSidebar,
32
- isListViewOpen,
33
29
  isFullscreen,
34
- isPublishSidebarEnabled,
35
- showBlockBreadcrumbs,
36
- isDistractionFree,
37
- isTopToolbar,
38
- isFocusMode
30
+ isPublishSidebarEnabled
39
31
  } = useSelect(select => {
40
32
  const {
41
33
  get
42
34
  } = select(preferencesStore);
43
- const {
44
- getEditorMode
45
- } = select(editPostStore);
46
- const {
47
- isListViewOpened
48
- } = select(editorStore);
49
35
  return {
50
36
  activeSidebar: select(interfaceStore).getActiveComplementaryArea(editPostStore.name),
51
- editorMode: getEditorMode(),
52
- isListViewOpen: isListViewOpened(),
53
37
  isPublishSidebarEnabled: select(editorStore).isPublishSidebarEnabled(),
54
- showBlockBreadcrumbs: get('core', 'showBlockBreadcrumbs'),
55
- isDistractionFree: get('core', 'distractionFree'),
56
- isFocusMode: get('core', 'focusMode'),
57
- isTopToolbar: get('core', 'fixedToolbar'),
58
38
  isFullscreen: get('core/edit-post', 'fullscreenMode')
59
39
  };
60
40
  }, []);
@@ -64,13 +44,6 @@ export default function useCommonCommands() {
64
44
  const {
65
45
  createInfoNotice
66
46
  } = useDispatch(noticesStore);
67
- const {
68
- __unstableSaveForPreview,
69
- setIsListViewOpened
70
- } = useDispatch(editorStore);
71
- const {
72
- getCurrentPostId
73
- } = useSelect(editorStore);
74
47
  useCommand({
75
48
  name: 'core/open-settings-sidebar',
76
49
  label: __('Toggle settings sidebar'),
@@ -101,36 +74,6 @@ export default function useCommonCommands() {
101
74
  }
102
75
  }
103
76
  });
104
- useCommand({
105
- name: 'core/toggle-distraction-free',
106
- label: isDistractionFree ? __('Exit Distraction Free') : __('Enter Distraction Free '),
107
- callback: ({
108
- close
109
- }) => {
110
- toggleDistractionFree();
111
- close();
112
- }
113
- });
114
- useCommand({
115
- name: 'core/toggle-spotlight-mode',
116
- label: __('Toggle spotlight'),
117
- callback: ({
118
- close
119
- }) => {
120
- toggle('core', 'focusMode');
121
- close();
122
- createInfoNotice(isFocusMode ? __('Spotlight off.') : __('Spotlight on.'), {
123
- id: 'core/edit-post/toggle-spotlight-mode/notice',
124
- type: 'snackbar',
125
- actions: [{
126
- label: __('Undo'),
127
- onClick: () => {
128
- toggle('core', 'focusMode');
129
- }
130
- }]
131
- });
132
- }
133
- });
134
77
  useCommand({
135
78
  name: 'core/toggle-fullscreen-mode',
136
79
  label: isFullscreen ? __('Exit fullscreen') : __('Enter fullscreen'),
@@ -152,55 +95,6 @@ export default function useCommonCommands() {
152
95
  });
153
96
  }
154
97
  });
155
- useCommand({
156
- name: 'core/toggle-list-view',
157
- label: isListViewOpen ? __('Close List View') : __('Open List View'),
158
- icon: listView,
159
- callback: ({
160
- close
161
- }) => {
162
- setIsListViewOpened(!isListViewOpen);
163
- close();
164
- createInfoNotice(isListViewOpen ? __('List View off.') : __('List View on.'), {
165
- id: 'core/edit-post/toggle-list-view/notice',
166
- type: 'snackbar'
167
- });
168
- }
169
- });
170
- useCommand({
171
- name: 'core/toggle-top-toolbar',
172
- label: __('Toggle top toolbar'),
173
- callback: ({
174
- close
175
- }) => {
176
- toggle('core', 'fixedToolbar');
177
- if (isDistractionFree) {
178
- toggleDistractionFree();
179
- }
180
- close();
181
- createInfoNotice(isTopToolbar ? __('Top toolbar off.') : __('Top toolbar on.'), {
182
- id: 'core/edit-post/toggle-top-toolbar/notice',
183
- type: 'snackbar',
184
- actions: [{
185
- label: __('Undo'),
186
- onClick: () => {
187
- toggle('core', 'fixedToolbar');
188
- }
189
- }]
190
- });
191
- }
192
- });
193
- useCommand({
194
- name: 'core/toggle-code-editor',
195
- label: editorMode === 'visual' ? __('Open code editor') : __('Exit code editor'),
196
- icon: code,
197
- callback: ({
198
- close
199
- }) => {
200
- switchEditorMode(editorMode === 'visual' ? 'text' : 'visual');
201
- close();
202
- }
203
- });
204
98
  useCommand({
205
99
  name: 'core/open-preferences',
206
100
  label: __('Editor preferences'),
@@ -216,20 +110,6 @@ export default function useCommonCommands() {
216
110
  openModal(KEYBOARD_SHORTCUT_HELP_MODAL_NAME);
217
111
  }
218
112
  });
219
- useCommand({
220
- name: 'core/toggle-breadcrumbs',
221
- label: showBlockBreadcrumbs ? __('Hide block breadcrumbs') : __('Show block breadcrumbs'),
222
- callback: ({
223
- close
224
- }) => {
225
- toggle('core', 'showBlockBreadcrumbs');
226
- close();
227
- createInfoNotice(showBlockBreadcrumbs ? __('Breadcrumbs hidden.') : __('Breadcrumbs visible.'), {
228
- id: 'core/edit-post/toggle-breadcrumbs/notice',
229
- type: 'snackbar'
230
- });
231
- }
232
- });
233
113
  useCommand({
234
114
  name: 'core/toggle-publish-sidebar',
235
115
  label: isPublishSidebarEnabled ? __('Disable pre-publish checks') : __('Enable pre-publish checks'),
@@ -245,18 +125,5 @@ export default function useCommonCommands() {
245
125
  });
246
126
  }
247
127
  });
248
- useCommand({
249
- name: 'core/preview-link',
250
- label: __('Preview in a new tab'),
251
- icon: external,
252
- callback: async ({
253
- close
254
- }) => {
255
- close();
256
- const postId = getCurrentPostId();
257
- const link = await __unstableSaveForPreview();
258
- window.open(link, `wp-preview-${postId}`);
259
- }
260
- });
261
128
  }
262
129
  //# sourceMappingURL=use-common-commands.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useDispatch","__","isRTL","code","drawerLeft","drawerRight","blockDefault","keyboard","fullscreen","listView","external","formatListBullets","useCommand","store","preferencesStore","interfaceStore","editorStore","noticesStore","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","PREFERENCES_MODAL_NAME","editPostStore","useCommonCommands","openGeneralSidebar","closeGeneralSidebar","switchEditorMode","toggleDistractionFree","openModal","editorMode","activeSidebar","isListViewOpen","isFullscreen","isPublishSidebarEnabled","showBlockBreadcrumbs","isDistractionFree","isTopToolbar","isFocusMode","select","get","getEditorMode","isListViewOpened","getActiveComplementaryArea","name","toggle","createInfoNotice","__unstableSaveForPreview","setIsListViewOpened","getCurrentPostId","label","icon","callback","close","id","type","actions","onClick","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":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SACCC,IAAI,EACJC,UAAU,EACVC,WAAW,EACXC,YAAY,EACZC,QAAQ,EACRC,UAAU,EACVC,QAAQ,EACRC,QAAQ,EACRC,iBAAiB,QACX,kBAAkB;AACzB,SAASC,UAAU,QAAQ,qBAAqB;AAChD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;AAClE,SAASD,KAAK,IAAIE,cAAc,QAAQ,sBAAsB;AAC9D,SAASF,KAAK,IAAIG,WAAW,QAAQ,mBAAmB;AACxD,SAASH,KAAK,IAAII,YAAY,QAAQ,oBAAoB;;AAE1D;AACA;AACA;AACA,SAASC,iCAAiC,QAAQ,+CAA+C;AACjG,SAASC,sBAAsB,QAAQ,oCAAoC;AAC3E,SAASN,KAAK,IAAIO,aAAa,QAAQ,aAAa;AAEpD,eAAe,SAASC,iBAAiBA,CAAA,EAAG;EAC3C,MAAM;IACLC,kBAAkB;IAClBC,mBAAmB;IACnBC,gBAAgB;IAChBC;EACD,CAAC,GAAGzB,WAAW,CAAEoB,aAAc,CAAC;EAChC,MAAM;IAAEM;EAAU,CAAC,GAAG1B,WAAW,CAAEe,cAAe,CAAC;EACnD,MAAM;IACLY,UAAU;IACVC,aAAa;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rDC,gBAAgB,CACfZ,uBAAuB,GACpB9B,EAAE,CAAE,8BAA+B,CAAC,GACpCA,EAAE,CAAE,6BAA8B,CAAC,EACtC;QACCkD,EAAE,EAAE,uCAAuC;QAC3CC,IAAI,EAAE;MACP,CACD,CAAC;IACF;EACD,CAAE,CAAC;EAEHxC,UAAU,CAAE;IACX6B,IAAI,EAAE,mBAAmB;IACzBM,KAAK,EAAE9C,EAAE,CAAE,sBAAuB,CAAC;IACnC+C,IAAI,EAAEtC,QAAQ;IACduC,QAAQ,EAAE,MAAAA,CAAQ;MAAEC;IAAM,CAAC,KAAM;MAChCA,KAAK,CAAC,CAAC;MACP,MAAMK,MAAM,GAAGT,gBAAgB,CAAC,CAAC;MACjC,MAAMU,IAAI,GAAG,MAAMZ,wBAAwB,CAAC,CAAC;MAC7Ca,MAAM,CAACC,IAAI,CAAEF,IAAI,EAAG,cAAcD,MAAQ,EAAE,CAAC;IAC9C;EACD,CAAE,CAAC;AACJ"}
1
+ {"version":3,"names":["useSelect","useDispatch","__","isRTL","drawerLeft","drawerRight","blockDefault","keyboard","fullscreen","formatListBullets","useCommand","store","preferencesStore","interfaceStore","editorStore","noticesStore","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","PREFERENCES_MODAL_NAME","editPostStore","useCommonCommands","openGeneralSidebar","closeGeneralSidebar","openModal","activeSidebar","isFullscreen","isPublishSidebarEnabled","select","get","getActiveComplementaryArea","name","toggle","createInfoNotice","label","icon","callback","close","id","type","actions","onClick"],"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":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SACCC,UAAU,EACVC,WAAW,EACXC,YAAY,EACZC,QAAQ,EACRC,UAAU,EACVC,iBAAiB,QACX,kBAAkB;AACzB,SAASC,UAAU,QAAQ,qBAAqB;AAChD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;AAClE,SAASD,KAAK,IAAIE,cAAc,QAAQ,sBAAsB;AAC9D,SAASF,KAAK,IAAIG,WAAW,QAAQ,mBAAmB;AACxD,SAASH,KAAK,IAAII,YAAY,QAAQ,oBAAoB;;AAE1D;AACA;AACA;AACA,SAASC,iCAAiC,QAAQ,+CAA+C;AACjG,SAASC,sBAAsB,QAAQ,oCAAoC;AAC3E,SAASN,KAAK,IAAIO,aAAa,QAAQ,aAAa;AAEpD,eAAe,SAASC,iBAAiBA,CAAA,EAAG;EAC3C,MAAM;IAAEC,kBAAkB;IAAEC;EAAoB,CAAC,GAChDpB,WAAW,CAAEiB,aAAc,CAAC;EAC7B,MAAM;IAAEI;EAAU,CAAC,GAAGrB,WAAW,CAAEY,cAAe,CAAC;EACnD,MAAM;IAAEU,aAAa;IAAEC,YAAY;IAAEC;EAAwB,CAAC,GAAGzB,SAAS,CACvE0B,MAAM,IAAM;IACb,MAAM;MAAEC;IAAI,CAAC,GAAGD,MAAM,CAAEd,gBAAiB,CAAC;IAE1C,OAAO;MACNW,aAAa,EAAEG,MAAM,CACpBb,cACD,CAAC,CAACe,0BAA0B,CAA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B,CACfN,uBAAuB,GACpBvB,EAAE,CAAE,8BAA+B,CAAC,GACpCA,EAAE,CAAE,6BAA8B,CAAC,EACtC;QACCkC,EAAE,EAAE,uCAAuC;QAC3CC,IAAI,EAAE;MACP,CACD,CAAC;IACF;EACD,CAAE,CAAC;AACJ"}
@@ -7,7 +7,6 @@ import { registerCoreBlocks, __experimentalRegisterExperimentalCoreBlocks } from
7
7
  import deprecated from '@wordpress/deprecated';
8
8
  import { createRoot } from '@wordpress/element';
9
9
  import { dispatch, select } from '@wordpress/data';
10
- import { addFilter } from '@wordpress/hooks';
11
10
  import { store as preferencesStore } from '@wordpress/preferences';
12
11
  import { registerLegacyWidgetBlock, registerWidgetGroupBlock } from '@wordpress/widgets';
13
12
  import { privateApis as editorPrivateApis, store as editorStore } from '@wordpress/editor';
@@ -41,7 +40,6 @@ export function initializeEditor(id, postType, postId, settings, initialEdits) {
41
40
  dispatch(preferencesStore).setDefaults('core/edit-post', {
42
41
  fullscreenMode: true,
43
42
  isPublishSidebarEnabled: true,
44
- preferredStyleVariations: {},
45
43
  themeStyles: true,
46
44
  welcomeGuide: true,
47
45
  welcomeGuideTemplate: true
@@ -78,34 +76,6 @@ export function initializeEditor(id, postType, postId, settings, initialEdits) {
78
76
  });
79
77
  }
80
78
 
81
- /*
82
- * Prevent adding template part in the post editor.
83
- * Only add the filter when the post editor is initialized, not imported.
84
- * Also only add the filter(s) after registerCoreBlocks()
85
- * so that common filters in the block library are not overwritten.
86
- */
87
- addFilter('blockEditor.__unstableCanInsertBlockType', 'removeTemplatePartsFromInserter', (canInsert, blockType) => {
88
- if (blockType.name === 'core/template-part') {
89
- return false;
90
- }
91
- return canInsert;
92
- });
93
-
94
- /*
95
- * Prevent adding post content block (except in query block) in the post editor.
96
- * Only add the filter when the post editor is initialized, not imported.
97
- * Also only add the filter(s) after registerCoreBlocks()
98
- * so that common filters in the block library are not overwritten.
99
- */
100
- addFilter('blockEditor.__unstableCanInsertBlockType', 'removePostContentFromInserter', (canInsert, blockType, rootClientId, {
101
- getBlockParentsByBlockName
102
- }) => {
103
- if (blockType.name === 'core/post-content') {
104
- return getBlockParentsByBlockName(rootClientId, 'core/query').length > 0;
105
- }
106
- return canInsert;
107
- });
108
-
109
79
  // Show a console log warning if the browser is not in Standards rendering mode.
110
80
  const documentMode = document.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';
111
81
  if (documentMode !== 'Standards') {
@@ -1 +1 @@
1
- {"version":3,"names":["store","blocksStore","registerCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","deprecated","createRoot","dispatch","select","addFilter","preferencesStore","registerLegacyWidgetBlock","registerWidgetGroupBlock","privateApis","editorPrivateApis","editorStore","Editor","unlock","PluginPostExcerpt","__experimentalPluginPostExcerpt","initializeEditor","id","postType","postId","settings","initialEdits","isMediumOrBigger","window","matchMedia","matches","target","document","getElementById","root","setDefaults","fullscreenMode","isPublishSidebarEnabled","preferredStyleVariations","themeStyles","welcomeGuide","welcomeGuideTemplate","allowRightClickOverrides","editorMode","fixedToolbar","hiddenBlockTypes","inactivePanels","openPanels","showBlockBreadcrumbs","showIconLabels","showListViewByDefault","reapplyBlockTypeFilters","get","setIsListViewOpened","inserter","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","__unstableEnableFullSiteEditingBlocks","canInsert","blockType","name","rootClientId","getBlockParentsByBlockName","length","documentMode","compatMode","console","warn","isIphone","navigator","userAgent","indexOf","addEventListener","event","editorScrollContainer","getElementsByClassName","scrollY","scrollTop","scrollTo","e","preventDefault","render","createElement","reinitializeEditor","since","version","default","PluginBlockSettingsMenuItem","PluginDocumentSettingPanel","PluginMoreMenuItem","PluginPostPublishPanel","PluginPostStatusInfo","PluginPrePublishPanel","PluginSidebar","PluginSidebarMoreMenuItem","__experimentalFullscreenModeClose","__experimentalMainDashboardButton"],"sources":["@wordpress/edit-post/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport { dispatch, select } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\nimport {\n\tprivateApis as editorPrivateApis,\n\tstore as editorStore,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport './plugins';\nimport Editor from './editor';\nimport { unlock } from './lock-unlock';\n\nconst { PluginPostExcerpt: __experimentalPluginPostExcerpt } =\n\tunlock( editorPrivateApis );\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 isMediumOrBigger = window.matchMedia( '(min-width: 782px)' ).matches;\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-post', {\n\t\tfullscreenMode: true,\n\t\tisPublishSidebarEnabled: true,\n\t\tpreferredStyleVariations: {},\n\t\tthemeStyles: true,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tallowRightClickOverrides: true,\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\thiddenBlockTypes: [],\n\t\tinactivePanels: [],\n\t\topenPanels: [ 'post-status' ],\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowIconLabels: false,\n\t\tshowListViewByDefault: false,\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\t// This behavior is disabled for small viewports.\n\tif (\n\t\tisMediumOrBigger &&\n\t\tselect( preferencesStore ).get( 'core', 'showListViewByDefault' ) &&\n\t\t! select( preferencesStore ).get( 'core', 'distractionFree' )\n\t) {\n\t\tdispatch( editorStore ).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 ( blockType.name === 'core/template-part' ) {\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 ( blockType.name === 'core/post-content' ) {\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 { __experimentalPluginPostExcerpt };\nexport { store } from './store';\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SACCC,kBAAkB,EAClBC,4CAA4C,QACtC,0BAA0B;AACjC,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,QAAQ,EAAEC,MAAM,QAAQ,iBAAiB;AAClD,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASR,KAAK,IAAI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GA,MAAQ;IACjBD,QAAQ,EAAGA,QAAU;IACrBG,YAAY,EAAGA;EAAc,CAC7B,CACF,CAAC;EAED,OAAOQ,IAAI;AACZ;;AAEA;AACA;AACA;AACA,OAAO,SAASmD,kBAAkBA,CAAA,EAAG;EACpC/E,UAAU,CAAE,gCAAgC,EAAE;IAC7CgF,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;AAEA,SAASC,OAAO,IAAIC,2BAA2B,QAAQ,kEAAkE;AACzH,SAASD,OAAO,IAAIE,0BAA0B,QAAQ,oDAAoD;AAC1G,SAASF,OAAO,IAAIG,kBAAkB,QAAQ,2CAA2C;AACzF,SAASH,OAAO,IAAII,sBAAsB,QAAQ,gDAAgD;AAClG,SAASJ,OAAO,IAAIK,oBAAoB,QAAQ,8CAA8C;AAC9F,SAASL,OAAO,IAAIM,qBAAqB,QAAQ,+CAA+C;AAChG,SAASN,OAAO,IAAIO,aAAa,QAAQ,qCAAqC;AAC9E,SAASP,OAAO,IAAIQ,yBAAyB,QAAQ,mDAAmD;AACxG,SAASR,OAAO,IAAIS,iCAAiC,QAAQ,2CAA2C;AACxG,SAAST,OAAO,IAAIU,iCAAiC,QAAQ,2CAA2C;AACxG,SAAS9E,+BAA+B;AACxC,SAASlB,KAAK,QAAQ,SAAS"}
1
+ {"version":3,"names":["store","blocksStore","registerCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","deprecated","createRoot","dispatch","select","preferencesStore","registerLegacyWidgetBlock","registerWidgetGroupBlock","privateApis","editorPrivateApis","editorStore","Editor","unlock","PluginPostExcerpt","__experimentalPluginPostExcerpt","initializeEditor","id","postType","postId","settings","initialEdits","isMediumOrBigger","window","matchMedia","matches","target","document","getElementById","root","setDefaults","fullscreenMode","isPublishSidebarEnabled","themeStyles","welcomeGuide","welcomeGuideTemplate","allowRightClickOverrides","editorMode","fixedToolbar","hiddenBlockTypes","inactivePanels","openPanels","showBlockBreadcrumbs","showIconLabels","showListViewByDefault","reapplyBlockTypeFilters","get","setIsListViewOpened","inserter","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","__unstableEnableFullSiteEditingBlocks","documentMode","compatMode","console","warn","isIphone","navigator","userAgent","indexOf","addEventListener","event","editorScrollContainer","getElementsByClassName","scrollY","scrollTop","scrollTo","e","preventDefault","render","createElement","reinitializeEditor","since","version","default","PluginBlockSettingsMenuItem","PluginDocumentSettingPanel","PluginMoreMenuItem","PluginPostPublishPanel","PluginPostStatusInfo","PluginPrePublishPanel","PluginSidebar","PluginSidebarMoreMenuItem","__experimentalFullscreenModeClose","__experimentalMainDashboardButton"],"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 { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\nimport {\n\tprivateApis as editorPrivateApis,\n\tstore as editorStore,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport './plugins';\nimport Editor from './editor';\nimport { unlock } from './lock-unlock';\n\nconst { PluginPostExcerpt: __experimentalPluginPostExcerpt } =\n\tunlock( editorPrivateApis );\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 isMediumOrBigger = window.matchMedia( '(min-width: 782px)' ).matches;\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-post', {\n\t\tfullscreenMode: true,\n\t\tisPublishSidebarEnabled: true,\n\t\tthemeStyles: true,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tallowRightClickOverrides: true,\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\thiddenBlockTypes: [],\n\t\tinactivePanels: [],\n\t\topenPanels: [ 'post-status' ],\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowIconLabels: false,\n\t\tshowListViewByDefault: false,\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\t// This behavior is disabled for small viewports.\n\tif (\n\t\tisMediumOrBigger &&\n\t\tselect( preferencesStore ).get( 'core', 'showListViewByDefault' ) &&\n\t\t! select( preferencesStore ).get( 'core', 'distractionFree' )\n\t) {\n\t\tdispatch( editorStore ).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// 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 { __experimentalPluginPostExcerpt };\nexport { store } from './store';\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SACCC,kBAAkB,EAClBC,4CAA4C,QACtC,0BAA0B;AACjC,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,QAAQ,EAAEC,MAAM,QAAQ,iBAAiB;AAClD,SAASP,KAAK,IAAIQ,gBAAgB,QAAQ,wBAAwB;AAClE,SACCC,yBAAyB,EACzBC,wBAAwB,QAClB,oBAAoB;AAC3B,SACCC,WAAW,IAAIC,iBAAiB,EAChCZ,KAAK,IAAIa,WAAW,QACd,mBAAmB;;AAE1B;AACA;AACA;AACA,OAAO,SAAS;AAChB,OAAO,WAAW;AAClB,OAAOC,MAAM,MAAM,UAAU;AAC7B,SAASC,MAAM,QAAQ,eAAe;AAEtC,MAAM;EAAEC,iBAAiB,EAAEC;AAAgC,CAAC,GAC3DF,MAAM,CAAEH,iBAAkB,CAAC;;AAE5B;AACA;A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AAU,EAAIO,CAAC,IAAMA,CAAC,CAACC,cAAc,CAAC,CAAC,EAAE,KAAM,CAAC;EACzE/C,MAAM,CAACuC,gBAAgB,CAAE,MAAM,EAAIO,CAAC,IAAMA,CAAC,CAACC,cAAc,CAAC,CAAC,EAAE,KAAM,CAAC;EAErEzC,IAAI,CAAC0C,MAAM,CACVC,aAAA,CAAC5D,MAAM;IACNQ,QAAQ,EAAGA,QAAU;IACrBD,MAAM,EAAGA,MAAQ;IACjBD,QAAQ,EAAGA,QAAU;IACrBG,YAAY,EAAGA;EAAc,CAC7B,CACF,CAAC;EAED,OAAOQ,IAAI;AACZ;;AAEA;AACA;AACA;AACA,OAAO,SAAS4C,kBAAkBA,CAAA,EAAG;EACpCvE,UAAU,CAAE,gCAAgC,EAAE;IAC7CwE,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;AAEA,SAASC,OAAO,IAAIC,2BAA2B,QAAQ,kEAAkE;AACzH,SAASD,OAAO,IAAIE,0BAA0B,QAAQ,oDAAoD;AAC1G,SAASF,OAAO,IAAIG,kBAAkB,QAAQ,2CAA2C;AACzF,SAASH,OAAO,IAAII,sBAAsB,QAAQ,gDAAgD;AAClG,SAASJ,OAAO,IAAIK,oBAAoB,QAAQ,8CAA8C;AAC9F,SAASL,OAAO,IAAIM,qBAAqB,QAAQ,+CAA+C;AAChG,SAASN,OAAO,IAAIO,aAAa,QAAQ,qCAAqC;AAC9E,SAASP,OAAO,IAAIQ,yBAAyB,QAAQ,mDAAmD;AACxG,SAASR,OAAO,IAAIS,iCAAiC,QAAQ,2CAA2C;AACxG,SAAST,OAAO,IAAIU,iCAAiC,QAAQ,2CAA2C;AACxG,SAASvE,+BAA+B;AACxC,SAASjB,KAAK,QAAQ,SAAS"}
@@ -28,7 +28,6 @@ export function initializeEditor(id, postType, postId) {
28
28
  inactivePanels: [],
29
29
  isPublishSidebarEnabled: true,
30
30
  openPanels: ['post-status'],
31
- preferredStyleVariations: {},
32
31
  welcomeGuide: true
33
32
  });
34
33
  dispatch(preferencesStore).setDefaults('core', {
@@ -1 +1 @@
1
- {"version":3,"names":["dispatch","store","preferencesStore","Editor","initializeEditor","id","postType","postId","setDefaults","editorMode","fullscreenMode","inactivePanels","isPublishSidebarEnabled","openPanels","preferredStyleVariations","welcomeGuide","hiddenBlockTypes","fixedToolbar","createElement"],"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\tfullscreenMode: true,\n\t\tinactivePanels: [],\n\t\tisPublishSidebarEnabled: true,\n\t\topenPanels: [ 'post-status' ],\n\t\tpreferredStyleVariations: {},\n\t\twelcomeGuide: true,\n\t} );\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\thiddenBlockTypes: [],\n\t\tinactivePanels: [],\n\t\topenPanels: [ 'post-status' ],\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tfixedToolbar: false,\n\t} );\n\n\treturn <Editor postId={ postId } postType={ postType } />;\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAO,sBAAsB;AAC7B,OAAO,2BAA2B;AAClC,SAASA,QAAQ,QAAQ,iBAAiB;AAC1C,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;;AAElE;AACA;AACA;AACA,SAASD,KAAK,QAAQ,SAAS;AAC/B,OAAOE,MAAM,MAAM,UAAU;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAAEC,EAAE,EAAEC,QAAQ,EAAEC,MAAM,EAAG;EACxDP,QAAQ,CAAEE,gBAAiB,CAAC,CAACM,WAAW,CAAE,gBAAgB,EAAE;IAC3DC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,IAAI;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;EACHf,QAAQ,CAAEE,gBAAiB,CAAC,CAACM,WAAW,CAAE,MAAM,EAAE;IACjDQ,gBAAgB,EAAE,EAAE;IACpBL,cAAc,EAAE,EAAE;IAClBE,UAAU,EAAE,CAAE,aAAa;EAC5B,CAAE,CAAC;EAEHb,QAAQ,CAAEE,gBAAiB,CAAC,CAACM,WAAW,CAAE,MAAM,EAAE;IACjDS,YAAY,EAAE;EACf,CAAE,CAAC;EAEH,OAAOC,aAAA,CAACf,MAAM;IAACI,MAAM,EAAGA,MAAQ;IAACD,QAAQ,EAAGA;EAAU,CAAE,CAAC;AAC1D"}
1
+ {"version":3,"names":["dispatch","store","preferencesStore","Editor","initializeEditor","id","postType","postId","setDefaults","editorMode","fullscreenMode","inactivePanels","isPublishSidebarEnabled","openPanels","welcomeGuide","hiddenBlockTypes","fixedToolbar","createElement"],"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\tfullscreenMode: true,\n\t\tinactivePanels: [],\n\t\tisPublishSidebarEnabled: true,\n\t\topenPanels: [ 'post-status' ],\n\t\twelcomeGuide: true,\n\t} );\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\thiddenBlockTypes: [],\n\t\tinactivePanels: [],\n\t\topenPanels: [ 'post-status' ],\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tfixedToolbar: false,\n\t} );\n\n\treturn <Editor postId={ postId } postType={ postType } />;\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAO,sBAAsB;AAC7B,OAAO,2BAA2B;AAClC,SAASA,QAAQ,QAAQ,iBAAiB;AAC1C,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;;AAElE;AACA;AACA;AACA,SAASD,KAAK,QAAQ,SAAS;AAC/B,OAAOE,MAAM,MAAM,UAAU;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAAEC,EAAE,EAAEC,QAAQ,EAAEC,MAAM,EAAG;EACxDP,QAAQ,CAAEE,gBAAiB,CAAC,CAACM,WAAW,CAAE,gBAAgB,EAAE;IAC3DC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,IAAI;IACpBC,cAAc,EAAE,EAAE;IAClBC,uBAAuB,EAAE,IAAI;IAC7BC,UAAU,EAAE,CAAE,aAAa,CAAE;IAC7BC,YAAY,EAAE;EACf,CAAE,CAAC;EACHd,QAAQ,CAAEE,gBAAiB,CAAC,CAACM,WAAW,CAAE,MAAM,EAAE;IACjDO,gBAAgB,EAAE,EAAE;IACpBJ,cAAc,EAAE,EAAE;IAClBE,UAAU,EAAE,CAAE,aAAa;EAC5B,CAAE,CAAC;EAEHb,QAAQ,CAAEE,gBAAiB,CAAC,CAACM,WAAW,CAAE,MAAM,EAAE;IACjDQ,YAAY,EAAE;EACf,CAAE,CAAC;EAEH,OAAOC,aAAA,CAACd,MAAM;IAACI,MAAM,EAAGA,MAAQ;IAACD,QAAQ,EAAGA;EAAU,CAAE,CAAC;AAC1D"}
@@ -1,13 +1,9 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { __ } from '@wordpress/i18n';
5
4
  import apiFetch from '@wordpress/api-fetch';
6
5
  import { store as interfaceStore } from '@wordpress/interface';
7
6
  import { store as preferencesStore } from '@wordpress/preferences';
8
- import { speak } from '@wordpress/a11y';
9
- import { store as noticesStore } from '@wordpress/notices';
10
- import { store as blockEditorStore } from '@wordpress/block-editor';
11
7
  import { store as editorStore } from '@wordpress/editor';
12
8
  import deprecated from '@wordpress/deprecated';
13
9
  import { addFilter } from '@wordpress/hooks';
@@ -25,13 +21,8 @@ import { unlock } from '../lock-unlock';
25
21
  * @param {?string} name Sidebar name to be opened.
26
22
  */
27
23
  export const openGeneralSidebar = name => ({
28
- dispatch,
29
24
  registry
30
25
  }) => {
31
- const isDistractionFree = registry.select(preferencesStore).get('core', 'distractionFree');
32
- if (isDistractionFree) {
33
- dispatch.toggleDistractionFree();
34
- }
35
26
  registry.dispatch(interfaceStore).enableComplementaryArea(editPostStore.name, name);
36
27
  };
37
28
 
@@ -181,23 +172,18 @@ export const toggleFeature = feature => ({
181
172
  /**
182
173
  * Triggers an action used to switch editor mode.
183
174
  *
175
+ * @deprecated
176
+ *
184
177
  * @param {string} mode The editor mode.
185
178
  */
186
179
  export const switchEditorMode = mode => ({
187
- dispatch,
188
180
  registry
189
181
  }) => {
190
- registry.dispatch(preferencesStore).set('core', 'editorMode', mode);
191
-
192
- // Unselect blocks when we switch to the code editor.
193
- if (mode !== 'visual') {
194
- registry.dispatch(blockEditorStore).clearSelectedBlock();
195
- }
196
- if (mode === 'text' && registry.select(preferencesStore).get('core', 'distractionFree')) {
197
- dispatch.toggleDistractionFree();
198
- }
199
- const message = mode === 'visual' ? __('Visual editor selected') : __('Code editor selected');
200
- speak(message, 'assertive');
182
+ deprecated("dispatch( 'core/edit-post' ).switchEditorMode", {
183
+ since: '6.6',
184
+ alternative: "dispatch( 'core/editor').switchEditorMode"
185
+ });
186
+ registry.dispatch(editorStore).switchEditorMode(mode);
201
187
  };
202
188
 
203
189
  /**
@@ -215,33 +201,17 @@ export const togglePinnedPluginItem = pluginName => ({
215
201
  /**
216
202
  * Returns an action object used in signaling that a style should be auto-applied when a block is created.
217
203
  *
218
- * @param {string} blockName Name of the block.
219
- * @param {?string} blockStyle Name of the style that should be auto applied. If undefined, the "auto apply" setting of the block is removed.
204
+ * @deprecated
220
205
  */
221
- export const updatePreferredStyleVariations = (blockName, blockStyle) => ({
222
- registry
223
- }) => {
224
- var _registry$select$get;
225
- if (!blockName) {
226
- return;
227
- }
228
- const existingVariations = (_registry$select$get = registry.select(preferencesStore).get('core/edit-post', 'preferredStyleVariations')) !== null && _registry$select$get !== void 0 ? _registry$select$get : {};
229
-
230
- // When the blockStyle is omitted, remove the block's preferred variation.
231
- if (!blockStyle) {
232
- const updatedVariations = {
233
- ...existingVariations
234
- };
235
- delete updatedVariations[blockName];
236
- registry.dispatch(preferencesStore).set('core/edit-post', 'preferredStyleVariations', updatedVariations);
237
- } else {
238
- // Else add the variation.
239
- registry.dispatch(preferencesStore).set('core/edit-post', 'preferredStyleVariations', {
240
- ...existingVariations,
241
- [blockName]: blockStyle
242
- });
243
- }
244
- };
206
+ export function updatePreferredStyleVariations() {
207
+ deprecated("dispatch( 'core/edit-post' ).updatePreferredStyleVariations", {
208
+ since: '6.6',
209
+ hint: 'Preferred Style Variations are not supported anymore.'
210
+ });
211
+ return {
212
+ type: 'NOTHING'
213
+ };
214
+ }
245
215
 
246
216
  /**
247
217
  * Update the provided block types to be visible.
@@ -471,38 +441,16 @@ export const initializeMetaBoxes = () => ({
471
441
  * Action that toggles Distraction free mode.
472
442
  * Distraction free mode expects there are no sidebars, as due to the
473
443
  * z-index values set, you can't close sidebars.
444
+ *
445
+ * @deprecated
474
446
  */
475
447
  export const toggleDistractionFree = () => ({
476
- dispatch,
477
448
  registry
478
449
  }) => {
479
- const isDistractionFree = registry.select(preferencesStore).get('core', 'distractionFree');
480
- if (isDistractionFree) {
481
- registry.dispatch(preferencesStore).set('core', 'fixedToolbar', false);
482
- }
483
- if (!isDistractionFree) {
484
- registry.batch(() => {
485
- registry.dispatch(preferencesStore).set('core', 'fixedToolbar', true);
486
- registry.dispatch(editorStore).setIsInserterOpened(false);
487
- registry.dispatch(editorStore).setIsListViewOpened(false);
488
- dispatch.closeGeneralSidebar();
489
- });
490
- }
491
- registry.batch(() => {
492
- registry.dispatch(preferencesStore).set('core', 'distractionFree', !isDistractionFree);
493
- registry.dispatch(noticesStore).createInfoNotice(isDistractionFree ? __('Distraction free off.') : __('Distraction free on.'), {
494
- id: 'core/edit-post/distraction-free-mode/notice',
495
- type: 'snackbar',
496
- actions: [{
497
- label: __('Undo'),
498
- onClick: () => {
499
- registry.batch(() => {
500
- registry.dispatch(preferencesStore).set('core', 'fixedToolbar', isDistractionFree ? true : false);
501
- registry.dispatch(preferencesStore).toggle('core', 'distractionFree');
502
- });
503
- }
504
- }]
505
- });
450
+ deprecated("dispatch( 'core/edit-post' ).toggleDistractionFree", {
451
+ since: '6.6',
452
+ alternative: "dispatch( 'core/editor').toggleDistractionFree"
506
453
  });
454
+ registry.dispatch(editorStore).toggleDistractionFree();
507
455
  };
508
456
  //# sourceMappingURL=actions.js.map