@wordpress/editor 13.26.0 → 13.27.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 (137) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/bindings/index.js +20 -0
  3. package/build/bindings/index.js.map +1 -0
  4. package/build/bindings/post-meta.js +52 -0
  5. package/build/bindings/post-meta.js.map +1 -0
  6. package/build/components/block-manager/category.js +106 -0
  7. package/build/components/block-manager/category.js.map +1 -0
  8. package/build/components/block-manager/checklist.js +35 -0
  9. package/build/components/block-manager/checklist.js.map +1 -0
  10. package/build/components/block-manager/index.js +130 -0
  11. package/build/components/block-manager/index.js.map +1 -0
  12. package/build/components/document-tools/index.js +58 -52
  13. package/build/components/document-tools/index.js.map +1 -1
  14. package/build/components/editor-canvas/index.js +4 -4
  15. package/build/components/editor-canvas/index.js.map +1 -1
  16. package/build/components/editor-notices/index.js +11 -11
  17. package/build/components/editor-notices/index.js.map +1 -1
  18. package/build/components/entities-saved-states/entity-type-list.js +38 -7
  19. package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
  20. package/build/components/entities-saved-states/index.js +1 -1
  21. package/build/components/entities-saved-states/index.js.map +1 -1
  22. package/build/components/offline-status/index.native.js +1 -3
  23. package/build/components/offline-status/index.native.js.map +1 -1
  24. package/build/components/post-locked-modal/index.js +1 -1
  25. package/build/components/post-locked-modal/index.js.map +1 -1
  26. package/build/components/post-saved-state/index.js +10 -24
  27. package/build/components/post-saved-state/index.js.map +1 -1
  28. package/build/components/post-schedule/check.js +5 -16
  29. package/build/components/post-schedule/check.js.map +1 -1
  30. package/build/components/preferences-modal/enable-panel.js +42 -0
  31. package/build/components/preferences-modal/enable-panel.js.map +1 -0
  32. package/build/components/preferences-modal/enable-plugin-document-setting-panel.js +33 -0
  33. package/build/components/preferences-modal/enable-plugin-document-setting-panel.js.map +1 -0
  34. package/build/components/preferences-modal/index.js +186 -0
  35. package/build/components/preferences-modal/index.js.map +1 -0
  36. package/build/components/provider/disable-non-page-content-blocks.js +1 -4
  37. package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
  38. package/build/components/provider/use-block-editor-settings.js +34 -8
  39. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  40. package/build/hooks/pattern-partial-syncing.js +12 -8
  41. package/build/hooks/pattern-partial-syncing.js.map +1 -1
  42. package/build/index.js +1 -0
  43. package/build/index.js.map +1 -1
  44. package/build/private-apis.js +6 -2
  45. package/build/private-apis.js.map +1 -1
  46. package/build/store/defaults.js +2 -0
  47. package/build/store/defaults.js.map +1 -1
  48. package/build/store/private-actions.js +33 -1
  49. package/build/store/private-actions.js.map +1 -1
  50. package/build/store/private-selectors.js +1 -1
  51. package/build/store/private-selectors.js.map +1 -1
  52. package/build-module/bindings/index.js +15 -0
  53. package/build-module/bindings/index.js.map +1 -0
  54. package/build-module/bindings/post-meta.js +45 -0
  55. package/build-module/bindings/post-meta.js.map +1 -0
  56. package/build-module/components/block-manager/category.js +97 -0
  57. package/build-module/components/block-manager/category.js.map +1 -0
  58. package/build-module/components/block-manager/checklist.js +27 -0
  59. package/build-module/components/block-manager/checklist.js.map +1 -0
  60. package/build-module/components/block-manager/index.js +121 -0
  61. package/build-module/components/block-manager/index.js.map +1 -0
  62. package/build-module/components/document-tools/index.js +58 -52
  63. package/build-module/components/document-tools/index.js.map +1 -1
  64. package/build-module/components/editor-canvas/index.js +4 -4
  65. package/build-module/components/editor-canvas/index.js.map +1 -1
  66. package/build-module/components/editor-notices/index.js +12 -12
  67. package/build-module/components/editor-notices/index.js.map +1 -1
  68. package/build-module/components/entities-saved-states/entity-type-list.js +39 -8
  69. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  70. package/build-module/components/entities-saved-states/index.js +1 -1
  71. package/build-module/components/entities-saved-states/index.js.map +1 -1
  72. package/build-module/components/offline-status/index.native.js +1 -3
  73. package/build-module/components/offline-status/index.native.js.map +1 -1
  74. package/build-module/components/post-locked-modal/index.js +1 -1
  75. package/build-module/components/post-locked-modal/index.js.map +1 -1
  76. package/build-module/components/post-saved-state/index.js +11 -25
  77. package/build-module/components/post-saved-state/index.js.map +1 -1
  78. package/build-module/components/post-schedule/check.js +6 -15
  79. package/build-module/components/post-schedule/check.js.map +1 -1
  80. package/build-module/components/preferences-modal/enable-panel.js +34 -0
  81. package/build-module/components/preferences-modal/enable-panel.js.map +1 -0
  82. package/build-module/components/preferences-modal/enable-plugin-document-setting-panel.js +24 -0
  83. package/build-module/components/preferences-modal/enable-plugin-document-setting-panel.js.map +1 -0
  84. package/build-module/components/preferences-modal/index.js +179 -0
  85. package/build-module/components/preferences-modal/index.js.map +1 -0
  86. package/build-module/components/provider/disable-non-page-content-blocks.js +1 -4
  87. package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
  88. package/build-module/components/provider/use-block-editor-settings.js +35 -9
  89. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  90. package/build-module/hooks/pattern-partial-syncing.js +12 -8
  91. package/build-module/hooks/pattern-partial-syncing.js.map +1 -1
  92. package/build-module/index.js +1 -0
  93. package/build-module/index.js.map +1 -1
  94. package/build-module/private-apis.js +6 -2
  95. package/build-module/private-apis.js.map +1 -1
  96. package/build-module/store/defaults.js +2 -0
  97. package/build-module/store/defaults.js.map +1 -1
  98. package/build-module/store/private-actions.js +29 -0
  99. package/build-module/store/private-actions.js.map +1 -1
  100. package/build-module/store/private-selectors.js +1 -1
  101. package/build-module/store/private-selectors.js.map +1 -1
  102. package/build-style/style-rtl.css +80 -12
  103. package/build-style/style.css +80 -12
  104. package/package.json +33 -33
  105. package/src/bindings/index.js +13 -0
  106. package/src/bindings/post-meta.js +42 -0
  107. package/src/components/block-manager/category.js +96 -0
  108. package/src/components/block-manager/checklist.js +30 -0
  109. package/src/components/block-manager/index.js +160 -0
  110. package/src/components/block-manager/style.scss +82 -0
  111. package/src/components/document-tools/index.js +9 -1
  112. package/src/components/editor-canvas/index.js +3 -2
  113. package/src/components/editor-notices/index.js +11 -12
  114. package/src/components/editor-notices/style.scss +0 -1
  115. package/src/components/entities-saved-states/entity-type-list.js +47 -5
  116. package/src/components/entities-saved-states/index.js +7 -7
  117. package/src/components/entities-saved-states/style.scss +4 -0
  118. package/src/components/offline-status/index.native.js +2 -4
  119. package/src/components/post-locked-modal/index.js +1 -1
  120. package/src/components/post-locked-modal/style.scss +0 -6
  121. package/src/components/post-saved-state/index.js +30 -47
  122. package/src/components/post-schedule/check.js +10 -14
  123. package/src/components/post-schedule/test/check.js +24 -9
  124. package/src/components/preferences-modal/enable-panel.js +30 -0
  125. package/src/components/preferences-modal/enable-plugin-document-setting-panel.js +23 -0
  126. package/src/components/preferences-modal/index.js +269 -0
  127. package/src/components/preferences-modal/test/index.js +28 -0
  128. package/src/components/provider/disable-non-page-content-blocks.js +3 -3
  129. package/src/components/provider/use-block-editor-settings.js +45 -17
  130. package/src/hooks/pattern-partial-syncing.js +26 -29
  131. package/src/index.js +1 -0
  132. package/src/private-apis.js +6 -2
  133. package/src/store/defaults.js +2 -0
  134. package/src/store/private-actions.js +49 -0
  135. package/src/store/private-selectors.js +1 -1
  136. package/src/style.scss +1 -1
  137. package/src/components/editor-canvas/style.scss +0 -5
