@@ -229,10 +229,8 @@ export const rootEntitiesConfig = [
229229] . map ( ( entity ) => {
230230 const syncEnabledRootEntities = new Set ( [ 'comment' ] ) ;
231231
232- if ( globalThis . IS_GUTENBERG_PLUGIN ) {
233- if ( syncEnabledRootEntities . has ( entity . name ) ) {
234- entity . syncConfig = defaultSyncConfig ;
235- }
232+ if ( syncEnabledRootEntities . has ( entity . name ) ) {
233+ entity . syncConfig = defaultSyncConfig ;
236234 }
237235 return entity ;
238236} ) ;
@@ -295,16 +293,14 @@ export const prePersistPostType = (
295293 }
296294
297295 // Add meta for persisted CRDT document.
298- if ( globalThis . IS_GUTENBERG_PLUGIN ) {
299- if ( persistedRecord ) {
300- const objectType = `postType/${ name } ` ;
301- const objectId = persistedRecord . id ;
302- const meta = getSyncManager ( ) ?. createMeta ( objectType , objectId ) ;
303- newEdits . meta = {
304- ...edits . meta ,
305- ...meta ,
306- } ;
307- }
296+ if ( persistedRecord ) {
297+ const objectType = `postType/${ name } ` ;
298+ const objectId = persistedRecord . id ;
299+ const meta = getSyncManager ( ) ?. createMeta ( objectType , objectId ) ;
300+ newEdits . meta = {
301+ ...edits . meta ,
302+ ...meta ,
303+ } ;
308304 }
309305
310306 return newEdits ;
@@ -359,60 +355,54 @@ async function loadPostTypeEntities() {
359355 : DEFAULT_ENTITY_KEY ,
360356 } ;
361357
362- if ( globalThis . IS_GUTENBERG_PLUGIN ) {
358+ /**
359+ * @type {import('@wordpress/sync').SyncConfig }
360+ */
361+ entity . syncConfig = {
363362 /**
364- * @type {import('@wordpress/sync').SyncConfig }
363+ * Apply changes from the local editor to the local CRDT document so
364+ * that those changes can be synced to other peers (via the provider).
365+ *
366+ * @param {import('@wordpress/sync').CRDTDoc } crdtDoc
367+ * @param {Partial< import('@wordpress/sync').ObjectData > } changes
368+ * @return {void }
365369 */
366- entity . syncConfig = {
367- /**
368- * Apply changes from the local editor to the local CRDT document so
369- * that those changes can be synced to other peers (via the provider).
370- *
371- * @param {import('@wordpress/sync').CRDTDoc } crdtDoc
372- * @param {Partial< import('@wordpress/sync').ObjectData > } changes
373- * @return {void }
374- */
375- applyChangesToCRDTDoc : ( crdtDoc , changes ) =>
376- applyPostChangesToCRDTDoc ( crdtDoc , changes , postType ) ,
370+ applyChangesToCRDTDoc : ( crdtDoc , changes ) =>
371+ applyPostChangesToCRDTDoc ( crdtDoc , changes , postType ) ,
377372
378- /**
379- * Create the awareness instance for the entity's CRDT document.
380- *
381- * @param {import('@wordpress/sync').CRDTDoc } ydoc
382- * @param {import('@wordpress/sync').ObjectID } objectId
383- * @return {import('@wordpress/sync').Awareness } Awareness instance
384- */
385- createAwareness : ( ydoc , objectId ) => {
386- const kind = 'postType' ;
387- const id = parseInt ( objectId , 10 ) ;
388- return new PostEditorAwareness ( ydoc , kind , name , id ) ;
389- } ,
373+ /**
374+ * Create the awareness instance for the entity's CRDT document.
375+ *
376+ * @param {import('@wordpress/sync').CRDTDoc } ydoc
377+ * @param {import('@wordpress/sync').ObjectID } objectId
378+ * @return {import('@wordpress/sync').Awareness } Awareness instance
379+ */
380+ createAwareness : ( ydoc , objectId ) => {
381+ const kind = 'postType' ;
382+ const id = parseInt ( objectId , 10 ) ;
383+ return new PostEditorAwareness ( ydoc , kind , name , id ) ;
384+ } ,
390385
391- /**
392- * Extract changes from a CRDT document that can be used to update the
393- * local editor state.
394- *
395- * @param {import('@wordpress/sync').CRDTDoc } crdtDoc
396- * @param {import('@wordpress/sync').ObjectData } editedRecord
397- * @return {Partial< import('@wordpress/sync').ObjectData > } Changes to record
398- */
399- getChangesFromCRDTDoc : ( crdtDoc , editedRecord ) =>
400- getPostChangesFromCRDTDoc (
401- crdtDoc ,
402- editedRecord ,
403- postType
404- ) ,
386+ /**
387+ * Extract changes from a CRDT document that can be used to update the
388+ * local editor state.
389+ *
390+ * @param {import('@wordpress/sync').CRDTDoc } crdtDoc
391+ * @param {import('@wordpress/sync').ObjectData } editedRecord
392+ * @return {Partial< import('@wordpress/sync').ObjectData > } Changes to record
393+ */
394+ getChangesFromCRDTDoc : ( crdtDoc , editedRecord ) =>
395+ getPostChangesFromCRDTDoc ( crdtDoc , editedRecord , postType ) ,
405396
406- /**
407- * Sync features supported by the entity.
408- *
409- * @type {Record< string, boolean > }
410- */
411- supports : {
412- crdtPersistence : true ,
413- } ,
414- } ;
415- }
397+ /**
398+ * Sync features supported by the entity.
399+ *
400+ * @type {Record< string, boolean > }
401+ */
402+ supports : {
403+ crdtPersistence : true ,
404+ } ,
405+ } ;
416406
417407 return entity ;
418408 } ) ;
@@ -439,9 +429,7 @@ async function loadTaxonomyEntities() {
439429 supportsPagination : true ,
440430 } ;
441431
442- if ( globalThis . IS_GUTENBERG_PLUGIN ) {
443- entity . syncConfig = defaultSyncConfig ;
444- }
432+ entity . syncConfig = defaultSyncConfig ;
445433
446434 return entity ;
447435 } ) ;
0 commit comments