@wordpress/editor 13.19.3 → 13.20.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.
- package/CHANGELOG.md +2 -0
- package/README.md +6 -6
- package/build/components/autocompleters/user.js +5 -4
- package/build/components/autocompleters/user.js.map +1 -1
- package/build/components/deprecated.js +3 -2
- package/build/components/deprecated.js.map +1 -1
- package/build/components/document-outline/index.js +11 -11
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/document-outline/item.js +6 -6
- package/build/components/document-outline/item.js.map +1 -1
- package/build/components/editor-help/add-blocks.native.js +5 -5
- package/build/components/editor-help/add-blocks.native.js.map +1 -1
- package/build/components/editor-help/customize-blocks.native.js +5 -5
- package/build/components/editor-help/customize-blocks.native.js.map +1 -1
- package/build/components/editor-help/help-detail-navigation-screen.native.js +8 -7
- package/build/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
- package/build/components/editor-help/help-get-support-button.native.js +3 -3
- package/build/components/editor-help/help-get-support-button.native.js.map +1 -1
- package/build/components/editor-help/help-section-title.native.js +3 -3
- package/build/components/editor-help/help-section-title.native.js.map +1 -1
- package/build/components/editor-help/help-topic-row.native.js +3 -3
- package/build/components/editor-help/help-topic-row.native.js.map +1 -1
- package/build/components/editor-help/icon-move-blocks.native.js +3 -3
- package/build/components/editor-help/icon-move-blocks.native.js.map +1 -1
- package/build/components/editor-help/index.native.js +19 -19
- package/build/components/editor-help/index.native.js.map +1 -1
- package/build/components/editor-help/intro-to-blocks.native.js +15 -15
- package/build/components/editor-help/intro-to-blocks.native.js.map +1 -1
- package/build/components/editor-help/move-blocks.native.js +9 -9
- package/build/components/editor-help/move-blocks.native.js.map +1 -1
- package/build/components/editor-help/remove-blocks.native.js +4 -4
- package/build/components/editor-help/remove-blocks.native.js.map +1 -1
- package/build/components/editor-help/view-sections.native.js +8 -8
- package/build/components/editor-help/view-sections.native.js.map +1 -1
- package/build/components/editor-history/redo.js +3 -2
- package/build/components/editor-history/redo.js.map +1 -1
- package/build/components/editor-history/undo.js +3 -2
- package/build/components/editor-history/undo.js.map +1 -1
- package/build/components/editor-notices/index.js +4 -4
- package/build/components/editor-notices/index.js.map +1 -1
- package/build/components/editor-snackbars/index.js +2 -2
- package/build/components/editor-snackbars/index.js.map +1 -1
- package/build/components/entities-saved-states/entity-record-item.js +3 -3
- package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build/components/entities-saved-states/entity-type-list.js +4 -4
- package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build/components/entities-saved-states/index.js +10 -9
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/error-boundary/index.js +5 -4
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js +2 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build/components/local-autosave-monitor/index.js +2 -1
- package/build/components/local-autosave-monitor/index.js.map +1 -1
- package/build/components/page-attributes/order.js +5 -4
- package/build/components/page-attributes/order.js.map +1 -1
- package/build/components/page-attributes/parent.js +3 -2
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/post-author/check.js +2 -2
- package/build/components/post-author/check.js.map +1 -1
- package/build/components/post-author/combobox.js +3 -2
- package/build/components/post-author/combobox.js.map +1 -1
- package/build/components/post-author/index.js +3 -3
- package/build/components/post-author/index.js.map +1 -1
- package/build/components/post-author/select.js +3 -2
- package/build/components/post-author/select.js.map +1 -1
- package/build/components/post-comments/index.js +2 -2
- package/build/components/post-comments/index.js.map +1 -1
- package/build/components/post-excerpt/check.js +2 -2
- package/build/components/post-excerpt/check.js.map +1 -1
- package/build/components/post-excerpt/index.js +4 -4
- package/build/components/post-excerpt/index.js.map +1 -1
- package/build/components/post-featured-image/check.js +3 -3
- package/build/components/post-featured-image/check.js.map +1 -1
- package/build/components/post-featured-image/index.js +15 -14
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-format/check.js +2 -2
- package/build/components/post-format/check.js.map +1 -1
- package/build/components/post-format/index.js +5 -5
- package/build/components/post-format/index.js.map +1 -1
- package/build/components/post-last-revision/check.js +2 -2
- package/build/components/post-last-revision/check.js.map +1 -1
- package/build/components/post-last-revision/index.js +2 -2
- package/build/components/post-last-revision/index.js.map +1 -1
- package/build/components/post-locked-modal/index.js +14 -13
- package/build/components/post-locked-modal/index.js.map +1 -1
- package/build/components/post-pending-status/index.js +2 -2
- package/build/components/post-pending-status/index.js.map +1 -1
- package/build/components/post-pingbacks/index.js +2 -2
- package/build/components/post-pingbacks/index.js.map +1 -1
- package/build/components/post-preview-button/index.js +8 -7
- package/build/components/post-preview-button/index.js.map +1 -1
- package/build/components/post-publish-button/index.js +4 -3
- package/build/components/post-publish-button/index.js.map +1 -1
- package/build/components/post-publish-panel/index.js +13 -12
- package/build/components/post-publish-panel/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-category-panel.js +5 -4
- package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js +5 -5
- package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-tags-panel.js +6 -5
- package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-upload-media.js +9 -8
- package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build/components/post-publish-panel/postpublish.js +15 -14
- package/build/components/post-publish-panel/postpublish.js.map +1 -1
- package/build/components/post-publish-panel/prepublish.js +15 -15
- package/build/components/post-publish-panel/prepublish.js.map +1 -1
- package/build/components/post-saved-state/index.js +5 -4
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-schedule/index.js +3 -2
- package/build/components/post-schedule/index.js.map +1 -1
- package/build/components/post-slug/check.js +2 -2
- package/build/components/post-slug/check.js.map +1 -1
- package/build/components/post-slug/index.js +3 -2
- package/build/components/post-slug/index.js.map +1 -1
- package/build/components/post-sticky/check.js +12 -14
- package/build/components/post-sticky/check.js.map +1 -1
- package/build/components/post-sticky/index.js +14 -24
- package/build/components/post-sticky/index.js.map +1 -1
- package/build/components/post-switch-to-draft-button/index.js +35 -43
- package/build/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build/components/post-sync-status/index.js +10 -9
- package/build/components/post-sync-status/index.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +4 -3
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +15 -14
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/index.js +3 -2
- package/build/components/post-taxonomies/index.js.map +1 -1
- package/build/components/post-taxonomies/most-used-terms.js +6 -6
- package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build/components/post-template/index.js +2 -2
- package/build/components/post-template/index.js.map +1 -1
- package/build/components/post-text-editor/index.js +4 -3
- package/build/components/post-text-editor/index.js.map +1 -1
- package/build/components/post-title/index.js +4 -3
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-title/index.native.js +4 -3
- package/build/components/post-title/index.native.js.map +1 -1
- package/build/components/post-trash/index.js +14 -4
- package/build/components/post-trash/index.js.map +1 -1
- package/build/components/post-type-support-check/index.js +2 -2
- package/build/components/post-type-support-check/index.js.map +1 -1
- package/build/components/post-url/index.js +11 -10
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/post-visibility/index.js +17 -16
- package/build/components/post-visibility/index.js.map +1 -1
- package/build/components/provider/index.js +7 -6
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/index.native.js +4 -3
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/with-registry-provider.js +4 -3
- package/build/components/provider/with-registry-provider.js.map +1 -1
- package/build/components/table-of-contents/index.js +5 -4
- package/build/components/table-of-contents/index.js.map +1 -1
- package/build/components/table-of-contents/panel.js +15 -15
- package/build/components/table-of-contents/panel.js.map +1 -1
- package/build/components/template-validation-notice/index.js +2 -2
- package/build/components/template-validation-notice/index.js.map +1 -1
- package/build/components/time-to-read/index.js +5 -4
- package/build/components/time-to-read/index.js.map +1 -1
- package/build/components/unsaved-changes-warning/index.js +1 -1
- package/build/components/unsaved-changes-warning/index.js.map +1 -1
- package/build/components/word-count/index.js +2 -2
- package/build/components/word-count/index.js.map +1 -1
- package/build/hooks/custom-sources-backwards-compatibility.js +3 -2
- package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build-module/components/autocompleters/user.js +1 -1
- package/build-module/components/deprecated.js +1 -1
- package/build-module/components/document-outline/index.js +1 -1
- package/build-module/components/document-outline/item.js +1 -1
- package/build-module/components/editor-help/add-blocks.native.js +1 -1
- package/build-module/components/editor-help/customize-blocks.native.js +1 -1
- package/build-module/components/editor-help/help-detail-navigation-screen.native.js +1 -1
- package/build-module/components/editor-help/help-get-support-button.native.js +1 -1
- package/build-module/components/editor-help/help-section-title.native.js +1 -1
- package/build-module/components/editor-help/help-topic-row.native.js +1 -1
- package/build-module/components/editor-help/icon-move-blocks.native.js +1 -1
- package/build-module/components/editor-help/index.native.js +1 -1
- package/build-module/components/editor-help/intro-to-blocks.native.js +1 -1
- package/build-module/components/editor-help/move-blocks.native.js +1 -1
- package/build-module/components/editor-help/remove-blocks.native.js +1 -1
- package/build-module/components/editor-help/view-sections.native.js +1 -1
- package/build-module/components/editor-history/redo.js +1 -1
- package/build-module/components/editor-history/undo.js +1 -1
- package/build-module/components/editor-notices/index.js +1 -1
- package/build-module/components/editor-snackbars/index.js +1 -1
- package/build-module/components/entities-saved-states/entity-record-item.js +1 -1
- package/build-module/components/entities-saved-states/entity-type-list.js +1 -1
- package/build-module/components/entities-saved-states/index.js +1 -1
- package/build-module/components/error-boundary/index.js +1 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +1 -1
- package/build-module/components/local-autosave-monitor/index.js +1 -1
- package/build-module/components/page-attributes/order.js +1 -1
- package/build-module/components/page-attributes/parent.js +1 -1
- package/build-module/components/post-author/check.js +1 -1
- package/build-module/components/post-author/combobox.js +1 -1
- package/build-module/components/post-author/index.js +1 -1
- package/build-module/components/post-author/select.js +1 -1
- package/build-module/components/post-comments/index.js +1 -1
- package/build-module/components/post-excerpt/check.js +1 -1
- package/build-module/components/post-excerpt/index.js +1 -1
- package/build-module/components/post-featured-image/check.js +1 -1
- package/build-module/components/post-featured-image/index.js +1 -1
- package/build-module/components/post-format/check.js +1 -1
- package/build-module/components/post-format/index.js +1 -1
- package/build-module/components/post-last-revision/check.js +1 -1
- package/build-module/components/post-last-revision/index.js +1 -1
- package/build-module/components/post-locked-modal/index.js +1 -1
- package/build-module/components/post-pending-status/index.js +1 -1
- package/build-module/components/post-pingbacks/index.js +1 -1
- package/build-module/components/post-preview-button/index.js +1 -1
- package/build-module/components/post-publish-button/index.js +1 -1
- package/build-module/components/post-publish-panel/index.js +1 -1
- package/build-module/components/post-publish-panel/maybe-category-panel.js +1 -1
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js +1 -1
- package/build-module/components/post-publish-panel/maybe-tags-panel.js +1 -1
- package/build-module/components/post-publish-panel/maybe-upload-media.js +1 -1
- package/build-module/components/post-publish-panel/postpublish.js +1 -1
- package/build-module/components/post-publish-panel/prepublish.js +1 -1
- package/build-module/components/post-saved-state/index.js +2 -2
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-schedule/index.js +1 -1
- package/build-module/components/post-slug/check.js +1 -1
- package/build-module/components/post-slug/index.js +1 -1
- package/build-module/components/post-sticky/check.js +13 -13
- package/build-module/components/post-sticky/check.js.map +1 -1
- package/build-module/components/post-sticky/index.js +13 -21
- package/build-module/components/post-sticky/index.js.map +1 -1
- package/build-module/components/post-switch-to-draft-button/index.js +32 -40
- package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build-module/components/post-sync-status/index.js +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +2 -2
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/index.js +1 -1
- package/build-module/components/post-taxonomies/most-used-terms.js +1 -1
- package/build-module/components/post-template/index.js +1 -1
- package/build-module/components/post-text-editor/index.js +1 -1
- package/build-module/components/post-title/index.js +1 -1
- package/build-module/components/post-title/index.native.js +1 -1
- package/build-module/components/post-trash/index.js +15 -5
- package/build-module/components/post-trash/index.js.map +1 -1
- package/build-module/components/post-type-support-check/index.js +2 -2
- package/build-module/components/post-type-support-check/index.js.map +1 -1
- package/build-module/components/post-url/index.js +1 -1
- package/build-module/components/post-visibility/index.js +1 -1
- package/build-module/components/provider/index.js +1 -1
- package/build-module/components/provider/index.native.js +1 -1
- package/build-module/components/provider/with-registry-provider.js +1 -1
- package/build-module/components/table-of-contents/index.js +1 -1
- package/build-module/components/table-of-contents/panel.js +1 -1
- package/build-module/components/template-validation-notice/index.js +1 -1
- package/build-module/components/time-to-read/index.js +1 -1
- package/build-module/components/unsaved-changes-warning/index.js +1 -1
- package/build-module/components/unsaved-changes-warning/index.js.map +1 -1
- package/build-module/components/word-count/index.js +1 -1
- package/build-module/hooks/custom-sources-backwards-compatibility.js +1 -1
- package/build-style/style-rtl.css +1 -1
- package/build-style/style.css +1 -1
- package/package.json +31 -31
- package/src/components/post-featured-image/README.md +3 -3
- package/src/components/post-saved-state/index.js +1 -1
- package/src/components/post-sticky/check.js +10 -13
- package/src/components/post-sticky/index.js +10 -20
- package/src/components/post-sticky/test/index.js +31 -16
- package/src/components/post-switch-to-draft-button/index.js +20 -35
- package/src/components/post-taxonomies/README.md +2 -2
- package/src/components/post-taxonomies/hierarchical-term-selector.js +1 -1
- package/src/components/post-trash/index.js +34 -11
- package/src/components/post-type-support-check/README.md +1 -1
- package/src/components/post-type-support-check/index.js +2 -2
- package/src/components/unsaved-changes-warning/index.js +1 -1
|
@@ -10,7 +10,7 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
10
10
|
* Warns the user if there are unsaved changes before leaving the editor.
|
|
11
11
|
* Compatible with Post Editor and Site Editor.
|
|
12
12
|
*
|
|
13
|
-
* @return {
|
|
13
|
+
* @return {Component} The component.
|
|
14
14
|
*/
|
|
15
15
|
export default function UnsavedChangesWarning() {
|
|
16
16
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","useEffect","useSelect","store","coreStore","UnsavedChangesWarning","__experimentalGetDirtyEntityRecords","warnIfUnsavedChanges","event","dirtyEntityRecords","length","returnValue","window","addEventListener","removeEventListener"],"sources":["@wordpress/editor/src/components/unsaved-changes-warning/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Warns the user if there are unsaved changes before leaving the editor.\n * Compatible with Post Editor and Site Editor.\n *\n * @return {
|
|
1
|
+
{"version":3,"names":["__","useEffect","useSelect","store","coreStore","UnsavedChangesWarning","__experimentalGetDirtyEntityRecords","warnIfUnsavedChanges","event","dirtyEntityRecords","length","returnValue","window","addEventListener","removeEventListener"],"sources":["@wordpress/editor/src/components/unsaved-changes-warning/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Warns the user if there are unsaved changes before leaving the editor.\n * Compatible with Post Editor and Site Editor.\n *\n * @return {Component} The component.\n */\nexport default function UnsavedChangesWarning() {\n\tconst { __experimentalGetDirtyEntityRecords } = useSelect( coreStore );\n\n\tuseEffect( () => {\n\t\t/**\n\t\t * Warns the user if there are unsaved changes before leaving the editor.\n\t\t *\n\t\t * @param {Event} event `beforeunload` event.\n\t\t *\n\t\t * @return {string | undefined} Warning prompt message, if unsaved changes exist.\n\t\t */\n\t\tconst warnIfUnsavedChanges = ( event ) => {\n\t\t\t// We need to call the selector directly in the listener to avoid race\n\t\t\t// conditions with `BrowserURL` where `componentDidUpdate` gets the\n\t\t\t// new value of `isEditedPostDirty` before this component does,\n\t\t\t// causing this component to incorrectly think a trashed post is still dirty.\n\t\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\t\tif ( dirtyEntityRecords.length > 0 ) {\n\t\t\t\tevent.returnValue = __(\n\t\t\t\t\t'You have unsaved changes. If you proceed, they will be lost.'\n\t\t\t\t);\n\t\t\t\treturn event.returnValue;\n\t\t\t}\n\t\t};\n\n\t\twindow.addEventListener( 'beforeunload', warnIfUnsavedChanges );\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener( 'beforeunload', warnIfUnsavedChanges );\n\t\t};\n\t}, [ __experimentalGetDirtyEntityRecords ] );\n\n\treturn null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,qBAAqBA,CAAA,EAAG;EAC/C,MAAM;IAAEC;EAAoC,CAAC,GAAGJ,SAAS,CAAEE,SAAU,CAAC;EAEtEH,SAAS,CAAE,MAAM;IAChB;AACF;AACA;AACA;AACA;AACA;AACA;IACE,MAAMM,oBAAoB,GAAKC,KAAK,IAAM;MACzC;MACA;MACA;MACA;MACA,MAAMC,kBAAkB,GAAGH,mCAAmC,CAAC,CAAC;MAChE,IAAKG,kBAAkB,CAACC,MAAM,GAAG,CAAC,EAAG;QACpCF,KAAK,CAACG,WAAW,GAAGX,EAAE,CACrB,8DACD,CAAC;QACD,OAAOQ,KAAK,CAACG,WAAW;MACzB;IACD,CAAC;IAEDC,MAAM,CAACC,gBAAgB,CAAE,cAAc,EAAEN,oBAAqB,CAAC;IAE/D,OAAO,MAAM;MACZK,MAAM,CAACE,mBAAmB,CAAE,cAAc,EAAEP,oBAAqB,CAAC;IACnE,CAAC;EACF,CAAC,EAAE,CAAED,mCAAmC,CAAG,CAAC;EAE5C,OAAO,IAAI;AACZ"}
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
--wp-block-synced-color: #7a00df;
|
|
99
99
|
--wp-block-synced-color--rgb: 122, 0, 223;
|
|
100
100
|
}
|
|
101
|
-
@media (min-resolution: 192dpi) {
|
|
101
|
+
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
|
|
102
102
|
:root {
|
|
103
103
|
--wp-admin-border-width-focus: 1.5px;
|
|
104
104
|
}
|
package/build-style/style.css
CHANGED
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
--wp-block-synced-color: #7a00df;
|
|
99
99
|
--wp-block-synced-color--rgb: 122, 0, 223;
|
|
100
100
|
}
|
|
101
|
-
@media (min-resolution: 192dpi) {
|
|
101
|
+
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
|
|
102
102
|
:root {
|
|
103
103
|
--wp-admin-border-width-focus: 1.5px;
|
|
104
104
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/editor",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.20.0",
|
|
4
4
|
"description": "Enhanced block editor for WordPress posts.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -31,35 +31,35 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.16.0",
|
|
34
|
-
"@wordpress/a11y": "^3.
|
|
35
|
-
"@wordpress/api-fetch": "^6.
|
|
36
|
-
"@wordpress/blob": "^3.
|
|
37
|
-
"@wordpress/block-editor": "^12.
|
|
38
|
-
"@wordpress/blocks": "^12.
|
|
39
|
-
"@wordpress/components": "^25.
|
|
40
|
-
"@wordpress/compose": "^6.
|
|
41
|
-
"@wordpress/core-data": "^6.
|
|
42
|
-
"@wordpress/data": "^9.
|
|
43
|
-
"@wordpress/date": "^4.
|
|
44
|
-
"@wordpress/deprecated": "^3.
|
|
45
|
-
"@wordpress/dom": "^3.
|
|
46
|
-
"@wordpress/element": "^5.
|
|
47
|
-
"@wordpress/hooks": "^3.
|
|
48
|
-
"@wordpress/html-entities": "^3.
|
|
49
|
-
"@wordpress/i18n": "^4.
|
|
50
|
-
"@wordpress/icons": "^9.
|
|
51
|
-
"@wordpress/keyboard-shortcuts": "^4.
|
|
52
|
-
"@wordpress/keycodes": "^3.
|
|
53
|
-
"@wordpress/media-utils": "^4.
|
|
54
|
-
"@wordpress/notices": "^4.
|
|
55
|
-
"@wordpress/patterns": "^1.
|
|
56
|
-
"@wordpress/preferences": "^3.
|
|
57
|
-
"@wordpress/private-apis": "^0.
|
|
58
|
-
"@wordpress/reusable-blocks": "^4.
|
|
59
|
-
"@wordpress/rich-text": "^6.
|
|
60
|
-
"@wordpress/server-side-render": "^4.
|
|
61
|
-
"@wordpress/url": "^3.
|
|
62
|
-
"@wordpress/wordcount": "^3.
|
|
34
|
+
"@wordpress/a11y": "^3.43.0",
|
|
35
|
+
"@wordpress/api-fetch": "^6.40.0",
|
|
36
|
+
"@wordpress/blob": "^3.43.0",
|
|
37
|
+
"@wordpress/block-editor": "^12.11.0",
|
|
38
|
+
"@wordpress/blocks": "^12.20.0",
|
|
39
|
+
"@wordpress/components": "^25.9.0",
|
|
40
|
+
"@wordpress/compose": "^6.20.0",
|
|
41
|
+
"@wordpress/core-data": "^6.20.0",
|
|
42
|
+
"@wordpress/data": "^9.13.0",
|
|
43
|
+
"@wordpress/date": "^4.43.0",
|
|
44
|
+
"@wordpress/deprecated": "^3.43.0",
|
|
45
|
+
"@wordpress/dom": "^3.43.0",
|
|
46
|
+
"@wordpress/element": "^5.20.0",
|
|
47
|
+
"@wordpress/hooks": "^3.43.0",
|
|
48
|
+
"@wordpress/html-entities": "^3.43.0",
|
|
49
|
+
"@wordpress/i18n": "^4.43.0",
|
|
50
|
+
"@wordpress/icons": "^9.34.0",
|
|
51
|
+
"@wordpress/keyboard-shortcuts": "^4.20.0",
|
|
52
|
+
"@wordpress/keycodes": "^3.43.0",
|
|
53
|
+
"@wordpress/media-utils": "^4.34.0",
|
|
54
|
+
"@wordpress/notices": "^4.11.0",
|
|
55
|
+
"@wordpress/patterns": "^1.4.0",
|
|
56
|
+
"@wordpress/preferences": "^3.20.0",
|
|
57
|
+
"@wordpress/private-apis": "^0.25.0",
|
|
58
|
+
"@wordpress/reusable-blocks": "^4.20.0",
|
|
59
|
+
"@wordpress/rich-text": "^6.20.0",
|
|
60
|
+
"@wordpress/server-side-render": "^4.20.0",
|
|
61
|
+
"@wordpress/url": "^3.44.0",
|
|
62
|
+
"@wordpress/wordcount": "^3.43.0",
|
|
63
63
|
"classnames": "^2.3.1",
|
|
64
64
|
"date-fns": "^2.28.0",
|
|
65
65
|
"memize": "^2.1.0",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"publishConfig": {
|
|
75
75
|
"access": "public"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "9b8e598c5418d38fe72197c24ef1d3dd6c712151"
|
|
78
78
|
}
|
|
@@ -13,7 +13,7 @@ Replace the contents of the panel:
|
|
|
13
13
|
```js
|
|
14
14
|
function replacePostFeaturedImage() {
|
|
15
15
|
return function () {
|
|
16
|
-
return
|
|
16
|
+
return React.createElement(
|
|
17
17
|
'div',
|
|
18
18
|
{},
|
|
19
19
|
'The replacement contents or components.'
|
|
@@ -31,12 +31,12 @@ wp.hooks.addFilter(
|
|
|
31
31
|
Prepend and append to the panel contents:
|
|
32
32
|
|
|
33
33
|
```js
|
|
34
|
-
var el =
|
|
34
|
+
var el = React.createElement;
|
|
35
35
|
|
|
36
36
|
function wrapPostFeaturedImage( OriginalComponent ) {
|
|
37
37
|
return function ( props ) {
|
|
38
38
|
return el(
|
|
39
|
-
|
|
39
|
+
React.Fragment,
|
|
40
40
|
{},
|
|
41
41
|
'Prepend above',
|
|
42
42
|
el( OriginalComponent, props ),
|
|
@@ -30,7 +30,7 @@ import { store as editorStore } from '../../store';
|
|
|
30
30
|
* @param {?boolean} props.forceIsDirty Whether to force the post to be marked
|
|
31
31
|
* as dirty.
|
|
32
32
|
* @param {?boolean} props.showIconLabels Whether interface buttons show labels instead of icons
|
|
33
|
-
* @return {import('
|
|
33
|
+
* @return {import('react').ComponentType} The component.
|
|
34
34
|
*/
|
|
35
35
|
export default function PostSavedState( {
|
|
36
36
|
forceIsDirty,
|
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
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
10
|
|
|
12
|
-
export function PostStickyCheck( {
|
|
11
|
+
export default function PostStickyCheck( { children } ) {
|
|
12
|
+
const { hasStickyAction, postType } = useSelect( ( select ) => {
|
|
13
|
+
const post = select( editorStore ).getCurrentPost();
|
|
14
|
+
return {
|
|
15
|
+
hasStickyAction: post._links?.[ 'wp:action-sticky' ] ?? false,
|
|
16
|
+
postType: select( editorStore ).getCurrentPostType(),
|
|
17
|
+
};
|
|
18
|
+
}, [] );
|
|
19
|
+
|
|
13
20
|
if ( postType !== 'post' || ! hasStickyAction ) {
|
|
14
21
|
return null;
|
|
15
22
|
}
|
|
16
23
|
|
|
17
24
|
return children;
|
|
18
25
|
}
|
|
19
|
-
|
|
20
|
-
export default compose( [
|
|
21
|
-
withSelect( ( select ) => {
|
|
22
|
-
const post = select( editorStore ).getCurrentPost();
|
|
23
|
-
return {
|
|
24
|
-
hasStickyAction: post._links?.[ 'wp:action-sticky' ] ?? false,
|
|
25
|
-
postType: select( editorStore ).getCurrentPostType(),
|
|
26
|
-
};
|
|
27
|
-
} ),
|
|
28
|
-
] )( PostStickyCheck );
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { CheckboxControl } from '@wordpress/components';
|
|
6
|
-
import {
|
|
7
|
-
import { compose } from '@wordpress/compose';
|
|
6
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* Internal dependencies
|
|
@@ -12,31 +11,22 @@ import { compose } from '@wordpress/compose';
|
|
|
12
11
|
import PostStickyCheck from './check';
|
|
13
12
|
import { store as editorStore } from '../../store';
|
|
14
13
|
|
|
15
|
-
export function PostSticky(
|
|
14
|
+
export default function PostSticky() {
|
|
15
|
+
const postSticky = useSelect( ( select ) => {
|
|
16
|
+
return (
|
|
17
|
+
select( editorStore ).getEditedPostAttribute( 'sticky' ) ?? false
|
|
18
|
+
);
|
|
19
|
+
}, [] );
|
|
20
|
+
const { editPost } = useDispatch( editorStore );
|
|
21
|
+
|
|
16
22
|
return (
|
|
17
23
|
<PostStickyCheck>
|
|
18
24
|
<CheckboxControl
|
|
19
25
|
__nextHasNoMarginBottom
|
|
20
26
|
label={ __( 'Stick to the top of the blog' ) }
|
|
21
27
|
checked={ postSticky }
|
|
22
|
-
onChange={ () =>
|
|
28
|
+
onChange={ () => editPost( { sticky: ! postSticky } ) }
|
|
23
29
|
/>
|
|
24
30
|
</PostStickyCheck>
|
|
25
31
|
);
|
|
26
32
|
}
|
|
27
|
-
|
|
28
|
-
export default compose( [
|
|
29
|
-
withSelect( ( select ) => {
|
|
30
|
-
return {
|
|
31
|
-
postSticky:
|
|
32
|
-
select( editorStore ).getEditedPostAttribute( 'sticky' ),
|
|
33
|
-
};
|
|
34
|
-
} ),
|
|
35
|
-
withDispatch( ( dispatch ) => {
|
|
36
|
-
return {
|
|
37
|
-
onUpdateSticky( postSticky ) {
|
|
38
|
-
dispatch( editorStore ).editPost( { sticky: postSticky } );
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
} ),
|
|
42
|
-
] )( PostSticky );
|
|
@@ -3,40 +3,55 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { render, screen } from '@testing-library/react';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { useSelect } from '@wordpress/data';
|
|
10
|
+
|
|
6
11
|
/**
|
|
7
12
|
* Internal dependencies
|
|
8
13
|
*/
|
|
9
|
-
import
|
|
14
|
+
import PostStickyCheck from '../check';
|
|
15
|
+
|
|
16
|
+
jest.mock( '@wordpress/data/src/components/use-select', () => {
|
|
17
|
+
// This allows us to tweak the returned value on each test.
|
|
18
|
+
const mock = jest.fn();
|
|
19
|
+
return mock;
|
|
20
|
+
} );
|
|
21
|
+
|
|
22
|
+
function setupUseSelectMock( { hasStickyAction, postType } ) {
|
|
23
|
+
useSelect.mockImplementation( ( cb ) => {
|
|
24
|
+
return cb( () => ( {
|
|
25
|
+
getCurrentPostType: () => postType,
|
|
26
|
+
getCurrentPost: () => ( {
|
|
27
|
+
_links: {
|
|
28
|
+
'wp:action-sticky': hasStickyAction,
|
|
29
|
+
},
|
|
30
|
+
} ),
|
|
31
|
+
} ) );
|
|
32
|
+
} );
|
|
33
|
+
}
|
|
10
34
|
|
|
11
35
|
describe( 'PostSticky', () => {
|
|
12
36
|
it( 'should not render anything if the post type is not "post"', () => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Can Toggle Sticky
|
|
16
|
-
</PostStickyCheck>
|
|
17
|
-
);
|
|
37
|
+
setupUseSelectMock( { hasStickyAction: true, postType: 'page' } );
|
|
38
|
+
render( <PostStickyCheck>Can Toggle Sticky</PostStickyCheck> );
|
|
18
39
|
expect(
|
|
19
40
|
screen.queryByText( 'Can Toggle Sticky' )
|
|
20
41
|
).not.toBeInTheDocument();
|
|
21
42
|
} );
|
|
22
43
|
|
|
23
44
|
it( "should not render anything if post doesn't support stickying", () => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
Can Toggle Sticky
|
|
27
|
-
</PostStickyCheck>
|
|
28
|
-
);
|
|
45
|
+
setupUseSelectMock( { hasStickyAction: false, postType: 'post' } );
|
|
46
|
+
render( <PostStickyCheck>Can Toggle Sticky</PostStickyCheck> );
|
|
29
47
|
expect(
|
|
30
48
|
screen.queryByText( 'Can Toggle Sticky' )
|
|
31
49
|
).not.toBeInTheDocument();
|
|
32
50
|
} );
|
|
33
51
|
|
|
34
52
|
it( 'should render if the post supports stickying', () => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
Can Toggle Sticky
|
|
38
|
-
</PostStickyCheck>
|
|
39
|
-
);
|
|
53
|
+
setupUseSelectMock( { hasStickyAction: true, postType: 'post' } );
|
|
54
|
+
render( <PostStickyCheck>Can Toggle Sticky</PostStickyCheck> );
|
|
40
55
|
expect( screen.getByText( 'Can Toggle Sticky' ) ).toBeVisible();
|
|
41
56
|
} );
|
|
42
57
|
} );
|
|
@@ -6,8 +6,7 @@ import {
|
|
|
6
6
|
__experimentalConfirmDialog as ConfirmDialog,
|
|
7
7
|
} from '@wordpress/components';
|
|
8
8
|
import { __ } from '@wordpress/i18n';
|
|
9
|
-
import {
|
|
10
|
-
import { compose } from '@wordpress/compose';
|
|
9
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
11
10
|
import { useState } from '@wordpress/element';
|
|
12
11
|
|
|
13
12
|
/**
|
|
@@ -15,17 +14,21 @@ import { useState } from '@wordpress/element';
|
|
|
15
14
|
*/
|
|
16
15
|
import { store as editorStore } from '../../store';
|
|
17
16
|
|
|
18
|
-
function PostSwitchToDraftButton( {
|
|
19
|
-
isSaving,
|
|
20
|
-
isPublished,
|
|
21
|
-
isScheduled,
|
|
22
|
-
onClick,
|
|
23
|
-
} ) {
|
|
17
|
+
export default function PostSwitchToDraftButton() {
|
|
24
18
|
const [ showConfirmDialog, setShowConfirmDialog ] = useState( false );
|
|
25
19
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
const { editPost, savePost } = useDispatch( editorStore );
|
|
21
|
+
const { isSaving, isPublished, isScheduled } = useSelect( ( select ) => {
|
|
22
|
+
const { isSavingPost, isCurrentPostPublished, isCurrentPostScheduled } =
|
|
23
|
+
select( editorStore );
|
|
24
|
+
return {
|
|
25
|
+
isSaving: isSavingPost(),
|
|
26
|
+
isPublished: isCurrentPostPublished(),
|
|
27
|
+
isScheduled: isCurrentPostScheduled(),
|
|
28
|
+
};
|
|
29
|
+
}, [] );
|
|
30
|
+
|
|
31
|
+
const isDisabled = isSaving || ( ! isPublished && ! isScheduled );
|
|
29
32
|
|
|
30
33
|
let alertMessage;
|
|
31
34
|
if ( isPublished ) {
|
|
@@ -36,7 +39,8 @@ function PostSwitchToDraftButton( {
|
|
|
36
39
|
|
|
37
40
|
const handleConfirm = () => {
|
|
38
41
|
setShowConfirmDialog( false );
|
|
39
|
-
|
|
42
|
+
editPost( { status: 'draft' } );
|
|
43
|
+
savePost();
|
|
40
44
|
};
|
|
41
45
|
|
|
42
46
|
return (
|
|
@@ -44,9 +48,11 @@ function PostSwitchToDraftButton( {
|
|
|
44
48
|
<Button
|
|
45
49
|
className="editor-post-switch-to-draft"
|
|
46
50
|
onClick={ () => {
|
|
47
|
-
|
|
51
|
+
if ( ! isDisabled ) {
|
|
52
|
+
setShowConfirmDialog( true );
|
|
53
|
+
}
|
|
48
54
|
} }
|
|
49
|
-
disabled={
|
|
55
|
+
aria-disabled={ isDisabled }
|
|
50
56
|
variant="secondary"
|
|
51
57
|
style={ { flexGrow: '1', justifyContent: 'center' } }
|
|
52
58
|
>
|
|
@@ -62,24 +68,3 @@ function PostSwitchToDraftButton( {
|
|
|
62
68
|
</>
|
|
63
69
|
);
|
|
64
70
|
}
|
|
65
|
-
|
|
66
|
-
export default compose( [
|
|
67
|
-
withSelect( ( select ) => {
|
|
68
|
-
const { isSavingPost, isCurrentPostPublished, isCurrentPostScheduled } =
|
|
69
|
-
select( editorStore );
|
|
70
|
-
return {
|
|
71
|
-
isSaving: isSavingPost(),
|
|
72
|
-
isPublished: isCurrentPostPublished(),
|
|
73
|
-
isScheduled: isCurrentPostScheduled(),
|
|
74
|
-
};
|
|
75
|
-
} ),
|
|
76
|
-
withDispatch( ( dispatch ) => {
|
|
77
|
-
const { editPost, savePost } = dispatch( editorStore );
|
|
78
|
-
return {
|
|
79
|
-
onClick: () => {
|
|
80
|
-
editPost( { status: 'draft' } );
|
|
81
|
-
savePost();
|
|
82
|
-
},
|
|
83
|
-
};
|
|
84
|
-
} ),
|
|
85
|
-
] )( PostSwitchToDraftButton );
|
|
@@ -19,7 +19,7 @@ For example, to render alternative UI for the taxonomy `product-type`,
|
|
|
19
19
|
we can render custom markup or use the original component as shown below.
|
|
20
20
|
|
|
21
21
|
```js
|
|
22
|
-
var el =
|
|
22
|
+
var el = React.createElement;
|
|
23
23
|
|
|
24
24
|
function customizeProductTypeSelector( OriginalComponent ) {
|
|
25
25
|
return function ( props ) {
|
|
@@ -42,7 +42,7 @@ Or, to use the hierarchical term selector with a non-hierarchical taxonomy `trac
|
|
|
42
42
|
you can set the `HierarchicalTermSelector` component as shown below.
|
|
43
43
|
|
|
44
44
|
```js
|
|
45
|
-
const el =
|
|
45
|
+
const el = React.createElement;
|
|
46
46
|
const HierarchicalTermSelector = wp.editor.PostTaxonomiesHierarchicalTermSelector;
|
|
47
47
|
|
|
48
48
|
function customizeTrackSelector( OriginalComponent ) {
|
|
@@ -149,7 +149,7 @@ export function getFilterMatcher( filterValue ) {
|
|
|
149
149
|
*
|
|
150
150
|
* @param {Object} props Component props.
|
|
151
151
|
* @param {string} props.slug Taxonomy slug.
|
|
152
|
-
* @return {
|
|
152
|
+
* @return {Element} Hierarchical term selector component.
|
|
153
153
|
*/
|
|
154
154
|
export function HierarchicalTermSelector( { slug } ) {
|
|
155
155
|
const [ adding, setAdding ] = useState( false );
|
|
@@ -2,8 +2,12 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
Button,
|
|
7
|
+
__experimentalConfirmDialog as ConfirmDialog,
|
|
8
|
+
} from '@wordpress/components';
|
|
6
9
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
10
|
+
import { useState } from '@wordpress/element';
|
|
7
11
|
|
|
8
12
|
/**
|
|
9
13
|
* Internal dependencies
|
|
@@ -20,21 +24,40 @@ export default function PostTrash() {
|
|
|
20
24
|
};
|
|
21
25
|
}, [] );
|
|
22
26
|
const { trashPost } = useDispatch( editorStore );
|
|
27
|
+
const [ showConfirmDialog, setShowConfirmDialog ] = useState( false );
|
|
23
28
|
|
|
24
29
|
if ( isNew || ! postId ) {
|
|
25
30
|
return null;
|
|
26
31
|
}
|
|
27
32
|
|
|
33
|
+
const handleConfirm = () => {
|
|
34
|
+
setShowConfirmDialog( false );
|
|
35
|
+
trashPost();
|
|
36
|
+
};
|
|
37
|
+
|
|
28
38
|
return (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
<>
|
|
40
|
+
<Button
|
|
41
|
+
className="editor-post-trash"
|
|
42
|
+
isDestructive
|
|
43
|
+
variant="secondary"
|
|
44
|
+
isBusy={ isDeleting }
|
|
45
|
+
aria-disabled={ isDeleting }
|
|
46
|
+
onClick={
|
|
47
|
+
isDeleting ? undefined : () => setShowConfirmDialog( true )
|
|
48
|
+
}
|
|
49
|
+
>
|
|
50
|
+
{ __( 'Move to trash' ) }
|
|
51
|
+
</Button>
|
|
52
|
+
<ConfirmDialog
|
|
53
|
+
isOpen={ showConfirmDialog }
|
|
54
|
+
onConfirm={ handleConfirm }
|
|
55
|
+
onCancel={ () => setShowConfirmDialog( false ) }
|
|
56
|
+
>
|
|
57
|
+
{ __(
|
|
58
|
+
'Are you sure you want to move this post to the trash?'
|
|
59
|
+
) }
|
|
60
|
+
</ConfirmDialog>
|
|
61
|
+
</>
|
|
39
62
|
);
|
|
40
63
|
}
|
|
@@ -14,12 +14,12 @@ import { store as editorStore } from '../../store';
|
|
|
14
14
|
* type supports one of the given `supportKeys` prop.
|
|
15
15
|
*
|
|
16
16
|
* @param {Object} props Props.
|
|
17
|
-
* @param {
|
|
17
|
+
* @param {Element} props.children Children to be rendered if post
|
|
18
18
|
* type supports.
|
|
19
19
|
* @param {(string|string[])} props.supportKeys String or string array of keys
|
|
20
20
|
* to test.
|
|
21
21
|
*
|
|
22
|
-
* @return {
|
|
22
|
+
* @return {Component} The component to be rendered.
|
|
23
23
|
*/
|
|
24
24
|
function PostTypeSupportCheck( { children, supportKeys } ) {
|
|
25
25
|
const postType = useSelect( ( select ) => {
|
|
@@ -10,7 +10,7 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
10
10
|
* Warns the user if there are unsaved changes before leaving the editor.
|
|
11
11
|
* Compatible with Post Editor and Site Editor.
|
|
12
12
|
*
|
|
13
|
-
* @return {
|
|
13
|
+
* @return {Component} The component.
|
|
14
14
|
*/
|
|
15
15
|
export default function UnsavedChangesWarning() {
|
|
16
16
|
const { __experimentalGetDirtyEntityRecords } = useSelect( coreStore );
|