@wordpress/editor 14.10.0 → 14.11.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 +6 -0
- package/README.md +2 -2
- package/build/bindings/post-meta.js +2 -1
- package/build/bindings/post-meta.js.map +1 -1
- package/build/components/collab-sidebar/add-comment.js +120 -0
- package/build/components/collab-sidebar/add-comment.js.map +1 -0
- package/build/components/collab-sidebar/comment-button-toolbar.js +37 -0
- package/build/components/collab-sidebar/comment-button-toolbar.js.map +1 -0
- package/build/components/collab-sidebar/comment-button.js +37 -0
- package/build/components/collab-sidebar/comment-button.js.map +1 -0
- package/build/components/collab-sidebar/comments.js +321 -0
- package/build/components/collab-sidebar/comments.js.map +1 -0
- package/build/components/collab-sidebar/constants.js +8 -0
- package/build/components/collab-sidebar/constants.js.map +1 -0
- package/build/components/collab-sidebar/index.js +272 -0
- package/build/components/collab-sidebar/index.js.map +1 -0
- package/build/components/collab-sidebar/utils.js +16 -0
- package/build/components/collab-sidebar/utils.js.map +1 -0
- package/build/components/commands/index.js +6 -6
- package/build/components/commands/index.js.map +1 -1
- package/build/components/document-bar/index.js +8 -7
- package/build/components/document-bar/index.js.map +1 -1
- package/build/components/document-tools/index.js +1 -5
- package/build/components/document-tools/index.js.map +1 -1
- package/build/components/editor-interface/index.js +3 -2
- package/build/components/editor-interface/index.js.map +1 -1
- package/build/components/entities-saved-states/index.js +1 -1
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js +3 -3
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build/components/global-styles-provider/index.js +13 -3
- package/build/components/global-styles-provider/index.js.map +1 -1
- package/build/components/header/index.js +5 -2
- package/build/components/header/index.js.map +1 -1
- package/build/components/inserter-sidebar/index.js +2 -2
- package/build/components/inserter-sidebar/index.js.map +1 -1
- package/build/components/page-attributes/parent.js +5 -5
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/plugin-more-menu-item/index.js +13 -11
- package/build/components/plugin-more-menu-item/index.js.map +1 -1
- package/build/components/plugin-preview-menu-item/index.js +15 -13
- package/build/components/plugin-preview-menu-item/index.js.map +1 -1
- package/build/components/plugin-sidebar/index.js +0 -15
- package/build/components/plugin-sidebar/index.js.map +1 -1
- package/build/components/post-actions/index.js +5 -5
- package/build/components/post-actions/index.js.map +1 -1
- package/build/components/post-author/panel.js +4 -4
- package/build/components/post-author/panel.js.map +1 -1
- package/build/components/post-card-panel/index.js +7 -36
- package/build/components/post-card-panel/index.js.map +1 -1
- package/build/components/post-content-information/index.js +1 -2
- package/build/components/post-content-information/index.js.map +1 -1
- package/build/components/post-featured-image/index.js +26 -7
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-last-revision/index.js +1 -1
- package/build/components/post-last-revision/index.js.map +1 -1
- package/build/components/post-schedule/label.js +1 -1
- package/build/components/post-schedule/label.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +9 -1
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +2 -2
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-url/index.js +1 -1
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/post-url/panel.js +3 -3
- package/build/components/post-url/panel.js.map +1 -1
- package/build/components/preview-dropdown/index.js +0 -4
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build/components/provider/index.js +10 -12
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +1 -1
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/sidebar/header.js +2 -1
- package/build/components/sidebar/header.js.map +1 -1
- package/build/components/sidebar/index.js +3 -3
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/time-to-read/index.js +2 -2
- package/build/components/time-to-read/index.js.map +1 -1
- package/build/components/visual-editor/index.js +25 -27
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/components/visual-editor/use-zoom-out-mode-exit.js +52 -0
- package/build/components/visual-editor/use-zoom-out-mode-exit.js.map +1 -0
- package/build/components/zoom-out-toggle/index.js +37 -5
- package/build/components/zoom-out-toggle/index.js.map +1 -1
- package/build/dataviews/actions/duplicate-template-part.js +2 -2
- package/build/dataviews/actions/duplicate-template-part.js.map +1 -1
- package/build/store/actions.js +4 -3
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +2 -2
- package/build/store/private-actions.js.map +1 -1
- package/build/store/selectors.js +3 -2
- package/build/store/selectors.js.map +1 -1
- package/build/utils/pageTypeBadge.js +51 -0
- package/build/utils/pageTypeBadge.js.map +1 -0
- package/build/utils/terms.js +2 -2
- package/build/utils/terms.js.map +1 -1
- package/build-module/bindings/post-meta.js +2 -1
- package/build-module/bindings/post-meta.js.map +1 -1
- package/build-module/components/collab-sidebar/add-comment.js +114 -0
- package/build-module/components/collab-sidebar/add-comment.js.map +1 -0
- package/build-module/components/collab-sidebar/comment-button-toolbar.js +30 -0
- package/build-module/components/collab-sidebar/comment-button-toolbar.js.map +1 -0
- package/build-module/components/collab-sidebar/comment-button.js +30 -0
- package/build-module/components/collab-sidebar/comment-button.js.map +1 -0
- package/build-module/components/collab-sidebar/comments.js +314 -0
- package/build-module/components/collab-sidebar/comments.js.map +1 -0
- package/build-module/components/collab-sidebar/constants.js +2 -0
- package/build-module/components/collab-sidebar/constants.js.map +1 -0
- package/build-module/components/collab-sidebar/index.js +264 -0
- package/build-module/components/collab-sidebar/index.js.map +1 -0
- package/build-module/components/collab-sidebar/utils.js +10 -0
- package/build-module/components/collab-sidebar/utils.js.map +1 -0
- package/build-module/components/commands/index.js +6 -6
- package/build-module/components/commands/index.js.map +1 -1
- package/build-module/components/document-bar/index.js +9 -8
- package/build-module/components/document-bar/index.js.map +1 -1
- package/build-module/components/document-tools/index.js +2 -6
- package/build-module/components/document-tools/index.js.map +1 -1
- package/build-module/components/editor-interface/index.js +3 -2
- package/build-module/components/editor-interface/index.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js +1 -1
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +3 -3
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build-module/components/global-styles-provider/index.js +13 -3
- package/build-module/components/global-styles-provider/index.js.map +1 -1
- package/build-module/components/header/index.js +5 -2
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/inserter-sidebar/index.js +2 -2
- package/build-module/components/inserter-sidebar/index.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +5 -5
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/plugin-more-menu-item/index.js +12 -10
- package/build-module/components/plugin-more-menu-item/index.js.map +1 -1
- package/build-module/components/plugin-preview-menu-item/index.js +14 -12
- package/build-module/components/plugin-preview-menu-item/index.js.map +1 -1
- package/build-module/components/plugin-sidebar/index.js +0 -15
- package/build-module/components/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/post-actions/index.js +5 -5
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-author/panel.js +4 -4
- package/build-module/components/post-author/panel.js.map +1 -1
- package/build-module/components/post-card-panel/index.js +8 -36
- package/build-module/components/post-card-panel/index.js.map +1 -1
- package/build-module/components/post-content-information/index.js +1 -2
- package/build-module/components/post-content-information/index.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +26 -7
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-last-revision/index.js +1 -1
- package/build-module/components/post-last-revision/index.js.map +1 -1
- package/build-module/components/post-schedule/label.js +1 -1
- package/build-module/components/post-schedule/label.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +12 -4
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +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-url/index.js +1 -1
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/post-url/panel.js +3 -3
- package/build-module/components/post-url/panel.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js +0 -4
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/provider/index.js +10 -12
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +1 -1
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/sidebar/header.js +2 -1
- package/build-module/components/sidebar/header.js.map +1 -1
- package/build-module/components/sidebar/index.js +4 -4
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/time-to-read/index.js +2 -2
- package/build-module/components/time-to-read/index.js.map +1 -1
- package/build-module/components/visual-editor/index.js +26 -28
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/components/visual-editor/use-zoom-out-mode-exit.js +46 -0
- package/build-module/components/visual-editor/use-zoom-out-mode-exit.js.map +1 -0
- package/build-module/components/zoom-out-toggle/index.js +37 -5
- package/build-module/components/zoom-out-toggle/index.js.map +1 -1
- package/build-module/dataviews/actions/duplicate-template-part.js +3 -3
- package/build-module/dataviews/actions/duplicate-template-part.js.map +1 -1
- package/build-module/store/actions.js +4 -3
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +3 -3
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/selectors.js +3 -2
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/pageTypeBadge.js +45 -0
- package/build-module/utils/pageTypeBadge.js.map +1 -0
- package/build-module/utils/terms.js +2 -2
- package/build-module/utils/terms.js.map +1 -1
- package/build-style/style-rtl.css +96 -54
- package/build-style/style.css +96 -54
- package/build-types/bindings/post-meta.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/add-comment.d.ts +15 -0
- package/build-types/components/collab-sidebar/add-comment.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/comment-button-toolbar.d.ts +5 -0
- package/build-types/components/collab-sidebar/comment-button-toolbar.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/comment-button.d.ts +5 -0
- package/build-types/components/collab-sidebar/comment-button.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/comments.d.ts +19 -0
- package/build-types/components/collab-sidebar/comments.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/constants.d.ts +2 -0
- package/build-types/components/collab-sidebar/constants.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/index.d.ts +5 -0
- package/build-types/components/collab-sidebar/index.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/utils.d.ts +8 -0
- package/build-types/components/collab-sidebar/utils.d.ts.map +1 -0
- package/build-types/components/commands/index.d.ts.map +1 -1
- package/build-types/components/document-bar/index.d.ts.map +1 -1
- package/build-types/components/document-tools/index.d.ts.map +1 -1
- package/build-types/components/editor-interface/index.d.ts.map +1 -1
- package/build-types/components/global-styles-provider/index.d.ts.map +1 -1
- package/build-types/components/header/index.d.ts.map +1 -1
- package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
- package/build-types/components/page-attributes/parent.d.ts.map +1 -1
- package/build-types/components/plugin-more-menu-item/index.d.ts +62 -2
- package/build-types/components/plugin-more-menu-item/index.d.ts.map +1 -1
- package/build-types/components/plugin-preview-menu-item/index.d.ts +41 -2
- package/build-types/components/plugin-preview-menu-item/index.d.ts.map +1 -1
- package/build-types/components/plugin-sidebar/index.d.ts.map +1 -1
- package/build-types/components/post-author/panel.d.ts.map +1 -1
- package/build-types/components/post-card-panel/index.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -1
- package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
- package/build-types/components/provider/index.d.ts.map +1 -1
- package/build-types/components/sidebar/index.d.ts.map +1 -1
- package/build-types/components/visual-editor/index.d.ts.map +1 -1
- package/build-types/components/visual-editor/use-zoom-out-mode-exit.d.ts +5 -0
- package/build-types/components/visual-editor/use-zoom-out-mode-exit.d.ts.map +1 -0
- package/build-types/components/zoom-out-toggle/index.d.ts +3 -1
- package/build-types/components/zoom-out-toggle/index.d.ts.map +1 -1
- package/build-types/store/actions.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts.map +1 -1
- package/build-types/utils/pageTypeBadge.d.ts +5 -0
- package/build-types/utils/pageTypeBadge.d.ts.map +1 -0
- package/build-types/utils/terms.d.ts.map +1 -1
- package/package.json +38 -37
- package/src/bindings/post-meta.js +1 -0
- package/src/components/collab-sidebar/add-comment.js +124 -0
- package/src/components/collab-sidebar/comment-button-toolbar.js +29 -0
- package/src/components/collab-sidebar/comment-button.js +31 -0
- package/src/components/collab-sidebar/comments.js +404 -0
- package/src/components/collab-sidebar/constants.js +1 -0
- package/src/components/collab-sidebar/index.js +307 -0
- package/src/components/collab-sidebar/style.scss +111 -0
- package/src/components/collab-sidebar/utils.js +9 -0
- package/src/components/commands/index.js +9 -7
- package/src/components/document-bar/index.js +15 -7
- package/src/components/document-bar/style.scss +0 -4
- package/src/components/document-tools/index.js +1 -7
- package/src/components/editor-interface/index.js +4 -3
- package/src/components/entities-saved-states/index.js +2 -2
- package/src/components/global-keyboard-shortcuts/register-shortcuts.js +3 -3
- package/src/components/global-styles-provider/index.js +20 -6
- package/src/components/header/index.js +3 -1
- package/src/components/inserter-sidebar/index.js +3 -6
- package/src/components/page-attributes/parent.js +6 -4
- package/src/components/plugin-more-menu-item/index.js +12 -11
- package/src/components/plugin-preview-menu-item/index.js +14 -13
- package/src/components/plugin-sidebar/index.js +0 -13
- package/src/components/post-actions/index.js +8 -11
- package/src/components/post-author/panel.js +4 -2
- package/src/components/post-card-panel/index.js +9 -43
- package/src/components/post-card-panel/style.scss +1 -9
- package/src/components/post-content-information/index.js +1 -1
- package/src/components/post-featured-image/index.js +31 -16
- package/src/components/post-featured-image/style.scss +5 -2
- package/src/components/post-last-revision/index.js +1 -1
- package/src/components/post-schedule/label.js +1 -1
- package/src/components/post-sticky/test/index.js +6 -6
- package/src/components/post-taxonomies/flat-term-selector.js +15 -4
- package/src/components/post-taxonomies/hierarchical-term-selector.js +2 -2
- package/src/components/post-url/index.js +1 -1
- package/src/components/post-url/panel.js +4 -2
- package/src/components/preview-dropdown/index.js +0 -2
- package/src/components/provider/index.js +31 -24
- package/src/components/provider/use-block-editor-settings.js +1 -1
- package/src/components/sidebar/header.js +3 -2
- package/src/components/sidebar/index.js +5 -3
- package/src/components/time-to-read/index.js +3 -3
- package/src/components/visual-editor/index.js +32 -41
- package/src/components/visual-editor/use-zoom-out-mode-exit.js +49 -0
- package/src/components/zoom-out-toggle/index.js +39 -5
- package/src/dataviews/actions/duplicate-template-part.tsx +3 -3
- package/src/store/actions.js +5 -3
- package/src/store/private-actions.js +3 -3
- package/src/store/selectors.js +3 -2
- package/src/style.scss +1 -0
- package/src/utils/pageTypeBadge.js +41 -0
- package/src/utils/terms.js +4 -2
- package/src/utils/test/terms.js +3 -3
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_element","_notices","_components","_data","_compose","_coreData","_a11y","_htmlEntities","_terms","_store","_jsxRuntime","DEFAULT_QUERY","per_page","orderby","order","_fields","context","MIN_TERMS_COUNT_FOR_FILTER","EMPTY_ARRAY","sortBySelected","termsTree","terms","treeHasSelection","termTree","indexOf","id","undefined","children","map","filter","child","length","termOrChildIsSelected","termA","termB","termASelected","termBSelected","newTermTree","sort","findTerm","parent","name","find","term","parseInt","toLowerCase","getFilterMatcher","filterValue","matchTermsForFilter","originalTerm","HierarchicalTermSelector","slug","_taxonomy$labels$sear","_taxonomy$name","adding","setAdding","useState","formName","setFormName","formParent","setFormParent","showForm","setShowForm","setFilterValue","filteredTermsTree","setFilteredTermsTree","debouncedSpeak","useDebounce","speak","hasCreateAction","hasAssignAction","loading","availableTerms","taxonomy","useSelect","select","_post$_links","_post$_links2","getCurrentPost","getEditedPostAttribute","editorStore","getTaxonomy","getEntityRecords","isResolving","coreStore","_taxonomy","post","_links","rest_base","editPost","useDispatch","saveEntityRecord","availableTermsTree","useMemo","buildTermsTree","createErrorNotice","noticesStore","addTerm","throwOnError","onUpdateTerms","termIds","onChange","termId","hasTerm","includes","newTerms","onChangeFormName","value","onChangeFormParent","parentId","onToggleForm","onAddTerm","event","_taxonomy$labels$sing","preventDefault","existingTerm","some","newTerm","error","message","type","defaultName","__","termAddedMessage","sprintf","_x","labels","singular_name","setFilter","newFilteredTermsTree","getResultCount","count","i","resultCount","resultsFoundMessage","_n","renderTerms","renderedTerms","jsxs","className","jsx","CheckboxControl","__nextHasNoMarginBottom","checked","label","decodeEntities","labelWithFallback","labelProperty","fallbackIsCategory","fallbackIsNotCategory","_taxonomy$labels$labe","newTermButtonLabel","newTermLabel","parentSelectLabel","noParentOption","newTermSubmitLabel","filterLabel","search_items","groupLabel","showFilter","Flex","direction","gap","SearchControl","__next40pxDefaultSize","placeholder","tabIndex","role","FlexItem","Button","onClick","variant","onSubmit","TextControl","required","TreeSelect","noOptionLabel","selectedId","tree","_default","exports","default","withFilters"],"sources":["@wordpress/editor/src/components/post-taxonomies/hierarchical-term-selector.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _n, _x, sprintf } from '@wordpress/i18n';\nimport { useMemo, useState } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport {\n\tButton,\n\tCheckboxControl,\n\tTextControl,\n\tTreeSelect,\n\twithFilters,\n\tFlex,\n\tFlexItem,\n\tSearchControl,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useDebounce } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { speak } from '@wordpress/a11y';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { buildTermsTree } from '../../utils/terms';\nimport { store as editorStore } from '../../store';\n\n/**\n * Module Constants\n */\nconst DEFAULT_QUERY = {\n\tper_page: -1,\n\torderby: 'name',\n\torder: 'asc',\n\t_fields: 'id,name,parent',\n\tcontext: 'view',\n};\n\nconst MIN_TERMS_COUNT_FOR_FILTER = 8;\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Sort Terms by Selected.\n *\n * @param {Object[]} termsTree Array of terms in tree format.\n * @param {number[]} terms Selected terms.\n *\n * @return {Object[]} Sorted array of terms.\n */\nexport function sortBySelected( termsTree, terms ) {\n\tconst treeHasSelection = ( termTree ) => {\n\t\tif ( terms.indexOf( termTree.id ) !== -1 ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( undefined === termTree.children ) {\n\t\t\treturn false;\n\t\t}\n\t\treturn (\n\t\t\ttermTree.children\n\t\t\t\t.map( treeHasSelection )\n\t\t\t\t.filter( ( child ) => child ).length > 0\n\t\t);\n\t};\n\tconst termOrChildIsSelected = ( termA, termB ) => {\n\t\tconst termASelected = treeHasSelection( termA );\n\t\tconst termBSelected = treeHasSelection( termB );\n\n\t\tif ( termASelected === termBSelected ) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tif ( termASelected && ! termBSelected ) {\n\t\t\treturn -1;\n\t\t}\n\n\t\tif ( ! termASelected && termBSelected ) {\n\t\t\treturn 1;\n\t\t}\n\n\t\treturn 0;\n\t};\n\tconst newTermTree = [ ...termsTree ];\n\tnewTermTree.sort( termOrChildIsSelected );\n\treturn newTermTree;\n}\n\n/**\n * Find term by parent id or name.\n *\n * @param {Object[]} terms Array of Terms.\n * @param {number|string} parent id.\n * @param {string} name Term name.\n * @return {Object} Term object.\n */\nexport function findTerm( terms, parent, name ) {\n\treturn terms.find( ( term ) => {\n\t\treturn (\n\t\t\t( ( ! term.parent && ! parent ) ||\n\t\t\t\tparseInt( term.parent ) === parseInt( parent ) ) &&\n\t\t\tterm.name.toLowerCase() === name.toLowerCase()\n\t\t);\n\t} );\n}\n\n/**\n * Get filter matcher function.\n *\n * @param {string} filterValue Filter value.\n * @return {(function(Object): (Object|boolean))} Matcher function.\n */\nexport function getFilterMatcher( filterValue ) {\n\tconst matchTermsForFilter = ( originalTerm ) => {\n\t\tif ( '' === filterValue ) {\n\t\t\treturn originalTerm;\n\t\t}\n\n\t\t// Shallow clone, because we'll be filtering the term's children and\n\t\t// don't want to modify the original term.\n\t\tconst term = { ...originalTerm };\n\n\t\t// Map and filter the children, recursive so we deal with grandchildren\n\t\t// and any deeper levels.\n\t\tif ( term.children.length > 0 ) {\n\t\t\tterm.children = term.children\n\t\t\t\t.map( matchTermsForFilter )\n\t\t\t\t.filter( ( child ) => child );\n\t\t}\n\n\t\t// If the term's name contains the filterValue, or it has children\n\t\t// (i.e. some child matched at some point in the tree) then return it.\n\t\tif (\n\t\t\t-1 !==\n\t\t\t\tterm.name.toLowerCase().indexOf( filterValue.toLowerCase() ) ||\n\t\t\tterm.children.length > 0\n\t\t) {\n\t\t\treturn term;\n\t\t}\n\n\t\t// Otherwise, return false. After mapping, the list of terms will need\n\t\t// to have false values filtered out.\n\t\treturn false;\n\t};\n\treturn matchTermsForFilter;\n}\n\n/**\n * Hierarchical term selector.\n *\n * @param {Object} props Component props.\n * @param {string} props.slug Taxonomy slug.\n * @return {Element} Hierarchical term selector component.\n */\nexport function HierarchicalTermSelector( { slug } ) {\n\tconst [ adding, setAdding ] = useState( false );\n\tconst [ formName, setFormName ] = useState( '' );\n\t/**\n\t * @type {[number|'', Function]}\n\t */\n\tconst [ formParent, setFormParent ] = useState( '' );\n\tconst [ showForm, setShowForm ] = useState( false );\n\tconst [ filterValue, setFilterValue ] = useState( '' );\n\tconst [ filteredTermsTree, setFilteredTermsTree ] = useState( [] );\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\n\tconst {\n\t\thasCreateAction,\n\t\thasAssignAction,\n\t\tterms,\n\t\tloading,\n\t\tavailableTerms,\n\t\ttaxonomy,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPost, getEditedPostAttribute } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst { getTaxonomy, getEntityRecords, isResolving } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst _taxonomy = getTaxonomy( slug );\n\t\t\tconst post = getCurrentPost();\n\n\t\t\treturn {\n\t\t\t\thasCreateAction: _taxonomy\n\t\t\t\t\t? post._links?.[\n\t\t\t\t\t\t\t'wp:action-create-' + _taxonomy.rest_base\n\t\t\t\t\t ] ?? false\n\t\t\t\t\t: false,\n\t\t\t\thasAssignAction: _taxonomy\n\t\t\t\t\t? post._links?.[\n\t\t\t\t\t\t\t'wp:action-assign-' + _taxonomy.rest_base\n\t\t\t\t\t ] ?? false\n\t\t\t\t\t: false,\n\t\t\t\tterms: _taxonomy\n\t\t\t\t\t? getEditedPostAttribute( _taxonomy.rest_base )\n\t\t\t\t\t: EMPTY_ARRAY,\n\t\t\t\tloading: isResolving( 'getEntityRecords', [\n\t\t\t\t\t'taxonomy',\n\t\t\t\t\tslug,\n\t\t\t\t\tDEFAULT_QUERY,\n\t\t\t\t] ),\n\t\t\t\tavailableTerms:\n\t\t\t\t\tgetEntityRecords( 'taxonomy', slug, DEFAULT_QUERY ) ||\n\t\t\t\t\tEMPTY_ARRAY,\n\t\t\t\ttaxonomy: _taxonomy,\n\t\t\t};\n\t\t},\n\t\t[ slug ]\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\tconst availableTermsTree = useMemo(\n\t\t() => sortBySelected( buildTermsTree( availableTerms ), terms ),\n\t\t// Remove `terms` from the dependency list to avoid reordering every time\n\t\t// checking or unchecking a term.\n\t\t[ availableTerms ]\n\t);\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tif ( ! hasAssignAction ) {\n\t\treturn null;\n\t}\n\n\t/**\n\t * Append new term.\n\t *\n\t * @param {Object} term Term object.\n\t * @return {Promise} A promise that resolves to save term object.\n\t */\n\tconst addTerm = ( term ) => {\n\t\treturn saveEntityRecord( 'taxonomy', slug, term, {\n\t\t\tthrowOnError: true,\n\t\t} );\n\t};\n\n\t/**\n\t * Update terms for post.\n\t *\n\t * @param {number[]} termIds Term ids.\n\t */\n\tconst onUpdateTerms = ( termIds ) => {\n\t\teditPost( { [ taxonomy.rest_base ]: termIds } );\n\t};\n\n\t/**\n\t * Handler for checking term.\n\t *\n\t * @param {number} termId\n\t */\n\tconst onChange = ( termId ) => {\n\t\tconst hasTerm = terms.includes( termId );\n\t\tconst newTerms = hasTerm\n\t\t\t? terms.filter( ( id ) => id !== termId )\n\t\t\t: [ ...terms, termId ];\n\t\tonUpdateTerms( newTerms );\n\t};\n\n\tconst onChangeFormName = ( value ) => {\n\t\tsetFormName( value );\n\t};\n\n\t/**\n\t * Handler for changing form parent.\n\t *\n\t * @param {number|''} parentId Parent post id.\n\t */\n\tconst onChangeFormParent = ( parentId ) => {\n\t\tsetFormParent( parentId );\n\t};\n\n\tconst onToggleForm = () => {\n\t\tsetShowForm( ! showForm );\n\t};\n\n\tconst onAddTerm = async ( event ) => {\n\t\tevent.preventDefault();\n\t\tif ( formName === '' || adding ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Check if the term we are adding already exists.\n\t\tconst existingTerm = findTerm( availableTerms, formParent, formName );\n\t\tif ( existingTerm ) {\n\t\t\t// If the term we are adding exists but is not selected select it.\n\t\t\tif ( ! terms.some( ( term ) => term === existingTerm.id ) ) {\n\t\t\t\tonUpdateTerms( [ ...terms, existingTerm.id ] );\n\t\t\t}\n\n\t\t\tsetFormName( '' );\n\t\t\tsetFormParent( '' );\n\n\t\t\treturn;\n\t\t}\n\t\tsetAdding( true );\n\t\tlet newTerm;\n\t\ttry {\n\t\t\tnewTerm = await addTerm( {\n\t\t\t\tname: formName,\n\t\t\t\tparent: formParent ? formParent : undefined,\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tcreateErrorNotice( error.message, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t\treturn;\n\t\t}\n\t\tconst defaultName =\n\t\t\tslug === 'category' ? __( 'Category' ) : __( 'Term' );\n\t\tconst termAddedMessage = sprintf(\n\t\t\t/* translators: %s: taxonomy name */\n\t\t\t_x( '%s added', 'term' ),\n\t\t\ttaxonomy?.labels?.singular_name ?? defaultName\n\t\t);\n\t\tspeak( termAddedMessage, 'assertive' );\n\t\tsetAdding( false );\n\t\tsetFormName( '' );\n\t\tsetFormParent( '' );\n\t\tonUpdateTerms( [ ...terms, newTerm.id ] );\n\t};\n\n\tconst setFilter = ( value ) => {\n\t\tconst newFilteredTermsTree = availableTermsTree\n\t\t\t.map( getFilterMatcher( value ) )\n\t\t\t.filter( ( term ) => term );\n\t\tconst getResultCount = ( termsTree ) => {\n\t\t\tlet count = 0;\n\t\t\tfor ( let i = 0; i < termsTree.length; i++ ) {\n\t\t\t\tcount++;\n\t\t\t\tif ( undefined !== termsTree[ i ].children ) {\n\t\t\t\t\tcount += getResultCount( termsTree[ i ].children );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn count;\n\t\t};\n\n\t\tsetFilterValue( value );\n\t\tsetFilteredTermsTree( newFilteredTermsTree );\n\n\t\tconst resultCount = getResultCount( newFilteredTermsTree );\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results */\n\t\t\t_n( '%d result found.', '%d results found.', resultCount ),\n\t\t\tresultCount\n\t\t);\n\n\t\tdebouncedSpeak( resultsFoundMessage, 'assertive' );\n\t};\n\n\tconst renderTerms = ( renderedTerms ) => {\n\t\treturn renderedTerms.map( ( term ) => {\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tkey={ term.id }\n\t\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-choice\"\n\t\t\t\t>\n\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tchecked={ terms.indexOf( term.id ) !== -1 }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tconst termId = parseInt( term.id, 10 );\n\t\t\t\t\t\t\tonChange( termId );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ decodeEntities( term.name ) }\n\t\t\t\t\t/>\n\t\t\t\t\t{ !! term.children.length && (\n\t\t\t\t\t\t<div className=\"editor-post-taxonomies__hierarchical-terms-subchoices\">\n\t\t\t\t\t\t\t{ renderTerms( term.children ) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t);\n\t\t} );\n\t};\n\n\tconst labelWithFallback = (\n\t\tlabelProperty,\n\t\tfallbackIsCategory,\n\t\tfallbackIsNotCategory\n\t) =>\n\t\ttaxonomy?.labels?.[ labelProperty ] ??\n\t\t( slug === 'category' ? fallbackIsCategory : fallbackIsNotCategory );\n\n\tconst newTermButtonLabel = labelWithFallback(\n\t\t'add_new_item',\n\t\t__( 'Add new category' ),\n\t\t__( 'Add new term' )\n\t);\n\tconst newTermLabel = labelWithFallback(\n\t\t'new_item_name',\n\t\t__( 'Add new category' ),\n\t\t__( 'Add new term' )\n\t);\n\tconst parentSelectLabel = labelWithFallback(\n\t\t'parent_item',\n\t\t__( 'Parent Category' ),\n\t\t__( 'Parent Term' )\n\t);\n\tconst noParentOption = `— ${ parentSelectLabel } —`;\n\tconst newTermSubmitLabel = newTermButtonLabel;\n\tconst filterLabel = taxonomy?.labels?.search_items ?? __( 'Search Terms' );\n\tconst groupLabel = taxonomy?.name ?? __( 'Terms' );\n\tconst showFilter = availableTerms.length >= MIN_TERMS_COUNT_FOR_FILTER;\n\n\treturn (\n\t\t<Flex direction=\"column\" gap=\"4\">\n\t\t\t{ showFilter && (\n\t\t\t\t<SearchControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ filterLabel }\n\t\t\t\t\tplaceholder={ filterLabel }\n\t\t\t\t\tvalue={ filterValue }\n\t\t\t\t\tonChange={ setFilter }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<div\n\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-list\"\n\t\t\t\ttabIndex=\"0\"\n\t\t\t\trole=\"group\"\n\t\t\t\taria-label={ groupLabel }\n\t\t\t>\n\t\t\t\t{ renderTerms(\n\t\t\t\t\t'' !== filterValue ? filteredTermsTree : availableTermsTree\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t{ ! loading && hasCreateAction && (\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tonClick={ onToggleForm }\n\t\t\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-add\"\n\t\t\t\t\t\taria-expanded={ showForm }\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ newTermButtonLabel }\n\t\t\t\t\t</Button>\n\t\t\t\t</FlexItem>\n\t\t\t) }\n\t\t\t{ showForm && (\n\t\t\t\t<form onSubmit={ onAddTerm }>\n\t\t\t\t\t<Flex direction=\"column\" gap=\"4\">\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-input\"\n\t\t\t\t\t\t\tlabel={ newTermLabel }\n\t\t\t\t\t\t\tvalue={ formName }\n\t\t\t\t\t\t\tonChange={ onChangeFormName }\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ !! availableTerms.length && (\n\t\t\t\t\t\t\t<TreeSelect\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ parentSelectLabel }\n\t\t\t\t\t\t\t\tnoOptionLabel={ noParentOption }\n\t\t\t\t\t\t\t\tonChange={ onChangeFormParent }\n\t\t\t\t\t\t\t\tselectedId={ formParent }\n\t\t\t\t\t\t\t\ttree={ availableTermsTree }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-submit\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ newTermSubmitLabel }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t</Flex>\n\t\t\t\t</form>\n\t\t\t) }\n\t\t</Flex>\n\t);\n}\n\nexport default withFilters( 'editor.PostTaxonomyType' )(\n\tHierarchicalTermSelector\n);\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAUA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,aAAA,GAAAR,OAAA;AAKA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AAAmD,IAAAW,WAAA,GAAAX,OAAA;AA1BnD;AACA;AACA;;AAoBA;AACA;AACA;;AAIA;AACA;AACA,GACA,MAAMY,aAAa,GAAG;EACrBC,QAAQ,EAAE,CAAC,CAAC;EACZC,OAAO,EAAE,MAAM;EACfC,KAAK,EAAE,KAAK;EACZC,OAAO,EAAE,gBAAgB;EACzBC,OAAO,EAAE;AACV,CAAC;AAED,MAAMC,0BAA0B,GAAG,CAAC;AAEpC,MAAMC,WAAW,GAAG,EAAE;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,cAAcA,CAAEC,SAAS,EAAEC,KAAK,EAAG;EAClD,MAAMC,gB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AkI,GAAA,EAAC1I,WAAA,CAAA6K,UAAU;UACVX,qBAAqB;UACrBtB,uBAAuB;UACvBE,KAAK,EAAGS,iBAAmB;UAC3BuB,aAAa,EAAGtB,cAAgB;UAChCrD,QAAQ,EAAGO,kBAAoB;UAC/BqE,UAAU,EAAGtH,UAAY;UACzBuH,IAAI,EAAGtF;QAAoB,CAC3B,CACD,eACD,IAAAlF,WAAA,CAAAkI,GAAA,EAAC1I,WAAA,CAAAsK,QAAQ;UAAA7I,QAAA,eACR,IAAAjB,WAAA,CAAAkI,GAAA,EAAC1I,WAAA,CAAAuK,MAAM;YACNL,qBAAqB;YACrBO,OAAO,EAAC,WAAW;YACnBnD,IAAI,EAAC,QAAQ;YACbmB,SAAS,EAAC,mDAAmD;YAAAhH,QAAA,EAE3DgI;UAAkB,CACb;QAAC,CACA,CAAC;MAAA,CACN;IAAC,CACF,CACN;EAAA,CACI,CAAC;AAET;AAAC,IAAAwB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAAC,uBAAW,EAAE,yBAA0B,CAAC,CACtDpI,wBACD,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_i18n","require","_element","_notices","_components","_data","_compose","_coreData","_a11y","_htmlEntities","_terms","_store","_jsxRuntime","DEFAULT_QUERY","per_page","orderby","order","_fields","context","MIN_TERMS_COUNT_FOR_FILTER","EMPTY_ARRAY","sortBySelected","termsTree","terms","treeHasSelection","termTree","indexOf","id","undefined","children","map","filter","child","length","termOrChildIsSelected","termA","termB","termASelected","termBSelected","newTermTree","sort","findTerm","parent","name","find","term","parseInt","toLowerCase","getFilterMatcher","filterValue","matchTermsForFilter","originalTerm","HierarchicalTermSelector","slug","_taxonomy$labels$sear","_taxonomy$name","adding","setAdding","useState","formName","setFormName","formParent","setFormParent","showForm","setShowForm","setFilterValue","filteredTermsTree","setFilteredTermsTree","debouncedSpeak","useDebounce","speak","hasCreateAction","hasAssignAction","loading","availableTerms","taxonomy","useSelect","select","_post$_links","_post$_links2","getCurrentPost","getEditedPostAttribute","editorStore","getTaxonomy","getEntityRecords","isResolving","coreStore","_taxonomy","post","_links","rest_base","editPost","useDispatch","saveEntityRecord","availableTermsTree","useMemo","buildTermsTree","createErrorNotice","noticesStore","addTerm","throwOnError","onUpdateTerms","termIds","onChange","termId","hasTerm","includes","newTerms","onChangeFormName","value","onChangeFormParent","parentId","onToggleForm","onAddTerm","event","_taxonomy$labels$sing","preventDefault","existingTerm","some","newTerm","error","message","type","defaultName","__","termAddedMessage","sprintf","_x","labels","singular_name","setFilter","newFilteredTermsTree","getResultCount","count","i","resultCount","resultsFoundMessage","_n","renderTerms","renderedTerms","jsxs","className","jsx","CheckboxControl","__nextHasNoMarginBottom","checked","label","decodeEntities","labelWithFallback","labelProperty","fallbackIsCategory","fallbackIsNotCategory","_taxonomy$labels$labe","newTermButtonLabel","newTermLabel","parentSelectLabel","noParentOption","newTermSubmitLabel","filterLabel","search_items","groupLabel","showFilter","Flex","direction","gap","SearchControl","__next40pxDefaultSize","placeholder","tabIndex","role","FlexItem","Button","onClick","variant","onSubmit","TextControl","required","TreeSelect","noOptionLabel","selectedId","tree","_default","exports","default","withFilters"],"sources":["@wordpress/editor/src/components/post-taxonomies/hierarchical-term-selector.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _n, _x, sprintf } from '@wordpress/i18n';\nimport { useMemo, useState } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport {\n\tButton,\n\tCheckboxControl,\n\tTextControl,\n\tTreeSelect,\n\twithFilters,\n\tFlex,\n\tFlexItem,\n\tSearchControl,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useDebounce } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { speak } from '@wordpress/a11y';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { buildTermsTree } from '../../utils/terms';\nimport { store as editorStore } from '../../store';\n\n/**\n * Module Constants\n */\nconst DEFAULT_QUERY = {\n\tper_page: -1,\n\torderby: 'name',\n\torder: 'asc',\n\t_fields: 'id,name,parent',\n\tcontext: 'view',\n};\n\nconst MIN_TERMS_COUNT_FOR_FILTER = 8;\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Sort Terms by Selected.\n *\n * @param {Object[]} termsTree Array of terms in tree format.\n * @param {number[]} terms Selected terms.\n *\n * @return {Object[]} Sorted array of terms.\n */\nexport function sortBySelected( termsTree, terms ) {\n\tconst treeHasSelection = ( termTree ) => {\n\t\tif ( terms.indexOf( termTree.id ) !== -1 ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( undefined === termTree.children ) {\n\t\t\treturn false;\n\t\t}\n\t\treturn (\n\t\t\ttermTree.children\n\t\t\t\t.map( treeHasSelection )\n\t\t\t\t.filter( ( child ) => child ).length > 0\n\t\t);\n\t};\n\tconst termOrChildIsSelected = ( termA, termB ) => {\n\t\tconst termASelected = treeHasSelection( termA );\n\t\tconst termBSelected = treeHasSelection( termB );\n\n\t\tif ( termASelected === termBSelected ) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tif ( termASelected && ! termBSelected ) {\n\t\t\treturn -1;\n\t\t}\n\n\t\tif ( ! termASelected && termBSelected ) {\n\t\t\treturn 1;\n\t\t}\n\n\t\treturn 0;\n\t};\n\tconst newTermTree = [ ...termsTree ];\n\tnewTermTree.sort( termOrChildIsSelected );\n\treturn newTermTree;\n}\n\n/**\n * Find term by parent id or name.\n *\n * @param {Object[]} terms Array of Terms.\n * @param {number|string} parent id.\n * @param {string} name Term name.\n * @return {Object} Term object.\n */\nexport function findTerm( terms, parent, name ) {\n\treturn terms.find( ( term ) => {\n\t\treturn (\n\t\t\t( ( ! term.parent && ! parent ) ||\n\t\t\t\tparseInt( term.parent ) === parseInt( parent ) ) &&\n\t\t\tterm.name.toLowerCase() === name.toLowerCase()\n\t\t);\n\t} );\n}\n\n/**\n * Get filter matcher function.\n *\n * @param {string} filterValue Filter value.\n * @return {(function(Object): (Object|boolean))} Matcher function.\n */\nexport function getFilterMatcher( filterValue ) {\n\tconst matchTermsForFilter = ( originalTerm ) => {\n\t\tif ( '' === filterValue ) {\n\t\t\treturn originalTerm;\n\t\t}\n\n\t\t// Shallow clone, because we'll be filtering the term's children and\n\t\t// don't want to modify the original term.\n\t\tconst term = { ...originalTerm };\n\n\t\t// Map and filter the children, recursive so we deal with grandchildren\n\t\t// and any deeper levels.\n\t\tif ( term.children.length > 0 ) {\n\t\t\tterm.children = term.children\n\t\t\t\t.map( matchTermsForFilter )\n\t\t\t\t.filter( ( child ) => child );\n\t\t}\n\n\t\t// If the term's name contains the filterValue, or it has children\n\t\t// (i.e. some child matched at some point in the tree) then return it.\n\t\tif (\n\t\t\t-1 !==\n\t\t\t\tterm.name.toLowerCase().indexOf( filterValue.toLowerCase() ) ||\n\t\t\tterm.children.length > 0\n\t\t) {\n\t\t\treturn term;\n\t\t}\n\n\t\t// Otherwise, return false. After mapping, the list of terms will need\n\t\t// to have false values filtered out.\n\t\treturn false;\n\t};\n\treturn matchTermsForFilter;\n}\n\n/**\n * Hierarchical term selector.\n *\n * @param {Object} props Component props.\n * @param {string} props.slug Taxonomy slug.\n * @return {Element} Hierarchical term selector component.\n */\nexport function HierarchicalTermSelector( { slug } ) {\n\tconst [ adding, setAdding ] = useState( false );\n\tconst [ formName, setFormName ] = useState( '' );\n\t/**\n\t * @type {[number|'', Function]}\n\t */\n\tconst [ formParent, setFormParent ] = useState( '' );\n\tconst [ showForm, setShowForm ] = useState( false );\n\tconst [ filterValue, setFilterValue ] = useState( '' );\n\tconst [ filteredTermsTree, setFilteredTermsTree ] = useState( [] );\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\n\tconst {\n\t\thasCreateAction,\n\t\thasAssignAction,\n\t\tterms,\n\t\tloading,\n\t\tavailableTerms,\n\t\ttaxonomy,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPost, getEditedPostAttribute } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst { getTaxonomy, getEntityRecords, isResolving } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst _taxonomy = getTaxonomy( slug );\n\t\t\tconst post = getCurrentPost();\n\n\t\t\treturn {\n\t\t\t\thasCreateAction: _taxonomy\n\t\t\t\t\t? post._links?.[\n\t\t\t\t\t\t\t'wp:action-create-' + _taxonomy.rest_base\n\t\t\t\t\t ] ?? false\n\t\t\t\t\t: false,\n\t\t\t\thasAssignAction: _taxonomy\n\t\t\t\t\t? post._links?.[\n\t\t\t\t\t\t\t'wp:action-assign-' + _taxonomy.rest_base\n\t\t\t\t\t ] ?? false\n\t\t\t\t\t: false,\n\t\t\t\tterms: _taxonomy\n\t\t\t\t\t? getEditedPostAttribute( _taxonomy.rest_base )\n\t\t\t\t\t: EMPTY_ARRAY,\n\t\t\t\tloading: isResolving( 'getEntityRecords', [\n\t\t\t\t\t'taxonomy',\n\t\t\t\t\tslug,\n\t\t\t\t\tDEFAULT_QUERY,\n\t\t\t\t] ),\n\t\t\t\tavailableTerms:\n\t\t\t\t\tgetEntityRecords( 'taxonomy', slug, DEFAULT_QUERY ) ||\n\t\t\t\t\tEMPTY_ARRAY,\n\t\t\t\ttaxonomy: _taxonomy,\n\t\t\t};\n\t\t},\n\t\t[ slug ]\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\tconst availableTermsTree = useMemo(\n\t\t() => sortBySelected( buildTermsTree( availableTerms ), terms ),\n\t\t// Remove `terms` from the dependency list to avoid reordering every time\n\t\t// checking or unchecking a term.\n\t\t[ availableTerms ]\n\t);\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tif ( ! hasAssignAction ) {\n\t\treturn null;\n\t}\n\n\t/**\n\t * Append new term.\n\t *\n\t * @param {Object} term Term object.\n\t * @return {Promise} A promise that resolves to save term object.\n\t */\n\tconst addTerm = ( term ) => {\n\t\treturn saveEntityRecord( 'taxonomy', slug, term, {\n\t\t\tthrowOnError: true,\n\t\t} );\n\t};\n\n\t/**\n\t * Update terms for post.\n\t *\n\t * @param {number[]} termIds Term ids.\n\t */\n\tconst onUpdateTerms = ( termIds ) => {\n\t\teditPost( { [ taxonomy.rest_base ]: termIds } );\n\t};\n\n\t/**\n\t * Handler for checking term.\n\t *\n\t * @param {number} termId\n\t */\n\tconst onChange = ( termId ) => {\n\t\tconst hasTerm = terms.includes( termId );\n\t\tconst newTerms = hasTerm\n\t\t\t? terms.filter( ( id ) => id !== termId )\n\t\t\t: [ ...terms, termId ];\n\t\tonUpdateTerms( newTerms );\n\t};\n\n\tconst onChangeFormName = ( value ) => {\n\t\tsetFormName( value );\n\t};\n\n\t/**\n\t * Handler for changing form parent.\n\t *\n\t * @param {number|''} parentId Parent post id.\n\t */\n\tconst onChangeFormParent = ( parentId ) => {\n\t\tsetFormParent( parentId );\n\t};\n\n\tconst onToggleForm = () => {\n\t\tsetShowForm( ! showForm );\n\t};\n\n\tconst onAddTerm = async ( event ) => {\n\t\tevent.preventDefault();\n\t\tif ( formName === '' || adding ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Check if the term we are adding already exists.\n\t\tconst existingTerm = findTerm( availableTerms, formParent, formName );\n\t\tif ( existingTerm ) {\n\t\t\t// If the term we are adding exists but is not selected select it.\n\t\t\tif ( ! terms.some( ( term ) => term === existingTerm.id ) ) {\n\t\t\t\tonUpdateTerms( [ ...terms, existingTerm.id ] );\n\t\t\t}\n\n\t\t\tsetFormName( '' );\n\t\t\tsetFormParent( '' );\n\n\t\t\treturn;\n\t\t}\n\t\tsetAdding( true );\n\t\tlet newTerm;\n\t\ttry {\n\t\t\tnewTerm = await addTerm( {\n\t\t\t\tname: formName,\n\t\t\t\tparent: formParent ? formParent : undefined,\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tcreateErrorNotice( error.message, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t\treturn;\n\t\t}\n\t\tconst defaultName =\n\t\t\tslug === 'category' ? __( 'Category' ) : __( 'Term' );\n\t\tconst termAddedMessage = sprintf(\n\t\t\t/* translators: %s: term name. */\n\t\t\t_x( '%s added', 'term' ),\n\t\t\ttaxonomy?.labels?.singular_name ?? defaultName\n\t\t);\n\t\tspeak( termAddedMessage, 'assertive' );\n\t\tsetAdding( false );\n\t\tsetFormName( '' );\n\t\tsetFormParent( '' );\n\t\tonUpdateTerms( [ ...terms, newTerm.id ] );\n\t};\n\n\tconst setFilter = ( value ) => {\n\t\tconst newFilteredTermsTree = availableTermsTree\n\t\t\t.map( getFilterMatcher( value ) )\n\t\t\t.filter( ( term ) => term );\n\t\tconst getResultCount = ( termsTree ) => {\n\t\t\tlet count = 0;\n\t\t\tfor ( let i = 0; i < termsTree.length; i++ ) {\n\t\t\t\tcount++;\n\t\t\t\tif ( undefined !== termsTree[ i ].children ) {\n\t\t\t\t\tcount += getResultCount( termsTree[ i ].children );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn count;\n\t\t};\n\n\t\tsetFilterValue( value );\n\t\tsetFilteredTermsTree( newFilteredTermsTree );\n\n\t\tconst resultCount = getResultCount( newFilteredTermsTree );\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', resultCount ),\n\t\t\tresultCount\n\t\t);\n\n\t\tdebouncedSpeak( resultsFoundMessage, 'assertive' );\n\t};\n\n\tconst renderTerms = ( renderedTerms ) => {\n\t\treturn renderedTerms.map( ( term ) => {\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tkey={ term.id }\n\t\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-choice\"\n\t\t\t\t>\n\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tchecked={ terms.indexOf( term.id ) !== -1 }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tconst termId = parseInt( term.id, 10 );\n\t\t\t\t\t\t\tonChange( termId );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ decodeEntities( term.name ) }\n\t\t\t\t\t/>\n\t\t\t\t\t{ !! term.children.length && (\n\t\t\t\t\t\t<div className=\"editor-post-taxonomies__hierarchical-terms-subchoices\">\n\t\t\t\t\t\t\t{ renderTerms( term.children ) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t);\n\t\t} );\n\t};\n\n\tconst labelWithFallback = (\n\t\tlabelProperty,\n\t\tfallbackIsCategory,\n\t\tfallbackIsNotCategory\n\t) =>\n\t\ttaxonomy?.labels?.[ labelProperty ] ??\n\t\t( slug === 'category' ? fallbackIsCategory : fallbackIsNotCategory );\n\n\tconst newTermButtonLabel = labelWithFallback(\n\t\t'add_new_item',\n\t\t__( 'Add new category' ),\n\t\t__( 'Add new term' )\n\t);\n\tconst newTermLabel = labelWithFallback(\n\t\t'new_item_name',\n\t\t__( 'Add new category' ),\n\t\t__( 'Add new term' )\n\t);\n\tconst parentSelectLabel = labelWithFallback(\n\t\t'parent_item',\n\t\t__( 'Parent Category' ),\n\t\t__( 'Parent Term' )\n\t);\n\tconst noParentOption = `— ${ parentSelectLabel } —`;\n\tconst newTermSubmitLabel = newTermButtonLabel;\n\tconst filterLabel = taxonomy?.labels?.search_items ?? __( 'Search Terms' );\n\tconst groupLabel = taxonomy?.name ?? __( 'Terms' );\n\tconst showFilter = availableTerms.length >= MIN_TERMS_COUNT_FOR_FILTER;\n\n\treturn (\n\t\t<Flex direction=\"column\" gap=\"4\">\n\t\t\t{ showFilter && (\n\t\t\t\t<SearchControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ filterLabel }\n\t\t\t\t\tplaceholder={ filterLabel }\n\t\t\t\t\tvalue={ filterValue }\n\t\t\t\t\tonChange={ setFilter }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<div\n\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-list\"\n\t\t\t\ttabIndex=\"0\"\n\t\t\t\trole=\"group\"\n\t\t\t\taria-label={ groupLabel }\n\t\t\t>\n\t\t\t\t{ renderTerms(\n\t\t\t\t\t'' !== filterValue ? filteredTermsTree : availableTermsTree\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t{ ! loading && hasCreateAction && (\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tonClick={ onToggleForm }\n\t\t\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-add\"\n\t\t\t\t\t\taria-expanded={ showForm }\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ newTermButtonLabel }\n\t\t\t\t\t</Button>\n\t\t\t\t</FlexItem>\n\t\t\t) }\n\t\t\t{ showForm && (\n\t\t\t\t<form onSubmit={ onAddTerm }>\n\t\t\t\t\t<Flex direction=\"column\" gap=\"4\">\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-input\"\n\t\t\t\t\t\t\tlabel={ newTermLabel }\n\t\t\t\t\t\t\tvalue={ formName }\n\t\t\t\t\t\t\tonChange={ onChangeFormName }\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ !! availableTerms.length && (\n\t\t\t\t\t\t\t<TreeSelect\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ parentSelectLabel }\n\t\t\t\t\t\t\t\tnoOptionLabel={ noParentOption }\n\t\t\t\t\t\t\t\tonChange={ onChangeFormParent }\n\t\t\t\t\t\t\t\tselectedId={ formParent }\n\t\t\t\t\t\t\t\ttree={ availableTermsTree }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-submit\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ newTermSubmitLabel }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t</Flex>\n\t\t\t\t</form>\n\t\t\t) }\n\t\t</Flex>\n\t);\n}\n\nexport default withFilters( 'editor.PostTaxonomyType' )(\n\tHierarchicalTermSelector\n);\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAUA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,aAAA,GAAAR,OAAA;AAKA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AAAmD,IAAAW,WAAA,GAAAX,OAAA;AA1BnD;AACA;AACA;;AAoBA;AACA;AACA;;AAIA;AACA;AACA,GACA,MAAMY,aAAa,GAAG;EACrBC,QAAQ,EAAE,CAAC,CAAC;EACZC,OAAO,EAAE,MAAM;EACfC,KAAK,EAAE,KAAK;EACZC,OAAO,EAAE,gBAAgB;EACzBC,OAAO,EAAE;AACV,CAAC;AAED,MAAMC,0BAA0B,GAAG,CAAC;AAEpC,MAAMC,WAAW,GAAG,EAAE;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,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AC,CAAEtG,cAAc,CAACzC,MAAM,iBACzB,IAAArB,WAAA,CAAAkI,GAAA,EAAC1I,WAAA,CAAA6K,UAAU;UACVX,qBAAqB;UACrBtB,uBAAuB;UACvBE,KAAK,EAAGS,iBAAmB;UAC3BuB,aAAa,EAAGtB,cAAgB;UAChCrD,QAAQ,EAAGO,kBAAoB;UAC/BqE,UAAU,EAAGtH,UAAY;UACzBuH,IAAI,EAAGtF;QAAoB,CAC3B,CACD,eACD,IAAAlF,WAAA,CAAAkI,GAAA,EAAC1I,WAAA,CAAAsK,QAAQ;UAAA7I,QAAA,eACR,IAAAjB,WAAA,CAAAkI,GAAA,EAAC1I,WAAA,CAAAuK,MAAM;YACNL,qBAAqB;YACrBO,OAAO,EAAC,WAAW;YACnBnD,IAAI,EAAC,QAAQ;YACbmB,SAAS,EAAC,mDAAmD;YAAAhH,QAAA,EAE3DgI;UAAkB,CACb;QAAC,CACA,CAAC;MAAA,CACN;IAAC,CACF,CACN;EAAA,CACI,CAAC;AAET;AAAC,IAAAwB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAAC,uBAAW,EAAE,yBAA0B,CAAC,CACtDpI,wBACD,CAAC","ignoreList":[]}
|
|
@@ -75,7 +75,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
75
75
|
type: 'snackbar'
|
|
76
76
|
});
|
|
77
77
|
});
|
|
78
|
-
const postUrlSlugDescriptionId = 'editor-post-url__slug-
|
|
78
|
+
const postUrlSlugDescriptionId = 'editor-post-url__slug-description-' + (0, _compose.useInstanceId)(PostURL);
|
|
79
79
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
80
80
|
className: "editor-post-url",
|
|
81
81
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.__experimentalInspectorPopoverHeader, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_url","_element","_blockEditor","_i18n","_components","_notices","_icons","_coreData","_compose","_store","_jsxRuntime","PostURL","onClose","isEditable","postSlug","postLink","permalinkPrefix","permalinkSuffix","permalink","useSelect","select","_post$_links$wpActio","post","editorStore","getCurrentPost","postTypeSlug","getCurrentPostType","postType","coreStore","getPostType","permalinkParts","getPermalinkParts","hasPublishAction","_links","isPermalinkEditable","safeDecodeURIComponent","getEditedPostSlug","viewPostLabel","labels","view_item","link","prefix","suffix","getPermalink","editPost","useDispatch","createNotice","noticesStore","forceEmptyField","setForceEmptyField","useState","copyButtonRef","useCopyToClipboard","__","isDismissible","type","postUrlSlugDescriptionId","useInstanceId","jsxs","className","children","jsx","__experimentalInspectorPopoverHeader","title","__experimentalVStack","spacing","createInterpolateElement","span","id","a","ExternalLink","href","Fragment","__experimentalInputControl","__next40pxDefaultSize","__experimentalInputControlPrefixWrapper","__experimentalInputControlSuffixWrapper","variant","Button","icon","copySmall","ref","size","label","hideLabelFromVision","value","autoComplete","spellCheck","onChange","newValue","slug","onBlur","event","cleanForSlug","target"],"sources":["@wordpress/editor/src/components/post-url/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { safeDecodeURIComponent, cleanForSlug } from '@wordpress/url';\nimport { useState, createInterpolateElement } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tExternalLink,\n\tButton,\n\t__experimentalInputControl as InputControl,\n\t__experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,\n\t__experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { copySmall } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useCopyToClipboard, useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Renders the `PostURL` component.\n *\n * @example\n * ```jsx\n * <PostURL />\n * ```\n *\n * @param {Function} onClose Callback function to be executed when the popover is closed.\n *\n * @return {Component} The rendered PostURL component.\n */\nexport default function PostURL( { onClose } ) {\n\tconst {\n\t\tisEditable,\n\t\tpostSlug,\n\t\tpostLink,\n\t\tpermalinkPrefix,\n\t\tpermalinkSuffix,\n\t\tpermalink,\n\t} = useSelect( ( select ) => {\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\tconst postTypeSlug = select( editorStore ).getCurrentPostType();\n\t\tconst postType = select( coreStore ).getPostType( postTypeSlug );\n\t\tconst permalinkParts = select( editorStore ).getPermalinkParts();\n\t\tconst hasPublishAction = post?._links?.[ 'wp:action-publish' ] ?? false;\n\n\t\treturn {\n\t\t\tisEditable:\n\t\t\t\tselect( editorStore ).isPermalinkEditable() && hasPublishAction,\n\t\t\tpostSlug: safeDecodeURIComponent(\n\t\t\t\tselect( editorStore ).getEditedPostSlug()\n\t\t\t),\n\t\t\tviewPostLabel: postType?.labels.view_item,\n\t\t\tpostLink: post.link,\n\t\t\tpermalinkPrefix: permalinkParts?.prefix,\n\t\t\tpermalinkSuffix: permalinkParts?.suffix,\n\t\t\tpermalink: safeDecodeURIComponent(\n\t\t\t\tselect( editorStore ).getPermalink()\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst [ forceEmptyField, setForceEmptyField ] = useState( false );\n\tconst copyButtonRef = useCopyToClipboard( permalink, () => {\n\t\tcreateNotice( 'info', __( 'Copied Permalink to clipboard.' ), {\n\t\t\tisDismissible: true,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t} );\n\tconst postUrlSlugDescriptionId =\n\t\t'editor-post-url__slug-descriotion-' + useInstanceId( PostURL );\n\n\treturn (\n\t\t<div className=\"editor-post-url\">\n\t\t\t<InspectorPopoverHeader\n\t\t\t\ttitle={ __( 'Slug' ) }\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t{ isEditable && (\n\t\t\t\t\t<p className=\"editor-post-url__intro\">\n\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'<span>Customize the last part of the Permalink.</span> <a>Learn more.</a>'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tspan: <span id={ postUrlSlugDescriptionId } />,\n\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink'\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}\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t\t<div>\n\t\t\t\t\t{ isEditable && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<InputControl\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tprefix={\n\t\t\t\t\t\t\t\t\t<InputControlPrefixWrapper>\n\t\t\t\t\t\t\t\t\t\t/\n\t\t\t\t\t\t\t\t\t</InputControlPrefixWrapper>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsuffix={\n\t\t\t\t\t\t\t\t\t<InputControlSuffixWrapper variant=\"control\">\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\ticon={ copySmall }\n\t\t\t\t\t\t\t\t\t\t\tref={ copyButtonRef }\n\t\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\t\tlabel=\"Copy\"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</InputControlSuffixWrapper>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tlabel={ __( 'Slug' ) }\n\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t\tvalue={ forceEmptyField ? '' : postSlug }\n\t\t\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\t\t\tspellCheck=\"false\"\n\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\tclassName=\"editor-post-url__input\"\n\t\t\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\t\t\teditPost( { slug: newValue } );\n\t\t\t\t\t\t\t\t\t// When we delete the field the permalink gets\n\t\t\t\t\t\t\t\t\t// reverted to the original value.\n\t\t\t\t\t\t\t\t\t// The forceEmptyField logic allows the user to have\n\t\t\t\t\t\t\t\t\t// the field temporarily empty while typing.\n\t\t\t\t\t\t\t\t\tif ( ! newValue ) {\n\t\t\t\t\t\t\t\t\t\tif ( ! forceEmptyField ) {\n\t\t\t\t\t\t\t\t\t\t\tsetForceEmptyField( true );\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( forceEmptyField ) {\n\t\t\t\t\t\t\t\t\t\tsetForceEmptyField( false );\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\tonBlur={ ( event ) => {\n\t\t\t\t\t\t\t\t\teditPost( {\n\t\t\t\t\t\t\t\t\t\tslug: cleanForSlug(\n\t\t\t\t\t\t\t\t\t\t\tevent.target.value\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\tif ( forceEmptyField ) {\n\t\t\t\t\t\t\t\t\t\tsetForceEmptyField( false );\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\taria-describedby={ postUrlSlugDescriptionId }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<p className=\"editor-post-url__permalink\">\n\t\t\t\t\t\t\t\t<span className=\"editor-post-url__permalink-visual-label\">\n\t\t\t\t\t\t\t\t\t{ __( 'Permalink:' ) }\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\tclassName=\"editor-post-url__link\"\n\t\t\t\t\t\t\t\t\thref={ postLink }\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<span className=\"editor-post-url__link-prefix\">\n\t\t\t\t\t\t\t\t\t\t{ permalinkPrefix }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t<span className=\"editor-post-url__link-slug\">\n\t\t\t\t\t\t\t\t\t\t{ postSlug }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t<span className=\"editor-post-url__link-suffix\">\n\t\t\t\t\t\t\t\t\t\t{ permalinkSuffix }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isEditable && (\n\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\tclassName=\"editor-post-url__link\"\n\t\t\t\t\t\t\thref={ postLink }\n\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ postLink }\n\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</VStack>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK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ACb,IAAAH,WAAA,CAAAmD,GAAA,EAACzD,WAAA,CAAAkE,YAAY;UACZX,SAAS,EAAC,uBAAuB;UACjCY,IAAI,EAAGxD,QAAU;UACjB+E,MAAM,EAAC,QAAQ;UAAAlC,QAAA,EAEb7C;QAAQ,CACG,CACd;MAAA,CACG,CAAC;IAAA,CACC,CAAC;EAAA,CACL,CAAC;AAER","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_data","require","_url","_element","_blockEditor","_i18n","_components","_notices","_icons","_coreData","_compose","_store","_jsxRuntime","PostURL","onClose","isEditable","postSlug","postLink","permalinkPrefix","permalinkSuffix","permalink","useSelect","select","_post$_links$wpActio","post","editorStore","getCurrentPost","postTypeSlug","getCurrentPostType","postType","coreStore","getPostType","permalinkParts","getPermalinkParts","hasPublishAction","_links","isPermalinkEditable","safeDecodeURIComponent","getEditedPostSlug","viewPostLabel","labels","view_item","link","prefix","suffix","getPermalink","editPost","useDispatch","createNotice","noticesStore","forceEmptyField","setForceEmptyField","useState","copyButtonRef","useCopyToClipboard","__","isDismissible","type","postUrlSlugDescriptionId","useInstanceId","jsxs","className","children","jsx","__experimentalInspectorPopoverHeader","title","__experimentalVStack","spacing","createInterpolateElement","span","id","a","ExternalLink","href","Fragment","__experimentalInputControl","__next40pxDefaultSize","__experimentalInputControlPrefixWrapper","__experimentalInputControlSuffixWrapper","variant","Button","icon","copySmall","ref","size","label","hideLabelFromVision","value","autoComplete","spellCheck","onChange","newValue","slug","onBlur","event","cleanForSlug","target"],"sources":["@wordpress/editor/src/components/post-url/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { safeDecodeURIComponent, cleanForSlug } from '@wordpress/url';\nimport { useState, createInterpolateElement } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tExternalLink,\n\tButton,\n\t__experimentalInputControl as InputControl,\n\t__experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,\n\t__experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { copySmall } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useCopyToClipboard, useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Renders the `PostURL` component.\n *\n * @example\n * ```jsx\n * <PostURL />\n * ```\n *\n * @param {Function} onClose Callback function to be executed when the popover is closed.\n *\n * @return {Component} The rendered PostURL component.\n */\nexport default function PostURL( { onClose } ) {\n\tconst {\n\t\tisEditable,\n\t\tpostSlug,\n\t\tpostLink,\n\t\tpermalinkPrefix,\n\t\tpermalinkSuffix,\n\t\tpermalink,\n\t} = useSelect( ( select ) => {\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\tconst postTypeSlug = select( editorStore ).getCurrentPostType();\n\t\tconst postType = select( coreStore ).getPostType( postTypeSlug );\n\t\tconst permalinkParts = select( editorStore ).getPermalinkParts();\n\t\tconst hasPublishAction = post?._links?.[ 'wp:action-publish' ] ?? false;\n\n\t\treturn {\n\t\t\tisEditable:\n\t\t\t\tselect( editorStore ).isPermalinkEditable() && hasPublishAction,\n\t\t\tpostSlug: safeDecodeURIComponent(\n\t\t\t\tselect( editorStore ).getEditedPostSlug()\n\t\t\t),\n\t\t\tviewPostLabel: postType?.labels.view_item,\n\t\t\tpostLink: post.link,\n\t\t\tpermalinkPrefix: permalinkParts?.prefix,\n\t\t\tpermalinkSuffix: permalinkParts?.suffix,\n\t\t\tpermalink: safeDecodeURIComponent(\n\t\t\t\tselect( editorStore ).getPermalink()\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst [ forceEmptyField, setForceEmptyField ] = useState( false );\n\tconst copyButtonRef = useCopyToClipboard( permalink, () => {\n\t\tcreateNotice( 'info', __( 'Copied Permalink to clipboard.' ), {\n\t\t\tisDismissible: true,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t} );\n\tconst postUrlSlugDescriptionId =\n\t\t'editor-post-url__slug-description-' + useInstanceId( PostURL );\n\n\treturn (\n\t\t<div className=\"editor-post-url\">\n\t\t\t<InspectorPopoverHeader\n\t\t\t\ttitle={ __( 'Slug' ) }\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t{ isEditable && (\n\t\t\t\t\t<p className=\"editor-post-url__intro\">\n\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'<span>Customize the last part of the Permalink.</span> <a>Learn more.</a>'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tspan: <span id={ postUrlSlugDescriptionId } />,\n\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink'\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}\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t\t<div>\n\t\t\t\t\t{ isEditable && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<InputControl\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tprefix={\n\t\t\t\t\t\t\t\t\t<InputControlPrefixWrapper>\n\t\t\t\t\t\t\t\t\t\t/\n\t\t\t\t\t\t\t\t\t</InputControlPrefixWrapper>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsuffix={\n\t\t\t\t\t\t\t\t\t<InputControlSuffixWrapper variant=\"control\">\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\ticon={ copySmall }\n\t\t\t\t\t\t\t\t\t\t\tref={ copyButtonRef }\n\t\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\t\tlabel=\"Copy\"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</InputControlSuffixWrapper>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tlabel={ __( 'Slug' ) }\n\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t\tvalue={ forceEmptyField ? '' : postSlug }\n\t\t\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\t\t\tspellCheck=\"false\"\n\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\tclassName=\"editor-post-url__input\"\n\t\t\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\t\t\teditPost( { slug: newValue } );\n\t\t\t\t\t\t\t\t\t// When we delete the field the permalink gets\n\t\t\t\t\t\t\t\t\t// reverted to the original value.\n\t\t\t\t\t\t\t\t\t// The forceEmptyField logic allows the user to have\n\t\t\t\t\t\t\t\t\t// the field temporarily empty while typing.\n\t\t\t\t\t\t\t\t\tif ( ! newValue ) {\n\t\t\t\t\t\t\t\t\t\tif ( ! forceEmptyField ) {\n\t\t\t\t\t\t\t\t\t\t\tsetForceEmptyField( true );\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( forceEmptyField ) {\n\t\t\t\t\t\t\t\t\t\tsetForceEmptyField( false );\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\tonBlur={ ( event ) => {\n\t\t\t\t\t\t\t\t\teditPost( {\n\t\t\t\t\t\t\t\t\t\tslug: cleanForSlug(\n\t\t\t\t\t\t\t\t\t\t\tevent.target.value\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\tif ( forceEmptyField ) {\n\t\t\t\t\t\t\t\t\t\tsetForceEmptyField( false );\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\taria-describedby={ postUrlSlugDescriptionId }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<p className=\"editor-post-url__permalink\">\n\t\t\t\t\t\t\t\t<span className=\"editor-post-url__permalink-visual-label\">\n\t\t\t\t\t\t\t\t\t{ __( 'Permalink:' ) }\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\tclassName=\"editor-post-url__link\"\n\t\t\t\t\t\t\t\t\thref={ postLink }\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<span className=\"editor-post-url__link-prefix\">\n\t\t\t\t\t\t\t\t\t\t{ permalinkPrefix }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t<span className=\"editor-post-url__link-slug\">\n\t\t\t\t\t\t\t\t\t\t{ postSlug }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t<span className=\"editor-post-url__link-suffix\">\n\t\t\t\t\t\t\t\t\t\t{ permalinkSuffix }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isEditable && (\n\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\tclassName=\"editor-post-url__link\"\n\t\t\t\t\t\t\thref={ postLink }\n\t\t\t\t\t\t\ttarget=\"_blank\"\n\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8B;gBAAAC,QAAA,EAC3C5C;cAAe,CACZ,CAAC,eACP,IAAAN,WAAA,CAAAmD,GAAA;gBAAMF,SAAS,EAAC,4BAA4B;gBAAAC,QAAA,EACzC9C;cAAQ,CACL,CAAC,eACP,IAAAJ,WAAA,CAAAmD,GAAA;gBAAMF,SAAS,EAAC,8BAA8B;gBAAAC,QAAA,EAC3C3C;cAAe,CACZ,CAAC;YAAA,CACM,CAAC;UAAA,CACb,CAAC;QAAA,CACH,CACF,EACC,CAAEJ,UAAU,iBACb,IAAAH,WAAA,CAAAmD,GAAA,EAACzD,WAAA,CAAAkE,YAAY;UACZX,SAAS,EAAC,uBAAuB;UACjCY,IAAI,EAAGxD,QAAU;UACjB+E,MAAM,EAAC,QAAQ;UAAAlC,QAAA,EAEb7C;QAAQ,CACG,CACd;MAAA,CACG,CAAC;IAAA,CACC,CAAC;EAAA,CACL,CAAC;AAER","ignoreList":[]}
|
|
@@ -102,10 +102,10 @@ function PostURLToggle({
|
|
|
102
102
|
size: "compact",
|
|
103
103
|
className: "editor-post-url__panel-toggle",
|
|
104
104
|
variant: "tertiary",
|
|
105
|
-
"aria-expanded": isOpen
|
|
105
|
+
"aria-expanded": isOpen,
|
|
106
|
+
"aria-label":
|
|
106
107
|
// translators: %s: Current post link.
|
|
107
|
-
,
|
|
108
|
-
"aria-label": (0, _i18n.sprintf)((0, _i18n.__)('Change link: %s'), decodedSlug),
|
|
108
|
+
(0, _i18n.sprintf)((0, _i18n.__)('Change link: %s'), decodedSlug),
|
|
109
109
|
onClick: onClick,
|
|
110
110
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
111
111
|
children: decodedSlug
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_data","_components","_i18n","_url","_coreData","_check","_interopRequireDefault","_index","_postPanelRow","_store","_jsxRuntime","PostURLPanel","isFrontPage","useSelect","select","getCurrentPostId","editorStore","getEditedEntityRecord","canUser","coreStore","siteSettings","kind","name","undefined","_id","page_on_front","popoverAnchor","setPopoverAnchor","useState","popoverProps","useMemo","anchor","placement","offset","shift","label","__","jsx","default","children","jsxs","ref","Dropdown","className","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","PostURLToggle","onClick","renderContent","onClose","FrontPageLink","slug","getEditedPostSlug","decodedSlug","safeDecodeURIComponent","Button","size","variant","sprintf","Fragment","postLink","getCurrentPost","link","ExternalLink","href","target"],"sources":["@wordpress/editor/src/components/post-url/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { Dropdown, Button, ExternalLink } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { safeDecodeURIComponent } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostURLCheck from './check';\nimport PostURL from './index';\nimport PostPanelRow from '../post-panel-row';\nimport { store as editorStore } from '../../store';\n\n/**\n * Renders the `PostURLPanel` component.\n *\n * @return {JSX.Element} The rendered PostURLPanel component.\n */\nexport default function PostURLPanel() {\n\tconst { isFrontPage } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostId } = select( editorStore );\n\t\tconst { getEditedEntityRecord, canUser } = select( coreStore );\n\t\tconst siteSettings = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? getEditedEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\tconst _id = getCurrentPostId();\n\t\treturn {\n\t\t\tisFrontPage: siteSettings?.page_on_front === _id,\n\t\t};\n\t}, [] );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\tconst label = isFrontPage ? __( 'Link' ) : __( 'Slug' );\n\n\treturn (\n\t\t<PostURLCheck>\n\t\t\t<PostPanelRow label={ label } ref={ setPopoverAnchor }>\n\t\t\t\t{ ! isFrontPage && (\n\t\t\t\t\t<Dropdown\n\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t\tclassName=\"editor-post-url__panel-dropdown\"\n\t\t\t\t\t\tcontentClassName=\"editor-post-url__panel-dialog\"\n\t\t\t\t\t\tfocusOnMount\n\t\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t\t<PostURLToggle\n\t\t\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t\t<PostURL onClose={ onClose } />\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ isFrontPage && <FrontPageLink /> }\n\t\t\t</PostPanelRow>\n\t\t</PostURLCheck>\n\t);\n}\n\nfunction PostURLToggle( { isOpen, onClick } ) {\n\tconst { slug } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tslug: select( editorStore ).getEditedPostSlug(),\n\t\t};\n\t}, [] );\n\tconst decodedSlug = safeDecodeURIComponent( slug );\n\treturn (\n\t\t<Button\n\t\t\tsize=\"compact\"\n\t\t\tclassName=\"editor-post-url__panel-toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\t// translators: %s: Current post link.\n\t\t\
|
|
1
|
+
{"version":3,"names":["_element","require","_data","_components","_i18n","_url","_coreData","_check","_interopRequireDefault","_index","_postPanelRow","_store","_jsxRuntime","PostURLPanel","isFrontPage","useSelect","select","getCurrentPostId","editorStore","getEditedEntityRecord","canUser","coreStore","siteSettings","kind","name","undefined","_id","page_on_front","popoverAnchor","setPopoverAnchor","useState","popoverProps","useMemo","anchor","placement","offset","shift","label","__","jsx","default","children","jsxs","ref","Dropdown","className","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","PostURLToggle","onClick","renderContent","onClose","FrontPageLink","slug","getEditedPostSlug","decodedSlug","safeDecodeURIComponent","Button","size","variant","sprintf","Fragment","postLink","getCurrentPost","link","ExternalLink","href","target"],"sources":["@wordpress/editor/src/components/post-url/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { Dropdown, Button, ExternalLink } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { safeDecodeURIComponent } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostURLCheck from './check';\nimport PostURL from './index';\nimport PostPanelRow from '../post-panel-row';\nimport { store as editorStore } from '../../store';\n\n/**\n * Renders the `PostURLPanel` component.\n *\n * @return {JSX.Element} The rendered PostURLPanel component.\n */\nexport default function PostURLPanel() {\n\tconst { isFrontPage } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostId } = select( editorStore );\n\t\tconst { getEditedEntityRecord, canUser } = select( coreStore );\n\t\tconst siteSettings = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? getEditedEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\tconst _id = getCurrentPostId();\n\t\treturn {\n\t\t\tisFrontPage: siteSettings?.page_on_front === _id,\n\t\t};\n\t}, [] );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\tconst label = isFrontPage ? __( 'Link' ) : __( 'Slug' );\n\n\treturn (\n\t\t<PostURLCheck>\n\t\t\t<PostPanelRow label={ label } ref={ setPopoverAnchor }>\n\t\t\t\t{ ! isFrontPage && (\n\t\t\t\t\t<Dropdown\n\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t\tclassName=\"editor-post-url__panel-dropdown\"\n\t\t\t\t\t\tcontentClassName=\"editor-post-url__panel-dialog\"\n\t\t\t\t\t\tfocusOnMount\n\t\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t\t<PostURLToggle\n\t\t\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t\t<PostURL onClose={ onClose } />\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ isFrontPage && <FrontPageLink /> }\n\t\t\t</PostPanelRow>\n\t\t</PostURLCheck>\n\t);\n}\n\nfunction PostURLToggle( { isOpen, onClick } ) {\n\tconst { slug } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tslug: select( editorStore ).getEditedPostSlug(),\n\t\t};\n\t}, [] );\n\tconst decodedSlug = safeDecodeURIComponent( slug );\n\treturn (\n\t\t<Button\n\t\t\tsize=\"compact\"\n\t\t\tclassName=\"editor-post-url__panel-toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\taria-label={\n\t\t\t\t// translators: %s: Current post link.\n\t\t\t\tsprintf( __( 'Change link: %s' ), decodedSlug )\n\t\t\t}\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t<>{ decodedSlug }</>\n\t\t</Button>\n\t);\n}\n\nfunction FrontPageLink() {\n\tconst { postLink } = useSelect( ( select ) => {\n\t\tconst { getCurrentPost } = select( editorStore );\n\t\treturn {\n\t\t\tpostLink: getCurrentPost()?.link,\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<ExternalLink\n\t\t\tclassName=\"editor-post-url__front-page-link\"\n\t\t\thref={ postLink }\n\t\t\ttarget=\"_blank\"\n\t\t>\n\t\t\t{ postLink }\n\t\t</ExternalLink>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAD,sBAAA,CAAAP,OAAA;AACA,IAAAS,aAAA,GAAAF,sBAAA,CAAAP,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AAAmD,IAAAW,WAAA,GAAAX,OAAA;AAhBnD;AACA;AACA;;AAQA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA,GACe,SAASY,YAAYA,CAAA,EAAG;EACtC,MAAM;IAAEC;EAAY,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAChD,MAAM;MAAEC;IAAiB,CAAC,GAAGD,MAAM,CAAEE,YAAY,CAAC;IAClD,MAAM;MAAEC,qBAAqB;MAAEC;IAAQ,CAAC,GAAGJ,MAAM,CAAEK,eAAU,CAAC;IAC9D,MAAMC,YAAY,GAAGF,OAAO,CAAE,MAAM,EAAE;MACrCG,IAAI,EAAE,MAAM;MACZC,IAAI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,CAAC,EAAE,EAAG,CAAC;EAEP,oBACC,IAAAvD,WAAA,CAAA2B,GAAA,EAACpC,WAAA,CAAAiE,YAAY;IACZvB,SAAS,EAAC,kCAAkC;IAC5CwB,IAAI,EAAGJ,QAAU;IACjBK,MAAM,EAAC,QAAQ;IAAA7B,QAAA,EAEbwB;EAAQ,CACG,CAAC;AAEjB","ignoreList":[]}
|
|
@@ -66,15 +66,11 @@ function PreviewDropdown({
|
|
|
66
66
|
const {
|
|
67
67
|
setDeviceType
|
|
68
68
|
} = (0, _data.useDispatch)(_store.store);
|
|
69
|
-
const {
|
|
70
|
-
__unstableSetEditorMode
|
|
71
|
-
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
72
69
|
const {
|
|
73
70
|
resetZoomLevel
|
|
74
71
|
} = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_blockEditor.store));
|
|
75
72
|
const handleDevicePreviewChange = newDeviceType => {
|
|
76
73
|
setDeviceType(newDeviceType);
|
|
77
|
-
__unstableSetEditorMode('edit');
|
|
78
74
|
resetZoomLevel();
|
|
79
75
|
};
|
|
80
76
|
const isMobile = (0, _compose.useViewportMatch)('medium', '<');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_compose","_components","_i18n","_icons","_data","_coreData","_preferences","_interface","_store","_blockEditor","_postPreviewButton","_lockUnlock","_jsxRuntime","PreviewDropdown","forceIsAutosaveable","disabled","deviceType","homeUrl","isTemplate","isViewable","showIconLabels","useSelect","select","_getPostType$viewable","getDeviceType","getCurrentPostType","editorStore","getEntityRecord","getPostType","coreStore","get","preferencesStore","_currentPostType","home","viewable","setDeviceType","useDispatch","__unstableSetEditorMode","blockEditorStore","resetZoomLevel","unlock","handleDevicePreviewChange","newDeviceType","isMobile","useViewportMatch","popoverProps","placement","toggleProps","className","iconPosition","size","showTooltip","accessibleWhenDisabled","menuProps","__","deviceIcons","desktop","mobile","tablet","choices","value","label","icon","jsx","DropdownMenu","clsx","toLowerCase","disableOpenOnArrowDown","children","onClose","jsxs","Fragment","MenuGroup","MenuItemsChoice","onSelect","MenuItem","href","target","external","onClick","VisuallyHidden","as","default","role","textContent","Icon","onPreview","ActionItem","Slot","name","fillProps"],"sources":["@wordpress/editor/src/components/preview-dropdown/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tMenuItemsChoice,\n\tVisuallyHidden,\n\tIcon,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { desktop, mobile, tablet, external } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { ActionItem } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport PostPreviewButton from '../post-preview-button';\nimport { unlock } from '../../lock-unlock';\n\nexport default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {\n\tconst { deviceType, homeUrl, isTemplate, isViewable, showIconLabels } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getDeviceType, getCurrentPostType } = select( editorStore );\n\t\t\tconst { getEntityRecord, getPostType } = select( coreStore );\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\tconst _currentPostType = getCurrentPostType();\n\t\t\treturn {\n\t\t\t\tdeviceType: getDeviceType(),\n\t\t\t\thomeUrl: getEntityRecord( 'root', '__unstableBase' )?.home,\n\t\t\t\tisTemplate: _currentPostType === 'wp_template',\n\t\t\t\tisViewable: getPostType( _currentPostType )?.viewable ?? false,\n\t\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\t};\n\t\t}, [] );\n\tconst { setDeviceType } = useDispatch( editorStore );\n\tconst { __unstableSetEditorMode } = useDispatch( blockEditorStore );\n\tconst { resetZoomLevel } = unlock( useDispatch( blockEditorStore ) );\n\n\tconst handleDevicePreviewChange = ( newDeviceType ) => {\n\t\tsetDeviceType( newDeviceType );\n\t\t__unstableSetEditorMode( 'edit' );\n\t\tresetZoomLevel();\n\t};\n\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\tif ( isMobile ) {\n\t\treturn null;\n\t}\n\n\tconst popoverProps = {\n\t\tplacement: 'bottom-end',\n\t};\n\tconst toggleProps = {\n\t\tclassName: 'editor-preview-dropdown__toggle',\n\t\ticonPosition: 'right',\n\t\tsize: 'compact',\n\t\tshowTooltip: ! showIconLabels,\n\t\tdisabled,\n\t\taccessibleWhenDisabled: disabled,\n\t};\n\tconst menuProps = {\n\t\t'aria-label': __( 'View options' ),\n\t};\n\n\tconst deviceIcons = {\n\t\tdesktop,\n\t\tmobile,\n\t\ttablet,\n\t};\n\n\t/**\n\t * The choices for the device type.\n\t *\n\t * @type {Array}\n\t */\n\tconst choices = [\n\t\t{\n\t\t\tvalue: 'Desktop',\n\t\t\tlabel: __( 'Desktop' ),\n\t\t\ticon: desktop,\n\t\t},\n\t\t{\n\t\t\tvalue: 'Tablet',\n\t\t\tlabel: __( 'Tablet' ),\n\t\t\ticon: tablet,\n\t\t},\n\t\t{\n\t\t\tvalue: 'Mobile',\n\t\t\tlabel: __( 'Mobile' ),\n\t\t\ticon: mobile,\n\t\t},\n\t];\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName={ clsx(\n\t\t\t\t'editor-preview-dropdown',\n\t\t\t\t`editor-preview-dropdown--${ deviceType.toLowerCase() }`\n\t\t\t) }\n\t\t\tpopoverProps={ popoverProps }\n\t\t\ttoggleProps={ toggleProps }\n\t\t\tmenuProps={ menuProps }\n\t\t\ticon={ deviceIcons[ deviceType.toLowerCase() ] }\n\t\t\tlabel={ __( 'View' ) }\n\t\t\tdisableOpenOnArrowDown={ disabled }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\tchoices={ choices }\n\t\t\t\t\t\t\tvalue={ deviceType }\n\t\t\t\t\t\t\tonSelect={ handleDevicePreviewChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t{ isTemplate && (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\thref={ homeUrl }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'View site' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isViewable && (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<PostPreviewButton\n\t\t\t\t\t\t\t\tclassName=\"editor-preview-dropdown__button-external\"\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\tforceIsAutosaveable={ forceIsAutosaveable }\n\t\t\t\t\t\t\t\taria-label={ __( 'Preview in new tab' ) }\n\t\t\t\t\t\t\t\ttextContent={\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Preview in new tab' ) }\n\t\t\t\t\t\t\t\t\t\t<Icon icon={ external } />\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\tonPreview={ onCl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,UAAA,CAAAgF,UAAU,CAACC,IAAI;QACfC,IAAI,EAAC,0BAA0B;QAC/BR,EAAE,EAAGT,qBAAW;QAChBkB,SAAS,EAAG;UAAEX,OAAO,EAAEV;QAAQ;MAAG,CAClC,CAAC;IAAA,CACD;EACF,CACY,CAAC;AAEjB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_compose","_components","_i18n","_icons","_data","_coreData","_preferences","_interface","_store","_blockEditor","_postPreviewButton","_lockUnlock","_jsxRuntime","PreviewDropdown","forceIsAutosaveable","disabled","deviceType","homeUrl","isTemplate","isViewable","showIconLabels","useSelect","select","_getPostType$viewable","getDeviceType","getCurrentPostType","editorStore","getEntityRecord","getPostType","coreStore","get","preferencesStore","_currentPostType","home","viewable","setDeviceType","useDispatch","resetZoomLevel","unlock","blockEditorStore","handleDevicePreviewChange","newDeviceType","isMobile","useViewportMatch","popoverProps","placement","toggleProps","className","iconPosition","size","showTooltip","accessibleWhenDisabled","menuProps","__","deviceIcons","desktop","mobile","tablet","choices","value","label","icon","jsx","DropdownMenu","clsx","toLowerCase","disableOpenOnArrowDown","children","onClose","jsxs","Fragment","MenuGroup","MenuItemsChoice","onSelect","MenuItem","href","target","external","onClick","VisuallyHidden","as","default","role","textContent","Icon","onPreview","ActionItem","Slot","name","fillProps"],"sources":["@wordpress/editor/src/components/preview-dropdown/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tMenuItemsChoice,\n\tVisuallyHidden,\n\tIcon,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { desktop, mobile, tablet, external } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { ActionItem } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport PostPreviewButton from '../post-preview-button';\nimport { unlock } from '../../lock-unlock';\n\nexport default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {\n\tconst { deviceType, homeUrl, isTemplate, isViewable, showIconLabels } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getDeviceType, getCurrentPostType } = select( editorStore );\n\t\t\tconst { getEntityRecord, getPostType } = select( coreStore );\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\tconst _currentPostType = getCurrentPostType();\n\t\t\treturn {\n\t\t\t\tdeviceType: getDeviceType(),\n\t\t\t\thomeUrl: getEntityRecord( 'root', '__unstableBase' )?.home,\n\t\t\t\tisTemplate: _currentPostType === 'wp_template',\n\t\t\t\tisViewable: getPostType( _currentPostType )?.viewable ?? false,\n\t\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\t};\n\t\t}, [] );\n\tconst { setDeviceType } = useDispatch( editorStore );\n\tconst { resetZoomLevel } = unlock( useDispatch( blockEditorStore ) );\n\n\tconst handleDevicePreviewChange = ( newDeviceType ) => {\n\t\tsetDeviceType( newDeviceType );\n\t\tresetZoomLevel();\n\t};\n\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\tif ( isMobile ) {\n\t\treturn null;\n\t}\n\n\tconst popoverProps = {\n\t\tplacement: 'bottom-end',\n\t};\n\tconst toggleProps = {\n\t\tclassName: 'editor-preview-dropdown__toggle',\n\t\ticonPosition: 'right',\n\t\tsize: 'compact',\n\t\tshowTooltip: ! showIconLabels,\n\t\tdisabled,\n\t\taccessibleWhenDisabled: disabled,\n\t};\n\tconst menuProps = {\n\t\t'aria-label': __( 'View options' ),\n\t};\n\n\tconst deviceIcons = {\n\t\tdesktop,\n\t\tmobile,\n\t\ttablet,\n\t};\n\n\t/**\n\t * The choices for the device type.\n\t *\n\t * @type {Array}\n\t */\n\tconst choices = [\n\t\t{\n\t\t\tvalue: 'Desktop',\n\t\t\tlabel: __( 'Desktop' ),\n\t\t\ticon: desktop,\n\t\t},\n\t\t{\n\t\t\tvalue: 'Tablet',\n\t\t\tlabel: __( 'Tablet' ),\n\t\t\ticon: tablet,\n\t\t},\n\t\t{\n\t\t\tvalue: 'Mobile',\n\t\t\tlabel: __( 'Mobile' ),\n\t\t\ticon: mobile,\n\t\t},\n\t];\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName={ clsx(\n\t\t\t\t'editor-preview-dropdown',\n\t\t\t\t`editor-preview-dropdown--${ deviceType.toLowerCase() }`\n\t\t\t) }\n\t\t\tpopoverProps={ popoverProps }\n\t\t\ttoggleProps={ toggleProps }\n\t\t\tmenuProps={ menuProps }\n\t\t\ticon={ deviceIcons[ deviceType.toLowerCase() ] }\n\t\t\tlabel={ __( 'View' ) }\n\t\t\tdisableOpenOnArrowDown={ disabled }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\tchoices={ choices }\n\t\t\t\t\t\t\tvalue={ deviceType }\n\t\t\t\t\t\t\tonSelect={ handleDevicePreviewChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t{ isTemplate && (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\thref={ homeUrl }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'View site' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isViewable && (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<PostPreviewButton\n\t\t\t\t\t\t\t\tclassName=\"editor-preview-dropdown__button-external\"\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\tforceIsAutosaveable={ forceIsAutosaveable }\n\t\t\t\t\t\t\t\taria-label={ __( 'Preview in new tab' ) }\n\t\t\t\t\t\t\t\ttextContent={\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Preview in new tab' ) }\n\t\t\t\t\t\t\t\t\t\t<Icon icon={ external } />\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\tonPreview={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t\t<ActionItem.Slot\n\t\t\t\t\t\tname=\"core/plugin-preview-menu\"\n\t\t\t\t\t\tas={ MenuGroup }\n\t\t\t\t\t\tfillProps={ { onClick: onClose } }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAQA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AAKA,IAAAS,MAAA,GAAAT,OAAA;AACA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kBAAA,CAAAuE,OAAiB;UACjBlC,SAAS,EAAC,0CAA0C;UACpDmC,IAAI,EAAC,UAAU;UACfpE,mBAAmB,EAAGA,mBAAqB;UAC3C,cAAa,IAAAuC,QAAE,EAAE,oBAAqB,CAAG;UACzC8B,WAAW,eACV,IAAAvE,WAAA,CAAAyD,IAAA,EAAAzD,WAAA,CAAA0D,QAAA;YAAAH,QAAA,GACG,IAAAd,QAAE,EAAE,oBAAqB,CAAC,eAC5B,IAAAzC,WAAA,CAAAkD,GAAA,EAAC7D,WAAA,CAAAmF,IAAI;cAACvB,IAAI,EAAGgB;YAAU,CAAE,CAAC;UAAA,CACzB,CACF;UACDQ,SAAS,EAAGjB;QAAS,CACrB;MAAC,CACQ,CACX,eACD,IAAAxD,WAAA,CAAAkD,GAAA,EAACvD,UAAA,CAAA+E,UAAU,CAACC,IAAI;QACfC,IAAI,EAAC,0BAA0B;QAC/BR,EAAE,EAAGT,qBAAW;QAChBkB,SAAS,EAAG;UAAEX,OAAO,EAAEV;QAAQ;MAAG,CAClC,CAAC;IAAA,CACD;EACF,CACY,CAAC;AAEjB","ignoreList":[]}
|
|
@@ -153,7 +153,7 @@ const ExperimentalEditorProvider = exports.ExperimentalEditorProvider = (0, _wit
|
|
|
153
153
|
selection,
|
|
154
154
|
isReady,
|
|
155
155
|
mode,
|
|
156
|
-
|
|
156
|
+
postTypeEntities
|
|
157
157
|
} = (0, _data.useSelect)(select => {
|
|
158
158
|
const {
|
|
159
159
|
getEditorSettings,
|
|
@@ -162,32 +162,30 @@ const ExperimentalEditorProvider = exports.ExperimentalEditorProvider = (0, _wit
|
|
|
162
162
|
__unstableIsEditorReady
|
|
163
163
|
} = select(_store.store);
|
|
164
164
|
const {
|
|
165
|
-
|
|
165
|
+
getEntitiesConfig
|
|
166
166
|
} = select(_coreData.store);
|
|
167
167
|
return {
|
|
168
168
|
editorSettings: getEditorSettings(),
|
|
169
169
|
isReady: __unstableIsEditorReady(),
|
|
170
170
|
mode: getRenderingMode(),
|
|
171
171
|
selection: getEditorSelection(),
|
|
172
|
-
|
|
173
|
-
per_page: -1
|
|
174
|
-
})
|
|
172
|
+
postTypeEntities: post.type === 'wp_template' ? getEntitiesConfig('postType') : null
|
|
175
173
|
};
|
|
176
|
-
}, []);
|
|
174
|
+
}, [post.type]);
|
|
177
175
|
const shouldRenderTemplate = !!template && mode !== 'post-only';
|
|
178
176
|
const rootLevelPost = shouldRenderTemplate ? template : post;
|
|
179
177
|
const defaultBlockContext = (0, _element.useMemo)(() => {
|
|
180
178
|
const postContext = {};
|
|
181
|
-
// If it is a template, try to inherit the post type from the
|
|
179
|
+
// If it is a template, try to inherit the post type from the name.
|
|
182
180
|
if (post.type === 'wp_template') {
|
|
183
181
|
if (post.slug === 'page') {
|
|
184
182
|
postContext.postType = 'page';
|
|
185
183
|
} else if (post.slug === 'single') {
|
|
186
184
|
postContext.postType = 'post';
|
|
187
185
|
} else if (post.slug.split('-')[0] === 'single') {
|
|
188
|
-
// If the slug is single-{postType}, infer the post type from the
|
|
189
|
-
const
|
|
190
|
-
const match = post.slug.match(`^single-(${
|
|
186
|
+
// If the slug is single-{postType}, infer the post type from the name.
|
|
187
|
+
const postTypeNames = postTypeEntities?.map(entity => entity.name) || [];
|
|
188
|
+
const match = post.slug.match(`^single-(${postTypeNames.join('|')})(?:-.+)?$`);
|
|
191
189
|
if (match) {
|
|
192
190
|
postContext.postType = match[1];
|
|
193
191
|
}
|
|
@@ -200,7 +198,7 @@ const ExperimentalEditorProvider = exports.ExperimentalEditorProvider = (0, _wit
|
|
|
200
198
|
...postContext,
|
|
201
199
|
templateSlug: rootLevelPost.type === 'wp_template' ? rootLevelPost.slug : undefined
|
|
202
200
|
};
|
|
203
|
-
}, [shouldRenderTemplate, post.id, post.type, post.slug, rootLevelPost.type, rootLevelPost.slug,
|
|
201
|
+
}, [shouldRenderTemplate, post.id, post.type, post.slug, rootLevelPost.type, rootLevelPost.slug, postTypeEntities]);
|
|
204
202
|
const {
|
|
205
203
|
id,
|
|
206
204
|
type
|
|
@@ -281,7 +279,7 @@ const ExperimentalEditorProvider = exports.ExperimentalEditorProvider = (0, _wit
|
|
|
281
279
|
selection: selection,
|
|
282
280
|
settings: blockEditorSettings,
|
|
283
281
|
useSubRegistry: false,
|
|
284
|
-
children: [children, !settings.
|
|
282
|
+
children: [children, !settings.isPreviewMode && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
285
283
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(PatternsMenuItems, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_templatePartMenuItems.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_contentOnlySettingsMenu.default, {}), mode === 'template-locked' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_disableNonPageContentBlocks.default, {}), type === 'wp_navigation' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_navigationBlockEditingMode.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_globalKeyboardShortcuts.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_keyboardShortcutHelpModal.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockRemovalWarnings.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_startPageOptions.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_startTemplateOptions.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_patternRenameModal.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_patternDuplicateModal.default, {})]
|
|
286
284
|
})]
|
|
287
285
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_data","_i18n","_coreData","_blockEditor","_notices","_patterns","_blocks","_withRegistryProvider","_interopRequireDefault","_store","_useBlockEditorSettings","_lockUnlock","_disableNonPageContentBlocks","_navigationBlockEditingMode","_useHideBlocksFromInserter","_commands","_blockRemovalWarnings","_startPageOptions","_keyboardShortcutHelpModal","_contentOnlySettingsMenu","_startTemplateOptions","_globalKeyboardShortcuts","_patternRenameModal","_patternDuplicateModal","_templatePartMenuItems","_jsxRuntime","ExperimentalBlockEditorProvider","unlock","blockEditorPrivateApis","PatternsMenuItems","editPatternsPrivateApis","noop","NON_CONTEXTUAL_POST_TYPES","useBlockEditorProps","post","template","mode","rootLevelPost","postBlocks","onInput","onChange","useEntityBlockEditor","type","id","templateBlocks","onInputTemplate","onChangeTemplate","maybeNavigationBlocks","useMemo","createBlock","ref","templateLock","blocks","disableRootLevelChanges","ExperimentalEditorProvider","exports","withRegistryProvider","settings","recovery","initialEdits","children","BlockEditorProviderComponent","__unstableTemplate","editorSettings","selection","isReady","postTypes","useSelect","select","getEditorSettings","getEditorSelection","getRenderingMode","__unstableIsEditorReady","editorStore","getPostTypes","coreStore","per_page","shouldRenderTemplate","defaultBlockContext","postContext","slug","postType","split","postTypesSlugs","map","entity","match","join","includes","postId","templateSlug","undefined","blockEditorSettings","useBlockEditorSettings","updatePostLock","setupEditor","updateEditorSettings","setCurrentTemplateId","setEditedPost","setRenderingMode","useDispatch","createWarningNotice","noticesStore","useLayoutEffect","postLock","autosave","__","actions","label","url","editLink","useEffect","_settings$defaultRend","defaultRenderingMode","useHideBlocksFromInserter","useCommands","jsx","EntityProvider","kind","BlockContextProvider","value","jsxs","useSubRegistry","__unstableIsPreviewMode","Fragment","default","EditorProvider","props","BlockEditorProvider","_default"],"sources":["@wordpress/editor/src/components/provider/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useLayoutEffect, useMemo } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tEntityProvider,\n\tuseEntityBlockEditor,\n\tstore as coreStore,\n} from '@wordpress/core-data';\nimport {\n\tBlockEditorProvider,\n\tBlockContextProvider,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as editPatternsPrivateApis } from '@wordpress/patterns';\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport withRegistryProvider from './with-registry-provider';\nimport { store as editorStore } from '../../store';\nimport useBlockEditorSettings from './use-block-editor-settings';\nimport { unlock } from '../../lock-unlock';\nimport DisableNonPageContentBlocks from './disable-non-page-content-blocks';\nimport NavigationBlockEditingMode from './navigation-block-editing-mode';\nimport { useHideBlocksFromInserter } from './use-hide-blocks-from-inserter';\nimport useCommands from '../commands';\nimport BlockRemovalWarnings from '../block-removal-warnings';\nimport StartPageOptions from '../start-page-options';\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\nimport ContentOnlySettingsMenu from '../block-settings-menu/content-only-settings-menu';\nimport StartTemplateOptions from '../start-template-options';\nimport EditorKeyboardShortcuts from '../global-keyboard-shortcuts';\nimport PatternRenameModal from '../pattern-rename-modal';\nimport PatternDuplicateModal from '../pattern-duplicate-modal';\nimport TemplatePartMenuItems from '../template-part-menu-items';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\nconst { PatternsMenuItems } = unlock( editPatternsPrivateApis );\n\nconst noop = () => {};\n\n/**\n * These are global entities that are only there to split blocks into logical units\n * They don't provide a \"context\" for the current post/page being rendered.\n * So we should not use their ids as post context. This is important to allow post blocks\n * (post content, post title) to be used within them without issues.\n */\nconst NON_CONTEXTUAL_POST_TYPES = [\n\t'wp_block',\n\t'wp_navigation',\n\t'wp_template_part',\n];\n\n/**\n * Depending on the post, template and template mode,\n * returns the appropriate blocks and change handlers for the block editor provider.\n *\n * @param {Array} post Block list.\n * @param {boolean} template Whether the page content has focus (and the surrounding template is inert). If `true` return page content blocks. Default `false`.\n * @param {string} mode Rendering mode.\n *\n * @example\n * ```jsx\n * const [ blocks, onInput, onChange ] = useBlockEditorProps( post, template, mode );\n * ```\n *\n * @return {Array} Block editor props.\n */\nfunction useBlockEditorProps( post, template, mode ) {\n\tconst rootLevelPost =\n\t\tmode === 'post-only' || ! template ? 'post' : 'template';\n\tconst [ postBlocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\tpost.type,\n\t\t{ id: post.id }\n\t);\n\tconst [ templateBlocks, onInputTemplate, onChangeTemplate ] =\n\t\tuseEntityBlockEditor( 'postType', template?.type, {\n\t\t\tid: template?.id,\n\t\t} );\n\tconst maybeNavigationBlocks = useMemo( () => {\n\t\tif ( post.type === 'wp_navigation' ) {\n\t\t\treturn [\n\t\t\t\tcreateBlock( 'core/navigation', {\n\t\t\t\t\tref: post.id,\n\t\t\t\t\t// As the parent editor is locked with `templateLock`, the template locking\n\t\t\t\t\t// must be explicitly \"unset\" on the block itself to allow the user to modify\n\t\t\t\t\t// the block's content.\n\t\t\t\t\ttemplateLock: false,\n\t\t\t\t} ),\n\t\t\t];\n\t\t}\n\t}, [ post.type, post.id ] );\n\n\t// It is important that we don't create a new instance of blocks on every change\n\t// We should only create a new instance if the blocks them selves change, not a dependency of them.\n\tconst blocks = useMemo( () => {\n\t\tif ( maybeNavigationBlocks ) {\n\t\t\treturn maybeNavigationBlocks;\n\t\t}\n\n\t\tif ( rootLevelPost === 'template' ) {\n\t\t\treturn templateBlocks;\n\t\t}\n\n\t\treturn postBlocks;\n\t}, [ maybeNavigationBlocks, rootLevelPost, templateBlocks, postBlocks ] );\n\n\t// Handle fallback to postBlocks outside of the above useMemo, to ensure\n\t// that constructed block templates that call `createBlock` are not generated\n\t// too frequently. This ensures that clientIds are stable.\n\tconst disableRootLevelChanges =\n\t\t( !! template && mode === 'template-locked' ) ||\n\t\tpost.type === 'wp_navigation';\n\tif ( disableRootLevelChanges ) {\n\t\treturn [ blocks, noop, noop ];\n\t}\n\n\treturn [\n\t\tblocks,\n\t\trootLevelPost === 'post' ? onInput : onInputTemplate,\n\t\trootLevelPost === 'post' ? onChange : onChangeTemplate,\n\t];\n}\n\n/**\n * This component provides the editor context and manages the state of the block editor.\n *\n * @param {Object} props The component props.\n * @param {Object} props.post The post object.\n * @param {Object} props.settings The editor settings.\n * @param {boolean} props.recovery Indicates if the editor is in recovery mode.\n * @param {Array} props.initialEdits The initial edits for the editor.\n * @param {Object} props.children The child components.\n * @param {Object} [props.BlockEditorProviderComponent] The block editor provider component to use. Defaults to ExperimentalBlockEditorProvider.\n * @param {Object} [props.__unstableTemplate] The template object.\n *\n * @example\n * ```jsx\n * <ExperimentalEditorProvider\n * post={ post }\n * settings={ settings }\n * recovery={ recovery }\n * initialEdits={ initialEdits }\n * __unstableTemplate={ template }\n * >\n * { children }\n * </ExperimentalEditorProvider>\n *\n * @return {Object} The rendered ExperimentalEditorProvider component.\n */\nexport const ExperimentalEditorProvider = withRegistryProvider(\n\t( {\n\t\tpost,\n\t\tsettings,\n\t\trecovery,\n\t\tinitialEdits,\n\t\tchildren,\n\t\tBlockEditorProviderComponent = ExperimentalBlockEditorProvider,\n\t\t__unstableTemplate: template,\n\t} ) => {\n\t\tconst { editorSettings, selection, isReady, mode, postTypes } =\n\t\t\tuseSelect( ( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetEditorSettings,\n\t\t\t\t\tgetEditorSelection,\n\t\t\t\t\tgetRenderingMode,\n\t\t\t\t\t__unstableIsEditorReady,\n\t\t\t\t} = select( editorStore );\n\t\t\t\tconst { getPostTypes } = select( coreStore );\n\n\t\t\t\treturn {\n\t\t\t\t\teditorSettings: getEditorSettings(),\n\t\t\t\t\tisReady: __unstableIsEditorReady(),\n\t\t\t\t\tmode: getRenderingMode(),\n\t\t\t\t\tselection: getEditorSelection(),\n\t\t\t\t\tpostTypes: getPostTypes( { per_page: -1 } ),\n\t\t\t\t};\n\t\t\t}, [] );\n\t\tconst shouldRenderTemplate = !! template && mode !== 'post-only';\n\t\tconst rootLevelPost = shouldRenderTemplate ? template : post;\n\t\tconst defaultBlockContext = useMemo( () => {\n\t\t\tconst postContext = {};\n\t\t\t// If it is a template, try to inherit the post type from the slug.\n\t\t\tif ( post.type === 'wp_template' ) {\n\t\t\t\tif ( post.slug === 'page' ) {\n\t\t\t\t\tpostContext.postType = 'page';\n\t\t\t\t} else if ( post.slug === 'single' ) {\n\t\t\t\t\tpostContext.postType = 'post';\n\t\t\t\t} else if ( post.slug.split( '-' )[ 0 ] === 'single' ) {\n\t\t\t\t\t// If the slug is single-{postType}, infer the post type from the slug.\n\t\t\t\t\tconst postTypesSlugs =\n\t\t\t\t\t\tpostTypes?.map( ( entity ) => entity.slug ) || [];\n\t\t\t\t\tconst match = post.slug.match(\n\t\t\t\t\t\t`^single-(${ postTypesSlugs.join( '|' ) })(?:-.+)?$`\n\t\t\t\t\t);\n\t\t\t\t\tif ( match ) {\n\t\t\t\t\t\tpostContext.postType = match[ 1 ];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\t! NON_CONTEXTUAL_POST_TYPES.includes( rootLevelPost.type ) ||\n\t\t\t\tshouldRenderTemplate\n\t\t\t) {\n\t\t\t\tpostContext.postId = post.id;\n\t\t\t\tpostContext.postType = post.type;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...postContext,\n\t\t\t\ttemplateSlug:\n\t\t\t\t\trootLevelPost.type === 'wp_template'\n\t\t\t\t\t\t? rootLevelPost.slug\n\t\t\t\t\t\t: undefined,\n\t\t\t};\n\t\t}, [\n\t\t\tshouldRenderTemplate,\n\t\t\tpost.id,\n\t\t\tpost.type,\n\t\t\tpost.slug,\n\t\t\trootLevelPost.type,\n\t\t\trootLevelPost.slug,\n\t\t\tpostTypes,\n\t\t] );\n\t\tconst { id, type } = rootLevelPost;\n\t\tconst blockEditorSettings = useBlockEditorSettings(\n\t\t\teditorSettings,\n\t\t\ttype,\n\t\t\tid,\n\t\t\tmode\n\t\t);\n\t\tconst [ blocks, onInput, onChange ] = useBlockEditorProps(\n\t\t\tpost,\n\t\t\ttemplate,\n\t\t\tmode\n\t\t);\n\n\t\tconst {\n\t\t\tupdatePostLock,\n\t\t\tsetupEditor,\n\t\t\tupdateEditorSettings,\n\t\t\tsetCurrentTemplateId,\n\t\t\tsetEditedPost,\n\t\t\tsetRenderingMode,\n\t\t} = unlock( useDispatch( editorStore ) );\n\t\tconst { createWarningNotice } = useDispatch( noticesStore );\n\n\t\t// Ideally this should be synced on each change and not just something you do once.\n\t\tuseLayoutEffect( () => {\n\t\t\t// Assume that we don't need to initialize in the case of an error recovery.\n\t\t\tif ( recovery ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tupdatePostLock( settings.postLock );\n\t\t\tsetupEditor( post, initialEdits, settings.template );\n\t\t\tif ( settings.autosave ) {\n\t\t\t\tcreateWarningNotice(\n\t\t\t\t\t__(\n\t\t\t\t\t\t'There is an autosave of this post that is more recent than the version below.'\n\t\t\t\t\t),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'autosave-exists',\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 the autosave' ),\n\t\t\t\t\t\t\t\turl: settings.autosave.editLink,\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}, [] );\n\n\t\t// Synchronizes the active post with the state\n\t\tuseEffect( () => {\n\t\t\tsetEditedPost( post.type, post.id );\n\t\t}, [ post.type, post.id, setEditedPost ] );\n\n\t\t// Synchronize the editor settings as they change.\n\t\tuseEffect( () => {\n\t\t\tupdateEditorSettings( settings );\n\t\t}, [ settings, updateEditorSettings ] );\n\n\t\t// Synchronizes the active template with the state.\n\t\tuseEffect( () => {\n\t\t\tsetCurrentTemplateId( template?.id );\n\t\t}, [ template?.id, setCurrentTemplateId ] );\n\n\t\t// Sets the right rendering mode when loading the editor.\n\t\tuseEffect( () => {\n\t\t\tsetRenderingMode( settings.defaultRenderingMode ?? 'post-only' );\n\t\t}, [ settings.defaultRenderingMode, setRenderingMode ] );\n\n\t\tuseHideBlocksFromInserter( post.type, mode );\n\n\t\t// Register the editor commands.\n\t\tuseCommands();\n\n\t\tif ( ! isReady ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<EntityProvider kind=\"root\" type=\"site\">\n\t\t\t\t<EntityProvider\n\t\t\t\t\tkind=\"postType\"\n\t\t\t\t\ttype={ post.type }\n\t\t\t\t\tid={ post.id }\n\t\t\t\t>\n\t\t\t\t\t<BlockContextProvider value={ defaultBlockContext }>\n\t\t\t\t\t\t<BlockEditorProviderComponent\n\t\t\t\t\t\t\tvalue={ blocks }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tonInput={ onInput }\n\t\t\t\t\t\t\tselection={ selection }\n\t\t\t\t\t\t\tsettings={ blockEditorSettings }\n\t\t\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t{ ! settings.__unstableIsPreviewMode && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<PatternsMenuItems />\n\t\t\t\t\t\t\t\t\t<TemplatePartMenuItems />\n\t\t\t\t\t\t\t\t\t<ContentOnlySettingsMenu />\n\t\t\t\t\t\t\t\t\t{ mode === 'template-locked' && (\n\t\t\t\t\t\t\t\t\t\t<DisableNonPageContentBlocks />\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ type === 'wp_navigation' && (\n\t\t\t\t\t\t\t\t\t\t<NavigationBlockEditingMode />\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t<EditorKeyboardShortcuts />\n\t\t\t\t\t\t\t\t\t<KeyboardShortcutHelpModal />\n\t\t\t\t\t\t\t\t\t<BlockRemovalWarnings />\n\t\t\t\t\t\t\t\t\t<StartPageOptions />\n\t\t\t\t\t\t\t\t\t<StartTemplateOptions />\n\t\t\t\t\t\t\t\t\t<PatternRenameModal />\n\t\t\t\t\t\t\t\t\t<PatternDuplicateModal />\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</BlockEditorProviderComponent>\n\t\t\t\t\t</BlockContextProvider>\n\t\t\t\t</EntityProvider>\n\t\t\t</EntityProvider>\n\t\t);\n\t}\n);\n\n/**\n * This component establishes a new post editing context, and serves as the entry point for a new post editor (or post with template editor).\n *\n * It supports a large number of post types, including post, page, templates,\n * custom post types, patterns, template parts.\n *\n * All modification and changes are performed to the `@wordpress/core-data` store.\n *\n * @param {Object} props The component props.\n * @param {Object} [props.post] The post object to edit. This is required.\n * @param {Object} [props.__unstableTemplate] The template object wrapper the edited post.\n * This is optional and can only be used when the post type supports templates (like posts and pages).\n * @param {Object} [props.settings] The settings object to use for the editor.\n * This is optional and can be used to override the default settings.\n * @param {Element} [props.children] Children elements for which the BlockEditorProvider context should apply.\n * This is optional.\n *\n * @example\n * ```jsx\n * <EditorProvider\n * post={ post }\n * settings={ settings }\n * __unstableTemplate={ template }\n * >\n * { children }\n * </EditorProvider>\n * ```\n *\n * @return {JSX.Element} The rendered EditorProvider component.\n */\nexport function EditorProvider( props ) {\n\treturn (\n\t\t<ExperimentalEditorProvider\n\t\t\t{ ...props }\n\t\t\tBlockEditorProviderComponent={ BlockEditorProvider }\n\t\t>\n\t\t\t{ props.children }\n\t\t</ExperimentalEditorProvider>\n\t);\n}\n\nexport default EditorProvider;\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAKA,IAAAI,YAAA,GAAAJ,OAAA;AAKA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAKA,IAAAQ,qBAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,uBAAA,GAAAF,sBAAA,CAAAT,OAAA;AACA,IAAAY,WAAA,GAAAZ,OAAA;AACA,IAAAa,4BAAA,G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EAAC7F,sBAAA,CAAAsG,OAAqB,IAAE,CAAC;UAAA,CACxB,CACF;QAAA,CAC4B;MAAC,CACV;IAAC,CACR;EAAC,CACF,CAAC;AAEnB,CACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,cAAcA,CAAEC,KAAK,EAAG;EACvC,oBACC,IAAAtG,WAAA,CAAA2F,GAAA,EAAC9D,0BAA0B;IAAA,GACrByE,KAAK;IACVlE,4BAA4B,EAAGmE,gCAAqB;IAAApE,QAAA,EAElDmE,KAAK,CAACnE;EAAQ,CACW,CAAC;AAE/B;AAAC,IAAAqE,QAAA,GAAA1E,OAAA,CAAAsE,OAAA,GAEcC,cAAc","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_element","require","_data","_i18n","_coreData","_blockEditor","_notices","_patterns","_blocks","_withRegistryProvider","_interopRequireDefault","_store","_useBlockEditorSettings","_lockUnlock","_disableNonPageContentBlocks","_navigationBlockEditingMode","_useHideBlocksFromInserter","_commands","_blockRemovalWarnings","_startPageOptions","_keyboardShortcutHelpModal","_contentOnlySettingsMenu","_startTemplateOptions","_globalKeyboardShortcuts","_patternRenameModal","_patternDuplicateModal","_templatePartMenuItems","_jsxRuntime","ExperimentalBlockEditorProvider","unlock","blockEditorPrivateApis","PatternsMenuItems","editPatternsPrivateApis","noop","NON_CONTEXTUAL_POST_TYPES","useBlockEditorProps","post","template","mode","rootLevelPost","postBlocks","onInput","onChange","useEntityBlockEditor","type","id","templateBlocks","onInputTemplate","onChangeTemplate","maybeNavigationBlocks","useMemo","createBlock","ref","templateLock","blocks","disableRootLevelChanges","ExperimentalEditorProvider","exports","withRegistryProvider","settings","recovery","initialEdits","children","BlockEditorProviderComponent","__unstableTemplate","editorSettings","selection","isReady","postTypeEntities","useSelect","select","getEditorSettings","getEditorSelection","getRenderingMode","__unstableIsEditorReady","editorStore","getEntitiesConfig","coreStore","shouldRenderTemplate","defaultBlockContext","postContext","slug","postType","split","postTypeNames","map","entity","name","match","join","includes","postId","templateSlug","undefined","blockEditorSettings","useBlockEditorSettings","updatePostLock","setupEditor","updateEditorSettings","setCurrentTemplateId","setEditedPost","setRenderingMode","useDispatch","createWarningNotice","noticesStore","useLayoutEffect","postLock","autosave","__","actions","label","url","editLink","useEffect","_settings$defaultRend","defaultRenderingMode","useHideBlocksFromInserter","useCommands","jsx","EntityProvider","kind","BlockContextProvider","value","jsxs","useSubRegistry","isPreviewMode","Fragment","default","EditorProvider","props","BlockEditorProvider","_default"],"sources":["@wordpress/editor/src/components/provider/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useLayoutEffect, useMemo } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tEntityProvider,\n\tuseEntityBlockEditor,\n\tstore as coreStore,\n} from '@wordpress/core-data';\nimport {\n\tBlockEditorProvider,\n\tBlockContextProvider,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as editPatternsPrivateApis } from '@wordpress/patterns';\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport withRegistryProvider from './with-registry-provider';\nimport { store as editorStore } from '../../store';\nimport useBlockEditorSettings from './use-block-editor-settings';\nimport { unlock } from '../../lock-unlock';\nimport DisableNonPageContentBlocks from './disable-non-page-content-blocks';\nimport NavigationBlockEditingMode from './navigation-block-editing-mode';\nimport { useHideBlocksFromInserter } from './use-hide-blocks-from-inserter';\nimport useCommands from '../commands';\nimport BlockRemovalWarnings from '../block-removal-warnings';\nimport StartPageOptions from '../start-page-options';\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\nimport ContentOnlySettingsMenu from '../block-settings-menu/content-only-settings-menu';\nimport StartTemplateOptions from '../start-template-options';\nimport EditorKeyboardShortcuts from '../global-keyboard-shortcuts';\nimport PatternRenameModal from '../pattern-rename-modal';\nimport PatternDuplicateModal from '../pattern-duplicate-modal';\nimport TemplatePartMenuItems from '../template-part-menu-items';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\nconst { PatternsMenuItems } = unlock( editPatternsPrivateApis );\n\nconst noop = () => {};\n\n/**\n * These are global entities that are only there to split blocks into logical units\n * They don't provide a \"context\" for the current post/page being rendered.\n * So we should not use their ids as post context. This is important to allow post blocks\n * (post content, post title) to be used within them without issues.\n */\nconst NON_CONTEXTUAL_POST_TYPES = [\n\t'wp_block',\n\t'wp_navigation',\n\t'wp_template_part',\n];\n\n/**\n * Depending on the post, template and template mode,\n * returns the appropriate blocks and change handlers for the block editor provider.\n *\n * @param {Array} post Block list.\n * @param {boolean} template Whether the page content has focus (and the surrounding template is inert). If `true` return page content blocks. Default `false`.\n * @param {string} mode Rendering mode.\n *\n * @example\n * ```jsx\n * const [ blocks, onInput, onChange ] = useBlockEditorProps( post, template, mode );\n * ```\n *\n * @return {Array} Block editor props.\n */\nfunction useBlockEditorProps( post, template, mode ) {\n\tconst rootLevelPost =\n\t\tmode === 'post-only' || ! template ? 'post' : 'template';\n\tconst [ postBlocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\tpost.type,\n\t\t{ id: post.id }\n\t);\n\tconst [ templateBlocks, onInputTemplate, onChangeTemplate ] =\n\t\tuseEntityBlockEditor( 'postType', template?.type, {\n\t\t\tid: template?.id,\n\t\t} );\n\tconst maybeNavigationBlocks = useMemo( () => {\n\t\tif ( post.type === 'wp_navigation' ) {\n\t\t\treturn [\n\t\t\t\tcreateBlock( 'core/navigation', {\n\t\t\t\t\tref: post.id,\n\t\t\t\t\t// As the parent editor is locked with `templateLock`, the template locking\n\t\t\t\t\t// must be explicitly \"unset\" on the block itself to allow the user to modify\n\t\t\t\t\t// the block's content.\n\t\t\t\t\ttemplateLock: false,\n\t\t\t\t} ),\n\t\t\t];\n\t\t}\n\t}, [ post.type, post.id ] );\n\n\t// It is important that we don't create a new instance of blocks on every change\n\t// We should only create a new instance if the blocks them selves change, not a dependency of them.\n\tconst blocks = useMemo( () => {\n\t\tif ( maybeNavigationBlocks ) {\n\t\t\treturn maybeNavigationBlocks;\n\t\t}\n\n\t\tif ( rootLevelPost === 'template' ) {\n\t\t\treturn templateBlocks;\n\t\t}\n\n\t\treturn postBlocks;\n\t}, [ maybeNavigationBlocks, rootLevelPost, templateBlocks, postBlocks ] );\n\n\t// Handle fallback to postBlocks outside of the above useMemo, to ensure\n\t// that constructed block templates that call `createBlock` are not generated\n\t// too frequently. This ensures that clientIds are stable.\n\tconst disableRootLevelChanges =\n\t\t( !! template && mode === 'template-locked' ) ||\n\t\tpost.type === 'wp_navigation';\n\tif ( disableRootLevelChanges ) {\n\t\treturn [ blocks, noop, noop ];\n\t}\n\n\treturn [\n\t\tblocks,\n\t\trootLevelPost === 'post' ? onInput : onInputTemplate,\n\t\trootLevelPost === 'post' ? onChange : onChangeTemplate,\n\t];\n}\n\n/**\n * This component provides the editor context and manages the state of the block editor.\n *\n * @param {Object} props The component props.\n * @param {Object} props.post The post object.\n * @param {Object} props.settings The editor settings.\n * @param {boolean} props.recovery Indicates if the editor is in recovery mode.\n * @param {Array} props.initialEdits The initial edits for the editor.\n * @param {Object} props.children The child components.\n * @param {Object} [props.BlockEditorProviderComponent] The block editor provider component to use. Defaults to ExperimentalBlockEditorProvider.\n * @param {Object} [props.__unstableTemplate] The template object.\n *\n * @example\n * ```jsx\n * <ExperimentalEditorProvider\n * post={ post }\n * settings={ settings }\n * recovery={ recovery }\n * initialEdits={ initialEdits }\n * __unstableTemplate={ template }\n * >\n * { children }\n * </ExperimentalEditorProvider>\n *\n * @return {Object} The rendered ExperimentalEditorProvider component.\n */\nexport const ExperimentalEditorProvider = withRegistryProvider(\n\t( {\n\t\tpost,\n\t\tsettings,\n\t\trecovery,\n\t\tinitialEdits,\n\t\tchildren,\n\t\tBlockEditorProviderComponent = ExperimentalBlockEditorProvider,\n\t\t__unstableTemplate: template,\n\t} ) => {\n\t\tconst { editorSettings, selection, isReady, mode, postTypeEntities } =\n\t\t\tuseSelect(\n\t\t\t\t( select ) => {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tgetEditorSettings,\n\t\t\t\t\t\tgetEditorSelection,\n\t\t\t\t\t\tgetRenderingMode,\n\t\t\t\t\t\t__unstableIsEditorReady,\n\t\t\t\t\t} = select( editorStore );\n\t\t\t\t\tconst { getEntitiesConfig } = select( coreStore );\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\teditorSettings: getEditorSettings(),\n\t\t\t\t\t\tisReady: __unstableIsEditorReady(),\n\t\t\t\t\t\tmode: getRenderingMode(),\n\t\t\t\t\t\tselection: getEditorSelection(),\n\t\t\t\t\t\tpostTypeEntities:\n\t\t\t\t\t\t\tpost.type === 'wp_template'\n\t\t\t\t\t\t\t\t? getEntitiesConfig( 'postType' )\n\t\t\t\t\t\t\t\t: null,\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t\t[ post.type ]\n\t\t\t);\n\t\tconst shouldRenderTemplate = !! template && mode !== 'post-only';\n\t\tconst rootLevelPost = shouldRenderTemplate ? template : post;\n\t\tconst defaultBlockContext = useMemo( () => {\n\t\t\tconst postContext = {};\n\t\t\t// If it is a template, try to inherit the post type from the name.\n\t\t\tif ( post.type === 'wp_template' ) {\n\t\t\t\tif ( post.slug === 'page' ) {\n\t\t\t\t\tpostContext.postType = 'page';\n\t\t\t\t} else if ( post.slug === 'single' ) {\n\t\t\t\t\tpostContext.postType = 'post';\n\t\t\t\t} else if ( post.slug.split( '-' )[ 0 ] === 'single' ) {\n\t\t\t\t\t// If the slug is single-{postType}, infer the post type from the name.\n\t\t\t\t\tconst postTypeNames =\n\t\t\t\t\t\tpostTypeEntities?.map( ( entity ) => entity.name ) ||\n\t\t\t\t\t\t[];\n\t\t\t\t\tconst match = post.slug.match(\n\t\t\t\t\t\t`^single-(${ postTypeNames.join( '|' ) })(?:-.+)?$`\n\t\t\t\t\t);\n\t\t\t\t\tif ( match ) {\n\t\t\t\t\t\tpostContext.postType = match[ 1 ];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\t! NON_CONTEXTUAL_POST_TYPES.includes( rootLevelPost.type ) ||\n\t\t\t\tshouldRenderTemplate\n\t\t\t) {\n\t\t\t\tpostContext.postId = post.id;\n\t\t\t\tpostContext.postType = post.type;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...postContext,\n\t\t\t\ttemplateSlug:\n\t\t\t\t\trootLevelPost.type === 'wp_template'\n\t\t\t\t\t\t? rootLevelPost.slug\n\t\t\t\t\t\t: undefined,\n\t\t\t};\n\t\t}, [\n\t\t\tshouldRenderTemplate,\n\t\t\tpost.id,\n\t\t\tpost.type,\n\t\t\tpost.slug,\n\t\t\trootLevelPost.type,\n\t\t\trootLevelPost.slug,\n\t\t\tpostTypeEntities,\n\t\t] );\n\t\tconst { id, type } = rootLevelPost;\n\t\tconst blockEditorSettings = useBlockEditorSettings(\n\t\t\teditorSettings,\n\t\t\ttype,\n\t\t\tid,\n\t\t\tmode\n\t\t);\n\t\tconst [ blocks, onInput, onChange ] = useBlockEditorProps(\n\t\t\tpost,\n\t\t\ttemplate,\n\t\t\tmode\n\t\t);\n\n\t\tconst {\n\t\t\tupdatePostLock,\n\t\t\tsetupEditor,\n\t\t\tupdateEditorSettings,\n\t\t\tsetCurrentTemplateId,\n\t\t\tsetEditedPost,\n\t\t\tsetRenderingMode,\n\t\t} = unlock( useDispatch( editorStore ) );\n\t\tconst { createWarningNotice } = useDispatch( noticesStore );\n\n\t\t// Ideally this should be synced on each change and not just something you do once.\n\t\tuseLayoutEffect( () => {\n\t\t\t// Assume that we don't need to initialize in the case of an error recovery.\n\t\t\tif ( recovery ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tupdatePostLock( settings.postLock );\n\t\t\tsetupEditor( post, initialEdits, settings.template );\n\t\t\tif ( settings.autosave ) {\n\t\t\t\tcreateWarningNotice(\n\t\t\t\t\t__(\n\t\t\t\t\t\t'There is an autosave of this post that is more recent than the version below.'\n\t\t\t\t\t),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'autosave-exists',\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 the autosave' ),\n\t\t\t\t\t\t\t\turl: settings.autosave.editLink,\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}, [] );\n\n\t\t// Synchronizes the active post with the state\n\t\tuseEffect( () => {\n\t\t\tsetEditedPost( post.type, post.id );\n\t\t}, [ post.type, post.id, setEditedPost ] );\n\n\t\t// Synchronize the editor settings as they change.\n\t\tuseEffect( () => {\n\t\t\tupdateEditorSettings( settings );\n\t\t}, [ settings, updateEditorSettings ] );\n\n\t\t// Synchronizes the active template with the state.\n\t\tuseEffect( () => {\n\t\t\tsetCurrentTemplateId( template?.id );\n\t\t}, [ template?.id, setCurrentTemplateId ] );\n\n\t\t// Sets the right rendering mode when loading the editor.\n\t\tuseEffect( () => {\n\t\t\tsetRenderingMode( settings.defaultRenderingMode ?? 'post-only' );\n\t\t}, [ settings.defaultRenderingMode, setRenderingMode ] );\n\n\t\tuseHideBlocksFromInserter( post.type, mode );\n\n\t\t// Register the editor commands.\n\t\tuseCommands();\n\n\t\tif ( ! isReady ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<EntityProvider kind=\"root\" type=\"site\">\n\t\t\t\t<EntityProvider\n\t\t\t\t\tkind=\"postType\"\n\t\t\t\t\ttype={ post.type }\n\t\t\t\t\tid={ post.id }\n\t\t\t\t>\n\t\t\t\t\t<BlockContextProvider value={ defaultBlockContext }>\n\t\t\t\t\t\t<BlockEditorProviderComponent\n\t\t\t\t\t\t\tvalue={ blocks }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tonInput={ onInput }\n\t\t\t\t\t\t\tselection={ selection }\n\t\t\t\t\t\t\tsettings={ blockEditorSettings }\n\t\t\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t{ ! settings.isPreviewMode && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<PatternsMenuItems />\n\t\t\t\t\t\t\t\t\t<TemplatePartMenuItems />\n\t\t\t\t\t\t\t\t\t<ContentOnlySettingsMenu />\n\t\t\t\t\t\t\t\t\t{ mode === 'template-locked' && (\n\t\t\t\t\t\t\t\t\t\t<DisableNonPageContentBlocks />\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ type === 'wp_navigation' && (\n\t\t\t\t\t\t\t\t\t\t<NavigationBlockEditingMode />\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t<EditorKeyboardShortcuts />\n\t\t\t\t\t\t\t\t\t<KeyboardShortcutHelpModal />\n\t\t\t\t\t\t\t\t\t<BlockRemovalWarnings />\n\t\t\t\t\t\t\t\t\t<StartPageOptions />\n\t\t\t\t\t\t\t\t\t<StartTemplateOptions />\n\t\t\t\t\t\t\t\t\t<PatternRenameModal />\n\t\t\t\t\t\t\t\t\t<PatternDuplicateModal />\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</BlockEditorProviderComponent>\n\t\t\t\t\t</BlockContextProvider>\n\t\t\t\t</EntityProvider>\n\t\t\t</EntityProvider>\n\t\t);\n\t}\n);\n\n/**\n * This component establishes a new post editing context, and serves as the entry point for a new post editor (or post with template editor).\n *\n * It supports a large number of post types, including post, page, templates,\n * custom post types, patterns, template parts.\n *\n * All modification and changes are performed to the `@wordpress/core-data` store.\n *\n * @param {Object} props The component props.\n * @param {Object} [props.post] The post object to edit. This is required.\n * @param {Object} [props.__unstableTemplate] The template object wrapper the edited post.\n * This is optional and can only be used when the post type supports templates (like posts and pages).\n * @param {Object} [props.settings] The settings object to use for the editor.\n * This is optional and can be used to override the default settings.\n * @param {Element} [props.children] Children elements for which the BlockEditorProvider context should apply.\n * This is optional.\n *\n * @example\n * ```jsx\n * <EditorProvider\n * post={ post }\n * settings={ settings }\n * __unstableTemplate={ template }\n * >\n * { children }\n * </EditorProvider>\n * ```\n *\n * @return {JSX.Element} The rendered EditorProvider component.\n */\nexport function EditorProvider( props ) {\n\treturn (\n\t\t<ExperimentalEditorProvider\n\t\t\t{ ...props }\n\t\t\tBlockEditorProviderComponent={ BlockEditorProvider }\n\t\t>\n\t\t\t{ props.children }\n\t\t</ExperimentalEditorProvider>\n\t);\n}\n\nexport default EditorProvider;\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAKA,IAAAI,YAAA,GAAAJ,OAAA;AAKA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAKA,IAAAQ,qBAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,uBAAA,GAAAF,sBAAA,CAAAT,OAAA;AACA,IAAAY,WAAA,GAAAZ,OAAA;AACA,IAAAa,4BAAA,GAAAJ,sBAAA,CAAAT,OAAA;AACA,IAAAc,2BAAA,GAAAL,sBAAA,CAAAT,OAAA;AACA,IAAAe,0BAAA,GAAAf,OAAA;AACA,IAAAgB,SAAA,GAAAP,sBAAA,CAAAT,OAAA;AACA,IAAAiB,qBAAA,GAAAR,sBAAA,CAAAT,OAAA;AACA,IAAAkB,iBAAA,GAAAT,sBAAA,CAAAT,OAAA;AACA,IAAAmB,0BAAA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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,cAAcA,CAAEC,KAAK,EAAG;EACvC,oBACC,IAAAtG,WAAA,CAAA2F,GAAA,EAAC9D,0BAA0B;IAAA,GACrByE,KAAK;IACVlE,4BAA4B,EAAGmE,gCAAqB;IAAApE,QAAA,EAElDmE,KAAK,CAACnE;EAAQ,CACW,CAAC;AAE/B;AAAC,IAAAqE,QAAA,GAAA1E,OAAA,CAAAsE,OAAA,GAEcC,cAAc","ignoreList":[]}
|
|
@@ -39,7 +39,7 @@ function __experimentalReusableBlocksSelect(select) {
|
|
|
39
39
|
per_page: -1
|
|
40
40
|
}]) ? reusableBlocks : undefined;
|
|
41
41
|
}
|
|
42
|
-
const BLOCK_EDITOR_SETTINGS = ['__experimentalBlockDirectory', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalGlobalStylesBaseStyles', 'alignWide', 'blockInspectorTabs', 'allowedMimeTypes', 'bodyPlaceholder', 'canLockBlocks', 'canUpdateBlockBindings', 'capabilities', 'clearBlockSelection', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomSpacingSizes', 'disableCustomGradients', 'disableLayoutStyles', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'enableOpenverseMediaCategory', 'fontSizes', 'gradients', 'generateAnchors', 'onNavigateToEntityRecord', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'locale', 'maxWidth', 'postContentAttributes', 'postsPerPage', 'readOnly', 'styles', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableHasCustomAppender', '
|
|
42
|
+
const BLOCK_EDITOR_SETTINGS = ['__experimentalBlockDirectory', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalGlobalStylesBaseStyles', 'alignWide', 'blockInspectorTabs', 'allowedMimeTypes', 'bodyPlaceholder', 'canLockBlocks', 'canUpdateBlockBindings', 'capabilities', 'clearBlockSelection', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomSpacingSizes', 'disableCustomGradients', 'disableLayoutStyles', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'enableOpenverseMediaCategory', 'fontSizes', 'gradients', 'generateAnchors', 'onNavigateToEntityRecord', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isPreviewMode', 'isRTL', 'locale', 'maxWidth', 'postContentAttributes', 'postsPerPage', 'readOnly', 'styles', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableHasCustomAppender', '__unstableResolvedAssets', '__unstableIsBlockBasedTheme'];
|
|
43
43
|
const {
|
|
44
44
|
globalStylesDataKey,
|
|
45
45
|
globalStylesLinksDataKey,
|