@wordpress/editor 11.0.2 → 12.0.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 (95) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +1 -1
  3. package/build/components/character-count/index.js +1 -1
  4. package/build/components/character-count/index.js.map +1 -1
  5. package/build/components/editor-help/help-get-support-button.native.js +46 -0
  6. package/build/components/editor-help/help-get-support-button.native.js.map +1 -0
  7. package/build/components/editor-help/index.native.js +20 -2
  8. package/build/components/editor-help/index.native.js.map +1 -1
  9. package/build/components/global-keyboard-shortcuts/save-shortcut.js +12 -14
  10. package/build/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
  11. package/build/components/global-keyboard-shortcuts/visual-editor-shortcuts.js +0 -4
  12. package/build/components/global-keyboard-shortcuts/visual-editor-shortcuts.js.map +1 -1
  13. package/build/components/post-format/index.js +3 -1
  14. package/build/components/post-format/index.js.map +1 -1
  15. package/build/components/post-locked-modal/index.js +1 -1
  16. package/build/components/post-locked-modal/index.js.map +1 -1
  17. package/build/components/post-saved-state/index.js +37 -46
  18. package/build/components/post-saved-state/index.js.map +1 -1
  19. package/build/components/post-title/index.js +1 -1
  20. package/build/components/post-title/index.js.map +1 -1
  21. package/build/components/provider/index.native.js +3 -1
  22. package/build/components/provider/index.native.js.map +1 -1
  23. package/build/components/provider/use-block-editor-settings.js +31 -4
  24. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  25. package/build/components/word-count/index.js +1 -1
  26. package/build/components/word-count/index.js.map +1 -1
  27. package/build/store/actions.js +0 -25
  28. package/build/store/actions.js.map +1 -1
  29. package/build/store/selectors.js +3 -84
  30. package/build/store/selectors.js.map +1 -1
  31. package/build/{store/utils → utils}/get-template-part-icon.js +0 -0
  32. package/build/utils/get-template-part-icon.js.map +1 -0
  33. package/build/utils/index.js +8 -0
  34. package/build/utils/index.js.map +1 -1
  35. package/build-module/components/character-count/index.js +1 -1
  36. package/build-module/components/character-count/index.js.map +1 -1
  37. package/build-module/components/editor-help/help-get-support-button.native.js +34 -0
  38. package/build-module/components/editor-help/help-get-support-button.native.js.map +1 -0
  39. package/build-module/components/editor-help/index.native.js +18 -3
  40. package/build-module/components/editor-help/index.native.js.map +1 -1
  41. package/build-module/components/global-keyboard-shortcuts/save-shortcut.js +12 -14
  42. package/build-module/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
  43. package/build-module/components/global-keyboard-shortcuts/visual-editor-shortcuts.js +0 -4
  44. package/build-module/components/global-keyboard-shortcuts/visual-editor-shortcuts.js.map +1 -1
  45. package/build-module/components/post-format/index.js +4 -2
  46. package/build-module/components/post-format/index.js.map +1 -1
  47. package/build-module/components/post-locked-modal/index.js +1 -1
  48. package/build-module/components/post-locked-modal/index.js.map +1 -1
  49. package/build-module/components/post-saved-state/index.js +38 -46
  50. package/build-module/components/post-saved-state/index.js.map +1 -1
  51. package/build-module/components/post-title/index.js +1 -1
  52. package/build-module/components/post-title/index.js.map +1 -1
  53. package/build-module/components/provider/index.native.js +3 -1
  54. package/build-module/components/provider/index.native.js.map +1 -1
  55. package/build-module/components/provider/use-block-editor-settings.js +30 -4
  56. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  57. package/build-module/components/word-count/index.js +1 -1
  58. package/build-module/components/word-count/index.js.map +1 -1
  59. package/build-module/store/actions.js +0 -23
  60. package/build-module/store/actions.js.map +1 -1
  61. package/build-module/store/selectors.js +3 -80
  62. package/build-module/store/selectors.js.map +1 -1
  63. package/build-module/{store/utils → utils}/get-template-part-icon.js +0 -0
  64. package/build-module/utils/get-template-part-icon.js.map +1 -0
  65. package/build-module/utils/index.js +1 -0
  66. package/build-module/utils/index.js.map +1 -1
  67. package/build-style/style-rtl.css +6 -1
  68. package/build-style/style.css +6 -1
  69. package/package.json +28 -28
  70. package/src/components/character-count/index.js +3 -2
  71. package/src/components/editor-help/help-get-support-button.native.js +38 -0
  72. package/src/components/editor-help/index.native.js +41 -1
  73. package/src/components/editor-help/style.android.scss +6 -0
  74. package/src/components/editor-help/style.ios.scss +6 -0
  75. package/src/components/editor-help/style.scss +21 -0
  76. package/src/components/editor-help/test/index.native.js +80 -0
  77. package/src/components/global-keyboard-shortcuts/save-shortcut.js +34 -42
  78. package/src/components/global-keyboard-shortcuts/visual-editor-shortcuts.js +8 -16
  79. package/src/components/post-format/index.js +6 -2
  80. package/src/components/post-format/style.scss +1 -0
  81. package/src/components/post-locked-modal/index.js +1 -1
  82. package/src/components/post-saved-state/index.js +41 -55
  83. package/src/components/post-saved-state/style.scss +8 -1
  84. package/src/components/post-saved-state/test/__snapshots__/index.js.snap +20 -0
  85. package/src/components/post-saved-state/test/index.js +2 -2
  86. package/src/components/post-title/index.js +1 -1
  87. package/src/components/provider/index.native.js +2 -0
  88. package/src/components/provider/use-block-editor-settings.js +24 -0
  89. package/src/components/word-count/index.js +3 -2
  90. package/src/store/actions.js +0 -28
  91. package/src/store/selectors.js +2 -105
  92. package/src/{store/utils → utils}/get-template-part-icon.js +0 -0
  93. package/src/utils/index.js +1 -0
  94. package/build/store/utils/get-template-part-icon.js.map +0 -1
  95. package/build-module/store/utils/get-template-part-icon.js.map +0 -1
@@ -0,0 +1,34 @@
1
+ import { createElement } from "@wordpress/element";
2
+
3
+ /**
4
+ * External dependencies
5
+ */
6
+ import { Pressable, Text } from 'react-native';
7
+ /**
8
+ * WordPress dependencies
9
+ */
10
+
11
+ import { usePreferredColorSchemeStyle } from '@wordpress/compose';
12
+ /**
13
+ * Internal dependencies
14
+ */
15
+
16
+ import styles from './style.scss';
17
+
18
+ const HelpGetSupportButton = ({
19
+ onPress,
20
+ title
21
+ }) => {
22
+ const buttonStyle = usePreferredColorSchemeStyle(styles.button, styles.buttonDark);
23
+ const textStyle = usePreferredColorSchemeStyle(styles.buttonText, styles.buttonTextDark);
24
+ return createElement(Pressable, {
25
+ style: buttonStyle,
26
+ onPress: onPress,
27
+ accessibilityRole: 'button'
28
+ }, createElement(Text, {
29
+ style: textStyle
30
+ }, title));
31
+ };
32
+
33
+ export default HelpGetSupportButton;
34
+ //# sourceMappingURL=help-get-support-button.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/editor/src/components/editor-help/help-get-support-button.native.js"],"names":["Pressable","Text","usePreferredColorSchemeStyle","styles","HelpGetSupportButton","onPress","title","buttonStyle","button","buttonDark","textStyle","buttonText","buttonTextDark"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,IAApB,QAAgC,cAAhC;AAEA;AACA;AACA;;AACA,SAASC,4BAAT,QAA6C,oBAA7C;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,cAAnB;;AAEA,MAAMC,oBAAoB,GAAG,CAAE;AAAEC,EAAAA,OAAF;AAAWC,EAAAA;AAAX,CAAF,KAA0B;AACtD,QAAMC,WAAW,GAAGL,4BAA4B,CAC/CC,MAAM,CAACK,MADwC,EAE/CL,MAAM,CAACM,UAFwC,CAAhD;AAKA,QAAMC,SAAS,GAAGR,4BAA4B,CAC7CC,MAAM,CAACQ,UADsC,EAE7CR,MAAM,CAACS,cAFsC,CAA9C;AAKA,SACC,cAAC,SAAD;AACC,IAAA,KAAK,EAAGL,WADT;AAEC,IAAA,OAAO,EAAGF,OAFX;AAGC,IAAA,iBAAiB,EAAG;AAHrB,KAKC,cAAC,IAAD;AAAM,IAAA,KAAK,EAAGK;AAAd,KAA4BJ,KAA5B,CALD,CADD;AASA,CApBD;;AAsBA,eAAeF,oBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { Pressable, Text } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nconst HelpGetSupportButton = ( { onPress, title } ) => {\n\tconst buttonStyle = usePreferredColorSchemeStyle(\n\t\tstyles.button,\n\t\tstyles.buttonDark\n\t);\n\n\tconst textStyle = usePreferredColorSchemeStyle(\n\t\tstyles.buttonText,\n\t\tstyles.buttonTextDark\n\t);\n\n\treturn (\n\t\t<Pressable\n\t\t\tstyle={ buttonStyle }\n\t\t\tonPress={ onPress }\n\t\t\taccessibilityRole={ 'button' }\n\t\t>\n\t\t\t<Text style={ textStyle }>{ title }</Text>\n\t\t</Pressable>\n\t);\n};\n\nexport default HelpGetSupportButton;\n"]}
@@ -5,7 +5,7 @@ import { createElement } from "@wordpress/element";
5
5
  * External dependencies
6
6
  */
7
7
  import { kebabCase } from 'lodash';
8
- import { ScrollView, StyleSheet, View } from 'react-native';
8
+ import { Text, ScrollView, StyleSheet, View } from 'react-native';
9
9
  import { TransitionPresets } from '@react-navigation/stack';
10
10
  /**
11
11
  * WordPress dependencies
@@ -16,6 +16,8 @@ import { __ } from '@wordpress/i18n';
16
16
  import { helpFilled, plusCircleFilled, alignJustifyAlt, trashFilled, cogAlt } from '@wordpress/icons';
17
17
  import { useSelect } from '@wordpress/data';
18
18
  import { store as editorStore } from '@wordpress/editor';
19
+ import { usePreferredColorSchemeStyle } from '@wordpress/compose';
20
+ import { requestContactCustomerSupport, requestGotoCustomerSupportOptions } from '@wordpress/react-native-bridge';
19
21
  /**
20
22
  * Internal dependencies
21
23
  */
@@ -23,6 +25,7 @@ import { store as editorStore } from '@wordpress/editor';
23
25
  import styles from './style.scss';
24
26
  import HelpDetailNavigationScreen from './help-detail-navigation-screen';
25
27
  import HelpTopicRow from './help-topic-row';
28
+ import HelpGetSupportButton from './help-get-support-button';
26
29
  import IntroToBlocks from './intro-to-blocks';
27
30
  import AddBlocks from './add-blocks';
28
31
  import MoveBlocks from './move-blocks';