@@ -1 +1 @@
1
- {"version":3,"names":["__","useSelect","PanelBody","PanelRow","store","coreStore","EntityRecordItem","getEntityDescription","entity","count","EntityTypeList","list","unselectedEntities","setUnselectedEntities","length","firstRecord","entityConfig","select","getEntityConfig","kind","name","entityLabel","label","description","createElement","title","initialOpen","map","record","key","property","checked","some","elt","onChange","value"],"sources":["@wordpress/editor/src/components/entities-saved-states/entity-type-list.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { PanelBody, PanelRow } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport EntityRecordItem from './entity-record-item';\n\nfunction getEntityDescription( entity, count ) {\n\tswitch ( entity ) {\n\t\tcase 'site':\n\t\t\treturn 1 === count\n\t\t\t\t? __( 'This change will affect your whole site.' )\n\t\t\t\t: __( 'These changes will affect your whole site.' );\n\t\tcase 'wp_template':\n\t\t\treturn __(\n\t\t\t\t'This change will affect pages and posts that use this template.'\n\t\t\t);\n\t\tcase 'page':\n\t\tcase 'post':\n\t\t\treturn __( 'The following content has been modified.' );\n\t}\n}\n\nexport default function EntityTypeList( {\n\tlist,\n\tunselectedEntities,\n\tsetUnselectedEntities,\n} ) {\n\tconst count = list.length;\n\tconst firstRecord = list[ 0 ];\n\tconst entityConfig = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityConfig(\n\t\t\t\tfirstRecord.kind,\n\t\t\t\tfirstRecord.name\n\t\t\t),\n\t\t[ firstRecord.kind, firstRecord.name ]\n\t);\n\tconst { name } = firstRecord;\n\n\tlet entityLabel = entityConfig.label;\n\tif ( name === 'wp_template_part' ) {\n\t\tentityLabel =\n\t\t\t1 === count ? __( 'Template Part' ) : __( 'Template Parts' );\n\t}\n\t// Set description based on type of entity.\n\tconst description = getEntityDescription( name, count );\n\n\treturn (\n\t\t<PanelBody title={ entityLabel } initialOpen={ true }>\n\t\t\t{ description && <PanelRow>{ description }</PanelRow> }\n\t\t\t{ list.map( ( record ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<EntityRecordItem\n\t\t\t\t\t\tkey={ record.key || record.property }\n\t\t\t\t\t\trecord={ record }\n\t\t\t\t\t\tchecked={\n\t\t\t\t\t\t\t! unselectedEntities.some(\n\t\t\t\t\t\t\t\t( elt ) =>\n\t\t\t\t\t\t\t\t\telt.kind === record.kind &&\n\t\t\t\t\t\t\t\t\telt.name === record.name &&\n\t\t\t\t\t\t\t\t\telt.key === record.key &&\n\t\t\t\t\t\t\t\t\telt.property === record.property\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetUnselectedEntities( record, value )\n\t\t\t\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AAgB,CAAC,GAAGA,EAAE,CAAE,gBAAiB,CAAC;EAC9D;EACA;EACA,MAAMuB,WAAW,GAAGhB,oBAAoB,CAAEa,IAAI,EAAEX,KAAM,CAAC;EAEvD,OACCe,aAAA,CAACtB,SAAS;IAACuB,KAAK,EAAGJ,WAAa;IAACK,WAAW,EAAG;EAAM,GAClDH,WAAW,IAAIC,aAAA,CAACrB,QAAQ,QAAGoB,WAAuB,CAAC,EACnDZ,IAAI,CAACgB,GAAG,CAAIC,MAAM,IAAM;IACzB,OACCJ,aAAA,CAAClB,gBAAgB;MAChBuB,GAAG,EAAGD,MAAM,CAACC,GAAG,IAAID,MAAM,CAACE,QAAU;MACrCF,MAAM,EAAGA,MAAQ;MACjBG,OAAO,EACN,CAAEnB,kBAAkB,CAACoB,IAAI,CACtBC,GAAG,IACJA,GAAG,CAACd,IAAI,KAAKS,MAAM,CAACT,IAAI,IACxBc,GAAG,CAACb,IAAI,KAAKQ,MAAM,CAACR,IAAI,IACxBa,GAAG,CAACJ,GAAG,KAAKD,MAAM,CAACC,GAAG,IACtBI,GAAG,CAACH,QAAQ,KAAKF,MAAM,CAACE,QAC1B,CACA;MACDI,QAAQ,EAAKC,KAAK,IACjBtB,qBAAqB,CAAEe,MAAM,EAAEO,KAAM;IACrC,CACD,CAAC;EAEJ,CAAE,CACQ,CAAC;AAEd"}
1
+ {"version":3,"names":["__","useSelect","PanelBody","PanelRow","store","coreStore","privateApis","blockEditorPrivateApis","useContext","EntityRecordItem","unlock","getGlobalStylesChanges","GlobalStylesContext","getEntityDescription","entity","count","GlobalStylesDescription","record","user","currentEditorGlobalStyles","savedRecord","select","getEntityRecord","kind","name","key","globalStylesChanges","maxResults","length","createElement","Fragment","className","join","EntityDescription","description","EntityTypeList","list","unselectedEntities","setUnselectedEntities","firstRecord","entityConfig","getEntityConfig","entityLabel","label","title","initialOpen","map","property","checked","some","elt","onChange","value"],"sources":["@wordpress/editor/src/components/entities-saved-states/entity-type-list.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { PanelBody, PanelRow } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport EntityRecordItem from './entity-record-item';\nimport { unlock } from '../../lock-unlock';\n\nconst { getGlobalStylesChanges, GlobalStylesContext } = unlock(\n\tblockEditorPrivateApis\n);\n\nfunction getEntityDescription( entity, count ) {\n\tswitch ( entity ) {\n\t\tcase 'site':\n\t\t\treturn 1 === count\n\t\t\t\t? __( 'This change will affect your whole site.' )\n\t\t\t\t: __( 'These changes will affect your whole site.' );\n\t\tcase 'wp_template':\n\t\t\treturn __(\n\t\t\t\t'This change will affect pages and posts that use this template.'\n\t\t\t);\n\t\tcase 'page':\n\t\tcase 'post':\n\t\t\treturn __( 'The following content has been modified.' );\n\t}\n}\n\nfunction GlobalStylesDescription( { record } ) {\n\tconst { user: currentEditorGlobalStyles } =\n\t\tuseContext( GlobalStylesContext );\n\tconst savedRecord = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord(\n\t\t\t\trecord.kind,\n\t\t\t\trecord.name,\n\t\t\t\trecord.key\n\t\t\t),\n\t\t[ record.kind, record.name, record.key ]\n\t);\n\n\tconst globalStylesChanges = getGlobalStylesChanges(\n\t\tcurrentEditorGlobalStyles,\n\t\tsavedRecord,\n\t\t{\n\t\t\tmaxResults: 10,\n\t\t}\n\t);\n\treturn globalStylesChanges.length ? (\n\t\t<>\n\t\t\t<h3 className=\"entities-saved-states__description-heading\">\n\t\t\t\t{ __( 'Changes made to:' ) }\n\t\t\t</h3>\n\t\t\t<PanelRow>{ globalStylesChanges.join( ', ' ) }</PanelRow>\n\t\t</>\n\t) : null;\n}\n\nfunction EntityDescription( { record, count } ) {\n\tif ( 'globalStyles' === record?.name ) {\n\t\treturn <GlobalStylesDescription record={ record } />;\n\t}\n\tconst description = getEntityDescription( record?.name, count );\n\treturn description ? <PanelRow>{ description }</PanelRow> : null;\n}\n\nexport default function EntityTypeList( {\n\tlist,\n\tunselectedEntities,\n\tsetUnselectedEntities,\n} ) {\n\tconst count = list.length;\n\tconst firstRecord = list[ 0 ];\n\tconst entityConfig = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityConfig(\n\t\t\t\tfirstRecord.kind,\n\t\t\t\tfirstRecord.name\n\t\t\t),\n\t\t[ firstRecord.kind, firstRecord.name ]\n\t);\n\n\tlet entityLabel = entityConfig.label;\n\tif ( firstRecord?.name === 'wp_template_part' ) {\n\t\tentityLabel =\n\t\t\t1 === count ? __( 'Template Part' ) : __( 'Template Parts' );\n\t}\n\n\treturn (\n\t\t<PanelBody title={ entityLabel } initialOpen={ true }>\n\t\t\t<EntityDescription record={ firstRecord } count={ count } />\n\t\t\t{ list.map( ( record ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<EntityRecordItem\n\t\t\t\t\t\tkey={ record.key || record.property }\n\t\t\t\t\t\trecord={ record }\n\t\t\t\t\t\tchecked={\n\t\t\t\t\t\t\t! unselectedEntities.some(\n\t\t\t\t\t\t\t\t( elt ) =>\n\t\t\t\t\t\t\t\t\telt.kind === record.kind &&\n\t\t\t\t\t\t\t\t\telt.name === record.name &&\n\t\t\t\t\t\t\t\t\telt.key === record.key &&\n\t\t\t\t\t\t\t\t\telt.property === record.property\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetUnselectedEntities( record, value )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</PanelBody>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,SAAS,EAAEC,QAAQ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DhB,aAAA,CAACI,iBAAiB;IAAChB,MAAM,EAAGsB,WAAa;IAACxB,KAAK,EAAGA;EAAO,CAAE,CAAC,EAC1DqB,IAAI,CAACU,GAAG,CAAI7B,MAAM,IAAM;IACzB,OACCY,aAAA,CAACpB,gBAAgB;MAChBgB,GAAG,EAAGR,MAAM,CAACQ,GAAG,IAAIR,MAAM,CAAC8B,QAAU;MACrC9B,MAAM,EAAGA,MAAQ;MACjB+B,OAAO,EACN,CAAEX,kBAAkB,CAACY,IAAI,CACtBC,GAAG,IACJA,GAAG,CAAC3B,IAAI,KAAKN,MAAM,CAACM,IAAI,IACxB2B,GAAG,CAAC1B,IAAI,KAAKP,MAAM,CAACO,IAAI,IACxB0B,GAAG,CAACzB,GAAG,KAAKR,MAAM,CAACQ,GAAG,IACtByB,GAAG,CAACH,QAAQ,KAAK9B,MAAM,CAAC8B,QAC1B,CACA;MACDI,QAAQ,EAAKC,KAAK,IACjBd,qBAAqB,CAAErB,MAAM,EAAEmC,KAAM;IACrC,CACD,CAAC;EAEJ,CAAE,CACQ,CAAC;AAEd"}
@@ -172,7 +172,7 @@ export function EntitiesSavedStatesExtensible({
172
172
  className: "entities-saved-states__text-prompt"
173
173
  }, createElement("strong", {
174
174
  className: "entities-saved-states__text-prompt--header"
175
- }, __('Are you ready to save?')), additionalPrompt, isDirty && createElement("p", null, __('The following changes have been made to your site, templates, and content.'))), sortedPartitionedSavables.map(list => {
175
+ }, __('Are you ready to save?')), additionalPrompt, createElement("p", null, isDirty ? __('The following changes have been made to your site, templates, and content.') : __('Select the items you want to save.'))), sortedPartitionedSavables.map(list => {
176
176
  return createElement(EntityTypeList, {
177
177
  key: list[0].name,
178
178
  list: list,
@@ -1 +1 @@
1
- {"version":3,"names":["Button","Flex","FlexItem","__","useSelect","useDispatch","useCallback","useRef","store","coreStore","blockEditorStore","__experimentalUseDialog","useDialog","noticesStore","EntityTypeList","useIsDirty","PUBLISH_ON_SAVE_ENTITIES","kind","name","identity","values","EntitiesSavedStates","close","isDirtyProps","createElement","EntitiesSavedStatesExtensible","additionalPrompt","undefined","onSave","saveEnabled","saveEnabledProp","saveLabel","dirtyEntityRecords","isDirty","setUnselectedEntities","unselectedEntities","saveButtonRef","editEntityRecord","saveEditedEntityRecord","__experimentalSaveSpecifiedEntityEdits","saveSpecifiedEntityEdits","__unstableMarkLastChangeAsPersistent","createSuccessNotice","createErrorNotice","removeNotice","partitionedSavables","reduce","acc","record","push","site","siteSavables","wp_template","templateSavables","wp_template_part","templatePartSavables","contentSavables","sortedPartitionedSavables","Object","filter","Array","isArray","homeUrl","select","getUnstableBase","home","saveCheckedEntities","saveNoticeId","entitiesToSave","key","property","some","elt","siteItemsToSave","pendingSavedRecords","forEach","typeToPublish","status","length","Promise","all","then","value","type","id","actions","label","url","catch","error","dismissPanel","saveDialogRef","saveDialogProps","onClose","ref","className","gap","isBlock","as","variant","disabled","onClick","map","list"],"sources":["@wordpress/editor/src/components/entities-saved-states/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, Flex, FlexItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { __experimentalUseDialog as useDialog } from '@wordpress/compose';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport EntityTypeList from './entity-type-list';\nimport { useIsDirty } from './hooks/use-is-dirty';\n\nconst PUBLISH_ON_SAVE_ENTITIES = [\n\t{\n\t\tkind: 'postType',\n\t\tname: 'wp_navigation',\n\t},\n];\n\nfunction identity( values ) {\n\treturn values;\n}\n\nexport default function EntitiesSavedStates( { close } ) {\n\tconst isDirtyProps = useIsDirty();\n\treturn (\n\t\t<EntitiesSavedStatesExtensible close={ close } { ...isDirtyProps } />\n\t);\n}\n\nexport function EntitiesSavedStatesExtensible( {\n\tadditionalPrompt = undefined,\n\tclose,\n\tonSave = identity,\n\tsaveEnabled: saveEnabledProp = undefined,\n\tsaveLabel = __( 'Save' ),\n\n\tdirtyEntityRecords,\n\tisDirty,\n\tsetUnselectedEntities,\n\tunselectedEntities,\n} ) {\n\tconst saveButtonRef = useRef();\n\tconst {\n\t\teditEntityRecord,\n\t\tsaveEditedEntityRecord,\n\t\t__experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits,\n\t} = useDispatch( coreStore );\n\n\tconst { __unstableMarkLastChangeAsPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst { createSuccessNotice, createErrorNotice, removeNotice } =\n\t\tuseDispatch( noticesStore );\n\n\t// To group entities by type.\n\tconst partitionedSavables = dirtyEntityRecords.reduce( ( acc, record ) => {\n\t\tconst { name } = record;\n\t\tif ( ! acc[ name ] ) {\n\t\t\tacc[ name ] = [];\n\t\t}\n\t\tacc[ name ].push( record );\n\t\treturn acc;\n\t}, {} );\n\n\t// Sort entity groups.\n\tconst {\n\t\tsite: siteSavables,\n\t\twp_template: templateSavables,\n\t\twp_template_part: templatePartSavables,\n\t\t...contentSavables\n\t} = partitionedSavables;\n\tconst sortedPartitionedSavables = [\n\t\tsiteSavables,\n\t\ttemplateSavables,\n\t\ttemplatePartSavables,\n\t\t...Object.values( contentSavables ),\n\t].filter( Array.isArray );\n\n\tconst saveEnabled = saveEnabledProp ?? isDirty;\n\n\tconst { homeUrl } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetUnstableBase, // Site index.\n\t\t} = select( coreStore );\n\t\treturn {\n\t\t\thomeUrl: getUnstableBase()?.home,\n\t\t};\n\t}, [] );\n\n\tconst saveCheckedEntities = () => {\n\t\tconst saveNoticeId = 'site-editor-save-success';\n\t\tremoveNotice( saveNoticeId );\n\t\tconst entitiesToSave = dirtyEntityRecords.filter(\n\t\t\t( { kind, name, key, property } ) => {\n\t\t\t\treturn ! unselectedEntities.some(\n\t\t\t\t\t( elt ) =>\n\t\t\t\t\t\telt.kind === kind &&\n\t\t\t\t\t\telt.name === name &&\n\t\t\t\t\t\telt.key === key &&\n\t\t\t\t\t\telt.property === property\n\t\t\t\t);\n\t\t\t}\n\t\t);\n\n\t\tclose( entitiesToSave );\n\n\t\tconst siteItemsToSave = [];\n\t\tconst pendingSavedRecords = [];\n\t\tentitiesToSave.forEach( ( { kind, name, key, property } ) => {\n\t\t\tif ( 'root' === kind && 'site' === name ) {\n\t\t\t\tsiteItemsToSave.push( property );\n\t\t\t} else {\n\t\t\t\tif (\n\t\t\t\t\tPUBLISH_ON_SAVE_ENTITIES.some(\n\t\t\t\t\t\t( typeToPublish ) =>\n\t\t\t\t\t\t\ttypeToPublish.kind === kind &&\n\t\t\t\t\t\t\ttypeToPublish.name === name\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\teditEntityRecord( kind, name, key, { status: 'publish' } );\n\t\t\t\t}\n\n\t\t\t\tpendingSavedRecords.push(\n\t\t\t\t\tsaveEditedEntityRecord( kind, name, key )\n\t\t\t\t);\n\t\t\t}\n\t\t} );\n\t\tif ( siteItemsToSave.length ) {\n\t\t\tpendingSavedRecords.push(\n\t\t\t\tsaveSpecifiedEntityEdits(\n\t\t\t\t\t'root',\n\t\t\t\t\t'site',\n\t\t\t\t\tundefined,\n\t\t\t\t\tsiteItemsToSave\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\t__unstableMarkLastChangeAsPersistent();\n\n\t\tPromise.all( pendingSavedRecords )\n\t\t\t.then( ( values ) => {\n\t\t\t\treturn onSave( values );\n\t\t\t} )\n\t\t\t.then( ( values ) => {\n\t\t\t\tif (\n\t\t\t\t\tvalues.some( ( value ) => typeof value === 'undefined' )\n\t\t\t\t) {\n\t\t\t\t\tcreateErrorNotice( __( 'Saving failed.' ) );\n\t\t\t\t} else {\n\t\t\t\t\tcreateSuccessNotice( __( 'Site updated.' ), {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: saveNoticeId,\n\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'View site' ),\n\t\t\t\t\t\t\t\turl: homeUrl,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} )\n\t\t\t.catch( ( error ) =>\n\t\t\t\tcreateErrorNotice( `${ __( 'Saving failed.' ) } ${ error }` )\n\t\t\t);\n\t};\n\n\t// Explicitly define this with no argument passed. Using `close` on\n\t// its own will use the event object in place of the expected saved entities.\n\tconst dismissPanel = useCallback( () => close(), [ close ] );\n\n\tconst [ saveDialogRef, saveDialogProps ] = useDialog( {\n\t\tonClose: () => dismissPanel(),\n\t} );\n\n\treturn (\n\t\t<div\n\t\t\tref={ saveDialogRef }\n\t\t\t{ ...saveDialogProps }\n\t\t\tclassName=\"entities-saved-states__panel\"\n\t\t>\n\t\t\t<Flex className=\"entities-saved-states__panel-header\" gap={ 2 }>\n\t\t\t\t<FlexItem\n\t\t\t\t\tisBlock\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tref={ saveButtonRef }\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tdisabled={ ! saveEnabled }\n\t\t\t\t\tonClick={ saveCheckedEntities }\n\t\t\t\t\tclassName=\"editor-entities-saved-states__save-button\"\n\t\t\t\t>\n\t\t\t\t\t{ saveLabel }\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem\n\t\t\t\t\tisBlock\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tonClick={ dismissPanel }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\n\t\t\t<div className=\"entities-saved-states__text-prompt\">\n\t\t\t\t<strong className=\"entities-saved-states__text-prompt--header\">\n\t\t\t\t\t{ __( 'Are you ready to save?' ) }\n\t\t\t\t</strong>\n\t\t\t\t{ additionalPrompt }\n\t\t\t\t{ isDirty && (\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'The following changes have been made to your site, templates, and content.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t</div>\n\n\t\t\t{ sortedPartitionedSavables.map( ( list ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<EntityTypeList\n\t\t\t\t\t\tkey={ list[ 0 ].name }\n\t\t\t\t\t\tlist={ list }\n\t\t\t\t\t\tunselectedEntities={ unselectedEntities }\n\t\t\t\t\t\tsetUnselectedEntities={ setUnselectedEntities }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,IAAI,EAAEC,QAAQ,QAAQ,uBAAuB;AAC9D,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,WAAW,EAAEC,MAAM,QAAQ,oBAAoB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASD,KAAK,IAAIE,gBAAgB,QAAQ,yBAAyB;AACnE,SAASC,uBAAuB,IAAIC,SAAS,QAAQ,oBAAoB;AACzE,SAASJ,KAAK,IAAIK,YAAY,QAAQ,oBAAoB;;AAE1D;AACA;AACA;AACA,OAAOC,cAAc,MAAM,oBAAoB;AAC/C,SAASC,UAAU,QAAQ,sBAAsB;AAEjD,MAAMC,wBAAwB,GAAG,CAChC;EACCC,IAAI,EAAE,UAAU;EAChBC,IAAI,EAAE;AACP,CAAC,CACD;AAED,SAASC,QAAQA,CAAEC,MAAM,EAAG;EAC3B,OAAOA,MAAM;AACd;AAEA,eAAe,SAASC,mBAAmBA,CAAE;EAAEC;AAAM,CAAC,EAAG;EACxD,MAAMC,YAAY,GAAGR,UAAU,CAAC,CAAC;EACjC,OACCS,aAAA,CAACC,6BAA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EAAGA,IAAM;MACbpE,kBAAkB,EAAGA,kBAAoB;MACzCD,qBAAqB,EAAGA;IAAuB,CAC/C,CAAC;EAEJ,CAAE,CACE,CAAC;AAER"}
1
+ {"version":3,"names":["Button","Flex","FlexItem","__","useSelect","useDispatch","useCallback","useRef","store","coreStore","blockEditorStore","__experimentalUseDialog","useDialog","noticesStore","EntityTypeList","useIsDirty","PUBLISH_ON_SAVE_ENTITIES","kind","name","identity","values","EntitiesSavedStates","close","isDirtyProps","createElement","EntitiesSavedStatesExtensible","additionalPrompt","undefined","onSave","saveEnabled","saveEnabledProp","saveLabel","dirtyEntityRecords","isDirty","setUnselectedEntities","unselectedEntities","saveButtonRef","editEntityRecord","saveEditedEntityRecord","__experimentalSaveSpecifiedEntityEdits","saveSpecifiedEntityEdits","__unstableMarkLastChangeAsPersistent","createSuccessNotice","createErrorNotice","removeNotice","partitionedSavables","reduce","acc","record","push","site","siteSavables","wp_template","templateSavables","wp_template_part","templatePartSavables","contentSavables","sortedPartitionedSavables","Object","filter","Array","isArray","homeUrl","select","getUnstableBase","home","saveCheckedEntities","saveNoticeId","entitiesToSave","key","property","some","elt","siteItemsToSave","pendingSavedRecords","forEach","typeToPublish","status","length","Promise","all","then","value","type","id","actions","label","url","catch","error","dismissPanel","saveDialogRef","saveDialogProps","onClose","ref","className","gap","isBlock","as","variant","disabled","onClick","map","list"],"sources":["@wordpress/editor/src/components/entities-saved-states/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, Flex, FlexItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { __experimentalUseDialog as useDialog } from '@wordpress/compose';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport EntityTypeList from './entity-type-list';\nimport { useIsDirty } from './hooks/use-is-dirty';\n\nconst PUBLISH_ON_SAVE_ENTITIES = [\n\t{\n\t\tkind: 'postType',\n\t\tname: 'wp_navigation',\n\t},\n];\n\nfunction identity( values ) {\n\treturn values;\n}\n\nexport default function EntitiesSavedStates( { close } ) {\n\tconst isDirtyProps = useIsDirty();\n\treturn (\n\t\t<EntitiesSavedStatesExtensible close={ close } { ...isDirtyProps } />\n\t);\n}\n\nexport function EntitiesSavedStatesExtensible( {\n\tadditionalPrompt = undefined,\n\tclose,\n\tonSave = identity,\n\tsaveEnabled: saveEnabledProp = undefined,\n\tsaveLabel = __( 'Save' ),\n\n\tdirtyEntityRecords,\n\tisDirty,\n\tsetUnselectedEntities,\n\tunselectedEntities,\n} ) {\n\tconst saveButtonRef = useRef();\n\tconst {\n\t\teditEntityRecord,\n\t\tsaveEditedEntityRecord,\n\t\t__experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits,\n\t} = useDispatch( coreStore );\n\n\tconst { __unstableMarkLastChangeAsPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst { createSuccessNotice, createErrorNotice, removeNotice } =\n\t\tuseDispatch( noticesStore );\n\n\t// To group entities by type.\n\tconst partitionedSavables = dirtyEntityRecords.reduce( ( acc, record ) => {\n\t\tconst { name } = record;\n\t\tif ( ! acc[ name ] ) {\n\t\t\tacc[ name ] = [];\n\t\t}\n\t\tacc[ name ].push( record );\n\t\treturn acc;\n\t}, {} );\n\n\t// Sort entity groups.\n\tconst {\n\t\tsite: siteSavables,\n\t\twp_template: templateSavables,\n\t\twp_template_part: templatePartSavables,\n\t\t...contentSavables\n\t} = partitionedSavables;\n\tconst sortedPartitionedSavables = [\n\t\tsiteSavables,\n\t\ttemplateSavables,\n\t\ttemplatePartSavables,\n\t\t...Object.values( contentSavables ),\n\t].filter( Array.isArray );\n\n\tconst saveEnabled = saveEnabledProp ?? isDirty;\n\n\tconst { homeUrl } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetUnstableBase, // Site index.\n\t\t} = select( coreStore );\n\t\treturn {\n\t\t\thomeUrl: getUnstableBase()?.home,\n\t\t};\n\t}, [] );\n\n\tconst saveCheckedEntities = () => {\n\t\tconst saveNoticeId = 'site-editor-save-success';\n\t\tremoveNotice( saveNoticeId );\n\t\tconst entitiesToSave = dirtyEntityRecords.filter(\n\t\t\t( { kind, name, key, property } ) => {\n\t\t\t\treturn ! unselectedEntities.some(\n\t\t\t\t\t( elt ) =>\n\t\t\t\t\t\telt.kind === kind &&\n\t\t\t\t\t\telt.name === name &&\n\t\t\t\t\t\telt.key === key &&\n\t\t\t\t\t\telt.property === property\n\t\t\t\t);\n\t\t\t}\n\t\t);\n\n\t\tclose( entitiesToSave );\n\n\t\tconst siteItemsToSave = [];\n\t\tconst pendingSavedRecords = [];\n\t\tentitiesToSave.forEach( ( { kind, name, key, property } ) => {\n\t\t\tif ( 'root' === kind && 'site' === name ) {\n\t\t\t\tsiteItemsToSave.push( property );\n\t\t\t} else {\n\t\t\t\tif (\n\t\t\t\t\tPUBLISH_ON_SAVE_ENTITIES.some(\n\t\t\t\t\t\t( typeToPublish ) =>\n\t\t\t\t\t\t\ttypeToPublish.kind === kind &&\n\t\t\t\t\t\t\ttypeToPublish.name === name\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\teditEntityRecord( kind, name, key, { status: 'publish' } );\n\t\t\t\t}\n\n\t\t\t\tpendingSavedRecords.push(\n\t\t\t\t\tsaveEditedEntityRecord( kind, name, key )\n\t\t\t\t);\n\t\t\t}\n\t\t} );\n\t\tif ( siteItemsToSave.length ) {\n\t\t\tpendingSavedRecords.push(\n\t\t\t\tsaveSpecifiedEntityEdits(\n\t\t\t\t\t'root',\n\t\t\t\t\t'site',\n\t\t\t\t\tundefined,\n\t\t\t\t\tsiteItemsToSave\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\t__unstableMarkLastChangeAsPersistent();\n\n\t\tPromise.all( pendingSavedRecords )\n\t\t\t.then( ( values ) => {\n\t\t\t\treturn onSave( values );\n\t\t\t} )\n\t\t\t.then( ( values ) => {\n\t\t\t\tif (\n\t\t\t\t\tvalues.some( ( value ) => typeof value === 'undefined' )\n\t\t\t\t) {\n\t\t\t\t\tcreateErrorNotice( __( 'Saving failed.' ) );\n\t\t\t\t} else {\n\t\t\t\t\tcreateSuccessNotice( __( 'Site updated.' ), {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: saveNoticeId,\n\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'View site' ),\n\t\t\t\t\t\t\t\turl: homeUrl,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} )\n\t\t\t.catch( ( error ) =>\n\t\t\t\tcreateErrorNotice( `${ __( 'Saving failed.' ) } ${ error }` )\n\t\t\t);\n\t};\n\n\t// Explicitly define this with no argument passed. Using `close` on\n\t// its own will use the event object in place of the expected saved entities.\n\tconst dismissPanel = useCallback( () => close(), [ close ] );\n\n\tconst [ saveDialogRef, saveDialogProps ] = useDialog( {\n\t\tonClose: () => dismissPanel(),\n\t} );\n\n\treturn (\n\t\t<div\n\t\t\tref={ saveDialogRef }\n\t\t\t{ ...saveDialogProps }\n\t\t\tclassName=\"entities-saved-states__panel\"\n\t\t>\n\t\t\t<Flex className=\"entities-saved-states__panel-header\" gap={ 2 }>\n\t\t\t\t<FlexItem\n\t\t\t\t\tisBlock\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tref={ saveButtonRef }\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tdisabled={ ! saveEnabled }\n\t\t\t\t\tonClick={ saveCheckedEntities }\n\t\t\t\t\tclassName=\"editor-entities-saved-states__save-button\"\n\t\t\t\t>\n\t\t\t\t\t{ saveLabel }\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem\n\t\t\t\t\tisBlock\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tonClick={ dismissPanel }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\n\t\t\t<div className=\"entities-saved-states__text-prompt\">\n\t\t\t\t<strong className=\"entities-saved-states__text-prompt--header\">\n\t\t\t\t\t{ __( 'Are you ready to save?' ) }\n\t\t\t\t</strong>\n\t\t\t\t{ additionalPrompt }\n\t\t\t\t<p>\n\t\t\t\t\t{ isDirty\n\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t'The following changes have been made to your site, templates, and content.'\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: __( 'Select the items you want to save.' ) }\n\t\t\t\t</p>\n\t\t\t</div>\n\n\t\t\t{ sortedPartitionedSavables.map( ( list ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<EntityTypeList\n\t\t\t\t\t\tkey={ list[ 0 ].name }\n\t\t\t\t\t\tlist={ list }\n\t\t\t\t\t\tunselectedEntities={ unselectedEntities }\n\t\t\t\t\t\tsetUnselectedEntities={ setUnselectedEntities }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,IAAI,EAAEC,QAAQ,QAAQ,uBAAuB;AAC9D,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,WAAW,EAAEC,MAAM,QAAQ,oBAAoB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASD,KAAK,IAAIE,gBAAgB,QAAQ,yBAAyB;AACnE,SAASC,uBAAuB,IAAIC,SAAS,QAAQ,oBAAoB;AACzE,SAASJ,KAAK,IAAIK,YAAY,QAAQ,oBAAoB;;AAE1D;AACA;AACA;AACA,OAAOC,cAAc,MAAM,oBAAoB;AAC/C,SAASC,UAA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IAAQuE,SAAS,EAAC;EAA4C,GAC3D5F,EAAE,CAAE,wBAAyB,CACxB,CAAC,EACPuB,gBAAgB,EAClBF,aAAA,YACGS,OAAO,GACN9B,EAAE,CACF,4EACA,CAAC,GACDA,EAAE,CAAE,oCAAqC,CAC1C,CACC,CAAC,EAEJsD,yBAAyB,CAAC6C,GAAG,CAAIC,IAAI,IAAM;IAC5C,OACC/E,aAAA,CAACV,cAAc;MACduD,GAAG,EAAGkC,IAAI,CAAE,CAAC,CAAE,CAACrF,IAAM;MACtBqF,IAAI,EAAGA,IAAM;MACbpE,kBAAkB,EAAGA,kBAAoB;MACzCD,qBAAqB,EAAGA;IAAuB,CAC/C,CAAC;EAEJ,CAAE,CACE,CAAC;AAER"}
@@ -64,14 +64,12 @@ const OfflineStatus = () => {
64
64
  accessibilityRole: "alert",
65
65
  accessibilityLabel: __('Network connection lost, working offline'),
66
66
  style: containerStyle
67
- }, createElement(View, {
68
- style: containerStyle
69
67
  }, createElement(Icon, {
70
68
  fill: iconStyle.fill,
71
69
  icon: offlineIcon
72
70
  }), createElement(Text, {
73
71
  style: textStyle
74
- }, __('Working Offline')))) : null;
72
+ }, __('Working Offline'), " ")) : null;
75
73
  };
76
74
  export default OfflineStatus;
77
75
  //# sourceMappingURL=index.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["AccessibilityInfo","Text","View","usePreferredColorSchemeStyle","useNetworkConnectivity","usePrevious","Icon","offline","offlineIcon","__","useEffect","styles","useAccessibilityLiveRegion","message","isActive","inactiveMessage","announceForAccessibility","prevIsActive","unconditionalMessage","initialRender","OfflineStatus","isConnected","containerStyle","offline__dark","textStyle","iconStyle","createElement","accessible","accessibilityRole","accessibilityLabel","style","fill","icon"],"sources":["@wordpress/editor/src/components/offline-status/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { AccessibilityInfo, Text, View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tusePreferredColorSchemeStyle,\n\tuseNetworkConnectivity,\n\tusePrevious,\n} from '@wordpress/compose';\nimport { Icon } from '@wordpress/components';\nimport { offline as offlineIcon } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.native.scss';\n\n/**\n * Conditionally announces messages for screen reader users. This Hook provides\n * two benefits over React Native's `accessibilityLiveRegion`:\n *\n * 1. It works on both iOS and Android.\n * 2. It allows announcing a secondary message when the component is inactive.\n *\n * @param {string} message The message to announce.\n * @param {Object} options Options for the Hook.\n * @param {boolean} [options.isActive] Whether the message should be announced.\n * @param {string} [options.inactiveMessage] The message to announce when inactive.\n */\nfunction useAccessibilityLiveRegion( message, { isActive, inactiveMessage } ) {\n\tconst { announceForAccessibility } = AccessibilityInfo;\n\tconst prevIsActive = usePrevious( isActive );\n\n\tuseEffect( () => {\n\t\tconst unconditionalMessage = typeof isActive === 'undefined';\n\t\tconst initialRender = typeof prevIsActive === 'undefined';\n\n\t\tif (\n\t\t\tunconditionalMessage ||\n\t\t\t( isActive && ! prevIsActive && ! initialRender )\n\t\t) {\n\t\t\tannounceForAccessibility( message );\n\t\t} else if ( ! isActive && prevIsActive && inactiveMessage ) {\n\t\t\tannounceForAccessibility( inactiveMessage );\n\t\t}\n\t}, [\n\t\tmessage,\n\t\tisActive,\n\t\tprevIsActive,\n\t\tinactiveMessage,\n\t\tannounceForAccessibility,\n\t] );\n}\n\nconst OfflineStatus = () => {\n\tconst { isConnected } = useNetworkConnectivity();\n\n\tuseAccessibilityLiveRegion( __( 'Network connection re-established' ), {\n\t\tisActive: isConnected,\n\t\tinactiveMessage: __( 'Network connection lost, working offline' ),\n\t} );\n\n\tconst containerStyle = usePreferredColorSchemeStyle(\n\t\tstyles.offline,\n\t\tstyles.offline__dark\n\t);\n\n\tconst textStyle = usePreferredColorSchemeStyle(\n\t\tstyles[ 'offline--text' ],\n\t\tstyles[ 'offline--text__dark' ]\n\t);\n\n\tconst iconStyle = usePreferredColorSchemeStyle(\n\t\tstyles[ 'offline--icon' ],\n\t\tstyles[ 'offline--icon__dark' ]\n\t);\n\n\treturn ! isConnected ? (\n\t\t<View\n\t\t\taccessible\n\t\t\taccessibilityRole=\"alert\"\n\t\t\taccessibilityLabel={ __(\n\t\t\t\t'Network connection lost, working offline'\n\t\t\t) }\n\t\t\tstyle={ containerStyle }\n\t\t>\n\t\t\t<View style={ containerStyle }>\n\t\t\t\t<Icon fill={ iconStyle.fill } icon={ offlineIcon } />\n\t\t\t\t<Text style={ textStyle }>{ __( 'Working Offline' ) }</Text>\n\t\t\t</View>\n\t\t</View>\n\t) : null;\n};\n\nexport default OfflineStatus;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,iBAAiB,EAAEC,IAAI,EAAEC,IAAI,QAAQ,cAAc;;AAE5D;AACA;AACA;AACA,SACCC,4BAA4B,EAC5BC,sBAAsB,EACtBC,WAAW,QACL,oBAAoB;AAC3B,SAASC,IAAI,QAAQ,uBAAuB;AAC5C,SAASC,OAAO,IAAIC,WAAW,QAAQ,kBAAkB;AACzD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,oBAAoB;;AAE9C;AACA;AACA;AACA,OAAOC,MAAM,MAAM,qBAAqB;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,0BAA0BA,CAAEC,OAAO,EAAE;EAAEC,QAAQ;EAAEC;AAAgB,CAAC,EAAG;EAC7E,MAAM;IAAEC;EAAyB,CAAC,GAAGhB,iBAAiB;EACtD,MAAMiB,YAAY,GAAGZ,WAAW,CAAES,QAAS,CAAC;EAE5CJ,SAAS,CAAE,MAAM;IAChB,MAAMQ,oBAAoB,GAAG,OAAOJ,QAAQ,KAAK,WAAW;IAC5D,MAAMK,aAAa,GAAG,OAAOF,YAAY,KAAK,WAAW;IAEzD,IACCC,oBAAoB,IAClBJ,QAAQ,IAAI,CAAEG,YAAY,IAAI,CAAEE,aAAe,EA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,CAAC,GACJ,IAAI;AACT,CAAC;AAED,eAAeW,aAAa"}
1
+ {"version":3,"names":["AccessibilityInfo","Text","View","usePreferredColorSchemeStyle","useNetworkConnectivity","usePrevious","Icon","offline","offlineIcon","__","useEffect","styles","useAccessibilityLiveRegion","message","isActive","inactiveMessage","announceForAccessibility","prevIsActive","unconditionalMessage","initialRender","OfflineStatus","isConnected","containerStyle","offline__dark","textStyle","iconStyle","createElement","accessible","accessibilityRole","accessibilityLabel","style","fill","icon"],"sources":["@wordpress/editor/src/components/offline-status/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { AccessibilityInfo, Text, View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tusePreferredColorSchemeStyle,\n\tuseNetworkConnectivity,\n\tusePrevious,\n} from '@wordpress/compose';\nimport { Icon } from '@wordpress/components';\nimport { offline as offlineIcon } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.native.scss';\n\n/**\n * Conditionally announces messages for screen reader users. This Hook provides\n * two benefits over React Native's `accessibilityLiveRegion`:\n *\n * 1. It works on both iOS and Android.\n * 2. It allows announcing a secondary message when the component is inactive.\n *\n * @param {string} message The message to announce.\n * @param {Object} options Options for the Hook.\n * @param {boolean} [options.isActive] Whether the message should be announced.\n * @param {string} [options.inactiveMessage] The message to announce when inactive.\n */\nfunction useAccessibilityLiveRegion( message, { isActive, inactiveMessage } ) {\n\tconst { announceForAccessibility } = AccessibilityInfo;\n\tconst prevIsActive = usePrevious( isActive );\n\n\tuseEffect( () => {\n\t\tconst unconditionalMessage = typeof isActive === 'undefined';\n\t\tconst initialRender = typeof prevIsActive === 'undefined';\n\n\t\tif (\n\t\t\tunconditionalMessage ||\n\t\t\t( isActive && ! prevIsActive && ! initialRender )\n\t\t) {\n\t\t\tannounceForAccessibility( message );\n\t\t} else if ( ! isActive && prevIsActive && inactiveMessage ) {\n\t\t\tannounceForAccessibility( inactiveMessage );\n\t\t}\n\t}, [\n\t\tmessage,\n\t\tisActive,\n\t\tprevIsActive,\n\t\tinactiveMessage,\n\t\tannounceForAccessibility,\n\t] );\n}\n\nconst OfflineStatus = () => {\n\tconst { isConnected } = useNetworkConnectivity();\n\n\tuseAccessibilityLiveRegion( __( 'Network connection re-established' ), {\n\t\tisActive: isConnected,\n\t\tinactiveMessage: __( 'Network connection lost, working offline' ),\n\t} );\n\n\tconst containerStyle = usePreferredColorSchemeStyle(\n\t\tstyles.offline,\n\t\tstyles.offline__dark\n\t);\n\n\tconst textStyle = usePreferredColorSchemeStyle(\n\t\tstyles[ 'offline--text' ],\n\t\tstyles[ 'offline--text__dark' ]\n\t);\n\n\tconst iconStyle = usePreferredColorSchemeStyle(\n\t\tstyles[ 'offline--icon' ],\n\t\tstyles[ 'offline--icon__dark' ]\n\t);\n\n\treturn ! isConnected ? (\n\t\t<View\n\t\t\taccessible\n\t\t\taccessibilityRole=\"alert\"\n\t\t\taccessibilityLabel={ __(\n\t\t\t\t'Network connection lost, working offline'\n\t\t\t) }\n\t\t\tstyle={ containerStyle }\n\t\t>\n\t\t\t<Icon fill={ iconStyle.fill } icon={ offlineIcon } />\n\t\t\t<Text style={ textStyle }>{ __( 'Working Offline' ) } </Text>\n\t\t</View>\n\t) : null;\n};\n\nexport default OfflineStatus;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,iBAAiB,EAAEC,IAAI,EAAEC,IAAI,QAAQ,cAAc;;AAE5D;AACA;AACA;AACA,SACCC,4BAA4B,EAC5BC,sBAAsB,EACtBC,WAAW,QACL,oBAAoB;AAC3B,SAASC,IAAI,QAAQ,uBAAuB;AAC5C,SAASC,OAAO,IAAIC,WAAW,QAAQ,kBAAkB;AACzD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,oBAAoB;;AAE9C;AACA;AACA;AACA,OAAOC,MAAM,MAAM,qBAAqB;;AAExC;AACA;AACA;AACA;AACA;A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CAAC;EAED,OAAO,CAAEU,WAAW,GACnBK,aAAA,CAACxB,IAAI;IACJyB,UAAU;IACVC,iBAAiB,EAAC,OAAO;IACzBC,kBAAkB,EAAGpB,EAAE,CACtB,0CACD,CAAG;IACHqB,KAAK,EAAGR;EAAgB,GAExBI,aAAA,CAACpB,IAAI;IAACyB,IAAI,EAAGN,SAAS,CAACM,IAAM;IAACC,IAAI,EAAGxB;EAAa,CAAE,CAAC,EACrDkB,aAAA,CAACzB,IAAI;IAAC6B,KAAK,EAAGN;EAAW,GAAGf,EAAE,CAAE,iBAAkB,CAAC,EAAE,GAAO,CACvD,CAAC,GACJ,IAAI;AACT,CAAC;AAED,eAAeW,aAAa"}
@@ -158,7 +158,7 @@ export default function PostLockedModal() {
158
158
  shouldCloseOnClickOutside: false,
159
159
  shouldCloseOnEsc: false,
160
160
  isDismissible: false,
161
- className: "editor-post-locked-modal"
161
+ size: "medium"
162
162
  }, createElement(HStack, {
163
163
  alignment: "top",
164
164
  spacing: 6
@@ -1 +1 @@
1
- {"version":3,"names":["__","sprintf","Modal","Button","ExternalLink","__experimentalHStack","HStack","useSelect","useDispatch","addQueryArgs","useEffect","createInterpolateElement","addAction","removeAction","useInstanceId","store","coreStore","editorStore","PostLockedModal","instanceId","hookName","autosave","updatePostLock","isLocked","isTakeover","user","postId","postLockUtils","activePostLock","postType","previewLink","select","isPostLocked","isPostLockTakeover","getPostLockUser","getCurrentPostId","getActivePostLock","getEditedPostAttribute","getEditedPostPreviewLink","getEditorSettings","getPostType","sendPostLock","data","lock","post_id","receivePostLock","received","lock_error","name","avatar","avatar_src_2x","new_lock","releasePostLock","window","FormData","append","unlockNonce","navigator","sendBeacon","ajaxUrl","xhr","XMLHttpRequest","open","send","addEventListener","removeEventListener","userDisplayName","userAvatar","unlockUrl","lockKey","post","action","_wpnonce","nonce","allPostsUrl","post_type","slug","allPostsLabel","createElement","title","focusOnMount","shouldCloseOnClickOutside","shouldCloseOnEsc","isDismissible","className","alignment","spacing","src","alt","width","height","strong","PreviewLink","href","Fragment","justify","variant"],"sources":["@wordpress/editor/src/components/post-locked-modal/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tModal,\n\tButton,\n\tExternalLink,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useEffect, createInterpolateElement } 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 { 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\tpreviewLink,\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\tgetEditedPostPreviewLink,\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\tpreviewLink: getEditedPostPreviewLink(),\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\tname: received.lock_error.name,\n\t\t\t\t\t\tavatar: received.lock_error.avatar_src_2x,\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 = addQueryArgs( 'edit.php', {\n\t\tpost_type: postType?.slug,\n\t} );\n\tconst allPostsLabel = __( 'Exit 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<HStack alignment=\"top\" spacing={ 6 }>\n\t\t\t\t{ !! userAvatar && (\n\t\t\t\t\t<img\n\t\t\t\t\t\tsrc={ userAvatar }\n\t\t\t\t\t\talt={ __( 'Avatar' ) }\n\t\t\t\t\t\tclassName=\"editor-post-locked-modal__avatar\"\n\t\t\t\t\t\twidth={ 64 }\n\t\t\t\t\t\theight={ 64 }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<div>\n\t\t\t\t\t{ !! isTakeover && (\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\tuserDisplayName\n\t\t\t\t\t\t\t\t\t? sprintf(\n\t\t\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\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t'<strong>%s</strong> now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\tuserDisplayName\n\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\t'Another user now has editing control of this post (<PreviewLink />). 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{\n\t\t\t\t\t\t\t\t\tstrong: <strong />,\n\t\t\t\t\t\t\t\t\tPreviewLink: (\n\t\t\t\t\t\t\t\t\t\t<ExternalLink href={ previewLink }>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'preview' ) }\n\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isTakeover && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\tuserDisplayName\n\t\t\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\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\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'<strong>%s</strong> is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'\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\tuserDisplayName\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Another user is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'\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\tstrong: <strong />,\n\t\t\t\t\t\t\t\t\t\tPreviewLink: (\n\t\t\t\t\t\t\t\t\t\t\t<ExternalLink href={ previewLink }>\n\t\t\t\t\t\t\t\t\t\t\t\t{ __( 'preview' ) }\n\t\t\t\t\t\t\t\t\t\t\t</ExternalLink>\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) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'If you take over, the other user will lose editing control to the post, but their changes will be saved.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<HStack\n\t\t\t\t\t\tclassName=\"editor-post-locked-modal__buttons\"\n\t\t\t\t\t\tjustify=\"flex-end\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ! isTakeover && (\n\t\t\t\t\t\t\t<Button variant=\"tertiary\" href={ unlockUrl }>\n\t\t\t\t\t\t\t\t{ __( 'Take over' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<Button variant=\"primary\" href={ allPostsUr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E,CACF,mIACA,CAAC,EACJ;IACC2F,MAAM,EAAEb,aAAA,eAAS,CAAC;IAClBc,WAAW,EACVd,aAAA,CAAC1E,YAAY;MAACyF,IAAI,EAAG/D;IAAa,GAC/B9B,EAAE,CAAE,SAAU,CACH;EAEhB,CACD,CACE,CACH,EACC,CAAEwB,UAAU,IACbsD,aAAA,CAAAgB,QAAA,QACChB,aAAA,YACGnE,wBAAwB,CACzBuD,eAAe,GACZjE,OAAO,EACP;EACAD,EAAE,CACD,qIACD,CAAC,EACDkE,eACA,CAAC,GACDlE,EAAE,CACF,8HACA,CAAC,EACJ;IACC2F,MAAM,EAAEb,aAAA,eAAS,CAAC;IAClBc,WAAW,EACVd,aAAA,CAAC1E,YAAY;MAACyF,IAAI,EAAG/D;IAAa,GAC/B9B,EAAE,CAAE,SAAU,CACH;EAEhB,CACD,CACE,CAAC,EACJ8E,aAAA,YACG9E,EAAE,CACH,0GACD,CACE,CACF,CACF,EAED8E,aAAA,CAACxE,MAAM;IACN8E,SAAS,EAAC,mCAAmC;IAC7CW,OAAO,EAAC;EAAU,GAEhB,CAAEvE,UAAU,IACbsD,aAAA,CAAC3E,MAAM;IAAC6F,OAAO,EAAC,UAAU;IAACH,IAAI,EAAGzB;EAAW,GAC1CpE,EAAE,CAAE,WAAY,CACX,CACR,EACD8E,aAAA,CAAC3E,MAAM;IAAC6F,OAAO,EAAC,SAAS;IAACH,IAAI,EAAGnB;EAAa,GAC3CG,aACK,CACD,CACJ,CACE,CACF,CAAC;AAEV"}
1
+ {"version":3,"names":["__","sprintf","Modal","Button","ExternalLink","__experimentalHStack","HStack","useSelect","useDispatch","addQueryArgs","useEffect","createInterpolateElement","addAction","removeAction","useInstanceId","store","coreStore","editorStore","PostLockedModal","instanceId","hookName","autosave","updatePostLock","isLocked","isTakeover","user","postId","postLockUtils","activePostLock","postType","previewLink","select","isPostLocked","isPostLockTakeover","getPostLockUser","getCurrentPostId","getActivePostLock","getEditedPostAttribute","getEditedPostPreviewLink","getEditorSettings","getPostType","sendPostLock","data","lock","post_id","receivePostLock","received","lock_error","name","avatar","avatar_src_2x","new_lock","releasePostLock","window","FormData","append","unlockNonce","navigator","sendBeacon","ajaxUrl","xhr","XMLHttpRequest","open","send","addEventListener","removeEventListener","userDisplayName","userAvatar","unlockUrl","lockKey","post","action","_wpnonce","nonce","allPostsUrl","post_type","slug","allPostsLabel","createElement","title","focusOnMount","shouldCloseOnClickOutside","shouldCloseOnEsc","isDismissible","size","alignment","spacing","src","alt","className","width","height","strong","PreviewLink","href","Fragment","justify","variant"],"sources":["@wordpress/editor/src/components/post-locked-modal/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tModal,\n\tButton,\n\tExternalLink,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useEffect, createInterpolateElement } 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 { 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\tpreviewLink,\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\tgetEditedPostPreviewLink,\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\tpreviewLink: getEditedPostPreviewLink(),\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\tname: received.lock_error.name,\n\t\t\t\t\t\tavatar: received.lock_error.avatar_src_2x,\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 = addQueryArgs( 'edit.php', {\n\t\tpost_type: postType?.slug,\n\t} );\n\tconst allPostsLabel = __( 'Exit 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\tsize=\"medium\"\n\t\t>\n\t\t\t<HStack alignment=\"top\" spacing={ 6 }>\n\t\t\t\t{ !! userAvatar && (\n\t\t\t\t\t<img\n\t\t\t\t\t\tsrc={ userAvatar }\n\t\t\t\t\t\talt={ __( 'Avatar' ) }\n\t\t\t\t\t\tclassName=\"editor-post-locked-modal__avatar\"\n\t\t\t\t\t\twidth={ 64 }\n\t\t\t\t\t\theight={ 64 }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<div>\n\t\t\t\t\t{ !! isTakeover && (\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\tuserDisplayName\n\t\t\t\t\t\t\t\t\t? sprintf(\n\t\t\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\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t'<strong>%s</strong> now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\tuserDisplayName\n\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\t'Another user now has editing control of this post (<PreviewLink />). 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{\n\t\t\t\t\t\t\t\t\tstrong: <strong />,\n\t\t\t\t\t\t\t\t\tPreviewLink: (\n\t\t\t\t\t\t\t\t\t\t<ExternalLink href={ previewLink }>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'preview' ) }\n\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isTakeover && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\tuserDisplayName\n\t\t\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\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\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'<strong>%s</strong> is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'\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\tuserDisplayName\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Another user is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'\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\tstrong: <strong />,\n\t\t\t\t\t\t\t\t\t\tPreviewLink: (\n\t\t\t\t\t\t\t\t\t\t\t<ExternalLink href={ previewLink }>\n\t\t\t\t\t\t\t\t\t\t\t\t{ __( 'preview' ) }\n\t\t\t\t\t\t\t\t\t\t\t</ExternalLink>\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) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'If you take over, the other user will lose editing control to the post, but their changes will be saved.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<HStack\n\t\t\t\t\t\tclassName=\"editor-post-locked-modal__buttons\"\n\t\t\t\t\t\tjustify=\"flex-end\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ! isTakeover && (\n\t\t\t\t\t\t\t<Button variant=\"tertiary\" href={ unlockUrl }>\n\t\t\t\t\t\t\t\t{ __( 'Take over' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t) }\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</HStack>\n\t\t\t\t</div>\n\t\t\t</HStack>\n\t\t</Modal>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SACCC,KAAK,EACLC,MAAM,EACNC,YAAY,EACZC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,SAAS,EAAEC,wBAAwB,QAAQ,oBAAoB;AACxE,SAASC,SAAS,EAAEC,YAAY,QAAQ,kBAAkB;AAC1D,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;AAElD,eAAe,SAASC,eAAeA,CAAA,EAAG;EACzC,MAAMC,UAAU,GAAGL,aAAa,CAAEI,eAAgB,CAAC;EACnD,MAAME,QAAQ,GAAG,gCAAgC,GAAGD,UAAU;EAC9D,MAAM;IAAEE,QAAQ;IAAEC;EAAe,CAAC,GAAGd,WAAW,CAAES,WAAY,CAAC;EAC/D,MAAM;IACLM,QAAQ;IACRC,UAAU;IACVC,IAAI;IACJC,MAAM;IACNC,aAAa;IACbC,cAAc;IACdC,QAAQ;IACRC;E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}
@@ -7,7 +7,7 @@ import classnames from 'classnames';
7
7
  /**
8
8
  * WordPress dependencies
9
9
  */
10
- import { __unstableGetAnimateClassName as getAnimateClassName, Button, Tooltip } from '@wordpress/components';
10
+ import { __unstableGetAnimateClassName as getAnimateClassName, Button } from '@wordpress/components';
11
11
  import { usePrevious, useViewportMatch } from '@wordpress/compose';
12
12
  import { useDispatch, useSelect } from '@wordpress/data';
13
13
  import { useEffect, useState } from '@wordpress/element';
@@ -117,27 +117,10 @@ export default function PostSavedState({
117
117
  } else if (showIconLabels) {
118
118
  text = shortLabel;
119
119
  }
120
- const buttonAccessibleLabel = text || label;
121
-
122
- /**
123
- * The tooltip needs to be enabled only if the button is not disabled. When
124
- * relying on the internal Button tooltip functionality, this causes the
125
- * resulting `button` element to be always removed and re-added to the DOM,
126
- * causing focus loss. An alternative approach to circumvent the issue
127
- * is not to use the `label` and `shortcut` props on `Button` (which would
128
- * trigger the tooltip), and instead manually wrap the `Button` in a separate
129
- * `Tooltip` component.
130
- */
131
- const tooltipProps = isDisabled ? undefined : {
132
- text: buttonAccessibleLabel,
133
- shortcut: displayShortcut.primary('s')
134
- };
135
120
 
136
121
  // Use common Button instance for all saved states so that focus is not
137
122
  // lost.
138
- return createElement(Tooltip, {
139
- ...tooltipProps
140
- }, createElement(Button, {
123
+ return createElement(Button, {
141
124
  className: isSaveable || isSaving ? classnames({
142
125
  'editor-post-save-draft': !isSavedState,
143
126
  'editor-post-saved-state': isSavedState,
@@ -148,16 +131,19 @@ export default function PostSavedState({
148
131
  type: 'loading'
149
132
  })]: isSaving
150
133
  }) : undefined,
151
- onClick: isDisabled ? undefined : () => savePost(),
134
+ onClick: isDisabled ? undefined : () => savePost()
135
+ /*
136
+ * We want the tooltip to show the keyboard shortcut only when the
137
+ * button does something, i.e. when it's not disabled.
138
+ */,
139
+ shortcut: isDisabled ? undefined : displayShortcut.primary('s'),
152
140
  variant: "tertiary",
153
141
  size: "compact",
154
- icon: isLargeViewport ? undefined : cloudUpload
155
- // Make sure the aria-label has always a value, as the default `text` is undefined on small screens.
156
- ,
157
- "aria-label": buttonAccessibleLabel,
142
+ icon: isLargeViewport ? undefined : cloudUpload,
143
+ label: text || label,
158
144
  "aria-disabled": isDisabled
159
145
  }, isSavedState && createElement(Icon, {
160
146
  icon: isSaved ? check : cloud
161
- }), text));
147
+ }), text);
162
148
  }
163
149
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","__unstableGetAnimateClassName","getAnimateClassName","Button","Tooltip","usePrevious","useViewportMatch","useDispatch","useSelect","useEffect","useState","__","Icon","check","cloud","cloudUpload","displayShortcut","store","preferencesStore","editorStore","PostSavedState","forceIsDirty","forceSavedMessage","setForceSavedMessage","isLargeViewport","isAutosaving","isDirty","isNew","isPending","isPublished","isSaveable","isSaving","isScheduled","hasPublishAction","showIconLabels","select","_getCurrentPost$_link","isEditedPostNew","isCurrentPostPublished","isCurrentPostScheduled","isEditedPostDirty","isSavingPost","isEditedPostSaveable","getCurrentPost","isAutosavingPost","getEditedPostAttribute","get","_links","savePost","wasSaving","timeoutId","setTimeout","clearTimeout","label","shortLabel","isSaved","isSavedState","isDisabled","text","buttonAccessibleLabel","tooltipProps","undefined","shortcut","primary","createElement","className","type","onClick","variant","size","icon"],"sources":["@wordpress/editor/src/components/post-saved-state/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__unstableGetAnimateClassName as getAnimateClassName,\n\tButton,\n\tTooltip,\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';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\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 * @return {import('react').ComponentType} The component.\n */\nexport default function PostSavedState( { forceIsDirty } ) {\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\tshowIconLabels,\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\t\t\tconst { get } = select( preferencesStore );\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: 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\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\t};\n\t\t},\n\t\t[ forceIsDirty ]\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 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\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\tconst buttonAccessibleLabel = text || label;\n\n\t/**\n\t * The tooltip needs to be enabled only if the button is not disabled. When\n\t * relying on the internal Button tooltip functionality, this causes the\n\t * resulting `button` element to be always removed and re-added to the DOM,\n\t * causing focus loss. An alternative approach to circumvent the issue\n\t * is not to use the `label` and `shortcut` props on `Button` (which would\n\t * trigger the tooltip), and instead manually wrap the `Button` in a separate\n\t * `Tooltip` component.\n\t */\n\tconst tooltipProps = isDisabled\n\t\t? undefined\n\t\t: {\n\t\t\t\ttext: buttonAccessibleLabel,\n\t\t\t\tshortcut: displayShortcut.primary( 's' ),\n\t\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<Tooltip { ...tooltipProps }>\n\t\t\t<Button\n\t\t\t\tclassName={\n\t\t\t\t\tisSaveable || isSaving\n\t\t\t\t\t\t? classnames( {\n\t\t\t\t\t\t\t\t'editor-post-save-draft': ! isSavedState,\n\t\t\t\t\t\t\t\t'editor-post-saved-state': isSavedState,\n\t\t\t\t\t\t\t\t'is-saving': isSaving,\n\t\t\t\t\t\t\t\t'is-autosaving': isAutosaving,\n\t\t\t\t\t\t\t\t'is-saved': isSaved,\n\t\t\t\t\t\t\t\t[ getAnimateClassName( {\n\t\t\t\t\t\t\t\t\ttype: 'loading',\n\t\t\t\t\t\t\t\t} ) ]: isSaving,\n\t\t\t\t\t\t } )\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\tonClick={ isDisabled ? undefined : () => savePost() }\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t\tsize=\"compact\"\n\t\t\t\ticon={ isLargeViewport ? undefined : cloudUpload }\n\t\t\t\t// Make sure the aria-label has always a value, as the default `text` is undefined on small screens.\n\t\t\t\taria-label={ buttonAccessibleLabel }\n\t\t\t\taria-disabled={ isDisabled }\n\t\t\t>\n\t\t\t\t{ isSavedState && <Icon icon={ isSaved ? check : cloud } /> }\n\t\t\t\t{ text }\n\t\t\t</Button>\n\t\t</Tooltip>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SACCC,6BAA6B,IAAIC,mBAAmB,EACpDC,MAAM,EACNC,OAAO,QACD,uBAAuB;AAC9B,SAASC,WAAW,EAAEC,gBAAgB,QAAQ,oBAAoB;AAClE,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,SAAS,EAAEC,QAAQ,QAAQ,oBAAoB;AACxD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,IAAI,EAAEC,KAAK,EAAEC,KAAK,EAAEC,WAAW,QAAQ,kBAAkB;AAClE,SAASC,eAAe,QAAQ,qBAAqB;AACrD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CAAC,EACzD4C,IACK,CACA,CAAC;AAEZ"}
1
+ {"version":3,"names":["classnames","__unstableGetAnimateClassName","getAnimateClassName","Button","usePrevious","useViewportMatch","useDispatch","useSelect","useEffect","useState","__","Icon","check","cloud","cloudUpload","displayShortcut","store","preferencesStore","editorStore","PostSavedState","forceIsDirty","forceSavedMessage","setForceSavedMessage","isLargeViewport","isAutosaving","isDirty","isNew","isPending","isPublished","isSaveable","isSaving","isScheduled","hasPublishAction","showIconLabels","select","_getCurrentPost$_link","isEditedPostNew","isCurrentPostPublished","isCurrentPostScheduled","isEditedPostDirty","isSavingPost","isEditedPostSaveable","getCurrentPost","isAutosavingPost","getEditedPostAttribute","get","_links","savePost","wasSaving","timeoutId","setTimeout","clearTimeout","label","shortLabel","isSaved","isSavedState","isDisabled","text","createElement","className","type","undefined","onClick","shortcut","primary","variant","size","icon"],"sources":["@wordpress/editor/src/components/post-saved-state/index.js"],"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';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\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 * @return {import('react').ComponentType} The component.\n */\nexport default function PostSavedState( { forceIsDirty } ) {\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\tshowIconLabels,\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\t\t\tconst { get } = select( preferencesStore );\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: 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\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\t};\n\t\t},\n\t\t[ forceIsDirty ]\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 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\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\t/*\n\t\t\t * We want the tooltip to show the keyboard shortcut only when the\n\t\t\t * button does something, i.e. when it's not disabled.\n\t\t\t */\n\t\t\tshortcut={ isDisabled ? undefined : displayShortcut.primary( 's' ) }\n\t\t\tvariant=\"tertiary\"\n\t\t\tsize=\"compact\"\n\t\t\ticon={ isLargeViewport ? undefined : cloudUpload }\n\t\t\tlabel={ text || 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"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SACCC,6BAA6B,IAAIC,mBAAmB,EACpDC,MAAM,QACA,uBAAuB;AAC9B,SAASC,WAAW,EAAEC,gBAAgB,QAAQ,oBAAoB;AAClE,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,SAAS,EAAEC,QAAQ,QAAQ,oBAAoB;AACxD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,IAAI,EAAEC,KAAK,EAAEC,KAAK,EAAEC,WAAW,QAAQ,kBAAkB;AAClE,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;;AAElE;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,cAAcA,CAAE;EAAEC;AAAa,CAAC,EAAG;EAC1D,MAAM,CAAEC,iBAAiB,EAAEC,oBAAoB,CAAE,GAAGb,QAAQ,CAAE,KAAM,CAAC;EACrE,MAAMc,eAAe,GAAGlB,gBAAgB,CAAE,OAAQ,CAAC;EAEnD,MAAM;IACLmB,YAAY;IACZC,OAAO;IACPC,KAAK;IACLC,SAAS;IACTC,WAAW;IACXC,UAAU;IACVC,QAAQ;IACRC,WAAW;IACXC,gBAAgB;IAChBC;EACD,CAAC,GAAG1B,SAAS,CACV2B,MAAM,IAAM;IAAA,IAAAC,qBAAA;IACb,MAAM;MACLC,eAAe;MACfC,sBAAsB;MACtBC,sBAAsB;MACtBC,iBAAiB;MACjBC,YAAY;MACZC,oBAAoB;MACpBC,cAAc;MACdC,gBAAgB;MAChBC;IACD,CA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;AACH;AACA;AACA,OAHG;IAIAgB,QAAQ,EAAGP,UAAU,GAAGK,SAAS,GAAG9C,eAAe,CAACiD,OAAO,CAAE,GAAI,CAAG;IACpEC,OAAO,EAAC,UAAU;IAClBC,IAAI,EAAC,SAAS;IACdC,IAAI,EAAG5C,eAAe,GAAGsC,SAAS,GAAG/C,WAAa;IAClDsC,KAAK,EAAGK,IAAI,IAAIL,KAAO;IACvB,iBAAgBI;EAAY,GAE1BD,YAAY,IAAIG,aAAA,CAAC/C,IAAI;IAACwD,IAAI,EAAGb,OAAO,GAAG1C,KAAK,GAAGC;EAAO,CAAE,CAAC,EACzD4C,IACK,CAAC;AAEX"}
@@ -1,31 +1,22 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { compose } from '@wordpress/compose';
5
- import { withSelect } from '@wordpress/data';
4
+ import { useSelect } from '@wordpress/data';
6
5
 
7
6
  /**
8
7
  * Internal dependencies
9
8
  */
10
9
  import { store as editorStore } from '../../store';
11
- export function PostScheduleCheck({
12
- hasPublishAction,
10
+ export default function PostScheduleCheck({
13
11
  children
14
12
  }) {
13
+ const hasPublishAction = useSelect(select => {
14
+ var _select$getCurrentPos;
15
+ return (_select$getCurrentPos = select(editorStore).getCurrentPost()._links?.['wp:action-publish']) !== null && _select$getCurrentPos !== void 0 ? _select$getCurrentPos : false;
16
+ }, []);
15
17
  if (!hasPublishAction) {
16
18
  return null;
17
19
  }
18
20
  return children;
19
21
  }
20
- export default compose([withSelect(select => {
21
- var _getCurrentPost$_link;
22
- const {
23
- getCurrentPost,
24
- getCurrentPostType
25
- } = select(editorStore);
26
- return {
27
- hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false,
28
- postType: getCurrentPostType()
29
- };
30
- })])(PostScheduleCheck);
31
22
  //# sourceMappingURL=check.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["compose","withSelect","store","editorStore","PostScheduleCheck","hasPublishAction","children","select","_getCurrentPost$_link","getCurrentPost","getCurrentPostType","_links","postType"],"sources":["@wordpress/editor/src/components/post-schedule/check.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function PostScheduleCheck( { hasPublishAction, children } ) {\n\tif ( ! hasPublishAction ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getCurrentPost, getCurrentPostType } = select( editorStore );\n\t\treturn {\n\t\t\thasPublishAction:\n\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t} ),\n] )( PostScheduleCheck );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,UAAU,QAAQ,iBAAiB;;AAE5C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAElD,OAAO,SAASC,iBAAiBA,CAAE;EAAEC,gBAAgB;EAAEC;AAAS,CAAC,EAAG;EACnE,IAAK,CAAED,gBAAgB,EAAG;IACzB,OAAO,IAAI;EACZ;EAEA,OAAOC,QAAQ;AAChB;AAEA,eAAeN,OAAO,CAAE,CACvBC,UAAU,CAAIM,MAAM,IAAM;EAAA,IAAAC,qBAAA;EACzB,MAAM;IAAEC,cAAc;IAAEC;EAAmB,CAAC,GAAGH,MAAM,CAAEJ,WAAY,CAAC;EACpE,OAAO;IACNE,gBAAgB,GAAAG,qBAAA,GACfC,cAAc,CAAC,CAAC,CAACE,MAAM,GAAI,mBAAmB,CAAE,cAAAH,qBAAA,cAAAA,qBAAA,GAAI,KAAK;IAC1DI,QAAQ,EAAEF,kBAAkB,CAAC;EAC9B,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAEN,iBAAkB,CAAC"}
1
+ {"version":3,"names":["useSelect","store","editorStore","PostScheduleCheck","children","hasPublishAction","select","_select$getCurrentPos","getCurrentPost","_links"],"sources":["@wordpress/editor/src/components/post-schedule/check.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function PostScheduleCheck( { children } ) {\n\tconst hasPublishAction = useSelect( ( select ) => {\n\t\treturn (\n\t\t\tselect( editorStore ).getCurrentPost()._links?.[\n\t\t\t\t'wp:action-publish'\n\t\t\t] ?? false\n\t\t);\n\t}, [] );\n\n\tif ( ! hasPublishAction ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAElD,eAAe,SAASC,iBAAiBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACzD,MAAMC,gBAAgB,GAAGL,SAAS,CAAIM,MAAM,IAAM;IAAA,IAAAC,qBAAA;IACjD,QAAAA,qBAAA,GACCD,MAAM,CAAEJ,WAAY,CAAC,CAACM,cAAc,CAAC,CAAC,CAACC,MAAM,GAC5C,mBAAmB,CACnB,cAAAF,qBAAA,cAAAA,qBAAA,GAAI,KAAK;EAEZ,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAEF,gBAAgB,EAAG;IACzB,OAAO,IAAI;EACZ;EAEA,OAAOD,QAAQ;AAChB"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { compose, ifCondition } from '@wordpress/compose';
5
+ import { withSelect, withDispatch } from '@wordpress/data';
6
+ import { privateApis as preferencesPrivateApis } from '@wordpress/preferences';
7
+
8
+ /**
9
+ * Internal dependencies
10
+ */
11
+ import { unlock } from '../../lock-unlock';
12
+ import { store as editorStore } from '../../store';
13
+ const {
14
+ PreferenceBaseOption
15
+ } = unlock(preferencesPrivateApis);
16
+ export default compose(withSelect((select, {
17
+ panelName
18
+ }) => {
19
+ const {
20
+ isEditorPanelEnabled,
21
+ isEditorPanelRemoved
22
+ } = select(editorStore);
23
+ return {
24
+ isRemoved: isEditorPanelRemoved(panelName),
25
+ isChecked: isEditorPanelEnabled(panelName)
26
+ };
27
+ }), ifCondition(({
28
+ isRemoved
29
+ }) => !isRemoved), withDispatch((dispatch, {
30
+ panelName
31
+ }) => ({
32
+ onChange: () => dispatch(editorStore).toggleEditorPanelEnabled(panelName)
33
+ })))(PreferenceBaseOption);
34
+ //# sourceMappingURL=enable-panel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["compose","ifCondition","withSelect","withDispatch","privateApis","preferencesPrivateApis","unlock","store","editorStore","PreferenceBaseOption","select","panelName","isEditorPanelEnabled","isEditorPanelRemoved","isRemoved","isChecked","dispatch","onChange","toggleEditorPanelEnabled"],"sources":["@wordpress/editor/src/components/preferences-modal/enable-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { compose, ifCondition } from '@wordpress/compose';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { privateApis as preferencesPrivateApis } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nconst { PreferenceBaseOption } = unlock( preferencesPrivateApis );\n\nexport default compose(\n\twithSelect( ( select, { panelName } ) => {\n\t\tconst { isEditorPanelEnabled, isEditorPanelRemoved } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tisRemoved: isEditorPanelRemoved( panelName ),\n\t\t\tisChecked: isEditorPanelEnabled( panelName ),\n\t\t};\n\t} ),\n\tifCondition( ( { isRemoved } ) => ! isRemoved ),\n\twithDispatch( ( dispatch, { panelName } ) => ( {\n\t\tonChange: () =>\n\t\t\tdispatch( editorStore ).toggleEditorPanelEnabled( panelName ),\n\t} ) )\n)( PreferenceBaseOption );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,EAAEC,WAAW,QAAQ,oBAAoB;AACzD,SAASC,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAC1D,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,wBAAwB;;AAE9E;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAElD,MAAM;EAAEC;AAAqB,CAAC,GAAGH,MAAM,CAAED,sBAAuB,CAAC;AAEjE,eAAeL,OAAO,CACrBE,UAAU,CAAE,CAAEQ,MAAM,EAAE;EAAEC;AAAU,CAAC,KAAM;EACxC,MAAM;IAAEC,oBAAoB;IAAEC;EAAqB,CAAC,GACnDH,MAAM,CAAEF,WAAY,CAAC;EACtB,OAAO;IACNM,SAAS,EAAED,oBAAoB,CAAEF,SAAU,CAAC;IAC5CI,SAAS,EAAEH,oBAAoB,CAAED,SAAU;EAC5C,CAAC;AACF,CAAE,CAAC,EACHV,WAAW,CAAE,CAAE;EAAEa;AAAU,CAAC,KAAM,CAAEA,SAAU,CAAC,EAC/CX,YAAY,CAAE,CAAEa,QAAQ,EAAE;EAAEL;AAAU,CAAC,MAAQ;EAC9CM,QAAQ,EAAEA,CAAA,KACTD,QAAQ,CAAER,WAAY,CAAC,CAACU,wBAAwB,CAAEP,SAAU;AAC9D,CAAC,CAAG,CACL,CAAC,CAAEF,oBAAqB,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { createElement } from "react";
2
+ /**
3
+ * WordPress dependencies
4
+ */
5
+ import { createSlotFill } from '@wordpress/components';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import EnablePanelOption from './enable-panel';
11
+ const {
12
+ Fill,
13
+ Slot
14
+ } = createSlotFill('EnablePluginDocumentSettingPanelOption');
15
+ const EnablePluginDocumentSettingPanelOption = ({
16
+ label,
17
+ panelName
18
+ }) => createElement(Fill, null, createElement(EnablePanelOption, {
19
+ label: label,
20
+ panelName: panelName
21
+ }));
22
+ EnablePluginDocumentSettingPanelOption.Slot = Slot;
23
+ export default EnablePluginDocumentSettingPanelOption;
24
+ //# sourceMappingURL=enable-plugin-document-setting-panel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createSlotFill","EnablePanelOption","Fill","Slot","EnablePluginDocumentSettingPanelOption","label","panelName","createElement"],"sources":["@wordpress/editor/src/components/preferences-modal/enable-plugin-document-setting-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport EnablePanelOption from './enable-panel';\n\nconst { Fill, Slot } = createSlotFill(\n\t'EnablePluginDocumentSettingPanelOption'\n);\n\nconst EnablePluginDocumentSettingPanelOption = ( { label, panelName } ) => (\n\t<Fill>\n\t\t<EnablePanelOption label={ label } panelName={ panelName } />\n\t</Fill>\n);\n\nEnablePluginDocumentSettingPanelOption.Slot = Slot;\n\nexport default EnablePluginDocumentSettingPanelOption;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,cAAc,QAAQ,uBAAuB;;AAEtD;AACA;AACA;AACA,OAAOC,iBAAiB,MAAM,gBAAgB;AAE9C,MAAM;EAAEC,IAAI;EAAEC;AAAK,CAAC,GAAGH,cAAc,CACpC,wCACD,CAAC;AAED,MAAMI,sCAAsC,GAAGA,CAAE;EAAEC,KAAK;EAAEC;AAAU,CAAC,KACpEC,aAAA,CAACL,IAAI,QACJK,aAAA,CAACN,iBAAiB;EAACI,KAAK,EAAGA,KAAO;EAACC,SAAS,EAAGA;AAAW,CAAE,CACvD,CACN;AAEDF,sCAAsC,CAACD,IAAI,GAAGA,IAAI;AAElD,eAAeC,sCAAsC"}