@wordpress/edit-post 5.0.1-next.5df0cd52b7.0 → 5.0.4

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 (157) hide show
  1. package/README.md +2 -5
  2. package/build/components/header/fullscreen-mode-close/index.js +19 -3
  3. package/build/components/header/fullscreen-mode-close/index.js.map +1 -1
  4. package/build/components/header/header-toolbar/index.native.js +10 -3
  5. package/build/components/header/header-toolbar/index.native.js.map +1 -1
  6. package/build/components/header/more-menu/index.js +3 -14
  7. package/build/components/header/more-menu/index.js.map +1 -1
  8. package/build/components/header/template-title/index.js +1 -1
  9. package/build/components/header/template-title/index.js.map +1 -1
  10. package/build/components/header/writing-menu/index.js +7 -10
  11. package/build/components/header/writing-menu/index.js.map +1 -1
  12. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -1
  13. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  14. package/build/components/keyboard-shortcut-help-modal/index.js +1 -3
  15. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  16. package/build/components/keyboard-shortcuts/index.js +1 -8
  17. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  18. package/build/components/layout/index.js +3 -5
  19. package/build/components/layout/index.js.map +1 -1
  20. package/build/components/layout/index.native.js +5 -1
  21. package/build/components/layout/index.native.js.map +1 -1
  22. package/build/components/meta-boxes/index.js +39 -19
  23. package/build/components/meta-boxes/index.js.map +1 -1
  24. package/build/components/preferences-modal/index.js +56 -18
  25. package/build/components/preferences-modal/index.js.map +1 -1
  26. package/build/components/secondary-sidebar/inserter-sidebar.js +2 -1
  27. package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  28. package/build/components/secondary-sidebar/list-view-sidebar.js +1 -0
  29. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  30. package/build/components/sidebar/plugin-sidebar/index.js +1 -1
  31. package/build/components/sidebar/plugin-sidebar/index.js.map +1 -1
  32. package/build/components/sidebar/post-link/index.js +1 -1
  33. package/build/components/sidebar/post-link/index.js.map +1 -1
  34. package/build/components/sidebar/template/actions.js +6 -1
  35. package/build/components/sidebar/template/actions.js.map +1 -1
  36. package/build/components/sidebar/template-summary/index.js +2 -1
  37. package/build/components/sidebar/template-summary/index.js.map +1 -1
  38. package/build/components/visual-editor/index.js +6 -4
  39. package/build/components/visual-editor/index.js.map +1 -1
  40. package/build/editor.js +9 -5
  41. package/build/editor.js.map +1 -1
  42. package/build/hooks/validate-multiple-use/index.js +1 -1
  43. package/build/hooks/validate-multiple-use/index.js.map +1 -1
  44. package/build/index.js +27 -12
  45. package/build/index.js.map +1 -1
  46. package/build/plugins/welcome-guide-menu-item/index.js +6 -7
  47. package/build/plugins/welcome-guide-menu-item/index.js.map +1 -1
  48. package/build/store/actions.js +68 -59
  49. package/build/store/actions.js.map +1 -1
  50. package/build/store/defaults.js +0 -9
  51. package/build/store/defaults.js.map +1 -1
  52. package/build/store/reducer.js +20 -11
  53. package/build/store/reducer.js.map +1 -1
  54. package/build/store/selectors.js +24 -10
  55. package/build/store/selectors.js.map +1 -1
  56. package/build-module/components/header/fullscreen-mode-close/index.js +19 -4
  57. package/build-module/components/header/fullscreen-mode-close/index.js.map +1 -1
  58. package/build-module/components/header/header-toolbar/index.native.js +11 -4
  59. package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
  60. package/build-module/components/header/more-menu/index.js +5 -15
  61. package/build-module/components/header/more-menu/index.js.map +1 -1
  62. package/build-module/components/header/template-title/index.js +1 -1
  63. package/build-module/components/header/template-title/index.js.map +1 -1
  64. package/build-module/components/header/writing-menu/index.js +7 -8
  65. package/build-module/components/header/writing-menu/index.js.map +1 -1
  66. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -1
  67. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  68. package/build-module/components/keyboard-shortcut-help-modal/index.js +1 -3
  69. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  70. package/build-module/components/keyboard-shortcuts/index.js +1 -8
  71. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  72. package/build-module/components/layout/index.js +4 -6
  73. package/build-module/components/layout/index.js.map +1 -1
  74. package/build-module/components/layout/index.native.js +5 -1
  75. package/build-module/components/layout/index.native.js.map +1 -1
  76. package/build-module/components/meta-boxes/index.js +40 -19
  77. package/build-module/components/meta-boxes/index.js.map +1 -1
  78. package/build-module/components/preferences-modal/index.js +57 -20
  79. package/build-module/components/preferences-modal/index.js.map +1 -1
  80. package/build-module/components/secondary-sidebar/inserter-sidebar.js +2 -1
  81. package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  82. package/build-module/components/secondary-sidebar/list-view-sidebar.js +1 -0
  83. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  84. package/build-module/components/sidebar/plugin-sidebar/index.js +1 -1
  85. package/build-module/components/sidebar/plugin-sidebar/index.js.map +1 -1
  86. package/build-module/components/sidebar/post-link/index.js +1 -1
  87. package/build-module/components/sidebar/post-link/index.js.map +1 -1
  88. package/build-module/components/sidebar/template/actions.js +6 -1
  89. package/build-module/components/sidebar/template/actions.js.map +1 -1
  90. package/build-module/components/sidebar/template-summary/index.js +2 -1
  91. package/build-module/components/sidebar/template-summary/index.js.map +1 -1
  92. package/build-module/components/visual-editor/index.js +6 -4
  93. package/build-module/components/visual-editor/index.js.map +1 -1
  94. package/build-module/editor.js +9 -6
  95. package/build-module/editor.js.map +1 -1
  96. package/build-module/hooks/validate-multiple-use/index.js +1 -1
  97. package/build-module/hooks/validate-multiple-use/index.js.map +1 -1
  98. package/build-module/index.js +17 -5
  99. package/build-module/index.js.map +1 -1
  100. package/build-module/plugins/welcome-guide-menu-item/index.js +7 -8
  101. package/build-module/plugins/welcome-guide-menu-item/index.js.map +1 -1
  102. package/build-module/store/actions.js +66 -59
  103. package/build-module/store/actions.js.map +1 -1
  104. package/build-module/store/defaults.js +0 -9
  105. package/build-module/store/defaults.js.map +1 -1
  106. package/build-module/store/reducer.js +20 -11
  107. package/build-module/store/reducer.js.map +1 -1
  108. package/build-module/store/selectors.js +20 -7
  109. package/build-module/store/selectors.js.map +1 -1
  110. package/build-style/style-rtl.css +68 -69
  111. package/build-style/style.css +68 -69
  112. package/package.json +27 -27
  113. package/src/components/header/fullscreen-mode-close/index.js +37 -15
  114. package/src/components/header/fullscreen-mode-close/style.scss +2 -2
  115. package/src/components/header/header-toolbar/index.native.js +8 -2
  116. package/src/components/header/more-menu/index.js +8 -13
  117. package/src/components/header/template-title/index.js +3 -1
  118. package/src/components/header/writing-menu/index.js +7 -8
  119. package/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +15 -12
  120. package/src/components/keyboard-shortcut-help-modal/index.js +1 -3
  121. package/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap +2 -2
  122. package/src/components/keyboard-shortcuts/index.js +19 -32
  123. package/src/components/layout/index.js +4 -10
  124. package/src/components/layout/index.native.js +7 -1
  125. package/src/components/meta-boxes/index.js +41 -13
  126. package/src/components/preferences-modal/index.js +93 -30
  127. package/src/components/preferences-modal/style.scss +6 -56
  128. package/src/components/preferences-modal/test/__snapshots__/index.js.snap +334 -136
  129. package/src/components/secondary-sidebar/inserter-sidebar.js +1 -0
  130. package/src/components/secondary-sidebar/list-view-sidebar.js +1 -0
  131. package/src/components/sidebar/plugin-sidebar/index.js +1 -1
  132. package/src/components/sidebar/post-link/index.js +5 -1
  133. package/src/components/sidebar/template/actions.js +6 -1
  134. package/src/components/sidebar/template-summary/index.js +1 -1
  135. package/src/components/sidebar/template-summary/style.scss +2 -1
  136. package/src/components/text-editor/style.scss +12 -22
  137. package/src/components/visual-editor/index.js +16 -10
  138. package/src/components/visual-editor/style.scss +4 -7
  139. package/src/components/welcome-guide/style.scss +5 -0
  140. package/src/editor.js +88 -79
  141. package/src/hooks/validate-multiple-use/index.js +1 -1
  142. package/src/index.js +17 -5
  143. package/src/plugins/welcome-guide-menu-item/index.js +7 -12
  144. package/src/store/actions.js +99 -80
  145. package/src/store/defaults.js +0 -9
  146. package/src/store/reducer.js +17 -10
  147. package/src/store/selectors.js +27 -7
  148. package/src/store/test/actions.js +0 -11
  149. package/src/store/test/reducer.js +0 -12
  150. package/src/store/test/selectors.js +0 -46
  151. package/build/components/header/feature-toggle/index.js +0 -76
  152. package/build/components/header/feature-toggle/index.js.map +0 -1
  153. package/build-module/components/header/feature-toggle/index.js +0 -60
  154. package/build-module/components/header/feature-toggle/index.js.map +0 -1
  155. package/src/components/header/feature-toggle/index.js +0 -61
  156. package/src/components/header/more-menu/test/__snapshots__/index.js.snap +0 -129
  157. package/src/components/header/more-menu/test/index.js +0 -17
