@wordpress/editor 12.2.1 → 12.2.2

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 (65) hide show
  1. package/build/components/local-autosave-monitor/index.js +5 -5
  2. package/build/components/local-autosave-monitor/index.js.map +1 -1
  3. package/build/components/post-saved-state/index.js +1 -1
  4. package/build/components/post-saved-state/index.js.map +1 -1
  5. package/build/components/post-switch-to-draft-button/index.js +19 -14
  6. package/build/components/post-switch-to-draft-button/index.js.map +1 -1
  7. package/build/components/post-trash/index.js +15 -29
  8. package/build/components/post-trash/index.js.map +1 -1
  9. package/build/components/provider/index.native.js +17 -8
  10. package/build/components/provider/index.native.js.map +1 -1
  11. package/build/components/provider/use-block-editor-settings.js +3 -2
  12. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  13. package/build/store/actions.js +231 -225
  14. package/build/store/actions.js.map +1 -1
  15. package/build/store/actions.native.js +6 -4
  16. package/build/store/actions.native.js.map +1 -1
  17. package/build/store/index.js +1 -8
  18. package/build/store/index.js.map +1 -1
  19. package/build/store/{controls.js → local-autosave.js} +1 -18
  20. package/build/store/local-autosave.js.map +1 -0
  21. package/build/store/reducer.js +0 -2
  22. package/build/store/reducer.js.map +1 -1
  23. package/build/store/utils/notice-builder.js +5 -0
  24. package/build/store/utils/notice-builder.js.map +1 -1
  25. package/build-module/components/local-autosave-monitor/index.js +1 -1
  26. package/build-module/components/local-autosave-monitor/index.js.map +1 -1
  27. package/build-module/components/post-saved-state/index.js +1 -1
  28. package/build-module/components/post-saved-state/index.js.map +1 -1
  29. package/build-module/components/post-switch-to-draft-button/index.js +22 -16
  30. package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
  31. package/build-module/components/post-trash/index.js +15 -27
  32. package/build-module/components/post-trash/index.js.map +1 -1
  33. package/build-module/components/provider/index.native.js +19 -10
  34. package/build-module/components/provider/index.native.js.map +1 -1
  35. package/build-module/components/provider/use-block-editor-settings.js +3 -2
  36. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  37. package/build-module/store/actions.js +208 -207
  38. package/build-module/store/actions.js.map +1 -1
  39. package/build-module/store/actions.native.js +3 -3
  40. package/build-module/store/actions.native.js.map +1 -1
  41. package/build-module/store/index.js +1 -6
  42. package/build-module/store/index.js.map +1 -1
  43. package/build-module/store/{controls.js → local-autosave.js} +1 -15
  44. package/build-module/store/local-autosave.js.map +1 -0
  45. package/build-module/store/reducer.js +0 -2
  46. package/build-module/store/reducer.js.map +1 -1
  47. package/build-module/store/utils/notice-builder.js +5 -0
  48. package/build-module/store/utils/notice-builder.js.map +1 -1
  49. package/package.json +14 -15
  50. package/src/components/local-autosave-monitor/index.js +4 -1
  51. package/src/components/post-saved-state/index.js +1 -1
  52. package/src/components/post-switch-to-draft-button/index.js +35 -24
  53. package/src/components/post-trash/index.js +12 -24
  54. package/src/components/provider/index.native.js +20 -16
  55. package/src/components/provider/use-block-editor-settings.js +2 -0
  56. package/src/store/actions.js +137 -249
  57. package/src/store/actions.native.js +3 -3
  58. package/src/store/index.js +0 -6
  59. package/src/store/{controls.js → local-autosave.js} +0 -8
  60. package/src/store/reducer.js +0 -2
  61. package/src/store/test/actions.js +244 -416
  62. package/src/store/utils/notice-builder.js +5 -0
  63. package/src/store/utils/test/notice-builder.js +1 -0
  64. package/build/store/controls.js.map +0 -1
  65. package/build-module/store/controls.js.map +0 -1