@@ -60,13 +63,15 @@ function EditorHelpTopics({
60
63
  } = useSelect(select => ({
61
64
  postType: select(editorStore).getEditedPostAttribute('type')
62
65
  }));
66
+ const sectionTitle = usePreferredColorSchemeStyle(styles.helpDetailSectionHeading, styles.helpDetailSectionHeadingDark);
63
67
  const title = postType === 'page' ? __('How to edit your page') : __('How to edit your post');
64
68
  return createElement(BottomSheet, {
65
69
  isVisible: isVisible,
66
70
  onClose: onClose,
67
71
  hideHeader: true,
68
72
  hasNavigation: true,
69
- contentStyle: styles.contentContainer
73
+ contentStyle: styles.contentContainer,
74
+ testID: "editor-help-modal"
70
75
  }, createElement(BottomSheet.NavigationContainer, {
71
76
  animate: true,
72
77
  main: true
@@ -94,7 +99,9 @@ function EditorHelpTopics({
94
99
  */
95
100
  marginTop: 0
96
101
  }
97
- }), createElement(PanelBody, null, HELP_TOPICS.map(({
102
+ }), createElement(PanelBody, null, createElement(Text, {
103
+ style: sectionTitle
104
+ }, __('The basics')), HELP_TOPICS.map(({
98
105
  label,
99
106
  icon
100
107
  }) => {
@@ -105,6 +112,14 @@ function EditorHelpTopics({
105
112
  icon: icon,
106
113
  screenName: labelSlug
107
114
  });
115
+ }), createElement(Text, {
116
+ style: sectionTitle
117
+ }, __('Get support')), createElement(HelpGetSupportButton, {
118
+ title: __('Contact support'),
119
+ onPress: requestContactCustomerSupport
120
+ }), createElement(HelpGetSupportButton, {
121
+ title: __('More support options'),
122
+ onPress: requestGotoCustomerSupportOptions
108
123
  })));
109
124
  }))), HELP_TOPICS.map(({
110
125
  view,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/editor-help/index.native.js"],"names":["kebabCase","ScrollView","StyleSheet","View","TransitionPresets","BottomSheet","BottomSheetConsumer","PanelBody","__","helpFilled","plusCircleFilled","alignJustifyAlt","trashFilled","cogAlt","useSelect","store","editorStore","styles","HelpDetailNavigationScreen","HelpTopicRow","IntroToBlocks","AddBlocks","MoveBlocks","RemoveBlocks","CustomizeBlocks","HELP_TOPICS","label","icon","view","EditorHelpTopics","close","isVisible","onClose","postType","select","getEditedPostAttribute","title","contentContainer","container","listProps","contentContainerStyle","flatten","paddingBottom","Math","max","safeAreaBottomInset","marginTop","map","labelSlug","gestureEnabled","DefaultTransition"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AACA,SAASC,UAAT,EA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dependencies\n */\nimport { kebabCase } from 'lodash';\nimport { ScrollView, StyleSheet, View } from 'react-native';\nimport { TransitionPresets } from '@react-navigation/stack';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBottomSheet,\n\tBottomSheetConsumer,\n\tPanelBody,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\thelpFilled,\n\tplusCircleFilled,\n\talignJustifyAlt,\n\ttrashFilled,\n\tcogAlt,\n} from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport HelpDetailNavigationScreen from './help-detail-navigation-screen';\nimport HelpTopicRow from './help-topic-row';\nimport IntroToBlocks from './intro-to-blocks';\nimport AddBlocks from './add-blocks';\nimport MoveBlocks from './move-blocks';\nimport RemoveBlocks from './remove-blocks';\nimport CustomizeBlocks from './customize-blocks';\n\nconst HELP_TOPICS = [\n\t{\n\t\tlabel: __( 'What is a block?' ),\n\t\ticon: helpFilled,\n\t\tview: <IntroToBlocks />,\n\t},\n\t{\n\t\tlabel: __( 'Add blocks' ),\n\t\ticon: plusCircleFilled,\n\t\tview: <AddBlocks />,\n\t},\n\t{ label: __( 'Move blocks' ), icon: alignJustifyAlt, view: <MoveBlocks /> },\n\t{ label: __( 'Remove blocks' ), icon: trashFilled, view: <RemoveBlocks /> },\n\t{\n\t\tlabel: __( 'Customize blocks' ),\n\t\ticon: cogAlt,\n\t\tview: <CustomizeBlocks />,\n\t},\n];\n\nfunction EditorHelpTopics( { close, isVisible, onClose } ) {\n\tconst { postType } = useSelect( ( select ) => ( {\n\t\tpostType: select( editorStore ).getEditedPostAttribute( 'type' ),\n\t} ) );\n\n\tconst title =\n\t\tpostType === 'page'\n\t\t\t? __( 'How to edit your page' )\n\t\t\t: __( 'How to edit your post' );\n\n\treturn (\n\t\t<BottomSheet\n\t\t\tisVisible={ isVisible }\n\t\t\tonClose={ onClose }\n\t\t\thideHeader\n\t\t\thasNavigation\n\t\t\tcontentStyle={ styles.contentContainer }\n\t\t>\n\t\t\t<BottomSheet.NavigationContainer animate main>\n\t\t\t\t<BottomSheet.NavigationScreen\n\t\t\t\t\tisScrollable\n\t\t\t\t\tfullScreen\n\t\t\t\t\tname=\"help-topics\"\n\t\t\t\t>\n\t\t\t\t\t<View style={ styles.container }>\n\t\t\t\t\t\t<BottomSheet.NavBar>\n\t\t\t\t\t\t\t<BottomSheet.NavBar.DismissButton\n\t\t\t\t\t\t\t\tonPress={ close }\n\t\t\t\t\t\t\t\tiosText={ __( 'Close' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<BottomSheet.NavBar.Heading>\n\t\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t</BottomSheet.NavBar.Heading>\n\t\t\t\t\t\t</BottomSheet.NavBar>\n\t\t\t\t\t\t<BottomSheetConsumer>\n\t\t\t\t\t\t\t{ ( { listProps } ) => {\n\t\t\t\t\t\t\t\tconst contentContainerStyle = StyleSheet.flatten(\n\t\t\t\t\t\t\t\t\tlistProps.contentContainerStyle\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<ScrollView\n\t\t\t\t\t\t\t\t\t\t{ ...listProps }\n\t\t\t\t\t\t\t\t\t\tcontentContainerStyle={ {\n\t\t\t\t\t\t\t\t\t\t\t...contentContainerStyle,\n\t\t\t\t\t\t\t\t\t\t\tpaddingBottom: Math.max(\n\t\t\t\t\t\t\t\t\t\t\t\tlistProps.safeAreaBottomInset,\n\t\t\t\t\t\t\t\t\t\t\t\tcontentContainerStyle.paddingBottom\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t\t\t\t * Remove margin set via `hideHeader`. Combining a header\n\t\t\t\t\t\t\t\t\t\t\t * and navigation in this bottom sheet is at odds with the\n\t\t\t\t\t\t\t\t\t\t\t * current `BottomSheet` implementation.\n\t\t\t\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\t\t\t\tmarginTop: 0,\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<PanelBody>\n\t\t\t\t\t\t\t\t\t\t\t{ /* Print out help topics */ }\n\t\t\t\t\t\t\t\t\t\t\t{ HELP_TOPICS.map(\n\t\t\t\t\t\t\t\t\t\t\t\t( { label, icon } ) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst labelSlug = kebabCase(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<HelpTopicRow\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={ labelSlug }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tscreenName={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabelSlug\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</PanelBody>\n\t\t\t\t\t\t\t\t\t</ScrollView>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t</BottomSheetConsumer>\n\t\t\t\t\t</View>\n\t\t\t\t</BottomSheet.NavigationScreen>\n\t\t\t\t{ /* Print out help detail screens */ }\n\t\t\t\t{ HELP_TOPICS.map( ( { view, label } ) => {\n\t\t\t\t\tconst labelSlug = kebabCase( label );\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<HelpDetailNavigationScreen\n\t\t\t\t\t\t\tkey={ labelSlug }\n\t\t\t\t\t\t\tname={ labelSlug }\n\t\t\t\t\t\t\tcontent={ view }\n\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\toptions={ {\n\t\t\t\t\t\t\t\tgestureEnabled: true,\n\t\t\t\t\t\t\t\t...TransitionPresets.DefaultTransition,\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</BottomSheet.NavigationContainer>\n\t\t</BottomSheet>\n\t);\n}\n\nexport default EditorHelpTopics;\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/editor-help/index.native.js"],"names":["kebabCase","Text","ScrollView","StyleSheet","View","TransitionPresets","BottomSheet","BottomSheetConsumer","PanelBody","__","helpFilled","plusCircleFilled","alignJustifyAlt","trashFilled","cogAlt","useSelect","store","editorStore","usePreferredColorSchemeStyle","requestContactCustomerSupport","requestGotoCustomerSupportOptions","styles","HelpDetailNavigationScreen","HelpTopicRow","HelpGetSupportButton","IntroToBlocks","AddBlocks","MoveBlocks","RemoveBlocks","CustomizeBlocks","HELP_TOPICS","label","icon","view","EditorHelpTopics","close","isVisible","onClose","postType","select","getEditedPostAttribute","sectionTitle","helpDetailSectionHeading","helpDetailSectionHeadingDark","title","contentContainer","container","listProps","contentContainerStyle","flatten","paddingBottom","Math","max","safeAreaBottomInset","marginTop","map","labelSlug","gestureEnabled","DefaultTransition"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AACA,SAASC,IAAT,EAAeC,UAAf,EAA2BC,UAA3B,EAAuCC,IAAvC,QAAmD,cAAnD;AACA,SAASC,iBAAT,QAAkC,yBAAlC;AAEA;AACA;AACA;;AACA,SACCC,WADD,EAECC,mBAFD,EAGCC,SAHD,QAIO,uBAJP;AAKA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,UAD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AEtB,IAAAA,IAAF;AAAQF,IAAAA;AAAR,GAAF,KAAuB;AACzC,UAAMyB,SAAS,GAAGxD,SAAS,CAAE+B,KAAF,CAA3B;AACA,WACC,cAAC,0BAAD;AACC,MAAA,GAAG,EAAGyB,SADP;AAEC,MAAA,IAAI,EAAGA,SAFR;AAGC,MAAA,OAAO,EAAGvB,IAHX;AAIC,MAAA,KAAK,EAAGF,KAJT;AAKC,MAAA,OAAO,EAAG;AACT0B,QAAAA,cAAc,EAAE,IADP;AAET,WAAGpD,iBAAiB,CAACqD;AAFZ;AALX,MADD;AAYA,GAdC,CA7FH,CARD,CADD;AAwHA;;AAED,eAAexB,gBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\nimport { Text, ScrollView, StyleSheet, View } from 'react-native';\nimport { TransitionPresets } from '@react-navigation/stack';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBottomSheet,\n\tBottomSheetConsumer,\n\tPanelBody,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\thelpFilled,\n\tplusCircleFilled,\n\talignJustifyAlt,\n\ttrashFilled,\n\tcogAlt,\n} from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\nimport {\n\trequestContactCustomerSupport,\n\trequestGotoCustomerSupportOptions,\n} from '@wordpress/react-native-bridge';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport HelpDetailNavigationScreen from './help-detail-navigation-screen';\nimport HelpTopicRow from './help-topic-row';\nimport HelpGetSupportButton from './help-get-support-button';\nimport IntroToBlocks from './intro-to-blocks';\nimport AddBlocks from './add-blocks';\nimport MoveBlocks from './move-blocks';\nimport RemoveBlocks from './remove-blocks';\nimport CustomizeBlocks from './customize-blocks';\n\nconst HELP_TOPICS = [\n\t{\n\t\tlabel: __( 'What is a block?' ),\n\t\ticon: helpFilled,\n\t\tview: <IntroToBlocks />,\n\t},\n\t{\n\t\tlabel: __( 'Add blocks' ),\n\t\ticon: plusCircleFilled,\n\t\tview: <AddBlocks />,\n\t},\n\t{ label: __( 'Move blocks' ), icon: alignJustifyAlt, view: <MoveBlocks /> },\n\t{ label: __( 'Remove blocks' ), icon: trashFilled, view: <RemoveBlocks /> },\n\t{\n\t\tlabel: __( 'Customize blocks' ),\n\t\ticon: cogAlt,\n\t\tview: <CustomizeBlocks />,\n\t},\n];\n\nfunction EditorHelpTopics( { close, isVisible, onClose } ) {\n\tconst { postType } = useSelect( ( select ) => ( {\n\t\tpostType: select( editorStore ).getEditedPostAttribute( 'type' ),\n\t} ) );\n\n\tconst sectionTitle = usePreferredColorSchemeStyle(\n\t\tstyles.helpDetailSectionHeading,\n\t\tstyles.helpDetailSectionHeadingDark\n\t);\n\n\tconst title =\n\t\tpostType === 'page'\n\t\t\t? __( 'How to edit your page' )\n\t\t\t: __( 'How to edit your post' );\n\n\treturn (\n\t\t<BottomSheet\n\t\t\tisVisible={ isVisible }\n\t\t\tonClose={ onClose }\n\t\t\thideHeader\n\t\t\thasNavigation\n\t\t\tcontentStyle={ styles.contentContainer }\n\t\t\ttestID=\"editor-help-modal\"\n\t\t>\n\t\t\t<BottomSheet.NavigationContainer animate main>\n\t\t\t\t<BottomSheet.NavigationScreen\n\t\t\t\t\tisScrollable\n\t\t\t\t\tfullScreen\n\t\t\t\t\tname=\"help-topics\"\n\t\t\t\t>\n\t\t\t\t\t<View style={ styles.container }>\n\t\t\t\t\t\t<BottomSheet.NavBar>\n\t\t\t\t\t\t\t<BottomSheet.NavBar.DismissButton\n\t\t\t\t\t\t\t\tonPress={ close }\n\t\t\t\t\t\t\t\tiosText={ __( 'Close' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<BottomSheet.NavBar.Heading>\n\t\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t</BottomSheet.NavBar.Heading>\n\t\t\t\t\t\t</BottomSheet.NavBar>\n\t\t\t\t\t\t<BottomSheetConsumer>\n\t\t\t\t\t\t\t{ ( { listProps } ) => {\n\t\t\t\t\t\t\t\tconst contentContainerStyle = StyleSheet.flatten(\n\t\t\t\t\t\t\t\t\tlistProps.contentContainerStyle\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<ScrollView\n\t\t\t\t\t\t\t\t\t\t{ ...listProps }\n\t\t\t\t\t\t\t\t\t\tcontentContainerStyle={ {\n\t\t\t\t\t\t\t\t\t\t\t...contentContainerStyle,\n\t\t\t\t\t\t\t\t\t\t\tpaddingBottom: Math.max(\n\t\t\t\t\t\t\t\t\t\t\t\tlistProps.safeAreaBottomInset,\n\t\t\t\t\t\t\t\t\t\t\t\tcontentContainerStyle.paddingBottom\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t\t\t\t * Remove margin set via `hideHeader`. Combining a header\n\t\t\t\t\t\t\t\t\t\t\t * and navigation in this bottom sheet is at odds with the\n\t\t\t\t\t\t\t\t\t\t\t * current `BottomSheet` implementation.\n\t\t\t\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\t\t\t\tmarginTop: 0,\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<PanelBody>\n\t\t\t\t\t\t\t\t\t\t\t<Text style={ sectionTitle }>\n\t\t\t\t\t\t\t\t\t\t\t\t{ __( 'The basics' ) }\n\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t{ /* Print out help topics */ }\n\t\t\t\t\t\t\t\t\t\t\t{ HELP_TOPICS.map(\n\t\t\t\t\t\t\t\t\t\t\t\t( { label, icon } ) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst labelSlug = kebabCase(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<HelpTopicRow\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={ labelSlug }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tscreenName={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabelSlug\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t<Text style={ sectionTitle }>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ __( 'Get support' ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t<HelpGetSupportButton\n\t\t\t\t\t\t\t\t\t\t\t\t\ttitle={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Contact support'\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\tonPress={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trequestContactCustomerSupport\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t<HelpGetSupportButton\n\t\t\t\t\t\t\t\t\t\t\t\t\ttitle={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'More support options'\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\tonPress={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trequestGotoCustomerSupportOptions\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t</PanelBody>\n\t\t\t\t\t\t\t\t\t</ScrollView>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t</BottomSheetConsumer>\n\t\t\t\t\t</View>\n\t\t\t\t</BottomSheet.NavigationScreen>\n\t\t\t\t{ /* Print out help detail screens */ }\n\t\t\t\t{ HELP_TOPICS.map( ( { view, label } ) => {\n\t\t\t\t\tconst labelSlug = kebabCase( label );\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<HelpDetailNavigationScreen\n\t\t\t\t\t\t\tkey={ labelSlug }\n\t\t\t\t\t\t\tname={ labelSlug }\n\t\t\t\t\t\t\tcontent={ view }\n\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\toptions={ {\n\t\t\t\t\t\t\t\tgestureEnabled: true,\n\t\t\t\t\t\t\t\t...TransitionPresets.DefaultTransition,\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</BottomSheet.NavigationContainer>\n\t\t</BottomSheet>\n\t);\n}\n\nexport default EditorHelpTopics;\n"]}
@@ -19,24 +19,24 @@ function SaveShortcut({
19
19
  } = useDispatch(editorStore);
20
20
  const {
21
21
  isEditedPostDirty,
22
- getPostEdits
23
- } = useSelect(select => {
24
- const {
25
- isEditedPostDirty: _isEditedPostDirty,
26
- getPostEdits: _getPostEdits
27
- } = select(editorStore);
28
- return {
29
- isEditedPostDirty: _isEditedPostDirty,
30
- getPostEdits: _getPostEdits
31
- };
32
- }, []);
22
+ getPostEdits,
23
+ isPostSavingLocked
24
+ } = useSelect(editorStore);
33
25
  useShortcut('core/editor/save', event => {
34
- event.preventDefault(); // TODO: This should be handled in the `savePost` effect in
26
+ event.preventDefault();
27
+ /**
28
+ * Do not save the post if post saving is locked.
29
+ */
30
+
31
+ if (isPostSavingLocked()) {
32
+ return;
33
+ } // TODO: This should be handled in the `savePost` effect in
35
34
  // considering `isSaveable`. See note on `isEditedPostSaveable`
36
35
  // selector about dirtiness and meta-boxes.
37
36
  //
38
37
  // See: `isEditedPostSaveable`
39
38
 
39
+
40
40
  if (!isEditedPostDirty()) {
41
41
  return;
42
42
  } // The text editor requires that editor blocks are updated for a
@@ -55,8 +55,6 @@ function SaveShortcut({
55
55
  }
56
56
 
57
57
  savePost();
58
- }, {
59
- bindGlobal: true
60
58
  });
61
59
  return null;
62
60
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/global-keyboard-shortcuts/save-shortcut.js"],"names":["useShortcut","useDispatch","useSelect","parse","store","editorStore","SaveShortcut","resetBlocksOnSave","resetEditorBlocks","savePost","isEditedPostDirty","getPostEdits","select","_isEditedPostDirty","_getPostEdits","event","preventDefault","postEdits","content","blocks","bindGlobal"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAT,QAA4B,+BAA5B;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAT,QAAsB,mBAAtB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;;AAEA,SAASC,YAAT,CAAuB;AAAEC,EAAAA;AAAF,CAAvB,EAA+C;AAC9C,QAAM;AAAEC,IAAAA,iBAAF;AAAqBC,IAAAA;AAArB,MAAkCR,WAAW,CAAEI,WAAF,CAAnD;AACA,QAAM;AAAEK,IAAAA,iBAAF;AAAqBC,IAAAA;AAArB,MAAsCT,SAAS,CAAIU,MAAF,IAAc;AACpE,UAAM;AACLF,MAAAA,iBAAiB,EAAEG,kBADd;AAELF,MAAAA,YAAY,EAAEG;AAFT,QAGFF,MAAM,CAAEP,WAAF,CAHV;AAKA,WAAO;AACNK,MAAAA,iBAAiB,EAAEG,kBADb;AAENF,MAAAA,YAAY,EAAEG;AAFR,KAAP;AAIA,GAVoD,EAUlD,EAVkD,CAArD;AAYAd,EAAAA,WAAW,CACV,kBADU,EAERe,KAAF,IAAa;AACZA,IAAAA,KAAK,CAACC,cAAN,GADY,CAGZ;AACA;AACA;AACA;AACA;;AACA,QAAK,CAAEN,iBAAiB,EAAxB,EAA6B;AAC5B;AACA,KAVW,CAYZ;AACA;AACA;AACA;;;AACA,QAAKH,iBAAL,EAAyB;AACxB,YAAMU,SAAS,GAAGN,YAAY,EAA9B;;AACA,UACCM,SAAS,CAACC,OAAV,IACA,OAAOD,SAAS,CAACC,OAAjB,KAA6B,QAF9B,EAGE;AACD,cAAMC,MAAM,GAAGhB,KAAK,CAAEc,SAAS,CAACC,OAAZ,CAApB;AACAV,QAAAA,iBAAiB,CAAEW,MAAF,CAAjB;AACA;AACD;;AAEDV,IAAAA,QAAQ;AACR,GA9BS,EA+BV;AAAEW,IAAAA,UAAU,EAAE;AAAd,GA/BU,CAAX;AAkCA,SAAO,IAAP;AACA;;AAED,eAAed,YAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { parse } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction SaveShortcut( { resetBlocksOnSave } ) {\n\tconst { resetEditorBlocks, savePost } = useDispatch( editorStore );\n\tconst { isEditedPostDirty, getPostEdits } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisEditedPostDirty: _isEditedPostDirty,\n\t\t\tgetPostEdits: _getPostEdits,\n\t\t} = select( editorStore );\n\n\t\treturn {\n\t\t\tisEditedPostDirty: _isEditedPostDirty,\n\t\t\tgetPostEdits: _getPostEdits,\n\t\t};\n\t}, [] );\n\n\tuseShortcut(\n\t\t'core/editor/save',\n\t\t( event ) => {\n\t\t\tevent.preventDefault();\n\n\t\t\t// TODO: This should be handled in the `savePost` effect in\n\t\t\t// considering `isSaveable`. See note on `isEditedPostSaveable`\n\t\t\t// selector about dirtiness and meta-boxes.\n\t\t\t//\n\t\t\t// See: `isEditedPostSaveable`\n\t\t\tif ( ! isEditedPostDirty() ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// The text editor requires that editor blocks are updated for a\n\t\t\t// save to work correctly. Usually this happens when the textarea\n\t\t\t// for the code editors blurs, but the shortcut can be used without\n\t\t\t// blurring the textarea.\n\t\t\tif ( resetBlocksOnSave ) {\n\t\t\t\tconst postEdits = getPostEdits();\n\t\t\t\tif (\n\t\t\t\t\tpostEdits.content &&\n\t\t\t\t\ttypeof postEdits.content === 'string'\n\t\t\t\t) {\n\t\t\t\t\tconst blocks = parse( postEdits.content );\n\t\t\t\t\tresetEditorBlocks( blocks );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tsavePost();\n\t\t},\n\t\t{ bindGlobal: true }\n\t);\n\n\treturn null;\n}\n\nexport default SaveShortcut;\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/global-keyboard-shortcuts/save-shortcut.js"],"names":["useShortcut","useDispatch","useSelect","parse","store","editorStore","SaveShortcut","resetBlocksOnSave","resetEditorBlocks","savePost","isEditedPostDirty","getPostEdits","isPostSavingLocked","event","preventDefault","postEdits","content","blocks"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAT,QAA4B,+BAA5B;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAT,QAAsB,mBAAtB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;;AAEA,SAASC,YAAT,CAAuB;AAAEC,EAAAA;AAAF,CAAvB,EAA+C;AAC9C,QAAM;AAAEC,IAAAA,iBAAF;AAAqBC,IAAAA;AAArB,MAAkCR,WAAW,CAAEI,WAAF,CAAnD;AACA,QAAM;AAAEK,IAAAA,iBAAF;AAAqBC,IAAAA,YAArB;AAAmCC,IAAAA;AAAnC,MAA0DV,SAAS,CACxEG,WADwE,CAAzE;AAIAL,EAAAA,WAAW,CAAE,kBAAF,EAAwBa,KAAF,IAAa;AAC7CA,IAAAA,KAAK,CAACC,cAAN;AAEA;AACF;AACA;;AACE,QAAKF,kBAAkB,EAAvB,EAA4B;AAC3B;AACA,KAR4C,CAU7C;AACA;AACA;AACA;AACA;;;AACA,QAAK,CAAEF,iBAAiB,EAAxB,EAA6B;AAC5B;AACA,KAjB4C,CAmB7C;AACA;AACA;AACA;;;AACA,QAAKH,iBAAL,EAAyB;AACxB,YAAMQ,SAAS,GAAGJ,YAAY,EAA9B;;AACA,UAAKI,SAAS,CAACC,OAAV,IAAqB,OAAOD,SAAS,CAACC,OAAjB,KAA6B,QAAvD,EAAkE;AACjE,cAAMC,MAAM,GAAGd,KAAK,CAAEY,SAAS,CAACC,OAAZ,CAApB;AACAR,QAAAA,iBAAiB,CAAES,MAAF,CAAjB;AACA;AACD;;AAEDR,IAAAA,QAAQ;AACR,GAhCU,CAAX;AAkCA,SAAO,IAAP;AACA;;AAED,eAAeH,YAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { parse } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction SaveShortcut( { resetBlocksOnSave } ) {\n\tconst { resetEditorBlocks, savePost } = useDispatch( editorStore );\n\tconst { isEditedPostDirty, getPostEdits, isPostSavingLocked } = useSelect(\n\t\teditorStore\n\t);\n\n\tuseShortcut( 'core/editor/save', ( event ) => {\n\t\tevent.preventDefault();\n\n\t\t/**\n\t\t * Do not save the post if post saving is locked.\n\t\t */\n\t\tif ( isPostSavingLocked() ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// TODO: This should be handled in the `savePost` effect in\n\t\t// considering `isSaveable`. See note on `isEditedPostSaveable`\n\t\t// selector about dirtiness and meta-boxes.\n\t\t//\n\t\t// See: `isEditedPostSaveable`\n\t\tif ( ! isEditedPostDirty() ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// The text editor requires that editor blocks are updated for a\n\t\t// save to work correctly. Usually this happens when the textarea\n\t\t// for the code editors blurs, but the shortcut can be used without\n\t\t// blurring the textarea.\n\t\tif ( resetBlocksOnSave ) {\n\t\t\tconst postEdits = getPostEdits();\n\t\t\tif ( postEdits.content && typeof postEdits.content === 'string' ) {\n\t\t\t\tconst blocks = parse( postEdits.content );\n\t\t\t\tresetEditorBlocks( blocks );\n\t\t\t}\n\t\t}\n\n\t\tsavePost();\n\t} );\n\n\treturn null;\n}\n\nexport default SaveShortcut;\n"]}
@@ -20,14 +20,10 @@ function VisualEditorGlobalKeyboardShortcuts() {
20
20
  useShortcut('core/editor/undo', event => {
21
21
  undo();
22
22
  event.preventDefault();
23
- }, {
24
- bindGlobal: true
25
23
  });
26
24
  useShortcut('core/editor/redo', event => {
27
25
  redo();
28
26
  event.preventDefault();
29
- }, {
30
- bindGlobal: true
31
27
  });
32
28
  return createElement(SaveShortcut, null);
33
29
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/global-keyboard-shortcuts/visual-editor-shortcuts.js"],"names":["useShortcut","useDispatch","SaveShortcut","store","editorStore","VisualEditorGlobalKeyboardShortcuts","redo","undo","event","preventDefault","bindGlobal"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,QAA4B,+BAA5B;AACA,SAASC,WAAT,QAA4B,iBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,iBAAzB;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;;AAEA,SAASC,mCAAT,GAA+C;AAC9C,QAAM;AAAEC,IAAAA,IAAF;AAAQC,IAAAA;AAAR,MAAiBN,WAAW,CAAEG,WAAF,CAAlC;AAEAJ,EAAAA,WAAW,CACV,kBADU,EAERQ,KAAF,IAAa;AACZD,IAAAA,IAAI;AACJC,IAAAA,KAAK,CAACC,cAAN;AACA,GALS,EAMV;AAAEC,IAAAA,UAAU,EAAE;AAAd,GANU,CAAX;AASAV,EAAAA,WAAW,CACV,kBADU,EAERQ,KAAF,IAAa;AACZF,IAAAA,IAAI;AACJE,IAAAA,KAAK,CAACC,cAAN;AACA,GALS,EAMV;AAAEC,IAAAA,UAAU,EAAE;AAAd,GANU,CAAX;AASA,SAAO,cAAC,YAAD,OAAP;AACA;;AAED,eAAeL,mCAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport SaveShortcut from './save-shortcut';\nimport { store as editorStore } from '../../store';\n\nfunction VisualEditorGlobalKeyboardShortcuts() {\n\tconst { redo, undo } = useDispatch( editorStore );\n\n\tuseShortcut(\n\t\t'core/editor/undo',\n\t\t( event ) => {\n\t\t\tundo();\n\t\t\tevent.preventDefault();\n\t\t},\n\t\t{ bindGlobal: true }\n\t);\n\n\tuseShortcut(\n\t\t'core/editor/redo',\n\t\t( event ) => {\n\t\t\tredo();\n\t\t\tevent.preventDefault();\n\t\t},\n\t\t{ bindGlobal: true }\n\t);\n\n\treturn <SaveShortcut />;\n}\n\nexport default VisualEditorGlobalKeyboardShortcuts;\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/global-keyboard-shortcuts/visual-editor-shortcuts.js"],"names":["useShortcut","useDispatch","SaveShortcut","store","editorStore","VisualEditorGlobalKeyboardShortcuts","redo","undo","event","preventDefault"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,QAA4B,+BAA5B;AACA,SAASC,WAAT,QAA4B,iBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,iBAAzB;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;;AAEA,SAASC,mCAAT,GAA+C;AAC9C,QAAM;AAAEC,IAAAA,IAAF;AAAQC,IAAAA;AAAR,MAAiBN,WAAW,CAAEG,WAAF,CAAlC;AAEAJ,EAAAA,WAAW,CAAE,kBAAF,EAAwBQ,KAAF,IAAa;AAC7CD,IAAAA,IAAI;AACJC,IAAAA,KAAK,CAACC,cAAN;AACA,GAHU,CAAX;AAKAT,EAAAA,WAAW,CAAE,kBAAF,EAAwBQ,KAAF,IAAa;AAC7CF,IAAAA,IAAI;AACJE,IAAAA,KAAK,CAACC,cAAN;AACA,GAHU,CAAX;AAKA,SAAO,cAAC,YAAD,OAAP;AACA;;AAED,eAAeJ,mCAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport SaveShortcut from './save-shortcut';\nimport { store as editorStore } from '../../store';\n\nfunction VisualEditorGlobalKeyboardShortcuts() {\n\tconst { redo, undo } = useDispatch( editorStore );\n\n\tuseShortcut( 'core/editor/undo', ( event ) => {\n\t\tundo();\n\t\tevent.preventDefault();\n\t} );\n\n\tuseShortcut( 'core/editor/redo', ( event ) => {\n\t\tredo();\n\t\tevent.preventDefault();\n\t} );\n\n\treturn <SaveShortcut />;\n}\n\nexport default VisualEditorGlobalKeyboardShortcuts;\n"]}
@@ -8,7 +8,7 @@ import { find, get, includes, union } from 'lodash';
8
8
  * WordPress dependencies
9
9
  */
10
10
 
11
- import { __ } from '@wordpress/i18n';
11
+ import { __, sprintf } from '@wordpress/i18n';
12
12
  import { Button, SelectControl } from '@wordpress/components';
13
13
  import { useDispatch, useSelect } from '@wordpress/data';
14
14
  import { useInstanceId } from '@wordpress/compose';
@@ -117,6 +117,8 @@ export default function PostFormat() {
117
117
  }, __('Suggestion:'), ' ', createElement(Button, {
118
118
  variant: "link",
119
119
  onClick: () => onUpdatePostFormat(suggestion.id)
120
- }, suggestion.caption))));
120
+ }, sprintf(
121
+ /* translators: %s: post format */
122
+ __('Apply format: %s'), suggestion.caption)))));
121
123
  }