@@ -5,15 +5,6 @@ export const PREFERENCES_DEFAULTS = {
5
5
  opened: true,
6
6
  },
7
7
  },
8
- features: {
9
- fixedToolbar: false,
10
- welcomeGuide: true,
11
- fullscreenMode: true,
12
- showIconLabels: false,
13
- themeStyles: true,
14
- showBlockBreadcrumbs: true,
15
- welcomeGuideTemplate: true,
16
- },
17
8
  hiddenBlockTypes: [],
18
9
  preferredStyleVariations: {},
19
10
  localAutosaveInterval: 15,
@@ -78,16 +78,6 @@ export const preferences = flow( [
78
78
 
79
79
  return state;
80
80
  },
81
- features( state, action ) {
82
- if ( action.type === 'TOGGLE_FEATURE' ) {
83
- return {
84
- ...state,
85
- [ action.feature ]: ! state[ action.feature ],
86
- };
87
- }
88
-
89
- return state;
90
- },
91
81
  editorMode( state, action ) {
92
82
  if ( action.type === 'SWITCH_MODE' ) {
93
83
  return action.mode;
@@ -291,9 +281,26 @@ function isEditingTemplate( state = false, action ) {
291
281
  return state;
292
282
  }
293
283
 
284
+ /**
285
+ * Reducer tracking whether meta boxes are initialized.
286
+ *
287
+ * @param {boolean} state
288
+ * @param {Object} action
289
+ *
290
+ * @return {boolean} Updated state.
291
+ */
292
+ function metaBoxesInitialized( state = false, action ) {
293
+ switch ( action.type ) {
294
+ case 'META_BOXES_INITIALIZED':
295
+ return true;
296
+ }
297
+ return state;
298
+ }
299
+
294
300
  const metaBoxes = combineReducers( {
295
301
  isSaving: isSavingMetaBoxes,
296
302
  locations: metaBoxLocations,
303
+ initialized: metaBoxesInitialized,
297
304
  } );
298
305
 
299
306
  export default combineReducers( {
@@ -189,9 +189,14 @@ export function isModalActive( state, modalName ) {
189
189
  *
190
190
  * @return {boolean} Is active.
191
191
  */
192
- export function isFeatureActive( state, feature ) {
193
- return get( state.preferences.features, [ feature ], false );
194
- }
192
+ export const isFeatureActive = createRegistrySelector(
193
+ ( select ) => ( state, feature ) => {
194
+ return select( interfaceStore ).isFeatureActive(
195
+ 'core/edit-post',
196
+ feature
197
+ );
198
+ }
199
+ );
195
200
 
196
201
  /**
197
202
  * Returns true if the plugin item is pinned to the header.
@@ -203,7 +208,7 @@ export function isFeatureActive( state, feature ) {
203
208
  * @return {boolean} Whether the plugin item is pinned.
204
209
  */
205
210
  export const isPluginItemPinned = createRegistrySelector(
206
- ( select ) => ( pluginName ) => {
211
+ ( select ) => ( state, pluginName ) => {
207
212
  return select( interfaceStore ).isItemPinned(
208
213
  'core/edit-post',
209
214
  pluginName
@@ -333,11 +338,15 @@ export function isInserterOpened( state ) {
333
338
  *
334
339
  * @param {Object} state Global application state.
335
340
  *
336
- * @return {Object} The root client ID and index to insert at.
341
+ * @return {Object} The root client ID, index to insert at and starting filter value.
337
342
  */
338
343
  export function __experimentalGetInsertionPoint( state ) {
339
- const { rootClientId, insertionIndex } = state.blockInserterPanel;
340
- return { rootClientId, insertionIndex };
344
+ const {
345
+ rootClientId,
346
+ insertionIndex,
347
+ filterValue,
348
+ } = state.blockInserterPanel;
349
+ return { rootClientId, insertionIndex, filterValue };
341
350
  }
342
351
 
343
352
  /**
@@ -362,6 +371,17 @@ export function isEditingTemplate( state ) {
362
371
  return state.isEditingTemplate;
363
372
  }
364
373
 
374
+ /**
375
+ * Returns true if meta boxes are initialized.
376
+ *
377
+ * @param {Object} state Global application state.
378
+ *
379
+ * @return {boolean} Whether meta boxes are initialized.
380
+ */
381
+ export function areMetaBoxesInitialized( state ) {
382
+ return state.metaBoxes.initialized;
383
+ }
384
+
365
385
  /**
366
386
  * Retrieves the template of the currently edited post.
367
387
  *
@@ -15,7 +15,6 @@ import {
15
15
  togglePublishSidebar,
16
16
  openModal,
17
17
  closeModal,
18
- toggleFeature,
19
18
  requestMetaBoxUpdates,
20
19
  setIsListViewOpened,
21
20
  } from '../actions';
@@ -90,16 +89,6 @@ describe( 'actions', () => {
90
89
  } );
91
90
  } );
92
91
 
93
- describe( 'toggleFeature', () => {
94
- it( 'should return TOGGLE_FEATURE action', () => {
95
- const feature = 'name';
96
- expect( toggleFeature( feature ) ).toEqual( {
97
- type: 'TOGGLE_FEATURE',
98
- feature,
99
- } );
100
- } );
101
- } );
102
-
103
92
  describe( 'requestMetaBoxUpdates', () => {
104
93
  it( 'should yield the REQUEST_META_BOX_UPDATES action', () => {
105
94
  const fulfillment = requestMetaBoxUpdates();
@@ -152,18 +152,6 @@ describe( 'state', () => {
152
152
  expect( state.editorMode ).toBe( 'text' );
153
153
  } );
154
154
 
155
- it( 'should toggle a feature flag', () => {
156
- const state = preferences(
157
- deepFreeze( { features: { chicken: true } } ),
158
- {
159
- type: 'TOGGLE_FEATURE',
160
- feature: 'chicken',
161
- }
162
- );
163
-
164
- expect( state.features ).toEqual( { chicken: false } );
165
- } );
166
-
167
155
  describe( 'hiddenBlockTypes', () => {
168
156
  it( 'concatenates unique names on disable', () => {
169
157
  const original = deepFreeze( {
@@ -11,7 +11,6 @@ import {
11
11
  getPreference,
12
12
  isEditorPanelOpened,
13
13
  isModalActive,
14
- isFeatureActive,
15
14
  hasMetaBoxes,
16
15
  isSavingMetaBoxes,
17
16
  getActiveMetaBoxLocations,
@@ -239,51 +238,6 @@ describe( 'selectors', () => {
239
238
  } );
240
239
  } );
241
240
 
242
- describe( 'isFeatureActive', () => {
243
- it( 'is tolerant to an undefined features preference', () => {
244
- // See: https://github.com/WordPress/gutenberg/issues/14580
245
- const state = {
246
- preferences: {},
247
- };
248
-
249
- expect( isFeatureActive( state, 'chicken' ) ).toBe( false );
250
- } );
251
-
252
- it( 'should return true if feature is active', () => {
253
- const state = {
254
- preferences: {
255
- features: {
256
- chicken: true,
257
- },
258
- },
259
- };
260
-
261
- expect( isFeatureActive( state, 'chicken' ) ).toBe( true );
262
- } );
263
-
264
- it( 'should return false if feature is not active', () => {
265
- const state = {
266
- preferences: {
267
- features: {
268
- chicken: false,
269
- },
270
- },
271
- };
272
-
273
- expect( isFeatureActive( state, 'chicken' ) ).toBe( false );
274
- } );
275
-
276
- it( 'should return false if feature is not referred', () => {
277
- const state = {
278
- preferences: {
279
- features: {},
280
- },
281
- };
282
-
283
- expect( isFeatureActive( state, 'chicken' ) ).toBe( false );
284
- } );
285
- } );
286
-
287
241
  describe( 'hasMetaBoxes', () => {
288
242
  it( 'should return true if there are active meta boxes', () => {
289
243
  const state = {
@@ -1,76 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _element = require("@wordpress/element");
9
-
10
- var _lodash = require("lodash");
11
-
12
- var _data = require("@wordpress/data");
13
-
14
- var _compose = require("@wordpress/compose");
15
-
16
- var _components = require("@wordpress/components");
17
-
18
- var _i18n = require("@wordpress/i18n");
19
-
20
- var _icons = require("@wordpress/icons");
21
-
22
- var _a11y = require("@wordpress/a11y");
23
-
24
- var _store = require("../../../store");
25
-
26
- /**
27
- * External dependencies
28
- */
29
-
30
- /**
31
- * WordPress dependencies
32
- */
33
-
34
- /**
35
- * Internal dependencies
36
- */
37
- function FeatureToggle({
38
- onToggle,
39
- isActive,
40
- label,
41
- info,
42
- messageActivated,
43
- messageDeactivated,
44
- shortcut
45
- }) {
46
- const speakMessage = () => {
47
- if (isActive) {
48
- (0, _a11y.speak)(messageDeactivated || (0, _i18n.__)('Feature deactivated'));
49
- } else {
50
- (0, _a11y.speak)(messageActivated || (0, _i18n.__)('Feature activated'));
51
- }
52
- };
53
-
54
- return (0, _element.createElement)(_components.MenuItem, {
55
- icon: isActive && _icons.check,
56
- isSelected: isActive,
57
- onClick: (0, _lodash.flow)(onToggle, speakMessage),
58
- role: "menuitemcheckbox",
59
- info: info,
60
- shortcut: shortcut
61
- }, label);
62
- }
63
-
64
- var _default = (0, _compose.compose)([(0, _data.withSelect)((select, {
65
- feature
66
- }) => ({
67
- isActive: select(_store.store).isFeatureActive(feature)
68
- })), (0, _data.withDispatch)((dispatch, ownProps) => ({
69
- onToggle() {
70
- dispatch(_store.store).toggleFeature(ownProps.feature);
71
- }
72
-
73
- }))])(FeatureToggle);
74
-
75
- exports.default = _default;
76
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/header/feature-toggle/index.js"],"names":["FeatureToggle","onToggle","isActive","label","info","messageActivated","messageDeactivated","shortcut","speakMessage","check","select","feature","editPostStore","isFeatureActive","dispatch","ownProps","toggleFeature"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;AAGA,SAASA,aAAT,CAAwB;AACvBC,EAAAA,QADuB;AAEvBC,EAAAA,QAFuB;AAGvBC,EAAAA,KAHuB;AAIvBC,EAAAA,IAJuB;AAKvBC,EAAAA,gBALuB;AAMvBC,EAAAA,kBANuB;AAOvBC,EAAAA;AAPuB,CAAxB,EAQI;AACH,QAAMC,YAAY,GAAG,MAAM;AAC1B,QAAKN,QAAL,EAAgB;AACf,uBAAOI,kBAAkB,IAAI,cAAI,qBAAJ,CAA7B;AACA,KAFD,MAEO;AACN,uBAAOD,gBAAgB,IAAI,cAAI,mBAAJ,CAA3B;AACA;AACD,GAND;;AAQA,SACC,4BAAC,oBAAD;AACC,IAAA,IAAI,EAAGH,QAAQ,IAAIO,YADpB;AAEC,IAAA,UAAU,EAAGP,QAFd;AAGC,IAAA,OAAO,EAAG,kBAAMD,QAAN,EAAgBO,YAAhB,CAHX;AAIC,IAAA,IAAI,EAAC,kBAJN;AAKC,IAAA,IAAI,EAAGJ,IALR;AAMC,IAAA,QAAQ,EAAGG;AANZ,KAQGJ,KARH,CADD;AAYA;;eAEc,sBAAS,CACvB,sBAAY,CAAEO,MAAF,EAAU;AAAEC,EAAAA;AAAF,CAAV,MAA6B;AACxCT,EAAAA,QAAQ,EAAEQ,MAAM,CAAEE,YAAF,CAAN,CAAwBC,eAAxB,CAAyCF,OAAzC;AAD8B,CAA7B,CAAZ,CADuB,EAIvB,wBAAc,CAAEG,QAAF,EAAYC,QAAZ,MAA4B;AACzCd,EAAAA,QAAQ,GAAG;AACVa,IAAAA,QAAQ,CAAEF,YAAF,CAAR,CAA0BI,aAA1B,CAAyCD,QAAQ,CAACJ,OAAlD;AACA;;AAHwC,CAA5B,CAAd,CAJuB,CAAT,EASVX,aATU,C","sourcesContent":["/**\n * External dependencies\n */\nimport { flow } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { check } from '@wordpress/icons';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nfunction FeatureToggle( {\n\tonToggle,\n\tisActive,\n\tlabel,\n\tinfo,\n\tmessageActivated,\n\tmessageDeactivated,\n\tshortcut,\n} ) {\n\tconst speakMessage = () => {\n\t\tif ( isActive ) {\n\t\t\tspeak( messageDeactivated || __( 'Feature deactivated' ) );\n\t\t} else {\n\t\t\tspeak( messageActivated || __( 'Feature activated' ) );\n\t\t}\n\t};\n\n\treturn (\n\t\t<MenuItem\n\t\t\ticon={ isActive && check }\n\t\t\tisSelected={ isActive }\n\t\t\tonClick={ flow( onToggle, speakMessage ) }\n\t\t\trole=\"menuitemcheckbox\"\n\t\t\tinfo={ info }\n\t\t\tshortcut={ shortcut }\n\t\t>\n\t\t\t{ label }\n\t\t</MenuItem>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select, { feature } ) => ( {\n\t\tisActive: select( editPostStore ).isFeatureActive( feature ),\n\t} ) ),\n\twithDispatch( ( dispatch, ownProps ) => ( {\n\t\tonToggle() {\n\t\t\tdispatch( editPostStore ).toggleFeature( ownProps.feature );\n\t\t},\n\t} ) ),\n] )( FeatureToggle );\n"]}
@@ -1,60 +0,0 @@
1
- import { createElement } from "@wordpress/element";
2
-
3
- /**
4
- * External dependencies
5
- */
6
- import { flow } from 'lodash';
7
- /**
8
- * WordPress dependencies
9
- */
10
-
11
- import { withSelect, withDispatch } from '@wordpress/data';
12
- import { compose } from '@wordpress/compose';
13
- import { MenuItem } from '@wordpress/components';
14
- import { __ } from '@wordpress/i18n';
15
- import { check } from '@wordpress/icons';
16
- import { speak } from '@wordpress/a11y';
17
- /**
18
- * Internal dependencies
19
- */
20
-
21
- import { store as editPostStore } from '../../../store';
22
-
23
- function FeatureToggle({
24
- onToggle,
25
- isActive,
26
- label,
27
- info,
28
- messageActivated,
29
- messageDeactivated,
30
- shortcut
31
- }) {
32
- const speakMessage = () => {
33
- if (isActive) {
34
- speak(messageDeactivated || __('Feature deactivated'));
35
- } else {
36
- speak(messageActivated || __('Feature activated'));
37
- }
38
- };
39
-
40
- return createElement(MenuItem, {
41
- icon: isActive && check,
42
- isSelected: isActive,
43
- onClick: flow(onToggle, speakMessage),
44
- role: "menuitemcheckbox",
45
- info: info,
46
- shortcut: shortcut
47
- }, label);
48
- }
49
-
50
- export default compose([withSelect((select, {
51
- feature
52
- }) => ({
53
- isActive: select(editPostStore).isFeatureActive(feature)
54
- })), withDispatch((dispatch, ownProps) => ({
55
- onToggle() {
56
- dispatch(editPostStore).toggleFeature(ownProps.feature);
57
- }
58
-
59
- }))])(FeatureToggle);
60
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/header/feature-toggle/index.js"],"names":["flow","withSelect","withDispatch","compose","MenuItem","__","check","speak","store","editPostStore","FeatureToggle","onToggle","isActive","label","info","messageActivated","messageDeactivated","shortcut","speakMessage","select","feature","isFeatureActive","dispatch","ownProps","toggleFeature"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,QAArB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,QAAT,QAAyB,uBAAzB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAT,QAAsB,kBAAtB;AACA,SAASC,KAAT,QAAsB,iBAAtB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,gBAAvC;;AAEA,SAASC,aAAT,CAAwB;AACvBC,EAAAA,QADuB;AAEvBC,EAAAA,QAFuB;AAGvBC,EAAAA,KAHuB;AAIvBC,EAAAA,IAJuB;AAKvBC,EAAAA,gBALuB;AAMvBC,EAAAA,kBANuB;AAOvBC,EAAAA;AAPuB,CAAxB,EAQI;AACH,QAAMC,YAAY,GAAG,MAAM;AAC1B,QAAKN,QAAL,EAAgB;AACfL,MAAAA,KAAK,CAAES,kBAAkB,IAAIX,EAAE,CAAE,qBAAF,CAA1B,CAAL;AACA,KAFD,MAEO;AACNE,MAAAA,KAAK,CAAEQ,gBAAgB,IAAIV,EAAE,CAAE,mBAAF,CAAxB,CAAL;AACA;AACD,GAND;;AAQA,SACC,cAAC,QAAD;AACC,IAAA,IAAI,EAAGO,QAAQ,IAAIN,KADpB;AAEC,IAAA,UAAU,EAAGM,QAFd;AAGC,IAAA,OAAO,EAAGZ,IAAI,CAAEW,QAAF,EAAYO,YAAZ,CAHf;AAIC,IAAA,IAAI,EAAC,kBAJN;AAKC,IAAA,IAAI,EAAGJ,IALR;AAMC,IAAA,QAAQ,EAAGG;AANZ,KAQGJ,KARH,CADD;AAYA;;AAED,eAAeV,OAAO,CAAE,CACvBF,UAAU,CAAE,CAAEkB,MAAF,EAAU;AAAEC,EAAAA;AAAF,CAAV,MAA6B;AACxCR,EAAAA,QAAQ,EAAEO,MAAM,CAAEV,aAAF,CAAN,CAAwBY,eAAxB,CAAyCD,OAAzC;AAD8B,CAA7B,CAAF,CADa,EAIvBlB,YAAY,CAAE,CAAEoB,QAAF,EAAYC,QAAZ,MAA4B;AACzCZ,EAAAA,QAAQ,GAAG;AACVW,IAAAA,QAAQ,CAAEb,aAAF,CAAR,CAA0Be,aAA1B,CAAyCD,QAAQ,CAACH,OAAlD;AACA;;AAHwC,CAA5B,CAAF,CAJW,CAAF,CAAP,CASVV,aATU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { flow } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { check } from '@wordpress/icons';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nfunction FeatureToggle( {\n\tonToggle,\n\tisActive,\n\tlabel,\n\tinfo,\n\tmessageActivated,\n\tmessageDeactivated,\n\tshortcut,\n} ) {\n\tconst speakMessage = () => {\n\t\tif ( isActive ) {\n\t\t\tspeak( messageDeactivated || __( 'Feature deactivated' ) );\n\t\t} else {\n\t\t\tspeak( messageActivated || __( 'Feature activated' ) );\n\t\t}\n\t};\n\n\treturn (\n\t\t<MenuItem\n\t\t\ticon={ isActive && check }\n\t\t\tisSelected={ isActive }\n\t\t\tonClick={ flow( onToggle, speakMessage ) }\n\t\t\trole=\"menuitemcheckbox\"\n\t\t\tinfo={ info }\n\t\t\tshortcut={ shortcut }\n\t\t>\n\t\t\t{ label }\n\t\t</MenuItem>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select, { feature } ) => ( {\n\t\tisActive: select( editPostStore ).isFeatureActive( feature ),\n\t} ) ),\n\twithDispatch( ( dispatch, ownProps ) => ( {\n\t\tonToggle() {\n\t\t\tdispatch( editPostStore ).toggleFeature( ownProps.feature );\n\t\t},\n\t} ) ),\n] )( FeatureToggle );\n"]}
@@ -1,61 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { flow } from 'lodash';
5
-
6
- /**
7
- * WordPress dependencies
8
- */
9
- import { withSelect, withDispatch } from '@wordpress/data';
10
- import { compose } from '@wordpress/compose';
11
- import { MenuItem } from '@wordpress/components';
12
- import { __ } from '@wordpress/i18n';
13
- import { check } from '@wordpress/icons';
14
- import { speak } from '@wordpress/a11y';
15
-
16
- /**
17
- * Internal dependencies
18
- */
19
- import { store as editPostStore } from '../../../store';
20
-
21
- function FeatureToggle( {
22
- onToggle,
23
- isActive,
24
- label,
25
- info,
26
- messageActivated,
27
- messageDeactivated,
28
- shortcut,
29
- } ) {
30
- const speakMessage = () => {
31
- if ( isActive ) {
32
- speak( messageDeactivated || __( 'Feature deactivated' ) );
33
- } else {
34
- speak( messageActivated || __( 'Feature activated' ) );
35
- }
36
- };
37
-
38
- return (
39
- <MenuItem
40
- icon={ isActive && check }
41
- isSelected={ isActive }
42
- onClick={ flow( onToggle, speakMessage ) }
43
- role="menuitemcheckbox"
44
- info={ info }
45
- shortcut={ shortcut }
46
- >
47
- { label }
48
- </MenuItem>
49
- );
50
- }
51
-
52
- export default compose( [
53
- withSelect( ( select, { feature } ) => ( {
54
- isActive: select( editPostStore ).isFeatureActive( feature ),
55
- } ) ),
56
- withDispatch( ( dispatch, ownProps ) => ( {
57
- onToggle() {
58
- dispatch( editPostStore ).toggleFeature( ownProps.feature );
59
- },
60
- } ) ),
61
- ] )( FeatureToggle );
@@ -1,129 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`MoreMenu should match snapshot 1`] = `
4
- <MoreMenu>
5
- <DropdownMenu
6
- className="edit-post-more-menu"
7
- icon={
8
- <SVG
9
- viewBox="0 0 24 24"
10
- xmlns="http://www.w3.org/2000/svg"
11
- >
12
- <Path
13
- d="M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"
14
- />
15
- </SVG>
16
- }
17
- label="Options"
18
- popoverProps={
19
- Object {
20
- "className": "edit-post-more-menu__content",
21
- "position": "bottom left",
22
- }
23
- }
24
- toggleProps={
25
- Object {
26
- "showTooltip": true,
27
- "tooltipPosition": "bottom",
28
- }
29
- }
30
- >
31
- <Dropdown
32
- className="components-dropdown-menu edit-post-more-menu"
33
- popoverProps={
34
- Object {
35
- "className": "edit-post-more-menu__content components-dropdown-menu__popover",
36
- "position": "bottom left",
37
- }
38
- }
39
- renderContent={[Function]}
40
- renderToggle={[Function]}
41
- >
42
- <div
43
- className="components-dropdown components-dropdown-menu edit-post-more-menu"
44
- >
45
- <ForwardRef(Button)
46
- aria-expanded={false}
47
- aria-haspopup="true"
48
- className="components-dropdown-menu__toggle"
49
- icon={
50
- <SVG
51
- viewBox="0 0 24 24"
52
- xmlns="http://www.w3.org/2000/svg"
53
- >
54
- <Path
55
- d="M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"
56
- />
57
- </SVG>
58
- }
59
- label="Options"
60
- onClick={[Function]}
61
- onKeyDown={[Function]}
62
- showTooltip={true}
63
- tooltipPosition="bottom"
64
- >
65
- <Tooltip
66
- position="bottom"
67
- text="Options"
68
- >
69
- <button
70
- aria-describedby={null}
71
- aria-expanded={false}
72
- aria-haspopup="true"
73
- aria-label="Options"
74
- className="components-button components-dropdown-menu__toggle has-icon"
75
- onBlur={[Function]}
76
- onClick={[Function]}
77
- onFocus={[Function]}
78
- onKeyDown={[Function]}
79
- onMouseDown={[Function]}
80
- onMouseEnter={[Function]}
81
- onMouseLeave={[Function]}
82
- type="button"
83
- >
84
- <Icon
85
- icon={
86
- <SVG
87
- viewBox="0 0 24 24"
88
- xmlns="http://www.w3.org/2000/svg"
89
- >
90
- <Path
91
- d="M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"
92
- />
93
- </SVG>
94
- }
95
- key="0,0"
96
- >
97
- <SVG
98
- height={24}
99
- viewBox="0 0 24 24"
100
- width={24}
101
- xmlns="http://www.w3.org/2000/svg"
102
- >
103
- <svg
104
- aria-hidden={true}
105
- focusable={false}
106
- height={24}
107
- role="img"
108
- viewBox="0 0 24 24"
109
- width={24}
110
- xmlns="http://www.w3.org/2000/svg"
111
- >
112
- <Path
113
- d="M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"
114
- >
115
- <path
116
- d="M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"
117
- />
118
- </Path>
119
- </svg>
120
- </SVG>
121
- </Icon>
122
- </button>
123
- </Tooltip>
124
- </ForwardRef(Button)>
125
- </div>
126
- </Dropdown>
127
- </DropdownMenu>
128
- </MoreMenu>
129
- `;
@@ -1,17 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { mount } from 'enzyme';
5
-
6
- /**
7
- * Internal dependencies
8
- */
9
- import MoreMenu from '../index';
10
-
11
- describe( 'MoreMenu', () => {
12
- it( 'should match snapshot', () => {
13
- const wrapper = mount( <MoreMenu /> );
14
-
15
- expect( wrapper ).toMatchSnapshot();
16
- } );
17
- } );