@@ -6,9 +6,8 @@ import { has } from 'lodash';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
+ import apiFetch from '@wordpress/api-fetch';
9
10
  import deprecated from '@wordpress/deprecated';
10
- import { controls } from '@wordpress/data';
11
- import { apiFetch } from '@wordpress/data-controls';
12
11
  import {
13
12
  parse,
14
13
  synchronizeBlocksWithTemplate,
@@ -21,7 +20,8 @@ import { store as blockEditorStore } from '@wordpress/block-editor';
21
20
  /**
22
21
  * Internal dependencies
23
22
  */
24
- import { STORE_NAME, TRASH_POST_NOTICE_ID } from './constants';
23
+ import { TRASH_POST_NOTICE_ID } from './constants';
24
+ import { localAutosaveSet } from './local-autosave';
25
25
  import {
26
26
  getNotificationArgumentsForSaveSuccess,
27
27
  getNotificationArgumentsForSaveFail,
@@ -36,15 +36,8 @@ import {
36
36
  * @param {Object} edits Initial edited attributes object.
37
37
  * @param {Array?} template Block Template.
38
38
  */
39
- export function* setupEditor( post, edits, template ) {
40
- yield resetPost( post );
41
- yield {
42
- type: 'SETUP_EDITOR',
43
- post,
44
- edits,
45
- template,
46
- };
47
- yield setupEditorState( post );
39
+ export const setupEditor = ( post, edits, template ) => ( { dispatch } ) => {
40
+ dispatch.setupEditorState( post );
48
41
  // Apply a template for new posts only, if exists.
49
42
  const isNewPost = post.status === 'auto-draft';
50
43
  if ( isNewPost && template ) {
@@ -59,21 +52,19 @@ export function* setupEditor( post, edits, template ) {
59
52
  }
60
53
  let blocks = parse( content );
61
54
  blocks = synchronizeBlocksWithTemplate( blocks, template );
62
- yield resetEditorBlocks( blocks, {
55
+ dispatch.resetEditorBlocks( blocks, {
63
56
  __unstableShouldCreateUndoLevel: false,
64
57
  } );
65
58
  }
66
59
  if (
67
60
  edits &&
68
- Object.keys( edits ).some(
69
- ( key ) =>
70
- edits[ key ] !==
71
- ( has( post, [ key, 'raw' ] ) ? post[ key ].raw : post[ key ] )
61
+ Object.values( edits ).some(
62
+ ( [ key, edit ] ) => edit !== ( post[ key ]?.raw ?? post[ key ] )
72
63
  )
73
64
  ) {
74
- yield editPost( edits );
65
+ dispatch.editPost( edits );
75
66
  }
76
- }
67
+ };
77
68
 
78
69
  /**
79
70
  * Returns an action object signalling that the editor is being destroyed and
@@ -89,43 +80,15 @@ export function __experimentalTearDownEditor() {
89
80
  * Returns an action object used in signalling that the latest version of the
90
81
  * post has been received, either by initialization or save.
91
82
  *
92
- * @param {Object} post Post object.
93
- *
94
- * @return {Object} Action object.
95
- */
96
- export function resetPost( post ) {
97
- return {
98
- type: 'RESET_POST',
99
- post,
100
- };
101
- }
102
-
103
- /**
104
- * Action for dispatching that a post update request has started.
105
- *
106
- * @param {Object} options
107
- *
108
- * @return {Object} An action object
109
- */
110
- export function __experimentalRequestPostUpdateStart( options = {} ) {
111
- return {
112
- type: 'REQUEST_POST_UPDATE_START',
113
- options,
114
- };
115
- }
116
-
117
- /**
118
- * Action for dispatching that a post update request has finished.
119
- *
120
- * @param {Object} options
121
- *
122
- * @return {Object} An action object
83
+ * @deprecated Since WordPress 6.0.
123
84
  */
124
- export function __experimentalRequestPostUpdateFinish( options = {} ) {
125
- return {
126
- type: 'REQUEST_POST_UPDATE_FINISH',
127
- options,
128
- };
85
+ export function resetPost() {
86
+ deprecated( "wp.data.dispatch( 'core/editor' ).resetPost", {
87
+ since: '6.0',
88
+ version: '6.3',
89
+ alternative: 'Initialize the editor with the setupEditorState action',
90
+ } );
91
+ return { type: 'DO_NOTHING' };
129
92
  }
130
93
 
131
94
  /**
@@ -166,73 +129,59 @@ export function setupEditorState( post ) {
166
129
  *
167
130
  * @param {Object} edits Post attributes to edit.
168
131
  * @param {Object} options Options for the edit.
169
- *
170
- * @yield {Object} Action object or control.
171
- */
172
- export function* editPost( edits, options ) {
173
- const { id, type } = yield controls.select( STORE_NAME, 'getCurrentPost' );
174
- yield controls.dispatch(
175
- coreStore,
176
- 'editEntityRecord',
177
- 'postType',
178
- type,
179
- id,
180
- edits,
181
- options
182
- );
183
- }
132
+ */
133
+ export const editPost = ( edits, options ) => ( { select, registry } ) => {
134
+ const { id, type } = select.getCurrentPost();
135
+ registry
136
+ .dispatch( coreStore )
137
+ .editEntityRecord( 'postType', type, id, edits, options );
138
+ };
184
139
 
185
140
  /**
186
- * Action generator for saving the current post in the editor.
141
+ * Action for saving the current post in the editor.
187
142
  *
188
143
  * @param {Object} options
189
144
  */
190
- export function* savePost( options = {} ) {
191
- if ( ! ( yield controls.select( STORE_NAME, 'isEditedPostSaveable' ) ) ) {
145
+ export const savePost = ( options = {} ) => async ( {
146
+ select,
147
+ dispatch,
148
+ registry,
149
+ } ) => {
150
+ if ( ! select.isEditedPostSaveable() ) {
192
151
  return;
193
152
  }
194
- let edits = {
195
- content: yield controls.select( STORE_NAME, 'getEditedPostContent' ),
196
- };
153
+
154
+ const content = select.getEditedPostContent();
155
+
197
156
  if ( ! options.isAutosave ) {
198
- yield controls.dispatch( STORE_NAME, 'editPost', edits, {
199
- undoIgnore: true,
200
- } );
157
+ dispatch.editPost( { content }, { undoIgnore: true } );
201
158
  }
202
159
 
203
- yield __experimentalRequestPostUpdateStart( options );
204
- const previousRecord = yield controls.select(
205
- STORE_NAME,
206
- 'getCurrentPost'
207
- );
208
- edits = {
160
+ const previousRecord = select.getCurrentPost();
161
+ const edits = {
209
162
  id: previousRecord.id,
210
- ...( yield controls.select(
211
- coreStore,
212
- 'getEntityRecordNonTransientEdits',
163
+ ...registry
164
+ .select( coreStore )
165
+ .getEntityRecordNonTransientEdits(
166
+ 'postType',
167
+ previousRecord.type,
168
+ previousRecord.id
169
+ ),
170
+ content,
171
+ };
172
+ dispatch( { type: 'REQUEST_POST_UPDATE_START', options } );
173
+ await registry
174
+ .dispatch( coreStore )
175
+ .saveEntityRecord( 'postType', previousRecord.type, edits, options );
176
+ dispatch( { type: 'REQUEST_POST_UPDATE_FINISH', options } );
177
+
178
+ const error = registry
179
+ .select( coreStore )
180
+ .getLastEntitySaveError(
213
181
  'postType',
214
182
  previousRecord.type,
215
183
  previousRecord.id
216
- ) ),
217
- ...edits,
218
- };
219
- yield controls.dispatch(
220
- coreStore,
221
- 'saveEntityRecord',
222
- 'postType',
223
- previousRecord.type,
224
- edits,
225
- options
226
- );
227
- yield __experimentalRequestPostUpdateFinish( options );
228
-
229
- const error = yield controls.select(
230
- coreStore,
231
- 'getLastEntitySaveError',
232
- 'postType',
233
- previousRecord.type,
234
- previousRecord.id
235
- );
184
+ );
236
185
  if ( error ) {
237
186
  const args = getNotificationArgumentsForSaveFail( {
238
187
  post: previousRecord,
@@ -240,44 +189,30 @@ export function* savePost( options = {} ) {
240
189
  error,
241
190
  } );
242
191
  if ( args.length ) {
243
- yield controls.dispatch(
244
- noticesStore,
245
- 'createErrorNotice',
246
- ...args
247
- );
192
+ registry.dispatch( noticesStore ).createErrorNotice( ...args );
248
193
  }
249
194
  } else {
250
- const updatedRecord = yield controls.select(
251
- STORE_NAME,
252
- 'getCurrentPost'
253
- );
195
+ const updatedRecord = select.getCurrentPost();
254
196
  const args = getNotificationArgumentsForSaveSuccess( {
255
197
  previousPost: previousRecord,
256
198
  post: updatedRecord,
257
- postType: yield controls.resolveSelect(
258
- coreStore,
259
- 'getPostType',
260
- updatedRecord.type
261
- ),
199
+ postType: await registry
200
+ .resolveSelect( coreStore )
201
+ .getPostType( updatedRecord.type ),
262
202
  options,
263
203
  } );
264
204
  if ( args.length ) {
265
- yield controls.dispatch(
266
- noticesStore,
267
- 'createSuccessNotice',
268
- ...args
269
- );
205
+ registry.dispatch( noticesStore ).createSuccessNotice( ...args );
270
206
  }
271
207
  // Make sure that any edits after saving create an undo level and are
272
208
  // considered for change detection.
273
209
  if ( ! options.isAutosave ) {
274
- yield controls.dispatch(
275
- blockEditorStore,
276
- '__unstableMarkLastChangeAsPersistent'
277
- );
210
+ registry
211
+ .dispatch( blockEditorStore )
212
+ .__unstableMarkLastChangeAsPersistent();
278
213
  }
279
214
  }
280
- }
215
+ };
281
216
 
282
217
  /**
283
218
  * Action for refreshing the current post.
@@ -294,104 +229,68 @@ export function refreshPost() {
294
229
  }
295
230
 
296
231
  /**
297
- * Action generator for trashing the current post in the editor.
298
- */
299
- export function* trashPost() {
300
- const postTypeSlug = yield controls.select(
301
- STORE_NAME,
302
- 'getCurrentPostType'
303
- );
304
- const postType = yield controls.resolveSelect(
305
- coreStore,
306
- 'getPostType',
307
- postTypeSlug
308
- );
309
- yield controls.dispatch(
310
- noticesStore,
311
- 'removeNotice',
312
- TRASH_POST_NOTICE_ID
313
- );
232
+ * Action for trashing the current post in the editor.
233
+ */
234
+ export const trashPost = () => async ( { select, dispatch, registry } ) => {
235
+ const postTypeSlug = select.getCurrentPostType();
236
+ const postType = await registry
237
+ .resolveSelect( coreStore )
238
+ .getPostType( postTypeSlug );
239
+ registry.dispatch( noticesStore ).removeNotice( TRASH_POST_NOTICE_ID );
314
240
  try {
315
- const post = yield controls.select( STORE_NAME, 'getCurrentPost' );
316
- yield apiFetch( {
241
+ const post = select.getCurrentPost();
242
+ await apiFetch( {
317
243
  path: `/wp/v2/${ postType.rest_base }/${ post.id }`,
318
244
  method: 'DELETE',
319
245
  } );
320
246
 
321
- yield controls.dispatch( STORE_NAME, 'savePost' );
247
+ await dispatch.savePost();
322
248
  } catch ( error ) {
323
- yield controls.dispatch(
324
- noticesStore,
325
- 'createErrorNotice',
326
- ...getNotificationArgumentsForTrashFail( { error } )
327
- );
249
+ registry
250
+ .dispatch( noticesStore )
251
+ .createErrorNotice(
252
+ ...getNotificationArgumentsForTrashFail( { error } )
253
+ );
328
254
  }
329
- }
255
+ };
330
256
 
331
257
  /**
332
- * Action generator used in signalling that the post should autosave. This
258
+ * Action that autosaves the current post. This
333
259
  * includes server-side autosaving (default) and client-side (a.k.a. local)
334
260
  * autosaving (e.g. on the Web, the post might be committed to Session
335
261
  * Storage).
336
262
  *
337
263
  * @param {Object?} options Extra flags to identify the autosave.
338
264
  */
339
- export function* autosave( { local = false, ...options } = {} ) {
265
+ export const autosave = ( { local = false, ...options } = {} ) => async ( {
266
+ select,
267
+ dispatch,
268
+ } ) => {
340
269
  if ( local ) {
341
- const post = yield controls.select( STORE_NAME, 'getCurrentPost' );
342
- const isPostNew = yield controls.select(
343
- STORE_NAME,
344
- 'isEditedPostNew'
345
- );
346
- const title = yield controls.select(
347
- STORE_NAME,
348
- 'getEditedPostAttribute',
349
- 'title'
350
- );
351
- const content = yield controls.select(
352
- STORE_NAME,
353
- 'getEditedPostAttribute',
354
- 'content'
355
- );
356
- const excerpt = yield controls.select(
357
- STORE_NAME,
358
- 'getEditedPostAttribute',
359
- 'excerpt'
360
- );
361
- yield {
362
- type: 'LOCAL_AUTOSAVE_SET',
363
- postId: post.id,
364
- isPostNew,
365
- title,
366
- content,
367
- excerpt,
368
- };
270
+ const post = select.getCurrentPost();
271
+ const isPostNew = select.isEditedPostNew();
272
+ const title = select.getEditedPostAttribute( 'title' );
273
+ const content = select.getEditedPostAttribute( 'content' );
274
+ const excerpt = select.getEditedPostAttribute( 'excerpt' );
275
+ localAutosaveSet( post.id, isPostNew, title, content, excerpt );
369
276
  } else {
370
- yield controls.dispatch( STORE_NAME, 'savePost', {
371
- isAutosave: true,
372
- ...options,
373
- } );
277
+ await dispatch.savePost( { isAutosave: true, ...options } );
374
278
  }
375
- }
279
+ };
376
280
 
377
281
  /**
378
- * Returns an action object used in signalling that undo history should
379
- * restore last popped state.
380
- *
381
- * @yield {Object} Action object.
282
+ * Action that restores last popped state in undo history.
382
283
  */
383
- export function* redo() {
384
- yield controls.dispatch( coreStore, 'redo' );
385
- }
284
+ export const redo = () => ( { registry } ) => {
285
+ registry.dispatch( coreStore ).redo();
286
+ };
386
287
 
387
288
  /**
388
- * Returns an action object used in signalling that undo history should pop.
389
- *
390
- * @yield {Object} Action object.
289
+ * Action that pops a record from undo history and undoes the edit.
391
290
  */
392
- export function* undo() {
393
- yield controls.dispatch( coreStore, 'undo' );
394
- }
291
+ export const undo = () => ( { registry } ) => {
292
+ registry.dispatch( coreStore ).undo();
293
+ };
395
294
 
396
295
  /**
397
296
  * Action that creates an undo history record.
@@ -408,10 +307,9 @@ export function createUndoLevel() {
408
307
  }
409
308
 
410
309
  /**
411
- * Returns an action object used to lock the editor.
310
+ * Action that locks the editor.
412
311
  *
413
312
  * @param {Object} lock Details about the post lock status, user, and nonce.
414
- *
415
313
  * @return {Object} Action object.
416
314
  */
417
315
  export function updatePostLock( lock ) {
@@ -422,8 +320,7 @@ export function updatePostLock( lock ) {
422
320
  }
423
321
 
424
322
  /**
425
- * Returns an action object used in signalling that the user has enabled the
426
- * publish sidebar.
323
+ * Action that enables the publish sidebar.
427
324
  *
428
325
  * @return {Object} Action object
429
326
  */
@@ -434,8 +331,7 @@ export function enablePublishSidebar() {
434
331
  }
435
332
 
436
333
  /**
437
- * Returns an action object used in signalling that the user has disabled the
438
- * publish sidebar.
334
+ * Action that disables the publish sidebar.
439
335
  *
440
336
  * @return {Object} Action object
441
337
  */
@@ -446,7 +342,7 @@ export function disablePublishSidebar() {
446
342
  }
447
343
 
448
344
  /**
449
- * Returns an action object used to signal that post saving is locked.
345
+ * Action that locks post saving.
450
346
  *
451
347
  * @param {string} lockName The lock name.
452
348
  *
@@ -496,7 +392,7 @@ export function lockPostSaving( lockName ) {
496
392
  }
497
393
 
498
394
  /**
499
- * Returns an action object used to signal that post saving is unlocked.
395
+ * Action that unlocks post saving.
500
396
  *
501
397
  * @param {string} lockName The lock name.
502
398
  *
@@ -516,7 +412,7 @@ export function unlockPostSaving( lockName ) {
516
412
  }
517
413
 
518
414
  /**
519
- * Returns an action object used to signal that post autosaving is locked.
415
+ * Action that locks post autosaving.
520
416
  *
521
417
  * @param {string} lockName The lock name.
522
418
  *
@@ -536,7 +432,7 @@ export function lockPostAutosaving( lockName ) {
536
432
  }
537
433
 
538
434
  /**
539
- * Returns an action object used to signal that post autosaving is unlocked.
435
+ * Action that unlocks post autosaving.
540
436
  *
541
437
  * @param {string} lockName The lock name.
542
438
  *
@@ -560,34 +456,27 @@ export function unlockPostAutosaving( lockName ) {
560
456
  *
561
457
  * @param {Array} blocks Block Array.
562
458
  * @param {?Object} options Optional options.
563
- *
564
- * @yield {Object} Action object
565
459
  */
566
- export function* resetEditorBlocks( blocks, options = {} ) {
460
+ export const resetEditorBlocks = ( blocks, options = {} ) => ( {
461
+ select,
462
+ dispatch,
463
+ registry,
464
+ } ) => {
567
465
  const { __unstableShouldCreateUndoLevel, selection } = options;
568
466
  const edits = { blocks, selection };
569
467
 
570
468
  if ( __unstableShouldCreateUndoLevel !== false ) {
571
- const { id, type } = yield controls.select(
572
- STORE_NAME,
573
- 'getCurrentPost'
574
- );
469
+ const { id, type } = select.getCurrentPost();
575
470
  const noChange =
576
- ( yield controls.select(
577
- coreStore,
578
- 'getEditedEntityRecord',
579
- 'postType',
580
- type,
581
- id
582
- ) ).blocks === edits.blocks;
471
+ registry
472
+ .select( coreStore )
473
+ .getEditedEntityRecord( 'postType', type, id ).blocks ===
474
+ edits.blocks;
583
475
  if ( noChange ) {
584
- return yield controls.dispatch(
585
- coreStore,
586
- '__unstableCreateUndoLevel',
587
- 'postType',
588
- type,
589
- id
590
- );
476
+ registry
477
+ .dispatch( coreStore )
478
+ .__unstableCreateUndoLevel( 'postType', type, id );
479
+ return;
591
480
  }
592
481
 
593
482
  // We create a new function here on every persistent edit
@@ -596,8 +485,9 @@ export function* resetEditorBlocks( blocks, options = {} ) {
596
485
  edits.content = ( { blocks: blocksForSerialization = [] } ) =>
597
486
  __unstableSerializeAndClean( blocksForSerialization );
598
487
  }
599
- yield* editPost( edits );
600
- }
488
+
489
+ dispatch.editPost( edits );
490
+ };
601
491
 
602
492
  /*
603
493
  * Returns an action object used in signalling that the post editor settings have been updated.
@@ -617,16 +507,14 @@ export function updateEditorSettings( settings ) {
617
507
  * Backward compatibility
618
508
  */
619
509
 
620
- const getBlockEditorAction = ( name ) =>
621
- function* ( ...args ) {
622
- deprecated( "`wp.data.dispatch( 'core/editor' )." + name + '`', {
623
- since: '5.3',
624
- alternative:
625
- "`wp.data.dispatch( 'core/block-editor' )." + name + '`',
626
- version: '6.2',
627
- } );
628
- yield controls.dispatch( blockEditorStore, name, ...args );
629
- };
510
+ const getBlockEditorAction = ( name ) => ( ...args ) => ( { registry } ) => {
511
+ deprecated( "`wp.data.dispatch( 'core/editor' )." + name + '`', {
512
+ since: '5.3',
513
+ alternative: "`wp.data.dispatch( 'core/block-editor' )." + name + '`',
514
+ version: '6.2',
515
+ } );
516
+ registry.dispatch( blockEditorStore )[ name ]( ...args );
517
+ };
630
518
 
631
519
  /**
632
520
  * @see resetBlocks in core/block-editor store.
@@ -20,8 +20,8 @@ export function togglePostTitleSelection( isSelected = true ) {
20
20
  }
21
21
 
22
22
  /**
23
- * Action generator used in signalling that the post should autosave.
23
+ * Action that autosaves the post.
24
24
  */
25
- export function* autosave() {
25
+ export const autosave = () => () => {
26
26
  RNReactNativeGutenbergBridge.editorDidAutosave();
27
- }
27
+ };
@@ -2,7 +2,6 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { createReduxStore, registerStore } from '@wordpress/data';
5
- import { controls as dataControls } from '@wordpress/data-controls';
6
5
 
7
6
  /**
8
7
  * Internal dependencies
@@ -10,7 +9,6 @@ import { controls as dataControls } from '@wordpress/data-controls';
10
9
  import reducer from './reducer';
11
10
  import * as selectors from './selectors';
12
11
  import * as actions from './actions';
13
- import controls from './controls';
14
12
  import { STORE_NAME } from './constants';
15
13
 
16
14
  /**
@@ -24,10 +22,6 @@ export const storeConfig = {
24
22
  reducer,
25
23
  selectors,
26
24
  actions,
27
- controls: {
28
- ...dataControls,
29
- ...controls,
30
- },
31
25
  };
32
26
 
33
27
  /**
@@ -36,11 +36,3 @@ export function localAutosaveSet( postId, isPostNew, title, content, excerpt ) {
36
36
  export function localAutosaveClear( postId, isPostNew ) {
37
37
  window.sessionStorage.removeItem( postKey( postId, isPostNew ) );
38
38
  }
39
-
40
- const controls = {
41
- LOCAL_AUTOSAVE_SET( { postId, isPostNew, title, content, excerpt } ) {
42
- localAutosaveSet( postId, isPostNew, title, content, excerpt );
43
- },
44
- };
45
-
46
- export default controls;
@@ -84,7 +84,6 @@ export function shouldOverwriteState( action, previousAction ) {
84
84
  export function postId( state = null, action ) {
85
85
  switch ( action.type ) {
86
86
  case 'SETUP_EDITOR_STATE':
87
- case 'RESET_POST':
88
87
  return action.post.id;
89
88
  }
90
89
 
@@ -94,7 +93,6 @@ export function postId( state = null, action ) {
94
93
  export function postType( state = null, action ) {
95
94
  switch ( action.type ) {
96
95
  case 'SETUP_EDITOR_STATE':
97
- case 'RESET_POST':
98
96
  return action.post.type;
99
97
  }
100
98