122
124
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-format/index.js"],"names":["find","get","includes","union","__","Button","SelectControl","useDispatch","useSelect","useInstanceId","store","coreStore","PostFormatCheck","editorStore","POST_FORMATS","id","caption","sort","a","b","normalizedA","toUpperCase","normalizedB","PostFormat","instanceId","postFormatSelectorId","postFormat","suggestedFormat","supportedFormats","select","getEditedPostAttribute","getSuggestedPostFormat","_postFormat","themeSupports","getThemeSupports","formats","filter","format","suggestion","editPost","onUpdatePostFormat","map","label","value"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,GAAf,EAAoBC,QAApB,EAA8BC,KAA9B,QAA2C,QAA3C;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,aAAjB,QAAsC,uBAAtC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,eAAP,MAA4B,SAA5B;AACA,SAASF,KAAK,IAAIG,WAAlB,QAAqC,aAArC,C,CAEA;;AACA,OAAO,MAAMC,YAAY,GAAG,CAC3B;AAAEC,EAAAA,EAAE,EAAE,OAAN;AAAeC,EAAAA,OAAO,EAAEZ,EAAE,CAAE,OAAF;AAA1B,CAD2B,EAE3B;AAAEW,EAAAA,EAAE,EAAE,OAAN;AAAeC,EAAAA,OAAO,EAAEZ,EAAE,CAAE,OAAF;AAA1B,CAF2B,EAG3B;AAAEW,EAAAA,EAAE,EAAE,MAAN;AAAcC,EAAAA,OAAO,EAAEZ,EAAE,CAAE,MAAF;AAAzB,CAH2B,EAI3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,EAAGsB,UADT;AAEC,IAAA,QAAQ,EAAKW,MAAF,IAAcG,kBAAkB,CAAEH,MAAF,CAF5C;AAGC,IAAA,EAAE,EAAGZ,oBAHN;AAIC,IAAA,OAAO,EAAGU,OAAO,CAACM,GAAR,CAAeJ,MAAF,KAAgB;AACtCK,MAAAA,KAAK,EAAEL,MAAM,CAACrB,OADwB;AAEtC2B,MAAAA,KAAK,EAAEN,MAAM,CAACtB;AAFwB,KAAhB,CAAb;AAJX,IAJD,CADD,EAgBGuB,UAAU,IAAIA,UAAU,CAACvB,EAAX,KAAkBW,UAAhC,IACD;AAAK,IAAA,SAAS,EAAC;AAAf,KACGtB,EAAE,CAAE,aAAF,CADL,EAC0B,GAD1B,EAEC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,MADT;AAEC,IAAA,OAAO,EAAG,MACToC,kBAAkB,CAAEF,UAAU,CAACvB,EAAb;AAHpB,KAMGuB,UAAU,CAACtB,OANd,CAFD,CAjBF,CADD,CADD;AAkCA","sourcesContent":["/**\n * External dependencies\n */\nimport { find, get, includes, union } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button, SelectControl } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostFormatCheck from './check';\nimport { store as editorStore } from '../../store';\n\n// All WP post formats, sorted alphabetically by translated name.\nexport const POST_FORMATS = [\n\t{ id: 'aside', caption: __( 'Aside' ) },\n\t{ id: 'audio', caption: __( 'Audio' ) },\n\t{ id: 'chat', caption: __( 'Chat' ) },\n\t{ id: 'gallery', caption: __( 'Gallery' ) },\n\t{ id: 'image', caption: __( 'Image' ) },\n\t{ id: 'link', caption: __( 'Link' ) },\n\t{ id: 'quote', caption: __( 'Quote' ) },\n\t{ id: 'standard', caption: __( 'Standard' ) },\n\t{ id: 'status', caption: __( 'Status' ) },\n\t{ id: 'video', caption: __( 'Video' ) },\n].sort( ( a, b ) => {\n\tconst normalizedA = a.caption.toUpperCase();\n\tconst normalizedB = b.caption.toUpperCase();\n\n\tif ( normalizedA < normalizedB ) {\n\t\treturn -1;\n\t}\n\tif ( normalizedA > normalizedB ) {\n\t\treturn 1;\n\t}\n\treturn 0;\n} );\n\nexport default function PostFormat() {\n\tconst instanceId = useInstanceId( PostFormat );\n\tconst postFormatSelectorId = `post-format-selector-${ instanceId }`;\n\n\tconst { postFormat, suggestedFormat, supportedFormats } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostAttribute, getSuggestedPostFormat } = select(\n\t\t\t\teditorStore\n\t\t\t);\n\t\t\tconst _postFormat = getEditedPostAttribute( 'format' );\n\t\t\tconst themeSupports = select( coreStore ).getThemeSupports();\n\t\t\treturn {\n\t\t\t\tpostFormat: _postFormat ?? 'standard',\n\t\t\t\tsuggestedFormat: getSuggestedPostFormat(),\n\t\t\t\t// Ensure current format is always in the set.\n\t\t\t\t// The current format may not be a format supported by the theme.\n\t\t\t\tsupportedFormats: union(\n\t\t\t\t\t[ _postFormat ],\n\t\t\t\t\tget( themeSupports, [ 'formats' ], [] )\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst formats = POST_FORMATS.filter( ( format ) =>\n\t\tincludes( supportedFormats, format.id )\n\t);\n\tconst suggestion = find(\n\t\tformats,\n\t\t( format ) => format.id === suggestedFormat\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tconst onUpdatePostFormat = ( format ) => editPost( { format } );\n\n\treturn (\n\t\t<PostFormatCheck>\n\t\t\t<div className=\"editor-post-format\">\n\t\t\t\t<div className=\"editor-post-format__content\">\n\t\t\t\t\t<label htmlFor={ postFormatSelectorId }>\n\t\t\t\t\t\t{ __( 'Post Format' ) }\n\t\t\t\t\t</label>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tvalue={ postFormat }\n\t\t\t\t\t\tonChange={ ( format ) => onUpdatePostFormat( format ) }\n\t\t\t\t\t\tid={ postFormatSelectorId }\n\t\t\t\t\t\toptions={ formats.map( ( format ) => ( {\n\t\t\t\t\t\t\tlabel: format.caption,\n\t\t\t\t\t\t\tvalue: format.id,\n\t\t\t\t\t\t} ) ) }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\n\t\t\t\t{ suggestion && suggestion.id !== postFormat && (\n\t\t\t\t\t<div className=\"editor-post-format__suggestion\">\n\t\t\t\t\t\t{ __( 'Suggestion:' ) }{ ' ' }\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\tonUpdatePostFormat( suggestion.id )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ suggestion.caption }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</PostFormatCheck>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-format/index.js"],"names":["find","get","includes","union","__","sprintf","Button","SelectControl","useDispatch","useSelect","useInstanceId","store","coreStore","PostFormatCheck","editorStore","POST_FORMATS","id","caption","sort","a","b","normalizedA","toUpperCase","normalizedB","PostFormat","instanceId","postFormatSelectorId","postFormat","suggestedFormat","supportedFormats","select","getEditedPostAttribute","getSuggestedPostFormat","_postFormat","themeSupports","getThemeSupports","formats","filter","format","suggestion","editPost","onUpdatePostFormat","map","label","value"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,GAAf,EAAoBC,QAApB,EAA8BC,KAA9B,QAA2C,QAA3C;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,MAAT,EAAiBC,aAAjB,QAAsC,uBAAtC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,aAAT,QA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\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button, SelectControl } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostFormatCheck from './check';\nimport { store as editorStore } from '../../store';\n\n// All WP post formats, sorted alphabetically by translated name.\nexport const POST_FORMATS = [\n\t{ id: 'aside', caption: __( 'Aside' ) },\n\t{ id: 'audio', caption: __( 'Audio' ) },\n\t{ id: 'chat', caption: __( 'Chat' ) },\n\t{ id: 'gallery', caption: __( 'Gallery' ) },\n\t{ id: 'image', caption: __( 'Image' ) },\n\t{ id: 'link', caption: __( 'Link' ) },\n\t{ id: 'quote', caption: __( 'Quote' ) },\n\t{ id: 'standard', caption: __( 'Standard' ) },\n\t{ id: 'status', caption: __( 'Status' ) },\n\t{ id: 'video', caption: __( 'Video' ) },\n].sort( ( a, b ) => {\n\tconst normalizedA = a.caption.toUpperCase();\n\tconst normalizedB = b.caption.toUpperCase();\n\n\tif ( normalizedA < normalizedB ) {\n\t\treturn -1;\n\t}\n\tif ( normalizedA > normalizedB ) {\n\t\treturn 1;\n\t}\n\treturn 0;\n} );\n\nexport default function PostFormat() {\n\tconst instanceId = useInstanceId( PostFormat );\n\tconst postFormatSelectorId = `post-format-selector-${ instanceId }`;\n\n\tconst { postFormat, suggestedFormat, supportedFormats } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostAttribute, getSuggestedPostFormat } = select(\n\t\t\t\teditorStore\n\t\t\t);\n\t\t\tconst _postFormat = getEditedPostAttribute( 'format' );\n\t\t\tconst themeSupports = select( coreStore ).getThemeSupports();\n\t\t\treturn {\n\t\t\t\tpostFormat: _postFormat ?? 'standard',\n\t\t\t\tsuggestedFormat: getSuggestedPostFormat(),\n\t\t\t\t// Ensure current format is always in the set.\n\t\t\t\t// The current format may not be a format supported by the theme.\n\t\t\t\tsupportedFormats: union(\n\t\t\t\t\t[ _postFormat ],\n\t\t\t\t\tget( themeSupports, [ 'formats' ], [] )\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst formats = POST_FORMATS.filter( ( format ) =>\n\t\tincludes( supportedFormats, format.id )\n\t);\n\tconst suggestion = find(\n\t\tformats,\n\t\t( format ) => format.id === suggestedFormat\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tconst onUpdatePostFormat = ( format ) => editPost( { format } );\n\n\treturn (\n\t\t<PostFormatCheck>\n\t\t\t<div className=\"editor-post-format\">\n\t\t\t\t<div className=\"editor-post-format__content\">\n\t\t\t\t\t<label htmlFor={ postFormatSelectorId }>\n\t\t\t\t\t\t{ __( 'Post Format' ) }\n\t\t\t\t\t</label>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tvalue={ postFormat }\n\t\t\t\t\t\tonChange={ ( format ) => onUpdatePostFormat( format ) }\n\t\t\t\t\t\tid={ postFormatSelectorId }\n\t\t\t\t\t\toptions={ formats.map( ( format ) => ( {\n\t\t\t\t\t\t\tlabel: format.caption,\n\t\t\t\t\t\t\tvalue: format.id,\n\t\t\t\t\t\t} ) ) }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\n\t\t\t\t{ suggestion && suggestion.id !== postFormat && (\n\t\t\t\t\t<div className=\"editor-post-format__suggestion\">\n\t\t\t\t\t\t{ __( 'Suggestion:' ) }{ ' ' }\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\tonUpdatePostFormat( suggestion.id )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: post format */\n\t\t\t\t\t\t\t\t__( 'Apply format: %s' ),\n\t\t\t\t\t\t\t\tsuggestion.caption\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</PostFormatCheck>\n\t);\n}\n"]}
@@ -60,7 +60,7 @@ export default function PostLockedModal() {
60
60
  activePostLock: getActivePostLock(),
61
61
  postType: getPostType(getEditedPostAttribute('type'))
62
62
  };
63
- });
63
+ }, []);
64
64
  useEffect(() => {
65
65
  /**
66
66
  * Keep the lock refreshed.
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-locked-modal/index.js"],"names":["get","__","sprintf","Modal","Button","useSelect","useDispatch","addQueryArgs","useEffect","addAction","removeAction","useInstanceId","store","coreStore","getWPAdminURL","PostPreviewButton","editorStore","PostLockedModal","instanceId","hookName","autosave","updatePostLock","isLocked","isTakeover","user","postId","postLockUtils","activePostLock","postType","select","isPostLocked","isPostLockTakeover","getPostLockUser","getCurrentPostId","getActivePostLock","getEditedPostAttribute","getEditorSettings","getPostType","sendPostLock","data","lock","post_id","receivePostLock","received","lock_error","avatar","avatar_src","new_lock","releasePostLock","window","FormData","append","unlockNonce","navigator","sendBeacon","ajaxUrl","xhr","XMLHttpRequest","open","send","addEventListener","removeEventListener","userDisplayName","name","userAvatar","unlockUrl","lockKey","post","action","_wpnonce","nonce","allPostsUrl","post_type","allPostsLabel"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,KAAT,EAAgBC,MAAhB,QAA8B,uBAA9B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,SAAT,EAAoBC,YAApB,QAAwC,kBAAxC;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASC,aAAT,QA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,OAJD,EAKC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAC,SAAhB;AAA0B,IAAA,IAAI,EAAGR;AAAjC,KACGhE,EAAE,CAAE,WAAF,CADL,CALD,CAfD,CA3CF,CADD;AAwEA","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Modal, Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useEffect } from '@wordpress/element';\nimport { addAction, removeAction } from '@wordpress/hooks';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { getWPAdminURL } from '../../utils/url';\nimport PostPreviewButton from '../post-preview-button';\nimport { store as editorStore } from '../../store';\n\nexport default function PostLockedModal() {\n\tconst instanceId = useInstanceId( PostLockedModal );\n\tconst hookName = 'core/editor/post-locked-modal-' + instanceId;\n\tconst { autosave, updatePostLock } = useDispatch( editorStore );\n\tconst {\n\t\tisLocked,\n\t\tisTakeover,\n\t\tuser,\n\t\tpostId,\n\t\tpostLockUtils,\n\t\tactivePostLock,\n\t\tpostType,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisPostLocked,\n\t\t\tisPostLockTakeover,\n\t\t\tgetPostLockUser,\n\t\t\tgetCurrentPostId,\n\t\t\tgetActivePostLock,\n\t\t\tgetEditedPostAttribute,\n\t\t\tgetEditorSettings,\n\t\t} = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\treturn {\n\t\t\tisLocked: isPostLocked(),\n\t\t\tisTakeover: isPostLockTakeover(),\n\t\t\tuser: getPostLockUser(),\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tpostLockUtils: getEditorSettings().postLockUtils,\n\t\t\tactivePostLock: getActivePostLock(),\n\t\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\t};\n\t} );\n\n\tuseEffect( () => {\n\t\t/**\n\t\t * Keep the lock refreshed.\n\t\t *\n\t\t * When the user does not send a heartbeat in a heartbeat-tick\n\t\t * the user is no longer editing and another user can start editing.\n\t\t *\n\t\t * @param {Object} data Data to send in the heartbeat request.\n\t\t */\n\t\tfunction sendPostLock( data ) {\n\t\t\tif ( isLocked ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tdata[ 'wp-refresh-post-lock' ] = {\n\t\t\t\tlock: activePostLock,\n\t\t\t\tpost_id: postId,\n\t\t\t};\n\t\t}\n\n\t\t/**\n\t\t * Refresh post locks: update the lock string or show the dialog if somebody has taken over editing.\n\t\t *\n\t\t * @param {Object} data Data received in the heartbeat request\n\t\t */\n\t\tfunction receivePostLock( data ) {\n\t\t\tif ( ! data[ 'wp-refresh-post-lock' ] ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst received = data[ 'wp-refresh-post-lock' ];\n\t\t\tif ( received.lock_error ) {\n\t\t\t\t// Auto save and display the takeover modal.\n\t\t\t\tautosave();\n\t\t\t\tupdatePostLock( {\n\t\t\t\t\tisLocked: true,\n\t\t\t\t\tisTakeover: true,\n\t\t\t\t\tuser: {\n\t\t\t\t\t\tavatar: received.lock_error.avatar_src,\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t} else if ( received.new_lock ) {\n\t\t\t\tupdatePostLock( {\n\t\t\t\t\tisLocked: false,\n\t\t\t\t\tactivePostLock: received.new_lock,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Unlock the post before the window is exited.\n\t\t */\n\t\tfunction releasePostLock() {\n\t\t\tif ( isLocked || ! activePostLock ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst data = new window.FormData();\n\t\t\tdata.append( 'action', 'wp-remove-post-lock' );\n\t\t\tdata.append( '_wpnonce', postLockUtils.unlockNonce );\n\t\t\tdata.append( 'post_ID', postId );\n\t\t\tdata.append( 'active_post_lock', activePostLock );\n\n\t\t\tif ( window.navigator.sendBeacon ) {\n\t\t\t\twindow.navigator.sendBeacon( postLockUtils.ajaxUrl, data );\n\t\t\t} else {\n\t\t\t\tconst xhr = new window.XMLHttpRequest();\n\t\t\t\txhr.open( 'POST', postLockUtils.ajaxUrl, false );\n\t\t\t\txhr.send( data );\n\t\t\t}\n\t\t}\n\n\t\t// Details on these events on the Heartbeat API docs\n\t\t// https://developer.wordpress.org/plugins/javascript/heartbeat-api/\n\t\taddAction( 'heartbeat.send', hookName, sendPostLock );\n\t\taddAction( 'heartbeat.tick', hookName, receivePostLock );\n\t\twindow.addEventListener( 'beforeunload', releasePostLock );\n\n\t\treturn () => {\n\t\t\tremoveAction( 'heartbeat.send', hookName );\n\t\t\tremoveAction( 'heartbeat.tick', hookName );\n\t\t\twindow.removeEventListener( 'beforeunload', releasePostLock );\n\t\t};\n\t}, [] );\n\n\tif ( ! isLocked ) {\n\t\treturn null;\n\t}\n\n\tconst userDisplayName = user.name;\n\tconst userAvatar = user.avatar;\n\n\tconst unlockUrl = addQueryArgs( 'post.php', {\n\t\t'get-post-lock': '1',\n\t\tlockKey: true,\n\t\tpost: postId,\n\t\taction: 'edit',\n\t\t_wpnonce: postLockUtils.nonce,\n\t} );\n\tconst allPostsUrl = getWPAdminURL( 'edit.php', {\n\t\tpost_type: get( postType, [ 'slug' ] ),\n\t} );\n\tconst allPostsLabel = __( 'Exit the Editor' );\n\treturn (\n\t\t<Modal\n\t\t\ttitle={\n\t\t\t\tisTakeover\n\t\t\t\t\t? __( 'Someone else has taken over this post.' )\n\t\t\t\t\t: __( 'This post is already being edited.' )\n\t\t\t}\n\t\t\tfocusOnMount={ true }\n\t\t\tshouldCloseOnClickOutside={ false }\n\t\t\tshouldCloseOnEsc={ false }\n\t\t\tisDismissible={ false }\n\t\t\tclassName=\"editor-post-locked-modal\"\n\t\t>\n\t\t\t{ !! userAvatar && (\n\t\t\t\t<img\n\t\t\t\t\tsrc={ userAvatar }\n\t\t\t\t\talt={ __( 'Avatar' ) }\n\t\t\t\t\tclassName=\"editor-post-locked-modal__avatar\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ !! isTakeover && (\n\t\t\t\t<div>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t{ userDisplayName\n\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: user's display name */\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'%s now has editing control of this post. Don’t worry, your changes up to this moment have been saved.'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tuserDisplayName\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'Another user now has editing control of this post. Don’t worry, your changes up to this moment have been saved.'\n\t\t\t\t\t\t\t ) }\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div className=\"editor-post-locked-modal__buttons\">\n\t\t\t\t\t\t<Button variant=\"primary\" href={ allPostsUrl }>\n\t\t\t\t\t\t\t{ allPostsLabel }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ ! isTakeover && (\n\t\t\t\t<div>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t{ userDisplayName\n\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: user's display name */\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'%s is currently working on this post, which means you cannot make changes, unless you take over.'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tuserDisplayName\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'Another user is currently working on this post, which means you cannot make changes, unless you take over.'\n\t\t\t\t\t\t\t ) }\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div className=\"editor-post-locked-modal__buttons\">\n\t\t\t\t\t\t<Button variant=\"secondary\" href={ allPostsUrl }>\n\t\t\t\t\t\t\t{ allPostsLabel }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<PostPreviewButton />\n\t\t\t\t\t\t<Button variant=\"primary\" href={ unlockUrl }>\n\t\t\t\t\t\t\t{ __( 'Take Over' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</Modal>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-locked-modal/index.js"],"names":["get","__","sprintf","Modal","Button","useSelect","useDispatch","addQueryArgs","useEffect","addAction","removeAction","useInstanceId","store","coreStore","getWPAdminURL","PostPreviewButton","editorStore","PostLockedModal","instanceId","hookName","autosave","updatePostLock","isLocked","isTakeover","user","postId","postLockUtils","activePostLock","postType","select","isPostLocked","isPostLockTakeover","getPostLockUser","getCurrentPostId","getActivePostLock","getEditedPostAttribute","getEditorSettings","getPostType","sendPostLock","data","lock","post_id","receivePostLock","received","lock_error","avatar","avatar_src","new_lock","releasePostLock","window","FormData","append","unlockNonce","navigator","sendBeacon","ajaxUrl","xhr","XMLHttpRequest","open","send","addEventListener","removeEventListener","userDisplayName","name","userAvatar","unlockUrl","lockKey","post","action","_wpnonce","nonce","allPostsUrl","post_type","allPostsLabel"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,KAAT,EAAgBC,MAAhB,QAA8B,uBAA9B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,SAAT,EAAoBC,YAApB,QAAwC,kBAAxC;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,S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ADH,CADD,EAIC,cAAC,iBAAD,OAJD,EAKC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAC,SAAhB;AAA0B,IAAA,IAAI,EAAGR;AAAjC,KACGhE,EAAE,CAAE,WAAF,CADL,CALD,CAfD,CA3CF,CADD;AAwEA","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Modal, Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useEffect } from '@wordpress/element';\nimport { addAction, removeAction } from '@wordpress/hooks';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { getWPAdminURL } from '../../utils/url';\nimport PostPreviewButton from '../post-preview-button';\nimport { store as editorStore } from '../../store';\n\nexport default function PostLockedModal() {\n\tconst instanceId = useInstanceId( PostLockedModal );\n\tconst hookName = 'core/editor/post-locked-modal-' + instanceId;\n\tconst { autosave, updatePostLock } = useDispatch( editorStore );\n\tconst {\n\t\tisLocked,\n\t\tisTakeover,\n\t\tuser,\n\t\tpostId,\n\t\tpostLockUtils,\n\t\tactivePostLock,\n\t\tpostType,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisPostLocked,\n\t\t\tisPostLockTakeover,\n\t\t\tgetPostLockUser,\n\t\t\tgetCurrentPostId,\n\t\t\tgetActivePostLock,\n\t\t\tgetEditedPostAttribute,\n\t\t\tgetEditorSettings,\n\t\t} = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\treturn {\n\t\t\tisLocked: isPostLocked(),\n\t\t\tisTakeover: isPostLockTakeover(),\n\t\t\tuser: getPostLockUser(),\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tpostLockUtils: getEditorSettings().postLockUtils,\n\t\t\tactivePostLock: getActivePostLock(),\n\t\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\t/**\n\t\t * Keep the lock refreshed.\n\t\t *\n\t\t * When the user does not send a heartbeat in a heartbeat-tick\n\t\t * the user is no longer editing and another user can start editing.\n\t\t *\n\t\t * @param {Object} data Data to send in the heartbeat request.\n\t\t */\n\t\tfunction sendPostLock( data ) {\n\t\t\tif ( isLocked ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tdata[ 'wp-refresh-post-lock' ] = {\n\t\t\t\tlock: activePostLock,\n\t\t\t\tpost_id: postId,\n\t\t\t};\n\t\t}\n\n\t\t/**\n\t\t * Refresh post locks: update the lock string or show the dialog if somebody has taken over editing.\n\t\t *\n\t\t * @param {Object} data Data received in the heartbeat request\n\t\t */\n\t\tfunction receivePostLock( data ) {\n\t\t\tif ( ! data[ 'wp-refresh-post-lock' ] ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst received = data[ 'wp-refresh-post-lock' ];\n\t\t\tif ( received.lock_error ) {\n\t\t\t\t// Auto save and display the takeover modal.\n\t\t\t\tautosave();\n\t\t\t\tupdatePostLock( {\n\t\t\t\t\tisLocked: true,\n\t\t\t\t\tisTakeover: true,\n\t\t\t\t\tuser: {\n\t\t\t\t\t\tavatar: received.lock_error.avatar_src,\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t} else if ( received.new_lock ) {\n\t\t\t\tupdatePostLock( {\n\t\t\t\t\tisLocked: false,\n\t\t\t\t\tactivePostLock: received.new_lock,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Unlock the post before the window is exited.\n\t\t */\n\t\tfunction releasePostLock() {\n\t\t\tif ( isLocked || ! activePostLock ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst data = new window.FormData();\n\t\t\tdata.append( 'action', 'wp-remove-post-lock' );\n\t\t\tdata.append( '_wpnonce', postLockUtils.unlockNonce );\n\t\t\tdata.append( 'post_ID', postId );\n\t\t\tdata.append( 'active_post_lock', activePostLock );\n\n\t\t\tif ( window.navigator.sendBeacon ) {\n\t\t\t\twindow.navigator.sendBeacon( postLockUtils.ajaxUrl, data );\n\t\t\t} else {\n\t\t\t\tconst xhr = new window.XMLHttpRequest();\n\t\t\t\txhr.open( 'POST', postLockUtils.ajaxUrl, false );\n\t\t\t\txhr.send( data );\n\t\t\t}\n\t\t}\n\n\t\t// Details on these events on the Heartbeat API docs\n\t\t// https://developer.wordpress.org/plugins/javascript/heartbeat-api/\n\t\taddAction( 'heartbeat.send', hookName, sendPostLock );\n\t\taddAction( 'heartbeat.tick', hookName, receivePostLock );\n\t\twindow.addEventListener( 'beforeunload', releasePostLock );\n\n\t\treturn () => {\n\t\t\tremoveAction( 'heartbeat.send', hookName );\n\t\t\tremoveAction( 'heartbeat.tick', hookName );\n\t\t\twindow.removeEventListener( 'beforeunload', releasePostLock );\n\t\t};\n\t}, [] );\n\n\tif ( ! isLocked ) {\n\t\treturn null;\n\t}\n\n\tconst userDisplayName = user.name;\n\tconst userAvatar = user.avatar;\n\n\tconst unlockUrl = addQueryArgs( 'post.php', {\n\t\t'get-post-lock': '1',\n\t\tlockKey: true,\n\t\tpost: postId,\n\t\taction: 'edit',\n\t\t_wpnonce: postLockUtils.nonce,\n\t} );\n\tconst allPostsUrl = getWPAdminURL( 'edit.php', {\n\t\tpost_type: get( postType, [ 'slug' ] ),\n\t} );\n\tconst allPostsLabel = __( 'Exit the Editor' );\n\treturn (\n\t\t<Modal\n\t\t\ttitle={\n\t\t\t\tisTakeover\n\t\t\t\t\t? __( 'Someone else has taken over this post.' )\n\t\t\t\t\t: __( 'This post is already being edited.' )\n\t\t\t}\n\t\t\tfocusOnMount={ true }\n\t\t\tshouldCloseOnClickOutside={ false }\n\t\t\tshouldCloseOnEsc={ false }\n\t\t\tisDismissible={ false }\n\t\t\tclassName=\"editor-post-locked-modal\"\n\t\t>\n\t\t\t{ !! userAvatar && (\n\t\t\t\t<img\n\t\t\t\t\tsrc={ userAvatar }\n\t\t\t\t\talt={ __( 'Avatar' ) }\n\t\t\t\t\tclassName=\"editor-post-locked-modal__avatar\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ !! isTakeover && (\n\t\t\t\t<div>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t{ userDisplayName\n\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: user's display name */\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'%s now has editing control of this post. Don’t worry, your changes up to this moment have been saved.'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tuserDisplayName\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'Another user now has editing control of this post. Don’t worry, your changes up to this moment have been saved.'\n\t\t\t\t\t\t\t ) }\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div className=\"editor-post-locked-modal__buttons\">\n\t\t\t\t\t\t<Button variant=\"primary\" href={ allPostsUrl }>\n\t\t\t\t\t\t\t{ allPostsLabel }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ ! isTakeover && (\n\t\t\t\t<div>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t{ userDisplayName\n\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: user's display name */\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'%s is currently working on this post, which means you cannot make changes, unless you take over.'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tuserDisplayName\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'Another user is currently working on this post, which means you cannot make changes, unless you take over.'\n\t\t\t\t\t\t\t ) }\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div className=\"editor-post-locked-modal__buttons\">\n\t\t\t\t\t\t<Button variant=\"secondary\" href={ allPostsUrl }>\n\t\t\t\t\t\t\t{ allPostsLabel }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<PostPreviewButton />\n\t\t\t\t\t\t<Button variant=\"primary\" href={ unlockUrl }>\n\t\t\t\t\t\t\t{ __( 'Take Over' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</Modal>\n\t);\n}\n"]}
@@ -92,45 +92,16 @@ export default function PostSavedState({
92
92
  }
93
93
 
94
94
  return () => clearTimeout(timeoutId);
95
- }, [isSaving]);
95
+ }, [isSaving]); // Once the post has been submitted for review this button
96
+ // is not needed for the contributor role.
96
97
 
97
- if (isSaving) {
98
- // TODO: Classes generation should be common across all return
99
- // paths of this function, including proper naming convention for
100
- // the "Save Draft" button.
101
- const classes = classnames('editor-post-saved-state', 'is-saving', getAnimateClassName({
102
- type: 'loading'
103
- }), {
104
- 'is-autosaving': isAutosaving
105
- });
106
- return createElement("span", {
107
- className: classes
108
- }, createElement(Icon, {
109
- icon: cloud
110
- }), isAutosaving ? __('Autosaving') : __('Saving'));
98
+ if (!hasPublishAction && isPending) {
99
+ return null;
111
100
  }
112
101
 
113
102
  if (isPublished || isScheduled) {
114
103
  return createElement(PostSwitchToDraftButton, null);
115
104
  }
116
-
117
- if (!isSaveable) {
118
- return null;
119
- }
120
-
121
- if (forceSavedMessage || !isNew && !isDirty) {
122
- return createElement("span", {
123
- className: "editor-post-saved-state is-saved"
124
- }, createElement(Icon, {
125
- icon: check
126
- }), __('Saved'));
127
- } // Once the post has been submitted for review this button
128
- // is not needed for the contributor role.
129
-
130
-
131
- if (!hasPublishAction && isPending) {
132
- return null;
133
- }
134
105
  /* translators: button label text should, if possible, be under 16 characters. */
135
106
 
136
107
 
@@ -139,21 +110,42 @@ export default function PostSavedState({
139
110
 
140
111
  const shortLabel = __('Save');
141
112
 
142
- if (!isLargeViewport) {
143
- return createElement(Button, {
144
- className: "editor-post-save-draft",
145
- label: label,
146
- onClick: () => savePost(),
147
- shortcut: displayShortcut.primary('s'),
148
- icon: cloudUpload
149
- }, showIconLabels && shortLabel);
150
- }
113
+ const isSaved = forceSavedMessage || !isNew && !isDirty;
114
+ const isSavedState = isSaving || isSaved;
115
+ const isDisabled = isSaving || isSaved || !isSaveable;
116
+ let text;
117
+
118
+ if (isSaving) {
119
+ text = isAutosaving ? __('Autosaving') : __('Saving');
120
+ } else if (isSaved) {
121
+ text = __('Saved');
122
+ } else if (isLargeViewport) {
123
+ text = label;
124
+ } else if (showIconLabels) {
125
+ text = shortLabel;
126
+ } // Use common Button instance for all saved states so that focus is not
127
+ // lost.
128
+
151
129
 
152
130
  return createElement(Button, {
153
- className: "editor-post-save-draft",
154
- onClick: () => savePost(),
131
+ className: isSaveable || isSaving ? classnames({
132
+ 'editor-post-save-draft': !isSavedState,
133
+ 'editor-post-saved-state': isSavedState,
134
+ 'is-saving': isSaving,
135
+ 'is-autosaving': isAutosaving,
136
+ 'is-saved': isSaved,
137
+ [getAnimateClassName({
138
+ type: 'loading'
139
+ })]: isSaving
140
+ }) : undefined,
141
+ onClick: isDisabled ? undefined : () => savePost(),
155
142
  shortcut: displayShortcut.primary('s'),
156
- variant: "tertiary"
157
- }, label);
143
+ variant: isLargeViewport ? 'tertiary' : undefined,
144
+ icon: isLargeViewport ? undefined : cloudUpload,
145
+ label: label,
146
+ "aria-disabled": isDisabled
147
+ }, isSavedState && createElement(Icon, {
148
+ icon: isSaved ? check : cloud
149
+ }), text);
158
150
  }
159
151
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-saved-state/index.js"],"names":["classnames","__unstableGetAnimateClassName","getAnimateClassName","Button","usePrevious","useViewportMatch","useDispatch","useSelect","useEffect","useState","__","Icon","check","cloud","cloudUpload","displayShortcut","PostSwitchToDraftButton","store","editorStore","PostSavedState","forceIsDirty","forceIsSaving","showIconLabels","forceSavedMessage","setForceSavedMessage","isLargeViewport","isAutosaving","isDirty","isNew","isPending","isPublished","isSaveable","isSaving","isScheduled","hasPublishAction","select","isEditedPostNew","isCurrentPostPublished","isCurrentPostScheduled","isEditedPostDirty","isSavingPost","isEditedPostSaveable","getCurrentPost","isAutosavingPost","getEditedPostAttribute","_links","savePost","wasSaving","timeoutId","setTimeout","clearTimeout","classes","type","label","shortLabel","primary"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,6BAA6B,IAAIC,mBADlC,EAECC,MAFD,QAGO,uBAHP;AAIA,SAASC,WAAT,EAAsBC,gBAAtB,QAA8C,oBAA9C;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,oBAApC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,IAAT,EAAeC,KAAf,EAAsBC,KAAtB,EAA6BC,WAA7B,QAAgD,kBAAhD;AACA,SAASC,eAAT,QAAgC,qBAAhC;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,gCAApC;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,cAAT,CAAyB;AACvCC,EAAAA,YADuC;AAEvCC,EAAAA,aAFuC;AAGvCC,EAAAA,cAAc,GAAG;AAHsB,CAAzB,EAIX;AACH,QAAM,CAAEC,iBAAF,EAAqBC,oBAArB,IAA8Cf,QAAQ,CAAE,KAAF,CAA5D;AACA,QAAMgB,eAAe,GAAGpB,gBAAgB,CAAE,OAAF,CAAxC;AAEA,QAAM;AACLqB,IAAAA,YADK;AAELC,IAAAA,OAFK;AAGLC,IAAAA,KAHK;AAILC,IAAAA,SAJK;AAKLC,IAAAA,WALK;AAMLC,IAAAA,UANK;AAOLC,IAAAA,QA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A,KAAK,EAAG4B,KAFT;AAGC,MAAA,OAAO,EAAG,MAAMP,QAAQ,EAHzB;AAIC,MAAA,QAAQ,EAAG/B,eAAe,CAACwC,OAAhB,CAAyB,GAAzB,CAJZ;AAKC,MAAA,IAAI,EAAGzC;AALR,OAOGQ,cAAc,IAAIgC,UAPrB,CADD;AAWA;;AAED,SACC,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,wBADX;AAEC,IAAA,OAAO,EAAG,MAAMR,QAAQ,EAFzB;AAGC,IAAA,QAAQ,EAAG/B,eAAe,CAACwC,OAAhB,CAAyB,GAAzB,CAHZ;AAIC,IAAA,OAAO,EAAC;AAJT,KAMGF,KANH,CADD;AAUA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__unstableGetAnimateClassName as getAnimateClassName,\n\tButton,\n} from '@wordpress/components';\nimport { usePrevious, useViewportMatch } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, check, cloud, cloudUpload } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport PostSwitchToDraftButton from '../post-switch-to-draft-button';\nimport { store as editorStore } from '../../store';\n\n/**\n * Component showing whether the post is saved or not and providing save\n * buttons.\n *\n * @param {Object} props Component props.\n * @param {?boolean} props.forceIsDirty Whether to force the post to be marked\n * as dirty.\n * @param {?boolean} props.forceIsSaving Whether to force the post to be marked\n * as being saved.\n * @param {?boolean} props.showIconLabels Whether interface buttons show labels instead of icons\n * @return {import('@wordpress/element').WPComponent} The component.\n */\nexport default function PostSavedState( {\n\tforceIsDirty,\n\tforceIsSaving,\n\tshowIconLabels = false,\n} ) {\n\tconst [ forceSavedMessage, setForceSavedMessage ] = useState( false );\n\tconst isLargeViewport = useViewportMatch( 'small' );\n\n\tconst {\n\t\tisAutosaving,\n\t\tisDirty,\n\t\tisNew,\n\t\tisPending,\n\t\tisPublished,\n\t\tisSaveable,\n\t\tisSaving,\n\t\tisScheduled,\n\t\thasPublishAction,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisEditedPostNew,\n\t\t\t\tisCurrentPostPublished,\n\t\t\t\tisCurrentPostScheduled,\n\t\t\t\tisEditedPostDirty,\n\t\t\t\tisSavingPost,\n\t\t\t\tisEditedPostSaveable,\n\t\t\t\tgetCurrentPost,\n\t\t\t\tisAutosavingPost,\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t} = select( editorStore );\n\n\t\t\treturn {\n\t\t\t\tisAutosaving: isAutosavingPost(),\n\t\t\t\tisDirty: forceIsDirty || isEditedPostDirty(),\n\t\t\t\tisNew: isEditedPostNew(),\n\t\t\t\tisPending: 'pending' === getEditedPostAttribute( 'status' ),\n\t\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\t\tisSaving: forceIsSaving || isSavingPost(),\n\t\t\t\tisSaveable: isEditedPostSaveable(),\n\t\t\t\tisScheduled: isCurrentPostScheduled(),\n\t\t\t\thasPublishAction:\n\t\t\t\t\tgetCurrentPost()?._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\t};\n\t\t},\n\t\t[ forceIsDirty, forceIsSaving ]\n\t);\n\n\tconst { savePost } = useDispatch( editorStore );\n\n\tconst wasSaving = usePrevious( isSaving );\n\n\tuseEffect( () => {\n\t\tlet timeoutId;\n\n\t\tif ( wasSaving && ! isSaving ) {\n\t\t\tsetForceSavedMessage( true );\n\t\t\ttimeoutId = setTimeout( () => {\n\t\t\t\tsetForceSavedMessage( false );\n\t\t\t}, 1000 );\n\t\t}\n\n\t\treturn () => clearTimeout( timeoutId );\n\t}, [ isSaving ] );\n\n\tif ( isSaving ) {\n\t\t// TODO: Classes generation should be common across all return\n\t\t// paths of this function, including proper naming convention for\n\t\t// the \"Save Draft\" button.\n\t\tconst classes = classnames(\n\t\t\t'editor-post-saved-state',\n\t\t\t'is-saving',\n\t\t\tgetAnimateClassName( { type: 'loading' } ),\n\t\t\t{\n\t\t\t\t'is-autosaving': isAutosaving,\n\t\t\t}\n\t\t);\n\n\t\treturn (\n\t\t\t<span className={ classes }>\n\t\t\t\t<Icon icon={ cloud } />\n\t\t\t\t{ isAutosaving ? __( 'Autosaving' ) : __( 'Saving' ) }\n\t\t\t</span>\n\t\t);\n\t}\n\n\tif ( isPublished || isScheduled ) {\n\t\treturn <PostSwitchToDraftButton />;\n\t}\n\n\tif ( ! isSaveable ) {\n\t\treturn null;\n\t}\n\n\tif ( forceSavedMessage || ( ! isNew && ! isDirty ) ) {\n\t\treturn (\n\t\t\t<span className=\"editor-post-saved-state is-saved\">\n\t\t\t\t<Icon icon={ check } />\n\t\t\t\t{ __( 'Saved' ) }\n\t\t\t</span>\n\t\t);\n\t}\n\n\t// Once the post has been submitted for review this button\n\t// is not needed for the contributor role.\n\n\tif ( ! hasPublishAction && isPending ) {\n\t\treturn null;\n\t}\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst label = isPending ? __( 'Save as pending' ) : __( 'Save draft' );\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst shortLabel = __( 'Save' );\n\n\tif ( ! isLargeViewport ) {\n\t\treturn (\n\t\t\t<Button\n\t\t\t\tclassName=\"editor-post-save-draft\"\n\t\t\t\tlabel={ label }\n\t\t\t\tonClick={ () => savePost() }\n\t\t\t\tshortcut={ displayShortcut.primary( 's' ) }\n\t\t\t\ticon={ cloudUpload }\n\t\t\t>\n\t\t\t\t{ showIconLabels && shortLabel }\n\t\t\t</Button>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"editor-post-save-draft\"\n\t\t\tonClick={ () => savePost() }\n\t\t\tshortcut={ displayShortcut.primary( 's' ) }\n\t\t\tvariant=\"tertiary\"\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-saved-state/index.js"],"names":["classnames","__unstableGetAnimateClassName","getAnimateClassName","Button","usePrevious","useViewportMatch","useDispatch","useSelect","useEffect","useState","__","Icon","check","cloud","cloudUpload","displayShortcut","PostSwitchToDraftButton","store","editorStore","PostSavedState","forceIsDirty","forceIsSaving","showIconLabels","forceSavedMessage","setForceSavedMessage","isLargeViewport","isAutosaving","isDirty","isNew","isPending","isPublished","isSaveable","isSaving","isScheduled","hasPublishAction","select","isEditedPostNew","isCurrentPostPublished","isCurrentPostScheduled","isEditedPostDirty","isSavingPost","isEditedPostSaveable","getCurrentPost","isAutosavingPost","getEditedPostAttribute","_links","savePost","wasSaving","timeoutId","setTimeout","clearTimeout","label","shortLabel","isSaved","isSavedState","isDisabled","text","type","undefined","primary"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,6BAA6B,IAAIC,mBADlC,EAECC,MAFD,QAGO,uBAHP;AAIA,SAASC,WAAT,EAAsBC,gBAAtB,QAA8C,oBAA9C;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,oBAApC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,IAAT,EAAeC,KAAf,EAAsBC,KAAtB,EAA6BC,WAA7B,QAAgD,kBAAhD;AACA,SAASC,eAAT,QAAgC,qBAAhC;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,gCAApC;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,cAAT,CAAyB;AACvCC,EAAAA,YADuC;AAEvCC,EAAAA,aAFuC;AAGvCC,EAAAA,cAAc,GAAG;AAHsB,CAAzB,EAIX;AACH,QAAM,CAAEC,iBAAF,EAAqBC,oBAArB,IAA8Cf,QAAQ,CA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AAsB;AAC5BkC,IAAAA,IAAI,GAAGJ,UAAP;AACA,GA3FE,CA6FH;AACA;;;AACA,SACC,cAAC,MAAD;AACC,IAAA,SAAS,EACRrB,UAAU,IAAIC,QAAd,GACGhC,UAAU,CAAE;AACZ,gCAA0B,CAAEsD,YADhB;AAEZ,iCAA2BA,YAFf;AAGZ,mBAAatB,QAHD;AAIZ,uBAAiBN,YAJL;AAKZ,kBAAY2B,OALA;AAMZ,OAAEnD,mBAAmB,CAAE;AACtBuD,QAAAA,IAAI,EAAE;AADgB,OAAF,CAArB,GAEOzB;AARK,KAAF,CADb,GAWG0B,SAbL;AAeC,IAAA,OAAO,EAAGH,UAAU,GAAGG,SAAH,GAAe,MAAMZ,QAAQ,EAflD;AAgBC,IAAA,QAAQ,EAAG/B,eAAe,CAAC4C,OAAhB,CAAyB,GAAzB,CAhBZ;AAiBC,IAAA,OAAO,EAAGlC,eAAe,GAAG,UAAH,GAAgBiC,SAjB1C;AAkBC,IAAA,IAAI,EAAGjC,eAAe,GAAGiC,SAAH,GAAe5C,WAlBtC;AAmBC,IAAA,KAAK,EAAGqC,KAnBT;AAoBC,qBAAgBI;AApBjB,KAsBGD,YAAY,IAAI,cAAC,IAAD;AAAM,IAAA,IAAI,EAAGD,OAAO,GAAGzC,KAAH,GAAWC;AAA/B,IAtBnB,EAuBG2C,IAvBH,CADD;AA2BA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__unstableGetAnimateClassName as getAnimateClassName,\n\tButton,\n} from '@wordpress/components';\nimport { usePrevious, useViewportMatch } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, check, cloud, cloudUpload } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport PostSwitchToDraftButton from '../post-switch-to-draft-button';\nimport { store as editorStore } from '../../store';\n\n/**\n * Component showing whether the post is saved or not and providing save\n * buttons.\n *\n * @param {Object} props Component props.\n * @param {?boolean} props.forceIsDirty Whether to force the post to be marked\n * as dirty.\n * @param {?boolean} props.forceIsSaving Whether to force the post to be marked\n * as being saved.\n * @param {?boolean} props.showIconLabels Whether interface buttons show labels instead of icons\n * @return {import('@wordpress/element').WPComponent} The component.\n */\nexport default function PostSavedState( {\n\tforceIsDirty,\n\tforceIsSaving,\n\tshowIconLabels = false,\n} ) {\n\tconst [ forceSavedMessage, setForceSavedMessage ] = useState( false );\n\tconst isLargeViewport = useViewportMatch( 'small' );\n\n\tconst {\n\t\tisAutosaving,\n\t\tisDirty,\n\t\tisNew,\n\t\tisPending,\n\t\tisPublished,\n\t\tisSaveable,\n\t\tisSaving,\n\t\tisScheduled,\n\t\thasPublishAction,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisEditedPostNew,\n\t\t\t\tisCurrentPostPublished,\n\t\t\t\tisCurrentPostScheduled,\n\t\t\t\tisEditedPostDirty,\n\t\t\t\tisSavingPost,\n\t\t\t\tisEditedPostSaveable,\n\t\t\t\tgetCurrentPost,\n\t\t\t\tisAutosavingPost,\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t} = select( editorStore );\n\n\t\t\treturn {\n\t\t\t\tisAutosaving: isAutosavingPost(),\n\t\t\t\tisDirty: forceIsDirty || isEditedPostDirty(),\n\t\t\t\tisNew: isEditedPostNew(),\n\t\t\t\tisPending: 'pending' === getEditedPostAttribute( 'status' ),\n\t\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\t\tisSaving: forceIsSaving || isSavingPost(),\n\t\t\t\tisSaveable: isEditedPostSaveable(),\n\t\t\t\tisScheduled: isCurrentPostScheduled(),\n\t\t\t\thasPublishAction:\n\t\t\t\t\tgetCurrentPost()?._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\t};\n\t\t},\n\t\t[ forceIsDirty, forceIsSaving ]\n\t);\n\n\tconst { savePost } = useDispatch( editorStore );\n\n\tconst wasSaving = usePrevious( isSaving );\n\n\tuseEffect( () => {\n\t\tlet timeoutId;\n\n\t\tif ( wasSaving && ! isSaving ) {\n\t\t\tsetForceSavedMessage( true );\n\t\t\ttimeoutId = setTimeout( () => {\n\t\t\t\tsetForceSavedMessage( false );\n\t\t\t}, 1000 );\n\t\t}\n\n\t\treturn () => clearTimeout( timeoutId );\n\t}, [ isSaving ] );\n\n\t// Once the post has been submitted for review this button\n\t// is not needed for the contributor role.\n\tif ( ! hasPublishAction && isPending ) {\n\t\treturn null;\n\t}\n\n\tif ( isPublished || isScheduled ) {\n\t\treturn <PostSwitchToDraftButton />;\n\t}\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst label = isPending ? __( 'Save as pending' ) : __( 'Save draft' );\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst shortLabel = __( 'Save' );\n\n\tconst isSaved = forceSavedMessage || ( ! isNew && ! isDirty );\n\tconst isSavedState = isSaving || isSaved;\n\tconst isDisabled = isSaving || isSaved || ! isSaveable;\n\n\tlet text;\n\n\tif ( isSaving ) {\n\t\ttext = isAutosaving ? __( 'Autosaving' ) : __( 'Saving' );\n\t} else if ( isSaved ) {\n\t\ttext = __( 'Saved' );\n\t} else if ( isLargeViewport ) {\n\t\ttext = label;\n\t} else if ( showIconLabels ) {\n\t\ttext = shortLabel;\n\t}\n\n\t// Use common Button instance for all saved states so that focus is not\n\t// lost.\n\treturn (\n\t\t<Button\n\t\t\tclassName={\n\t\t\t\tisSaveable || isSaving\n\t\t\t\t\t? classnames( {\n\t\t\t\t\t\t\t'editor-post-save-draft': ! isSavedState,\n\t\t\t\t\t\t\t'editor-post-saved-state': isSavedState,\n\t\t\t\t\t\t\t'is-saving': isSaving,\n\t\t\t\t\t\t\t'is-autosaving': isAutosaving,\n\t\t\t\t\t\t\t'is-saved': isSaved,\n\t\t\t\t\t\t\t[ getAnimateClassName( {\n\t\t\t\t\t\t\t\ttype: 'loading',\n\t\t\t\t\t\t\t} ) ]: isSaving,\n\t\t\t\t\t } )\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\tonClick={ isDisabled ? undefined : () => savePost() }\n\t\t\tshortcut={ displayShortcut.primary( 's' ) }\n\t\t\tvariant={ isLargeViewport ? 'tertiary' : undefined }\n\t\t\ticon={ isLargeViewport ? undefined : cloudUpload }\n\t\t\tlabel={ label }\n\t\t\taria-disabled={ isDisabled }\n\t\t>\n\t\t\t{ isSavedState && <Icon icon={ isSaved ? check : cloud } /> }\n\t\t\t{ text }\n\t\t</Button>\n\t);\n}\n"]}
@@ -65,7 +65,7 @@ export default function PostTitle() {
65
65
  isFocusMode: focusMode,
66
66
  hasFixedToolbar: _hasFixedToolbar
67
67
  };
68
- });
68
+ }, []);
69
69
  useEffect(() => {
70
70
  if (!ref.current) {
71
71
  return;