@wordpress/editor 14.18.0 → 14.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +2 -0
- package/build/components/document-bar/index.js +3 -2
- package/build/components/document-bar/index.js.map +1 -1
- package/build/components/document-outline/index.js +37 -17
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/document-outline/item.js +32 -20
- package/build/components/document-outline/item.js.map +1 -1
- package/build/components/entities-saved-states/entity-record-item.js +4 -3
- package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build/components/entities-saved-states/entity-type-list.js +2 -1
- package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build/components/entities-saved-states/index.js +66 -42
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/post-actions/index.js +19 -28
- package/build/components/post-actions/index.js.map +1 -1
- package/build/components/post-card-panel/index.js +5 -5
- package/build/components/post-card-panel/index.js.map +1 -1
- package/build/components/post-featured-image/index.js +4 -2
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-template/block-theme.js +68 -48
- package/build/components/post-template/block-theme.js.map +1 -1
- package/build/components/post-template/classic-theme.js +30 -18
- package/build/components/post-template/classic-theme.js.map +1 -1
- package/build/components/post-template/create-new-template-modal.js +3 -1
- package/build/components/post-template/create-new-template-modal.js.map +1 -1
- package/build/components/post-template/panel.js +3 -11
- package/build/components/post-template/panel.js.map +1 -1
- package/build/components/preferences-modal/block-visibility.js +2 -1
- package/build/components/preferences-modal/block-visibility.js.map +1 -1
- package/build/components/preferences-modal/index.js +1 -1
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preview-dropdown/index.js +6 -3
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build/components/provider/index.js +19 -18
- package/build/components/provider/index.js.map +1 -1
- package/build/components/sidebar/header.js +1 -1
- package/build/components/sidebar/header.js.map +1 -1
- package/build/components/sidebar/index.js +1 -1
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/start-page-options/index.js +148 -23
- package/build/components/start-page-options/index.js.map +1 -1
- package/build/components/visual-editor/edit-template-blocks-notification.js +1 -1
- package/build/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
- package/build/store/private-actions.js +29 -2
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +45 -1
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/selectors.js +8 -7
- package/build/store/selectors.js.map +1 -1
- package/build/utils/media-upload/index.js +5 -2
- package/build/utils/media-upload/index.js.map +1 -1
- package/build-module/components/document-bar/index.js +3 -2
- package/build-module/components/document-bar/index.js.map +1 -1
- package/build-module/components/document-outline/index.js +38 -18
- package/build-module/components/document-outline/index.js.map +1 -1
- package/build-module/components/document-outline/item.js +32 -20
- package/build-module/components/document-outline/item.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-record-item.js +4 -3
- package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-type-list.js +2 -1
- package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js +67 -43
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/post-actions/index.js +19 -28
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-card-panel/index.js +5 -5
- package/build-module/components/post-card-panel/index.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +4 -2
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-template/block-theme.js +68 -48
- package/build-module/components/post-template/block-theme.js.map +1 -1
- package/build-module/components/post-template/classic-theme.js +30 -18
- package/build-module/components/post-template/classic-theme.js.map +1 -1
- package/build-module/components/post-template/create-new-template-modal.js +3 -1
- package/build-module/components/post-template/create-new-template-modal.js.map +1 -1
- package/build-module/components/post-template/panel.js +3 -11
- package/build-module/components/post-template/panel.js.map +1 -1
- package/build-module/components/preferences-modal/block-visibility.js +2 -1
- package/build-module/components/preferences-modal/block-visibility.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +1 -1
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js +6 -3
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/provider/index.js +19 -18
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/sidebar/header.js +1 -1
- package/build-module/components/sidebar/header.js.map +1 -1
- package/build-module/components/sidebar/index.js +1 -1
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/start-page-options/index.js +148 -24
- package/build-module/components/start-page-options/index.js.map +1 -1
- package/build-module/components/visual-editor/edit-template-blocks-notification.js +1 -1
- package/build-module/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
- package/build-module/store/private-actions.js +25 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +44 -1
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/selectors.js +8 -7
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/media-upload/index.js +5 -2
- package/build-module/utils/media-upload/index.js.map +1 -1
- package/build-style/style-rtl.css +51 -9
- package/build-style/style.css +51 -9
- package/build-types/components/document-outline/index.d.ts.map +1 -1
- package/build-types/components/document-outline/item.d.ts +2 -1
- package/build-types/components/document-outline/item.d.ts.map +1 -1
- package/build-types/components/entities-saved-states/entity-record-item.d.ts.map +1 -1
- package/build-types/components/entities-saved-states/entity-type-list.d.ts.map +1 -1
- package/build-types/components/entities-saved-states/index.d.ts +6 -2
- package/build-types/components/entities-saved-states/index.d.ts.map +1 -1
- package/build-types/components/post-actions/index.d.ts.map +1 -1
- package/build-types/components/post-card-panel/index.d.ts.map +1 -1
- package/build-types/components/post-template/block-theme.d.ts.map +1 -1
- package/build-types/components/post-template/classic-theme.d.ts.map +1 -1
- package/build-types/components/post-template/create-new-template-modal.d.ts.map +1 -1
- package/build-types/components/post-template/panel.d.ts.map +1 -1
- package/build-types/components/preferences-modal/block-visibility.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/start-page-options/index.d.ts +2 -1
- package/build-types/components/start-page-options/index.d.ts.map +1 -1
- package/build-types/store/private-actions.d.ts +4 -0
- package/build-types/store/private-actions.d.ts.map +1 -1
- package/build-types/store/private-selectors.d.ts +13 -0
- package/build-types/store/private-selectors.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts.map +1 -1
- package/build-types/utils/media-upload/index.d.ts +3 -1
- package/build-types/utils/media-upload/index.d.ts.map +1 -1
- package/package.json +37 -37
- package/src/components/document-bar/index.js +2 -2
- package/src/components/document-outline/index.js +49 -17
- package/src/components/document-outline/item.js +38 -23
- package/src/components/document-outline/style.scss +2 -0
- package/src/components/entities-saved-states/entity-record-item.js +2 -4
- package/src/components/entities-saved-states/entity-type-list.js +6 -2
- package/src/components/entities-saved-states/index.js +98 -58
- package/src/components/entities-saved-states/style.scss +40 -5
- package/src/components/post-actions/index.js +19 -37
- package/src/components/post-card-panel/index.js +9 -7
- package/src/components/post-featured-image/index.js +2 -0
- package/src/components/post-template/block-theme.js +76 -56
- package/src/components/post-template/classic-theme.js +31 -15
- package/src/components/post-template/create-new-template-modal.js +1 -0
- package/src/components/post-template/panel.js +2 -12
- package/src/components/post-text-editor/style.scss +0 -2
- package/src/components/preferences-modal/block-visibility.js +2 -1
- package/src/components/preferences-modal/index.js +1 -1
- package/src/components/preview-dropdown/index.js +8 -6
- package/src/components/provider/index.js +21 -30
- package/src/components/sidebar/header.js +1 -1
- package/src/components/sidebar/index.js +1 -1
- package/src/components/start-page-options/index.js +149 -23
- package/src/components/start-page-options/style.scss +27 -0
- package/src/components/visual-editor/edit-template-blocks-notification.js +1 -1
- package/src/store/private-actions.js +33 -0
- package/src/store/private-selectors.js +59 -4
- package/src/store/selectors.js +9 -14
- package/src/utils/media-upload/index.js +3 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_uuid","require","_data","_mediaUtils","_store","noop","mediaUpload","additionalData","allowedTypes","filesList","maxUploadFileSize","onError","onFileChange","onSuccess","getCurrentPost","getEditorSettings","select","editorStore","lockPostAutosaving","unlockPostAutosaving","lockPostSaving","unlockPostSaving","dispatch","wpAllowedMimeTypes","allowedMimeTypes","lockKey","uuid","imageIsUploading","currentPost","currentPostId","id","wp_id","setSaveLock","postData","post","clearSaveLock","uploadMedia","file","message"],"sources":["@wordpress/editor/src/utils/media-upload/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { v4 as uuid } from 'uuid';\n\n/**\n * WordPress dependencies\n */\nimport { select, dispatch } from '@wordpress/data';\nimport { uploadMedia } from '@wordpress/media-utils';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nconst noop = () => {};\n\n/**\n * Upload a media file when the file upload button is activated.\n * Wrapper around mediaUpload() that injects the current post ID.\n *\n * @param {Object} $0 Parameters object passed to the function.\n * @param {?Object} $0.additionalData Additional data to include in the request.\n * @param {string} $0.allowedTypes Array with the types of media that can be uploaded, if unset all types are allowed.\n * @param {Array} $0.filesList List of files.\n * @param {?number} $0.maxUploadFileSize Maximum upload size in bytes allowed for the site.\n * @param {Function} $0.onError Function called when an error happens.\n * @param {Function} $0.onFileChange Function called each time a file or a temporary representation of the file is available.\n * @param {Function} $0.onSuccess Function called after the final representation of the file is available.\n */\nexport default function mediaUpload( {\n\tadditionalData = {},\n\tallowedTypes,\n\tfilesList,\n\tmaxUploadFileSize,\n\tonError = noop,\n\tonFileChange,\n\tonSuccess,\n} ) {\n\tconst { getCurrentPost, getEditorSettings } = select( editorStore );\n\tconst {\n\t\tlockPostAutosaving,\n\t\tunlockPostAutosaving,\n\t\tlockPostSaving,\n\t\tunlockPostSaving,\n\t} = dispatch( editorStore );\n\n\tconst wpAllowedMimeTypes = getEditorSettings().allowedMimeTypes;\n\tconst lockKey = `image-upload-${ uuid() }`;\n\tlet imageIsUploading = false;\n\tmaxUploadFileSize =\n\t\tmaxUploadFileSize || getEditorSettings().maxUploadFileSize;\n\tconst currentPost = getCurrentPost();\n\t// Templates and template parts' numerical ID is stored in `wp_id`.\n\tconst currentPostId =\n\t\ttypeof currentPost?.id === 'number'\n\t\t\t? currentPost.id\n\t\t\t: currentPost?.wp_id;\n\tconst setSaveLock = () => {\n\t\tlockPostSaving( lockKey );\n\t\tlockPostAutosaving( lockKey );\n\t\timageIsUploading = true;\n\t};\n\n\tconst postData = currentPostId ? { post: currentPostId } : {};\n\tconst clearSaveLock = () => {\n\t\tunlockPostSaving( lockKey );\n\t\tunlockPostAutosaving( lockKey );\n\t\timageIsUploading = false;\n\t};\n\n\tuploadMedia( {\n\t\tallowedTypes,\n\t\tfilesList,\n\t\tonFileChange: ( file ) => {\n\t\t\tif ( ! imageIsUploading ) {\n\t\t\t\tsetSaveLock();\n\t\t\t} else {\n\t\t\t\tclearSaveLock();\n\t\t\t}\n\t\t\tonFileChange?.( file );\n\t\t},\n\t\tonSuccess,\n\t\tadditionalData: {\n\t\t\t...postData,\n\t\t\t...additionalData,\n\t\t},\n\t\tmaxUploadFileSize,\n\t\tonError: ( { message } ) => {\n\t\t\tclearSaveLock();\n\t\t\tonError( message );\n\t\t},\n\t\twpAllowedMimeTypes,\n\t} );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;;AAGA,MAAMI,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,WAAWA,CAAE;EACpCC,cAAc,GAAG,CAAC,CAAC;EACnBC,YAAY;EACZC,SAAS;EACTC,iBAAiB;EACjBC,OAAO,GAAGN,IAAI;EACdO,YAAY;EACZC;
|
|
1
|
+
{"version":3,"names":["_uuid","require","_data","_mediaUtils","_store","noop","mediaUpload","additionalData","allowedTypes","filesList","maxUploadFileSize","onError","onFileChange","onSuccess","multiple","getCurrentPost","getEditorSettings","select","editorStore","lockPostAutosaving","unlockPostAutosaving","lockPostSaving","unlockPostSaving","dispatch","wpAllowedMimeTypes","allowedMimeTypes","lockKey","uuid","imageIsUploading","currentPost","currentPostId","id","wp_id","setSaveLock","postData","post","clearSaveLock","uploadMedia","file","message"],"sources":["@wordpress/editor/src/utils/media-upload/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { v4 as uuid } from 'uuid';\n\n/**\n * WordPress dependencies\n */\nimport { select, dispatch } from '@wordpress/data';\nimport { uploadMedia } from '@wordpress/media-utils';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nconst noop = () => {};\n\n/**\n * Upload a media file when the file upload button is activated.\n * Wrapper around mediaUpload() that injects the current post ID.\n *\n * @param {Object} $0 Parameters object passed to the function.\n * @param {?Object} $0.additionalData Additional data to include in the request.\n * @param {string} $0.allowedTypes Array with the types of media that can be uploaded, if unset all types are allowed.\n * @param {Array} $0.filesList List of files.\n * @param {?number} $0.maxUploadFileSize Maximum upload size in bytes allowed for the site.\n * @param {Function} $0.onError Function called when an error happens.\n * @param {Function} $0.onFileChange Function called each time a file or a temporary representation of the file is available.\n * @param {Function} $0.onSuccess Function called after the final representation of the file is available.\n * @param {boolean} $0.multiple Whether to allow multiple files to be uploaded.\n */\nexport default function mediaUpload( {\n\tadditionalData = {},\n\tallowedTypes,\n\tfilesList,\n\tmaxUploadFileSize,\n\tonError = noop,\n\tonFileChange,\n\tonSuccess,\n\tmultiple = true,\n} ) {\n\tconst { getCurrentPost, getEditorSettings } = select( editorStore );\n\tconst {\n\t\tlockPostAutosaving,\n\t\tunlockPostAutosaving,\n\t\tlockPostSaving,\n\t\tunlockPostSaving,\n\t} = dispatch( editorStore );\n\n\tconst wpAllowedMimeTypes = getEditorSettings().allowedMimeTypes;\n\tconst lockKey = `image-upload-${ uuid() }`;\n\tlet imageIsUploading = false;\n\tmaxUploadFileSize =\n\t\tmaxUploadFileSize || getEditorSettings().maxUploadFileSize;\n\tconst currentPost = getCurrentPost();\n\t// Templates and template parts' numerical ID is stored in `wp_id`.\n\tconst currentPostId =\n\t\ttypeof currentPost?.id === 'number'\n\t\t\t? currentPost.id\n\t\t\t: currentPost?.wp_id;\n\tconst setSaveLock = () => {\n\t\tlockPostSaving( lockKey );\n\t\tlockPostAutosaving( lockKey );\n\t\timageIsUploading = true;\n\t};\n\n\tconst postData = currentPostId ? { post: currentPostId } : {};\n\tconst clearSaveLock = () => {\n\t\tunlockPostSaving( lockKey );\n\t\tunlockPostAutosaving( lockKey );\n\t\timageIsUploading = false;\n\t};\n\n\tuploadMedia( {\n\t\tallowedTypes,\n\t\tfilesList,\n\t\tonFileChange: ( file ) => {\n\t\t\tif ( ! imageIsUploading ) {\n\t\t\t\tsetSaveLock();\n\t\t\t} else {\n\t\t\t\tclearSaveLock();\n\t\t\t}\n\t\t\tonFileChange?.( file );\n\t\t},\n\t\tonSuccess,\n\t\tadditionalData: {\n\t\t\t...postData,\n\t\t\t...additionalData,\n\t\t},\n\t\tmaxUploadFileSize,\n\t\tonError: ( { message } ) => {\n\t\t\tclearSaveLock();\n\t\t\tonError( message );\n\t\t},\n\t\twpAllowedMimeTypes,\n\t\tmultiple,\n\t} );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;;AAGA,MAAMI,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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,SAAS;IACTG,YAAY,EAAI0B,IAAI,IAAM;MACzB,IAAK,CAAEV,gBAAgB,EAAG;QACzBK,WAAW,CAAC,CAAC;MACd,CAAC,MAAM;QACNG,aAAa,CAAC,CAAC;MAChB;MACAxB,YAAY,GAAI0B,IAAK,CAAC;IACvB,CAAC;IACDzB,SAAS;IACTN,cAAc,EAAE;MACf,GAAG2B,QAAQ;MACX,GAAG3B;IACJ,CAAC;IACDG,iBAAiB;IACjBC,OAAO,EAAEA,CAAE;MAAE4B;IAAQ,CAAC,KAAM;MAC3BH,aAAa,CAAC,CAAC;MACfzB,OAAO,CAAE4B,OAAQ,CAAC;IACnB,CAAC;IACDf,kBAAkB;IAClBV;EACD,CAAE,CAAC;AACJ","ignoreList":[]}
|
|
@@ -59,7 +59,7 @@ export default function DocumentBar(props) {
|
|
|
59
59
|
onNavigateToPreviousEntityRecord,
|
|
60
60
|
isTemplatePreview
|
|
61
61
|
} = useSelect(select => {
|
|
62
|
-
var
|
|
62
|
+
var _getCurrentTheme;
|
|
63
63
|
const {
|
|
64
64
|
getCurrentPostType,
|
|
65
65
|
getCurrentPostId,
|
|
@@ -69,6 +69,7 @@ export default function DocumentBar(props) {
|
|
|
69
69
|
const {
|
|
70
70
|
getEditedEntityRecord,
|
|
71
71
|
getPostType,
|
|
72
|
+
getCurrentTheme,
|
|
72
73
|
isResolving: isResolvingSelector
|
|
73
74
|
} = select(coreStore);
|
|
74
75
|
const _postType = getCurrentPostType();
|
|
@@ -76,7 +77,7 @@ export default function DocumentBar(props) {
|
|
|
76
77
|
const _document = getEditedEntityRecord('postType', _postType, _postId);
|
|
77
78
|
const {
|
|
78
79
|
default_template_types: templateTypes = []
|
|
79
|
-
} = (
|
|
80
|
+
} = (_getCurrentTheme = getCurrentTheme()) !== null && _getCurrentTheme !== void 0 ? _getCurrentTheme : {};
|
|
80
81
|
const _templateInfo = getTemplateInfo({
|
|
81
82
|
templateTypes,
|
|
82
83
|
template: _document
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","__","isRTL","useSelect","useDispatch","Button","__experimentalText","Text","__unstableMotion","motion","__unstableAnimatePresence","AnimatePresence","BlockIcon","chevronLeftSmall","chevronRightSmall","layout","displayShortcut","store","coreStore","commandsStore","useRef","useEffect","useReducedMotion","decodeEntities","__unstableStripHTML","stripHTML","TEMPLATE_POST_TYPES","editorStore","usePageTypeBadge","getTemplateInfo","jsx","_jsx","jsxs","_jsxs","MotionButton","DocumentBar","props","postId","postType","postTypeLabel","documentTitle","isNotFound","templateTitle","onNavigateToPreviousEntityRecord","isTemplatePreview","select","_select$getEntityReco","getCurrentPostType","getCurrentPostId","getEditorSettings","getRenderingMode","getEditedEntityRecord","getPostType","isResolving","isResolvingSelector","_postType","_postId","_document","default_template_types","templateTypes","getEntityRecord","_templateInfo","template","_postTypeLabel","labels","singular_name","title","open","openCommandCenter","isReducedMotion","isTemplate","includes","hasBackButton","entityTitle","icon","pageTypeBadge","mountedRef","current","className","children","onClick","event","stopPropagation","size","initial","opacity","transform","animate","exit","transition","duration","undefined","div","as","primary"],"sources":["@wordpress/editor/src/components/document-bar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\t__experimentalText as Text,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { chevronLeftSmall, chevronRightSmall, layout } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as commandsStore } from '@wordpress/commands';\nimport { useRef, useEffect } from '@wordpress/element';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPES } from '../../store/constants';\nimport { store as editorStore } from '../../store';\nimport usePageTypeBadge from '../../utils/pageTypeBadge';\nimport { getTemplateInfo } from '../../utils/get-template-info';\n\n/** @typedef {import(\"@wordpress/components\").IconType} IconType */\n\nconst MotionButton = motion( Button );\n\n/**\n * This component renders a navigation bar at the top of the editor. It displays the title of the current document,\n * a back button (if applicable), and a command center button. It also handles different states of the document,\n * such as \"not found\" or \"unsynced\".\n *\n * @example\n * ```jsx\n * <DocumentBar />\n * ```\n * @param {Object} props The component props.\n * @param {string} props.title A title for the document, defaulting to the document or\n * template title currently being edited.\n * @param {IconType} props.icon An icon for the document, no default.\n * (A default icon indicating the document post type is no longer used.)\n *\n * @return {React.ReactNode} The rendered DocumentBar component.\n */\nexport default function DocumentBar( props ) {\n\tconst {\n\t\tpostId,\n\t\tpostType,\n\t\tpostTypeLabel,\n\t\tdocumentTitle,\n\t\tisNotFound,\n\t\ttemplateTitle,\n\t\tonNavigateToPreviousEntityRecord,\n\t\tisTemplatePreview,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentPostId,\n\t\t\tgetEditorSettings,\n\t\t\tgetRenderingMode,\n\t\t} = select( editorStore );\n\n\t\tconst {\n\t\t\tgetEditedEntityRecord,\n\t\t\tgetPostType,\n\t\t\tisResolving: isResolvingSelector,\n\t\t} = select( coreStore );\n\t\tconst _postType = getCurrentPostType();\n\t\tconst _postId = getCurrentPostId();\n\t\tconst _document = getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\t_postType,\n\t\t\t_postId\n\t\t);\n\n\t\tconst { default_template_types: templateTypes = [] } =\n\t\t\tselect( coreStore ).getEntityRecord( 'root', '__unstableBase' ) ??\n\t\t\t{};\n\n\t\tconst _templateInfo = getTemplateInfo( {\n\t\t\ttemplateTypes,\n\t\t\ttemplate: _document,\n\t\t} );\n\t\tconst _postTypeLabel = getPostType( _postType )?.labels?.singular_name;\n\n\t\treturn {\n\t\t\tpostId: _postId,\n\t\t\tpostType: _postType,\n\t\t\tpostTypeLabel: _postTypeLabel,\n\t\t\tdocumentTitle: _document.title,\n\t\t\tisNotFound:\n\t\t\t\t! _document &&\n\t\t\t\t! isResolvingSelector(\n\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\t'postType',\n\t\t\t\t\t_postType,\n\t\t\t\t\t_postId\n\t\t\t\t),\n\t\t\ttemplateTitle: _templateInfo.title,\n\t\t\tonNavigateToPreviousEntityRecord:\n\t\t\t\tgetEditorSettings().onNavigateToPreviousEntityRecord,\n\t\t\tisTemplatePreview: getRenderingMode() === 'template-locked',\n\t\t};\n\t}, [] );\n\n\tconst { open: openCommandCenter } = useDispatch( commandsStore );\n\tconst isReducedMotion = useReducedMotion();\n\n\tconst isTemplate = TEMPLATE_POST_TYPES.includes( postType );\n\tconst hasBackButton = !! onNavigateToPreviousEntityRecord;\n\tconst entityTitle = isTemplate ? templateTitle : documentTitle;\n\tconst title = props.title || entityTitle;\n\tconst icon = props.icon;\n\n\tconst pageTypeBadge = usePageTypeBadge( postId );\n\n\tconst mountedRef = useRef( false );\n\tuseEffect( () => {\n\t\tmountedRef.current = true;\n\t}, [] );\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx( 'editor-document-bar', {\n\t\t\t\t'has-back-button': hasBackButton,\n\t\t\t} ) }\n\t\t>\n\t\t\t<AnimatePresence>\n\t\t\t\t{ hasBackButton && (\n\t\t\t\t\t<MotionButton\n\t\t\t\t\t\tclassName=\"editor-document-bar__back\"\n\t\t\t\t\t\ticon={ isRTL() ? chevronRightSmall : chevronLeftSmall }\n\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\tonNavigateToPreviousEntityRecord();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\tmountedRef.current\n\t\t\t\t\t\t\t\t? { opacity: 0, transform: 'translateX(15%)' }\n\t\t\t\t\t\t\t\t: false // Don't show entry animation when DocumentBar mounts.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanimate={ { opacity: 1, transform: 'translateX(0%)' } }\n\t\t\t\t\t\texit={ { opacity: 0, transform: 'translateX(15%)' } }\n\t\t\t\t\t\ttransition={\n\t\t\t\t\t\t\tisReducedMotion ? { duration: 0 } : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Back' ) }\n\t\t\t\t\t</MotionButton>\n\t\t\t\t) }\n\t\t\t</AnimatePresence>\n\t\t\t{ ! isTemplate && isTemplatePreview && (\n\t\t\t\t<BlockIcon\n\t\t\t\t\ticon={ layout }\n\t\t\t\t\tclassName=\"editor-document-bar__icon-layout\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isNotFound ? (\n\t\t\t\t<Text>{ __( 'Document not found' ) }</Text>\n\t\t\t) : (\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"editor-document-bar__command\"\n\t\t\t\t\tonClick={ () => openCommandCenter() }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t>\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tclassName=\"editor-document-bar__title\"\n\t\t\t\t\t\t// Force entry animation when the back button is added or removed.\n\t\t\t\t\t\tkey={ hasBackButton }\n\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\tmountedRef.current\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t\t\t\ttransform: hasBackButton\n\t\t\t\t\t\t\t\t\t\t\t? 'translateX(15%)'\n\t\t\t\t\t\t\t\t\t\t\t: 'translateX(-15%)',\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t: false // Don't show entry animation when DocumentBar mounts.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanimate={ {\n\t\t\t\t\t\t\topacity: 1,\n\t\t\t\t\t\t\ttransform: 'translateX(0%)',\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ttransition={\n\t\t\t\t\t\t\tisReducedMotion ? { duration: 0 } : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ icon && <BlockIcon icon={ icon } /> }\n\t\t\t\t\t\t<Text size=\"body\" as=\"h1\">\n\t\t\t\t\t\t\t<span className=\"editor-document-bar__post-title\">\n\t\t\t\t\t\t\t\t{ title\n\t\t\t\t\t\t\t\t\t? stripHTML( title )\n\t\t\t\t\t\t\t\t\t: __( 'No title' ) }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t{ pageTypeBadge && (\n\t\t\t\t\t\t\t\t<span className=\"editor-document-bar__post-type-label\">\n\t\t\t\t\t\t\t\t\t{ `· ${ pageTypeBadge }` }\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ postTypeLabel &&\n\t\t\t\t\t\t\t\t! props.title &&\n\t\t\t\t\t\t\t\t! pageTypeBadge && (\n\t\t\t\t\t\t\t\t\t<span className=\"editor-document-bar__post-type-label\">\n\t\t\t\t\t\t\t\t\t\t{ `· ${ decodeEntities(\n\t\t\t\t\t\t\t\t\t\t\tpostTypeLabel\n\t\t\t\t\t\t\t\t\t\t) }` }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</motion.div>\n\t\t\t\t\t<span className=\"editor-document-bar__shortcut\">\n\t\t\t\t\t\t{ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t</span>\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;A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+C,SAAS,EAAC,sCAAsC;YAAAC,QAAA,EACnD,KAAMJ,aAAa;UAAG,CACnB,CACN,EACCpC,aAAa,IACd,CAAEH,KAAK,CAAC8B,KAAK,IACb,CAAES,aAAa,iBACd5C,IAAA;YAAM+C,SAAS,EAAC,sCAAsC;YAAAC,QAAA,EACnD,KAAMxD,cAAc,CACrBgB,aACD,CAAC;UAAG,CACC,CACN;QAAA,CACG,CAAC;MAAA,GAxCDiC,aAyCK,CAAC,eACbzC,IAAA;QAAM+C,SAAS,EAAC,+BAA+B;QAAAC,QAAA,EAC5C/D,eAAe,CAAC8E,OAAO,CAAE,GAAI;MAAC,CAC3B,CAAC;IAAA,CACA,CACR;EAAA,CACG,CAAC;AAER","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","__","isRTL","useSelect","useDispatch","Button","__experimentalText","Text","__unstableMotion","motion","__unstableAnimatePresence","AnimatePresence","BlockIcon","chevronLeftSmall","chevronRightSmall","layout","displayShortcut","store","coreStore","commandsStore","useRef","useEffect","useReducedMotion","decodeEntities","__unstableStripHTML","stripHTML","TEMPLATE_POST_TYPES","editorStore","usePageTypeBadge","getTemplateInfo","jsx","_jsx","jsxs","_jsxs","MotionButton","DocumentBar","props","postId","postType","postTypeLabel","documentTitle","isNotFound","templateTitle","onNavigateToPreviousEntityRecord","isTemplatePreview","select","_getCurrentTheme","getCurrentPostType","getCurrentPostId","getEditorSettings","getRenderingMode","getEditedEntityRecord","getPostType","getCurrentTheme","isResolving","isResolvingSelector","_postType","_postId","_document","default_template_types","templateTypes","_templateInfo","template","_postTypeLabel","labels","singular_name","title","open","openCommandCenter","isReducedMotion","isTemplate","includes","hasBackButton","entityTitle","icon","pageTypeBadge","mountedRef","current","className","children","onClick","event","stopPropagation","size","initial","opacity","transform","animate","exit","transition","duration","undefined","div","as","primary"],"sources":["@wordpress/editor/src/components/document-bar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\t__experimentalText as Text,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { chevronLeftSmall, chevronRightSmall, layout } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as commandsStore } from '@wordpress/commands';\nimport { useRef, useEffect } from '@wordpress/element';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPES } from '../../store/constants';\nimport { store as editorStore } from '../../store';\nimport usePageTypeBadge from '../../utils/pageTypeBadge';\nimport { getTemplateInfo } from '../../utils/get-template-info';\n\n/** @typedef {import(\"@wordpress/components\").IconType} IconType */\n\nconst MotionButton = motion( Button );\n\n/**\n * This component renders a navigation bar at the top of the editor. It displays the title of the current document,\n * a back button (if applicable), and a command center button. It also handles different states of the document,\n * such as \"not found\" or \"unsynced\".\n *\n * @example\n * ```jsx\n * <DocumentBar />\n * ```\n * @param {Object} props The component props.\n * @param {string} props.title A title for the document, defaulting to the document or\n * template title currently being edited.\n * @param {IconType} props.icon An icon for the document, no default.\n * (A default icon indicating the document post type is no longer used.)\n *\n * @return {React.ReactNode} The rendered DocumentBar component.\n */\nexport default function DocumentBar( props ) {\n\tconst {\n\t\tpostId,\n\t\tpostType,\n\t\tpostTypeLabel,\n\t\tdocumentTitle,\n\t\tisNotFound,\n\t\ttemplateTitle,\n\t\tonNavigateToPreviousEntityRecord,\n\t\tisTemplatePreview,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentPostId,\n\t\t\tgetEditorSettings,\n\t\t\tgetRenderingMode,\n\t\t} = select( editorStore );\n\n\t\tconst {\n\t\t\tgetEditedEntityRecord,\n\t\t\tgetPostType,\n\t\t\tgetCurrentTheme,\n\t\t\tisResolving: isResolvingSelector,\n\t\t} = select( coreStore );\n\t\tconst _postType = getCurrentPostType();\n\t\tconst _postId = getCurrentPostId();\n\t\tconst _document = getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\t_postType,\n\t\t\t_postId\n\t\t);\n\n\t\tconst { default_template_types: templateTypes = [] } =\n\t\t\tgetCurrentTheme() ?? {};\n\n\t\tconst _templateInfo = getTemplateInfo( {\n\t\t\ttemplateTypes,\n\t\t\ttemplate: _document,\n\t\t} );\n\t\tconst _postTypeLabel = getPostType( _postType )?.labels?.singular_name;\n\n\t\treturn {\n\t\t\tpostId: _postId,\n\t\t\tpostType: _postType,\n\t\t\tpostTypeLabel: _postTypeLabel,\n\t\t\tdocumentTitle: _document.title,\n\t\t\tisNotFound:\n\t\t\t\t! _document &&\n\t\t\t\t! isResolvingSelector(\n\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\t'postType',\n\t\t\t\t\t_postType,\n\t\t\t\t\t_postId\n\t\t\t\t),\n\t\t\ttemplateTitle: _templateInfo.title,\n\t\t\tonNavigateToPreviousEntityRecord:\n\t\t\t\tgetEditorSettings().onNavigateToPreviousEntityRecord,\n\t\t\tisTemplatePreview: getRenderingMode() === 'template-locked',\n\t\t};\n\t}, [] );\n\n\tconst { open: openCommandCenter } = useDispatch( commandsStore );\n\tconst isReducedMotion = useReducedMotion();\n\n\tconst isTemplate = TEMPLATE_POST_TYPES.includes( postType );\n\tconst hasBackButton = !! onNavigateToPreviousEntityRecord;\n\tconst entityTitle = isTemplate ? templateTitle : documentTitle;\n\tconst title = props.title || entityTitle;\n\tconst icon = props.icon;\n\n\tconst pageTypeBadge = usePageTypeBadge( postId );\n\n\tconst mountedRef = useRef( false );\n\tuseEffect( () => {\n\t\tmountedRef.current = true;\n\t}, [] );\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx( 'editor-document-bar', {\n\t\t\t\t'has-back-button': hasBackButton,\n\t\t\t} ) }\n\t\t>\n\t\t\t<AnimatePresence>\n\t\t\t\t{ hasBackButton && (\n\t\t\t\t\t<MotionButton\n\t\t\t\t\t\tclassName=\"editor-document-bar__back\"\n\t\t\t\t\t\ticon={ isRTL() ? chevronRightSmall : chevronLeftSmall }\n\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\tonNavigateToPreviousEntityRecord();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\tmountedRef.current\n\t\t\t\t\t\t\t\t? { opacity: 0, transform: 'translateX(15%)' }\n\t\t\t\t\t\t\t\t: false // Don't show entry animation when DocumentBar mounts.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanimate={ { opacity: 1, transform: 'translateX(0%)' } }\n\t\t\t\t\t\texit={ { opacity: 0, transform: 'translateX(15%)' } }\n\t\t\t\t\t\ttransition={\n\t\t\t\t\t\t\tisReducedMotion ? { duration: 0 } : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Back' ) }\n\t\t\t\t\t</MotionButton>\n\t\t\t\t) }\n\t\t\t</AnimatePresence>\n\t\t\t{ ! isTemplate && isTemplatePreview && (\n\t\t\t\t<BlockIcon\n\t\t\t\t\ticon={ layout }\n\t\t\t\t\tclassName=\"editor-document-bar__icon-layout\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isNotFound ? (\n\t\t\t\t<Text>{ __( 'Document not found' ) }</Text>\n\t\t\t) : (\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"editor-document-bar__command\"\n\t\t\t\t\tonClick={ () => openCommandCenter() }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t>\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tclassName=\"editor-document-bar__title\"\n\t\t\t\t\t\t// Force entry animation when the back button is added or removed.\n\t\t\t\t\t\tkey={ hasBackButton }\n\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\tmountedRef.current\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t\t\t\ttransform: hasBackButton\n\t\t\t\t\t\t\t\t\t\t\t? 'translateX(15%)'\n\t\t\t\t\t\t\t\t\t\t\t: 'translateX(-15%)',\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t: false // Don't show entry animation when DocumentBar mounts.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanimate={ {\n\t\t\t\t\t\t\topacity: 1,\n\t\t\t\t\t\t\ttransform: 'translateX(0%)',\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ttransition={\n\t\t\t\t\t\t\tisReducedMotion ? { duration: 0 } : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ icon && <BlockIcon icon={ icon } /> }\n\t\t\t\t\t\t<Text size=\"body\" as=\"h1\">\n\t\t\t\t\t\t\t<span className=\"editor-document-bar__post-title\">\n\t\t\t\t\t\t\t\t{ title\n\t\t\t\t\t\t\t\t\t? stripHTML( title )\n\t\t\t\t\t\t\t\t\t: __( 'No title' ) }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t{ pageTypeBadge && (\n\t\t\t\t\t\t\t\t<span className=\"editor-document-bar__post-type-label\">\n\t\t\t\t\t\t\t\t\t{ `· ${ pageTypeBadge }` }\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ postTypeLabel &&\n\t\t\t\t\t\t\t\t! props.title &&\n\t\t\t\t\t\t\t\t! pageTypeBadge && (\n\t\t\t\t\t\t\t\t\t<span className=\"editor-document-bar__post-type-label\">\n\t\t\t\t\t\t\t\t\t\t{ `· ${ decodeEntities(\n\t\t\t\t\t\t\t\t\t\t\tpostTypeLabel\n\t\t\t\t\t\t\t\t\t\t) }` }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</motion.div>\n\t\t\t\t\t<span className=\"editor-document-bar__shortcut\">\n\t\t\t\t\t\t{ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t</span>\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SACCC,MAAM,EACNC,kBAAkB,IAAIC,IAAI,EAC1BC,gBAAgB,IAAIC,MAAM,EAC1BC,yBAAyB,IAAIC,eAAe,QACtC,uBAAuB;AAC9B,SAASC,SAAS,QAAQ,yBAAyB;AACnD,SAASC,gBAAgB,EAAEC,iBAAiB,EAAEC,MAAM,QAAQ,kBAAkB;AAC9E,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASD,KAAK,IAAIE,aAAa,QAAQ,qBAAqB;AAC5D,SAASC,MAAM,EAAEC,SAAS,QAAQ,oBAAoB;AACtD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,mBAAmB,IAAIC,SAAS,QAAQ,gBAAgB;;AAEjE;AACA;AACA;AACA,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAAST,KAAK,IAAIU,WAAW,QAAQ,aAAa;AAClD,OAAOC,gBAAgB,MAAM,2BAA2B;AACxD,SAASC,eAAe,QAAQ,+BAA+B;;AAE/D;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEA,MAAMC,YAAY,GAAGzB,MAA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B,QAAQ,EAAE;QAAE,CAAC,GAAGC,SACpC;QAAAZ,QAAA,GAECL,IAAI,iBAAI3C,IAAA,CAACnB,SAAS;UAAC8D,IAAI,EAAGA;QAAM,CAAE,CAAC,eACrCzC,KAAA,CAAC1B,IAAI;UAAC4E,IAAI,EAAC,MAAM;UAACU,EAAE,EAAC,IAAI;UAAAd,QAAA,gBACxBhD,IAAA;YAAM+C,SAAS,EAAC,iCAAiC;YAAAC,QAAA,EAC9Cb,KAAK,GACJzC,SAAS,CAAEyC,KAAM,CAAC,GAClBjE,EAAE,CAAE,UAAW;UAAC,CACd,CAAC,EACL0E,aAAa,iBACd5C,IAAA;YAAM+C,SAAS,EAAC,sCAAsC;YAAAC,QAAA,EACnD,KAAMJ,aAAa;UAAG,CACnB,CACN,EACCpC,aAAa,IACd,CAAEH,KAAK,CAAC8B,KAAK,IACb,CAAES,aAAa,iBACd5C,IAAA;YAAM+C,SAAS,EAAC,sCAAsC;YAAAC,QAAA,EACnD,KAAMxD,cAAc,CACrBgB,aACD,CAAC;UAAG,CACC,CACN;QAAA,CACG,CAAC;MAAA,GAxCDiC,aAyCK,CAAC,eACbzC,IAAA;QAAM+C,SAAS,EAAC,+BAA+B;QAAAC,QAAA,EAC5C/D,eAAe,CAAC8E,OAAO,CAAE,GAAI;MAAC,CAC3B,CAAC;IAAA,CACA,CACR;EAAA,CACG,CAAC;AAER","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
6
|
-
import { useRef } from '@wordpress/element';
|
|
6
|
+
import { useRef, useMemo } from '@wordpress/element';
|
|
7
7
|
import { create, getTextContent } from '@wordpress/rich-text';
|
|
8
8
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
9
9
|
import { store as coreStore } from '@wordpress/core-data';
|
|
@@ -121,16 +121,11 @@ function EmptyOutlineIllustration() {
|
|
|
121
121
|
* @return {Array} An array of heading blocks enhanced with the properties described above.
|
|
122
122
|
*/
|
|
123
123
|
const computeOutlineHeadings = (blocks = []) => {
|
|
124
|
-
return blocks.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
isEmpty: isEmptyHeading(block)
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
return computeOutlineHeadings(block.innerBlocks);
|
|
133
|
-
});
|
|
124
|
+
return blocks.filter(block => block.name === 'core/heading').map(block => ({
|
|
125
|
+
...block,
|
|
126
|
+
level: block.attributes.level,
|
|
127
|
+
isEmpty: isEmptyHeading(block)
|
|
128
|
+
}));
|
|
134
129
|
};
|
|
135
130
|
const isEmptyHeading = heading => !heading.attributes.content || heading.attributes.content.trim().length === 0;
|
|
136
131
|
|
|
@@ -151,14 +146,10 @@ export default function DocumentOutline({
|
|
|
151
146
|
selectBlock
|
|
152
147
|
} = useDispatch(blockEditorStore);
|
|
153
148
|
const {
|
|
154
|
-
blocks,
|
|
155
149
|
title,
|
|
156
150
|
isTitleSupported
|
|
157
151
|
} = useSelect(select => {
|
|
158
152
|
var _postType$supports$ti;
|
|
159
|
-
const {
|
|
160
|
-
getBlocks
|
|
161
|
-
} = select(blockEditorStore);
|
|
162
153
|
const {
|
|
163
154
|
getEditedPostAttribute
|
|
164
155
|
} = select(editorStore);
|
|
@@ -168,12 +159,38 @@ export default function DocumentOutline({
|
|
|
168
159
|
const postType = getPostType(getEditedPostAttribute('type'));
|
|
169
160
|
return {
|
|
170
161
|
title: getEditedPostAttribute('title'),
|
|
171
|
-
blocks: getBlocks(),
|
|
172
162
|
isTitleSupported: (_postType$supports$ti = postType?.supports?.title) !== null && _postType$supports$ti !== void 0 ? _postType$supports$ti : false
|
|
173
163
|
};
|
|
174
164
|
});
|
|
165
|
+
const blocks = useSelect(select => {
|
|
166
|
+
const {
|
|
167
|
+
getClientIdsWithDescendants,
|
|
168
|
+
getBlock
|
|
169
|
+
} = select(blockEditorStore);
|
|
170
|
+
const clientIds = getClientIdsWithDescendants();
|
|
171
|
+
// Note: Don't modify data inside the `Array.map` callback,
|
|
172
|
+
// all compulations should happen in `computeOutlineHeadings`.
|
|
173
|
+
return clientIds.map(id => getBlock(id));
|
|
174
|
+
});
|
|
175
|
+
const contentBlocks = useSelect(select => {
|
|
176
|
+
// When rendering in `post-only` mode all blocks are considered content blocks.
|
|
177
|
+
if (select(editorStore).getRenderingMode() === 'post-only') {
|
|
178
|
+
return undefined;
|
|
179
|
+
}
|
|
180
|
+
const {
|
|
181
|
+
getBlocksByName,
|
|
182
|
+
getClientIdsOfDescendants
|
|
183
|
+
} = select(blockEditorStore);
|
|
184
|
+
const [postContentClientId] = getBlocksByName('core/post-content');
|
|
185
|
+
|
|
186
|
+
// Do nothing if there's no post content block.
|
|
187
|
+
if (!postContentClientId) {
|
|
188
|
+
return undefined;
|
|
189
|
+
}
|
|
190
|
+
return getClientIdsOfDescendants(postContentClientId);
|
|
191
|
+
}, []);
|
|
175
192
|
const prevHeadingLevelRef = useRef(1);
|
|
176
|
-
const headings = computeOutlineHeadings(blocks);
|
|
193
|
+
const headings = useMemo(() => computeOutlineHeadings(blocks), [blocks]);
|
|
177
194
|
if (headings.length < 1) {
|
|
178
195
|
return /*#__PURE__*/_jsxs("div", {
|
|
179
196
|
className: "editor-document-outline has-no-headings",
|
|
@@ -191,6 +208,9 @@ export default function DocumentOutline({
|
|
|
191
208
|
[heading.level]: (acc[heading.level] || 0) + 1
|
|
192
209
|
}), {});
|
|
193
210
|
const hasMultipleH1 = countByLevel[1] > 1;
|
|
211
|
+
function isContentBlock(clientId) {
|
|
212
|
+
return Array.isArray(contentBlocks) ? contentBlocks.includes(clientId) : true;
|
|
213
|
+
}
|
|
194
214
|
return /*#__PURE__*/_jsx("div", {
|
|
195
215
|
className: "document-outline",
|
|
196
216
|
children: /*#__PURE__*/_jsxs("ul", {
|
|
@@ -210,7 +230,7 @@ export default function DocumentOutline({
|
|
|
210
230
|
return /*#__PURE__*/_jsxs(DocumentOutlineItem, {
|
|
211
231
|
level: `H${item.level}`,
|
|
212
232
|
isValid: isValid,
|
|
213
|
-
isDisabled: hasOutlineItemsDisabled,
|
|
233
|
+
isDisabled: hasOutlineItemsDisabled || !isContentBlock(item.clientId),
|
|
214
234
|
href: `#block-${item.clientId}`,
|
|
215
235
|
onSelect: () => {
|
|
216
236
|
selectBlock(item.clientId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","useDispatch","useSelect","useRef","create","getTextContent","store","blockEditorStore","coreStore","Path","SVG","Line","Rect","DocumentOutlineItem","editorStore","jsx","_jsx","jsxs","_jsxs","emptyHeadingContent","children","incorrectLevelContent","singleH1Headings","multipleH1Headings","EmptyOutlineIllustration","width","height","viewBox","fill","xmlns","rx","x1","y1","x2","y2","stroke","x","y","d","computeOutlineHeadings","blocks","flatMap","block","name","level","attributes","isEmpty","isEmptyHeading","innerBlocks","heading","content","trim","length","DocumentOutline","onSelect","hasOutlineItemsDisabled","selectBlock","title","isTitleSupported","select","_postType$supports$ti","getBlocks","getEditedPostAttribute","getPostType","postType","supports","prevHeadingLevelRef","headings","className","titleNode","document","querySelector","hasTitle","countByLevel","reduce","acc","hasMultipleH1","isValid","href","id","isDisabled","map","item","isIncorrectLevel","current","clientId","html"],"sources":["@wordpress/editor/src/components/document-outline/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useRef } from '@wordpress/element';\nimport { create, getTextContent } from '@wordpress/rich-text';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { Path, SVG, Line, Rect } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport DocumentOutlineItem from './item';\nimport { store as editorStore } from '../../store';\n\n/**\n * Module constants\n */\nconst emptyHeadingContent = <em>{ __( '(Empty heading)' ) }</em>;\nconst incorrectLevelContent = [\n\t<br key=\"incorrect-break\" />,\n\t<em key=\"incorrect-message\">{ __( '(Incorrect heading level)' ) }</em>,\n];\nconst singleH1Headings = [\n\t<br key=\"incorrect-break-h1\" />,\n\t<em key=\"incorrect-message-h1\">\n\t\t{ __( '(Your theme may already use a H1 for the post title)' ) }\n\t</em>,\n];\nconst multipleH1Headings = [\n\t<br key=\"incorrect-break-multiple-h1\" />,\n\t<em key=\"incorrect-message-multiple-h1\">\n\t\t{ __( '(Multiple H1 headings are not recommended)' ) }\n\t</em>,\n];\nfunction EmptyOutlineIllustration() {\n\treturn (\n\t\t<SVG\n\t\t\twidth=\"138\"\n\t\t\theight=\"148\"\n\t\t\tviewBox=\"0 0 138 148\"\n\t\t\tfill=\"none\"\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t>\n\t\t\t<Rect width=\"138\" height=\"148\" rx=\"4\" fill=\"#F0F6FC\" />\n\t\t\t<Line x1=\"44\" y1=\"28\" x2=\"24\" y2=\"28\" stroke=\"#DDDDDD\" />\n\t\t\t<Rect x=\"48\" y=\"16\" width=\"27\" height=\"23\" rx=\"4\" fill=\"#DDDDDD\" />\n\t\t\t<Path\n\t\t\t\td=\"M54.7585 32V23.2727H56.6037V26.8736H60.3494V23.2727H62.1903V32H60.3494V28.3949H56.6037V32H54.7585ZM67.4574 23.2727V32H65.6122V25.0241H65.5611L63.5625 26.277V24.6406L65.723 23.2727H67.4574Z\"\n\t\t\t\tfill=\"black\"\n\t\t\t/>\n\t\t\t<Line x1=\"55\" y1=\"59\" x2=\"24\" y2=\"59\" stroke=\"#DDDDDD\" />\n\t\t\t<Rect x=\"59\" y=\"47\" width=\"29\" height=\"23\" rx=\"4\" fill=\"#DDDDDD\" />\n\t\t\t<Path\n\t\t\t\td=\"M65.7585 63V54.2727H67.6037V57.8736H71.3494V54.2727H73.1903V63H71.3494V59.3949H67.6037V63H65.7585ZM74.6605 63V61.6705L77.767 58.794C78.0313 58.5384 78.2528 58.3082 78.4318 58.1037C78.6136 57.8991 78.7514 57.6989 78.8452 57.5028C78.9389 57.304 78.9858 57.0895 78.9858 56.8594C78.9858 56.6037 78.9276 56.3835 78.8111 56.1989C78.6946 56.0114 78.5355 55.8679 78.3338 55.7685C78.1321 55.6662 77.9034 55.6151 77.6477 55.6151C77.3807 55.6151 77.1477 55.669 76.9489 55.777C76.75 55.8849 76.5966 56.0398 76.4886 56.2415C76.3807 56.4432 76.3267 56.6832 76.3267 56.9616H74.5753C74.5753 56.3906 74.7045 55.8949 74.9631 55.4744C75.2216 55.054 75.5838 54.7287 76.0497 54.4986C76.5156 54.2685 77.0526 54.1534 77.6605 54.1534C78.2855 54.1534 78.8295 54.2642 79.2926 54.4858C79.7585 54.7045 80.1207 55.0085 80.3793 55.3977C80.6378 55.7869 80.767 56.233 80.767 56.7358C80.767 57.0653 80.7017 57.3906 80.571 57.7116C80.4432 58.0327 80.2145 58.3892 79.8849 58.7812C79.5554 59.1705 79.0909 59.6378 78.4915 60.1832L77.2173 61.4318V61.4915H80.8821V63H74.6605Z\"\n\t\t\t\tfill=\"black\"\n\t\t\t/>\n\t\t\t<Line x1=\"80\" y1=\"90\" x2=\"24\" y2=\"90\" stroke=\"#DDDDDD\" />\n\t\t\t<Rect x=\"84\" y=\"78\" width=\"30\" height=\"23\" rx=\"4\" fill=\"#F0B849\" />\n\t\t\t<Path\n\t\t\t\td=\"M90.7585 94V85.2727H92.6037V88.8736H96.3494V85.2727H98.1903V94H96.3494V90.3949H92.6037V94H90.7585ZM99.5284 92.4659V91.0128L103.172 85.2727H104.425V87.2841H103.683L101.386 90.919V90.9872H106.564V92.4659H99.5284ZM103.717 94V92.0227L103.751 91.3793V85.2727H105.482V94H103.717Z\"\n\t\t\t\tfill=\"black\"\n\t\t\t/>\n\t\t\t<Line x1=\"66\" y1=\"121\" x2=\"24\" y2=\"121\" stroke=\"#DDDDDD\" />\n\t\t\t<Rect x=\"70\" y=\"109\" width=\"29\" height=\"23\" rx=\"4\" fill=\"#DDDDDD\" />\n\t\t\t<Path\n\t\t\t\td=\"M76.7585 125V116.273H78.6037V119.874H82.3494V116.273H84.1903V125H82.3494V121.395H78.6037V125H76.7585ZM88.8864 125.119C88.25 125.119 87.6832 125.01 87.1861 124.791C86.6918 124.57 86.3011 124.266 86.0142 123.879C85.7301 123.49 85.5838 123.041 85.5753 122.533H87.4332C87.4446 122.746 87.5142 122.933 87.642 123.095C87.7727 123.254 87.946 123.378 88.1619 123.466C88.3778 123.554 88.6207 123.598 88.8906 123.598C89.1719 123.598 89.4205 123.548 89.6364 123.449C89.8523 123.349 90.0213 123.212 90.1435 123.036C90.2656 122.859 90.3267 122.656 90.3267 122.426C90.3267 122.193 90.2614 121.987 90.1307 121.808C90.0028 121.626 89.8182 121.484 89.5767 121.382C89.3381 121.28 89.054 121.229 88.7244 121.229H87.9105V119.874H88.7244C89.0028 119.874 89.2486 119.825 89.4616 119.729C89.6776 119.632 89.8452 119.499 89.9645 119.328C90.0838 119.155 90.1435 118.953 90.1435 118.723C90.1435 118.504 90.0909 118.312 89.9858 118.148C89.8835 117.98 89.7386 117.849 89.5511 117.756C89.3665 117.662 89.1506 117.615 88.9034 117.615C88.6534 117.615 88.4247 117.661 88.2173 117.751C88.0099 117.839 87.8438 117.966 87.7188 118.131C87.5938 118.295 87.527 118.489 87.5185 118.71H85.75C85.7585 118.207 85.902 117.764 86.1804 117.381C86.4588 116.997 86.8338 116.697 87.3054 116.482C87.7798 116.263 88.3153 116.153 88.9119 116.153C89.5142 116.153 90.0412 116.263 90.4929 116.482C90.9446 116.7 91.2955 116.996 91.5455 117.368C91.7983 117.737 91.9233 118.152 91.9205 118.612C91.9233 119.101 91.7713 119.509 91.4645 119.835C91.1605 120.162 90.7642 120.369 90.2756 120.457V120.526C90.9176 120.608 91.4063 120.831 91.7415 121.195C92.0795 121.555 92.2472 122.007 92.2443 122.55C92.2472 123.047 92.1037 123.489 91.8139 123.875C91.527 124.261 91.1307 124.565 90.625 124.787C90.1193 125.009 89.5398 125.119 88.8864 125.119Z\"\n\t\t\t\tfill=\"black\"\n\t\t\t/>\n\t\t</SVG>\n\t);\n}\n\n/**\n * Returns an array of heading blocks enhanced with the following properties:\n * level - An integer with the heading level.\n * isEmpty - Flag indicating if the heading has no content.\n *\n * @param {?Array} blocks An array of blocks.\n *\n * @return {Array} An array of heading blocks enhanced with the properties described above.\n */\nconst computeOutlineHeadings = ( blocks = [] ) => {\n\treturn blocks.flatMap( ( block = {} ) => {\n\t\tif ( block.name === 'core/heading' ) {\n\t\t\treturn {\n\t\t\t\t...block,\n\t\t\t\tlevel: block.attributes.level,\n\t\t\t\tisEmpty: isEmptyHeading( block ),\n\t\t\t};\n\t\t}\n\t\treturn computeOutlineHeadings( block.innerBlocks );\n\t} );\n};\n\nconst isEmptyHeading = ( heading ) =>\n\t! heading.attributes.content ||\n\theading.attributes.content.trim().length === 0;\n\n/**\n * Renders a document outline component.\n *\n * @param {Object} props Props.\n * @param {Function} props.onSelect Function to be called when an outline item is selected\n * @param {boolean} props.hasOutlineItemsDisabled Indicates whether the outline items are disabled.\n *\n * @return {React.ReactNode} The rendered component.\n */\nexport default function DocumentOutline( {\n\tonSelect,\n\thasOutlineItemsDisabled,\n} ) {\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\tconst { blocks, title, isTitleSupported } = useSelect( ( select ) => {\n\t\tconst { getBlocks } = select( blockEditorStore );\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\n\t\treturn {\n\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t\tblocks: getBlocks(),\n\t\t\tisTitleSupported: postType?.supports?.title ?? false,\n\t\t};\n\t} );\n\n\tconst prevHeadingLevelRef = useRef( 1 );\n\n\tconst headings = computeOutlineHeadings( blocks );\n\tif ( headings.length < 1 ) {\n\t\treturn (\n\t\t\t<div className=\"editor-document-outline has-no-headings\">\n\t\t\t\t<EmptyOutlineIllustration />\n\t\t\t\t<p>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Navigate the structure of your document and address issues like empty or incorrect heading levels.'\n\t\t\t\t\t) }\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Not great but it's the simplest way to locate the title right now.\n\tconst titleNode = document.querySelector( '.editor-post-title__input' );\n\tconst hasTitle = isTitleSupported && title && titleNode;\n\tconst countByLevel = headings.reduce(\n\t\t( acc, heading ) => ( {\n\t\t\t...acc,\n\t\t\t[ heading.level ]: ( acc[ heading.level ] || 0 ) + 1,\n\t\t} ),\n\t\t{}\n\t);\n\tconst hasMultipleH1 = countByLevel[ 1 ] > 1;\n\n\treturn (\n\t\t<div className=\"document-outline\">\n\t\t\t<ul>\n\t\t\t\t{ hasTitle && (\n\t\t\t\t\t<DocumentOutlineItem\n\t\t\t\t\t\tlevel={ __( 'Title' ) }\n\t\t\t\t\t\tisValid\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\thref={ `#${ titleNode.id }` }\n\t\t\t\t\t\tisDisabled={ hasOutlineItemsDisabled }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</DocumentOutlineItem>\n\t\t\t\t) }\n\t\t\t\t{ headings.map( ( item ) => {\n\t\t\t\t\t// Headings remain the same, go up by one, or down by any amount.\n\t\t\t\t\t// Otherwise there are missing levels.\n\t\t\t\t\tconst isIncorrectLevel =\n\t\t\t\t\t\titem.level > prevHeadingLevelRef.current + 1;\n\n\t\t\t\t\tconst isValid =\n\t\t\t\t\t\t! item.isEmpty &&\n\t\t\t\t\t\t! isIncorrectLevel &&\n\t\t\t\t\t\t!! item.level &&\n\t\t\t\t\t\t( item.level !== 1 ||\n\t\t\t\t\t\t\t( ! hasMultipleH1 && ! hasTitle ) );\n\t\t\t\t\tprevHeadingLevelRef.current = item.level;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<DocumentOutlineItem\n\t\t\t\t\t\t\tkey={ item.clientId }\n\t\t\t\t\t\t\tlevel={ `H${ item.level }` }\n\t\t\t\t\t\t\tisValid={ isValid }\n\t\t\t\t\t\t\tisDisabled={ hasOutlineItemsDisabled }\n\t\t\t\t\t\t\thref={ `#block-${ item.clientId }` }\n\t\t\t\t\t\t\tonSelect={ () => {\n\t\t\t\t\t\t\t\tselectBlock( item.clientId );\n\t\t\t\t\t\t\t\tonSelect?.();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ item.isEmpty\n\t\t\t\t\t\t\t\t? emptyHeadingContent\n\t\t\t\t\t\t\t\t: getTextContent(\n\t\t\t\t\t\t\t\t\t\tcreate( {\n\t\t\t\t\t\t\t\t\t\t\thtml: item.attributes.content,\n\t\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{ isIncorrectLevel && incorrectLevelContent }\n\t\t\t\t\t\t\t{ item.level === 1 &&\n\t\t\t\t\t\t\t\thasMultipleH1 &&\n\t\t\t\t\t\t\t\tmultipleH1Headings }\n\t\t\t\t\t\t\t{ hasTitle &&\n\t\t\t\t\t\t\t\titem.level === 1 &&\n\t\t\t\t\t\t\t\t! hasMultipleH1 &&\n\t\t\t\t\t\t\t\tsingleH1Headings }\n\t\t\t\t\t\t</DocumentOutlineItem>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</ul>\n\t\t</div>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,MAAM,EAAEC,cAAc,QAAQ,sBAAsB;AAC7D,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASD,KAAK,IAAIE,SAAS,QAAQ,sBAAsB;AACzD,SAASC,IAAI,EAAEC,GAAG,EAAEC,IAAI,EAAEC,IAAI,QAAQ,uB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QAAA,GAED8D,IAAI,CAACpC,OAAO,GACX3B,mBAAmB,GACnBd,cAAc,CACdD,MAAM,CAAE;YACPkF,IAAI,EAAEJ,IAAI,CAACrC,UAAU,CAACK;UACvB,CAAE,CACF,CAAC,EACFiC,gBAAgB,IAAI9D,qBAAqB,EACzC6D,IAAI,CAACtC,KAAK,KAAK,CAAC,IACjBgC,aAAa,IACbrD,kBAAkB,EACjBiD,QAAQ,IACTU,IAAI,CAACtC,KAAK,KAAK,CAAC,IAChB,CAAEgC,aAAa,IACftD,gBAAgB;QAAA,GAxBX4D,IAAI,CAACG,QAyBS,CAAC;MAExB,CAAE,CAAC;IAAA,CACA;EAAC,CACD,CAAC;AAER","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["__","useDispatch","useSelect","useRef","useMemo","create","getTextContent","store","blockEditorStore","coreStore","Path","SVG","Line","Rect","DocumentOutlineItem","editorStore","jsx","_jsx","jsxs","_jsxs","emptyHeadingContent","children","incorrectLevelContent","singleH1Headings","multipleH1Headings","EmptyOutlineIllustration","width","height","viewBox","fill","xmlns","rx","x1","y1","x2","y2","stroke","x","y","d","computeOutlineHeadings","blocks","filter","block","name","map","level","attributes","isEmpty","isEmptyHeading","heading","content","trim","length","DocumentOutline","onSelect","hasOutlineItemsDisabled","selectBlock","title","isTitleSupported","select","_postType$supports$ti","getEditedPostAttribute","getPostType","postType","supports","getClientIdsWithDescendants","getBlock","clientIds","id","contentBlocks","getRenderingMode","undefined","getBlocksByName","getClientIdsOfDescendants","postContentClientId","prevHeadingLevelRef","headings","className","titleNode","document","querySelector","hasTitle","countByLevel","reduce","acc","hasMultipleH1","isContentBlock","clientId","Array","isArray","includes","isValid","href","isDisabled","item","isIncorrectLevel","current","html"],"sources":["@wordpress/editor/src/components/document-outline/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useRef, useMemo } from '@wordpress/element';\nimport { create, getTextContent } from '@wordpress/rich-text';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { Path, SVG, Line, Rect } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport DocumentOutlineItem from './item';\nimport { store as editorStore } from '../../store';\n\n/**\n * Module constants\n */\nconst emptyHeadingContent = <em>{ __( '(Empty heading)' ) }</em>;\nconst incorrectLevelContent = [\n\t<br key=\"incorrect-break\" />,\n\t<em key=\"incorrect-message\">{ __( '(Incorrect heading level)' ) }</em>,\n];\nconst singleH1Headings = [\n\t<br key=\"incorrect-break-h1\" />,\n\t<em key=\"incorrect-message-h1\">\n\t\t{ __( '(Your theme may already use a H1 for the post title)' ) }\n\t</em>,\n];\nconst multipleH1Headings = [\n\t<br key=\"incorrect-break-multiple-h1\" />,\n\t<em key=\"incorrect-message-multiple-h1\">\n\t\t{ __( '(Multiple H1 headings are not recommended)' ) }\n\t</em>,\n];\nfunction EmptyOutlineIllustration() {\n\treturn (\n\t\t<SVG\n\t\t\twidth=\"138\"\n\t\t\theight=\"148\"\n\t\t\tviewBox=\"0 0 138 148\"\n\t\t\tfill=\"none\"\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t>\n\t\t\t<Rect width=\"138\" height=\"148\" rx=\"4\" fill=\"#F0F6FC\" />\n\t\t\t<Line x1=\"44\" y1=\"28\" x2=\"24\" y2=\"28\" stroke=\"#DDDDDD\" />\n\t\t\t<Rect x=\"48\" y=\"16\" width=\"27\" height=\"23\" rx=\"4\" fill=\"#DDDDDD\" />\n\t\t\t<Path\n\t\t\t\td=\"M54.7585 32V23.2727H56.6037V26.8736H60.3494V23.2727H62.1903V32H60.3494V28.3949H56.6037V32H54.7585ZM67.4574 23.2727V32H65.6122V25.0241H65.5611L63.5625 26.277V24.6406L65.723 23.2727H67.4574Z\"\n\t\t\t\tfill=\"black\"\n\t\t\t/>\n\t\t\t<Line x1=\"55\" y1=\"59\" x2=\"24\" y2=\"59\" stroke=\"#DDDDDD\" />\n\t\t\t<Rect x=\"59\" y=\"47\" width=\"29\" height=\"23\" rx=\"4\" fill=\"#DDDDDD\" />\n\t\t\t<Path\n\t\t\t\td=\"M65.7585 63V54.2727H67.6037V57.8736H71.3494V54.2727H73.1903V63H71.3494V59.3949H67.6037V63H65.7585ZM74.6605 63V61.6705L77.767 58.794C78.0313 58.5384 78.2528 58.3082 78.4318 58.1037C78.6136 57.8991 78.7514 57.6989 78.8452 57.5028C78.9389 57.304 78.9858 57.0895 78.9858 56.8594C78.9858 56.6037 78.9276 56.3835 78.8111 56.1989C78.6946 56.0114 78.5355 55.8679 78.3338 55.7685C78.1321 55.6662 77.9034 55.6151 77.6477 55.6151C77.3807 55.6151 77.1477 55.669 76.9489 55.777C76.75 55.8849 76.5966 56.0398 76.4886 56.2415C76.3807 56.4432 76.3267 56.6832 76.3267 56.9616H74.5753C74.5753 56.3906 74.7045 55.8949 74.9631 55.4744C75.2216 55.054 75.5838 54.7287 76.0497 54.4986C76.5156 54.2685 77.0526 54.1534 77.6605 54.1534C78.2855 54.1534 78.8295 54.2642 79.2926 54.4858C79.7585 54.7045 80.1207 55.0085 80.3793 55.3977C80.6378 55.7869 80.767 56.233 80.767 56.7358C80.767 57.0653 80.7017 57.3906 80.571 57.7116C80.4432 58.0327 80.2145 58.3892 79.8849 58.7812C79.5554 59.1705 79.0909 59.6378 78.4915 60.1832L77.2173 61.4318V61.4915H80.8821V63H74.6605Z\"\n\t\t\t\tfill=\"black\"\n\t\t\t/>\n\t\t\t<Line x1=\"80\" y1=\"90\" x2=\"24\" y2=\"90\" stroke=\"#DDDDDD\" />\n\t\t\t<Rect x=\"84\" y=\"78\" width=\"30\" height=\"23\" rx=\"4\" fill=\"#F0B849\" />\n\t\t\t<Path\n\t\t\t\td=\"M90.7585 94V85.2727H92.6037V88.8736H96.3494V85.2727H98.1903V94H96.3494V90.3949H92.6037V94H90.7585ZM99.5284 92.4659V91.0128L103.172 85.2727H104.425V87.2841H103.683L101.386 90.919V90.9872H106.564V92.4659H99.5284ZM103.717 94V92.0227L103.751 91.3793V85.2727H105.482V94H103.717Z\"\n\t\t\t\tfill=\"black\"\n\t\t\t/>\n\t\t\t<Line x1=\"66\" y1=\"121\" x2=\"24\" y2=\"121\" stroke=\"#DDDDDD\" />\n\t\t\t<Rect x=\"70\" y=\"109\" width=\"29\" height=\"23\" rx=\"4\" fill=\"#DDDDDD\" />\n\t\t\t<Path\n\t\t\t\td=\"M76.7585 125V116.273H78.6037V119.874H82.3494V116.273H84.1903V125H82.3494V121.395H78.6037V125H76.7585ZM88.8864 125.119C88.25 125.119 87.6832 125.01 87.1861 124.791C86.6918 124.57 86.3011 124.266 86.0142 123.879C85.7301 123.49 85.5838 123.041 85.5753 122.533H87.4332C87.4446 122.746 87.5142 122.933 87.642 123.095C87.7727 123.254 87.946 123.378 88.1619 123.466C88.3778 123.554 88.6207 123.598 88.8906 123.598C89.1719 123.598 89.4205 123.548 89.6364 123.449C89.8523 123.349 90.0213 123.212 90.1435 123.036C90.2656 122.859 90.3267 122.656 90.3267 122.426C90.3267 122.193 90.2614 121.987 90.1307 121.808C90.0028 121.626 89.8182 121.484 89.5767 121.382C89.3381 121.28 89.054 121.229 88.7244 121.229H87.9105V119.874H88.7244C89.0028 119.874 89.2486 119.825 89.4616 119.729C89.6776 119.632 89.8452 119.499 89.9645 119.328C90.0838 119.155 90.1435 118.953 90.1435 118.723C90.1435 118.504 90.0909 118.312 89.9858 118.148C89.8835 117.98 89.7386 117.849 89.5511 117.756C89.3665 117.662 89.1506 117.615 88.9034 117.615C88.6534 117.615 88.4247 117.661 88.2173 117.751C88.0099 117.839 87.8438 117.966 87.7188 118.131C87.5938 118.295 87.527 118.489 87.5185 118.71H85.75C85.7585 118.207 85.902 117.764 86.1804 117.381C86.4588 116.997 86.8338 116.697 87.3054 116.482C87.7798 116.263 88.3153 116.153 88.9119 116.153C89.5142 116.153 90.0412 116.263 90.4929 116.482C90.9446 116.7 91.2955 116.996 91.5455 117.368C91.7983 117.737 91.9233 118.152 91.9205 118.612C91.9233 119.101 91.7713 119.509 91.4645 119.835C91.1605 120.162 90.7642 120.369 90.2756 120.457V120.526C90.9176 120.608 91.4063 120.831 91.7415 121.195C92.0795 121.555 92.2472 122.007 92.2443 122.55C92.2472 123.047 92.1037 123.489 91.8139 123.875C91.527 124.261 91.1307 124.565 90.625 124.787C90.1193 125.009 89.5398 125.119 88.8864 125.119Z\"\n\t\t\t\tfill=\"black\"\n\t\t\t/>\n\t\t</SVG>\n\t);\n}\n\n/**\n * Returns an array of heading blocks enhanced with the following properties:\n * level - An integer with the heading level.\n * isEmpty - Flag indicating if the heading has no content.\n *\n * @param {?Array} blocks An array of blocks.\n *\n * @return {Array} An array of heading blocks enhanced with the properties described above.\n */\nconst computeOutlineHeadings = ( blocks = [] ) => {\n\treturn blocks\n\t\t.filter( ( block ) => block.name === 'core/heading' )\n\t\t.map( ( block ) => ( {\n\t\t\t...block,\n\t\t\tlevel: block.attributes.level,\n\t\t\tisEmpty: isEmptyHeading( block ),\n\t\t} ) );\n};\n\nconst isEmptyHeading = ( heading ) =>\n\t! heading.attributes.content ||\n\theading.attributes.content.trim().length === 0;\n\n/**\n * Renders a document outline component.\n *\n * @param {Object} props Props.\n * @param {Function} props.onSelect Function to be called when an outline item is selected\n * @param {boolean} props.hasOutlineItemsDisabled Indicates whether the outline items are disabled.\n *\n * @return {React.ReactNode} The rendered component.\n */\nexport default function DocumentOutline( {\n\tonSelect,\n\thasOutlineItemsDisabled,\n} ) {\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\tconst { title, isTitleSupported } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\t\treturn {\n\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t\tisTitleSupported: postType?.supports?.title ?? false,\n\t\t};\n\t} );\n\tconst blocks = useSelect( ( select ) => {\n\t\tconst { getClientIdsWithDescendants, getBlock } =\n\t\t\tselect( blockEditorStore );\n\t\tconst clientIds = getClientIdsWithDescendants();\n\t\t// Note: Don't modify data inside the `Array.map` callback,\n\t\t// all compulations should happen in `computeOutlineHeadings`.\n\t\treturn clientIds.map( ( id ) => getBlock( id ) );\n\t} );\n\tconst contentBlocks = useSelect( ( select ) => {\n\t\t// When rendering in `post-only` mode all blocks are considered content blocks.\n\t\tif ( select( editorStore ).getRenderingMode() === 'post-only' ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst { getBlocksByName, getClientIdsOfDescendants } =\n\t\t\tselect( blockEditorStore );\n\t\tconst [ postContentClientId ] = getBlocksByName( 'core/post-content' );\n\n\t\t// Do nothing if there's no post content block.\n\t\tif ( ! postContentClientId ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn getClientIdsOfDescendants( postContentClientId );\n\t}, [] );\n\n\tconst prevHeadingLevelRef = useRef( 1 );\n\n\tconst headings = useMemo(\n\t\t() => computeOutlineHeadings( blocks ),\n\t\t[ blocks ]\n\t);\n\n\tif ( headings.length < 1 ) {\n\t\treturn (\n\t\t\t<div className=\"editor-document-outline has-no-headings\">\n\t\t\t\t<EmptyOutlineIllustration />\n\t\t\t\t<p>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Navigate the structure of your document and address issues like empty or incorrect heading levels.'\n\t\t\t\t\t) }\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Not great but it's the simplest way to locate the title right now.\n\tconst titleNode = document.querySelector( '.editor-post-title__input' );\n\tconst hasTitle = isTitleSupported && title && titleNode;\n\tconst countByLevel = headings.reduce(\n\t\t( acc, heading ) => ( {\n\t\t\t...acc,\n\t\t\t[ heading.level ]: ( acc[ heading.level ] || 0 ) + 1,\n\t\t} ),\n\t\t{}\n\t);\n\tconst hasMultipleH1 = countByLevel[ 1 ] > 1;\n\n\tfunction isContentBlock( clientId ) {\n\t\treturn Array.isArray( contentBlocks )\n\t\t\t? contentBlocks.includes( clientId )\n\t\t\t: true;\n\t}\n\n\treturn (\n\t\t<div className=\"document-outline\">\n\t\t\t<ul>\n\t\t\t\t{ hasTitle && (\n\t\t\t\t\t<DocumentOutlineItem\n\t\t\t\t\t\tlevel={ __( 'Title' ) }\n\t\t\t\t\t\tisValid\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\thref={ `#${ titleNode.id }` }\n\t\t\t\t\t\tisDisabled={ hasOutlineItemsDisabled }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</DocumentOutlineItem>\n\t\t\t\t) }\n\t\t\t\t{ headings.map( ( item ) => {\n\t\t\t\t\t// Headings remain the same, go up by one, or down by any amount.\n\t\t\t\t\t// Otherwise there are missing levels.\n\t\t\t\t\tconst isIncorrectLevel =\n\t\t\t\t\t\titem.level > prevHeadingLevelRef.current + 1;\n\n\t\t\t\t\tconst isValid =\n\t\t\t\t\t\t! item.isEmpty &&\n\t\t\t\t\t\t! isIncorrectLevel &&\n\t\t\t\t\t\t!! item.level &&\n\t\t\t\t\t\t( item.level !== 1 ||\n\t\t\t\t\t\t\t( ! hasMultipleH1 && ! hasTitle ) );\n\t\t\t\t\tprevHeadingLevelRef.current = item.level;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<DocumentOutlineItem\n\t\t\t\t\t\t\tkey={ item.clientId }\n\t\t\t\t\t\t\tlevel={ `H${ item.level }` }\n\t\t\t\t\t\t\tisValid={ isValid }\n\t\t\t\t\t\t\tisDisabled={\n\t\t\t\t\t\t\t\thasOutlineItemsDisabled ||\n\t\t\t\t\t\t\t\t! isContentBlock( item.clientId )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\thref={ `#block-${ item.clientId }` }\n\t\t\t\t\t\t\tonSelect={ () => {\n\t\t\t\t\t\t\t\tselectBlock( item.clientId );\n\t\t\t\t\t\t\t\tonSelect?.();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ item.isEmpty\n\t\t\t\t\t\t\t\t? emptyHeadingContent\n\t\t\t\t\t\t\t\t: getTextContent(\n\t\t\t\t\t\t\t\t\t\tcreate( {\n\t\t\t\t\t\t\t\t\t\t\thtml: item.attributes.content,\n\t\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{ isIncorrectLevel && incorrectLevelContent }\n\t\t\t\t\t\t\t{ item.level === 1 &&\n\t\t\t\t\t\t\t\thasMultipleH1 &&\n\t\t\t\t\t\t\t\tmultipleH1Headings }\n\t\t\t\t\t\t\t{ hasTitle &&\n\t\t\t\t\t\t\t\titem.level === 1 &&\n\t\t\t\t\t\t\t\t! hasMultipleH1 &&\n\t\t\t\t\t\t\t\tsingleH1Headings }\n\t\t\t\t\t\t</DocumentOutlineItem>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</ul>\n\t\t</div>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,MAAM,EAAEC,OAAO,QAAQ,oBAAoB;AACpD,SAASC,MAAM,EAAEC,cAAc,QAAQ,sBAAsB;AAC7D,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASD,KAAK,IAAIE,SAAS,QAAQ,sBAAsB;AACzD,SAASC,IAAI,EAAEC,GAAG,EAAEC,IAAI,EAAEC,IAAI,QAAQ,uBAAuB;;AAE7D;AACA;AACA;AACA,OAAOC,mBAAmB,MAAM,QAAQ;AACxC,SAASP,KAAK,IAAIQ,WAAW,QAAQ,aAAa;;AAElD;AACA;AACA;AAFA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAGA,MAAMC,mBAAmB,gBAAGH,IAAA;EAAAI,QAAA,EAAMrB,EAAE,CAAE,iBAAkB;AAAC,CAA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AgB,IAClB,CAAC,CAAED,IAAI,CAACjD,KAAK,KACXiD,IAAI,CAACjD,KAAK,KAAK,CAAC,IACf,CAAEwC,aAAa,IAAI,CAAEJ,QAAU,CAAE;QACrCN,mBAAmB,CAACqB,OAAO,GAAGF,IAAI,CAACjD,KAAK;QAExC,oBACC3B,KAAA,CAACL,mBAAmB;UAEnBgC,KAAK,EAAG,IAAKiD,IAAI,CAACjD,KAAK,EAAK;UAC5B8C,OAAO,EAAGA,OAAS;UACnBE,UAAU,EACTtC,uBAAuB,IACvB,CAAE+B,cAAc,CAAEQ,IAAI,CAACP,QAAS,CAChC;UACDK,IAAI,EAAG,UAAWE,IAAI,CAACP,QAAQ,EAAK;UACpCjC,QAAQ,EAAGA,CAAA,KAAM;YAChBE,WAAW,CAAEsC,IAAI,CAACP,QAAS,CAAC;YAC5BjC,QAAQ,GAAG,CAAC;UACb,CAAG;UAAAlC,QAAA,GAED0E,IAAI,CAAC/C,OAAO,GACX5B,mBAAmB,GACnBd,cAAc,CACdD,MAAM,CAAE;YACP6F,IAAI,EAAEH,IAAI,CAAChD,UAAU,CAACI;UACvB,CAAE,CACF,CAAC,EACF6C,gBAAgB,IAAI1E,qBAAqB,EACzCyE,IAAI,CAACjD,KAAK,KAAK,CAAC,IACjBwC,aAAa,IACb9D,kBAAkB,EACjB0D,QAAQ,IACTa,IAAI,CAACjD,KAAK,KAAK,CAAC,IAChB,CAAEwC,aAAa,IACf/D,gBAAgB;QAAA,GA3BXwE,IAAI,CAACP,QA4BS,CAAC;MAExB,CAAE,CAAC;IAAA,CACA;EAAC,CACD,CAAC;AAER","ignoreList":[]}
|
|
@@ -6,28 +6,40 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
const TableOfContentsItem = ({
|
|
7
7
|
children,
|
|
8
8
|
isValid,
|
|
9
|
+
isDisabled,
|
|
9
10
|
level,
|
|
10
11
|
href,
|
|
11
12
|
onSelect
|
|
12
|
-
}) =>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
className: "document-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
13
|
+
}) => {
|
|
14
|
+
function handleClick(event) {
|
|
15
|
+
if (isDisabled) {
|
|
16
|
+
event.preventDefault();
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
onSelect();
|
|
20
|
+
}
|
|
21
|
+
return /*#__PURE__*/_jsx("li", {
|
|
22
|
+
className: clsx('document-outline__item', `is-${level.toLowerCase()}`, {
|
|
23
|
+
'is-invalid': !isValid,
|
|
24
|
+
'is-disabled': isDisabled
|
|
25
|
+
}),
|
|
26
|
+
children: /*#__PURE__*/_jsxs("a", {
|
|
27
|
+
href: href,
|
|
28
|
+
className: "document-outline__button",
|
|
29
|
+
"aria-disabled": isDisabled,
|
|
30
|
+
onClick: handleClick,
|
|
31
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
32
|
+
className: "document-outline__emdash",
|
|
33
|
+
"aria-hidden": "true"
|
|
34
|
+
}), /*#__PURE__*/_jsx("strong", {
|
|
35
|
+
className: "document-outline__level",
|
|
36
|
+
children: level
|
|
37
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
38
|
+
className: "document-outline__item-content",
|
|
39
|
+
children: children
|
|
40
|
+
})]
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
};
|
|
32
44
|
export default TableOfContentsItem;
|
|
33
45
|
//# sourceMappingURL=item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","jsx","_jsx","jsxs","_jsxs","TableOfContentsItem","children","isValid","level","href","onSelect","className","toLowerCase","onClick"],"sources":["@wordpress/editor/src/components/document-outline/item.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\nconst TableOfContentsItem = ( {\n\tchildren,\n\tisValid,\n\tlevel,\n\thref,\n\tonSelect,\n} ) => (\n\t<li\n\t\tclassName={ clsx(\n\t\t\t'document-outline__item',\n\t\t\t`is-${ level.toLowerCase() }`,\n\t\t\t{\n\t\t\t\t'is-invalid': ! isValid,\n\t\t\t}\n\t\t) }\n\t>\n\t\t<a\n\t\t\thref={ href }\n\t\t\tclassName=\"document-outline__button\"\n\t\t\tonClick={
|
|
1
|
+
{"version":3,"names":["clsx","jsx","_jsx","jsxs","_jsxs","TableOfContentsItem","children","isValid","isDisabled","level","href","onSelect","handleClick","event","preventDefault","className","toLowerCase","onClick"],"sources":["@wordpress/editor/src/components/document-outline/item.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\nconst TableOfContentsItem = ( {\n\tchildren,\n\tisValid,\n\tisDisabled,\n\tlevel,\n\thref,\n\tonSelect,\n} ) => {\n\tfunction handleClick( event ) {\n\t\tif ( isDisabled ) {\n\t\t\tevent.preventDefault();\n\t\t\treturn;\n\t\t}\n\t\tonSelect();\n\t}\n\n\treturn (\n\t\t<li\n\t\t\tclassName={ clsx(\n\t\t\t\t'document-outline__item',\n\t\t\t\t`is-${ level.toLowerCase() }`,\n\t\t\t\t{\n\t\t\t\t\t'is-invalid': ! isValid,\n\t\t\t\t\t'is-disabled': isDisabled,\n\t\t\t\t}\n\t\t\t) }\n\t\t>\n\t\t\t<a\n\t\t\t\thref={ href }\n\t\t\t\tclassName=\"document-outline__button\"\n\t\t\t\taria-disabled={ isDisabled }\n\t\t\t\tonClick={ handleClick }\n\t\t\t>\n\t\t\t\t<span\n\t\t\t\t\tclassName=\"document-outline__emdash\"\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t></span>\n\t\t\t\t<strong className=\"document-outline__level\">{ level }</strong>\n\t\t\t\t<span className=\"document-outline__item-content\">\n\t\t\t\t\t{ children }\n\t\t\t\t</span>\n\t\t\t</a>\n\t\t</li>\n\t);\n};\n\nexport default TableOfContentsItem;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAExB,MAAMC,mBAAmB,GAAGA,CAAE;EAC7BC,QAAQ;EACRC,OAAO;EACPC,UAAU;EACVC,KAAK;EACLC,IAAI;EACJC;AACD,CAAC,KAAM;EACN,SAASC,WAAWA,CAAEC,KAAK,EAAG;IAC7B,IAAKL,UAAU,EAAG;MACjBK,KAAK,CAACC,cAAc,CAAC,CAAC;MACtB;IACD;IACAH,QAAQ,CAAC,CAAC;EACX;EAEA,oBACCT,IAAA;IACCa,SAAS,EAAGf,IAAI,CACf,wBAAwB,EACxB,MAAOS,KAAK,CAACO,WAAW,CAAC,CAAC,EAAG,EAC7B;MACC,YAAY,EAAE,CAAET,OAAO;MACvB,aAAa,EAAEC;IAChB,CACD,CAAG;IAAAF,QAAA,eAEHF,KAAA;MACCM,IAAI,EAAGA,IAAM;MACbK,SAAS,EAAC,0BAA0B;MACpC,iBAAgBP,UAAY;MAC5BS,OAAO,EAAGL,WAAa;MAAAN,QAAA,gBAEvBJ,IAAA;QACCa,SAAS,EAAC,0BAA0B;QACpC,eAAY;MAAM,CACZ,CAAC,eACRb,IAAA;QAAQa,SAAS,EAAC,yBAAyB;QAAAT,QAAA,EAAGG;MAAK,CAAU,CAAC,eAC9DP,IAAA;QAAMa,SAAS,EAAC,gCAAgC;QAAAT,QAAA,EAC7CA;MAAQ,CACL,CAAC;IAAA,CACL;EAAC,CACD,CAAC;AAEP,CAAC;AAED,eAAeD,mBAAmB","ignoreList":[]}
|
|
@@ -31,7 +31,7 @@ export default function EntityRecordItem({
|
|
|
31
31
|
entityRecordTitle,
|
|
32
32
|
hasPostMetaChanges
|
|
33
33
|
} = useSelect(select => {
|
|
34
|
-
var _select$
|
|
34
|
+
var _select$getCurrentThe;
|
|
35
35
|
if ('postType' !== kind || 'wp_template' !== name) {
|
|
36
36
|
return {
|
|
37
37
|
entityRecordTitle: title,
|
|
@@ -41,7 +41,7 @@ export default function EntityRecordItem({
|
|
|
41
41
|
const template = select(coreStore).getEditedEntityRecord(kind, name, key);
|
|
42
42
|
const {
|
|
43
43
|
default_template_types: templateTypes = []
|
|
44
|
-
} = (_select$
|
|
44
|
+
} = (_select$getCurrentThe = select(coreStore).getCurrentTheme()) !== null && _select$getCurrentThe !== void 0 ? _select$getCurrentThe : {};
|
|
45
45
|
return {
|
|
46
46
|
entityRecordTitle: getTemplateInfo({
|
|
47
47
|
template,
|
|
@@ -56,7 +56,8 @@ export default function EntityRecordItem({
|
|
|
56
56
|
__nextHasNoMarginBottom: true,
|
|
57
57
|
label: decodeEntities(entityRecordTitle) || __('Untitled'),
|
|
58
58
|
checked: checked,
|
|
59
|
-
onChange: onChange
|
|
59
|
+
onChange: onChange,
|
|
60
|
+
className: "entities-saved-states__change-control"
|
|
60
61
|
})
|
|
61
62
|
}), hasPostMetaChanges && /*#__PURE__*/_jsx("ul", {
|
|
62
63
|
className: "entities-saved-states__changes",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CheckboxControl","PanelRow","__","useSelect","store","coreStore","decodeEntities","editorStore","unlock","getTemplateInfo","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","EntityRecordItem","record","checked","onChange","name","kind","title","key","entityRecordTitle","hasPostMetaChanges","select","_select$
|
|
1
|
+
{"version":3,"names":["CheckboxControl","PanelRow","__","useSelect","store","coreStore","decodeEntities","editorStore","unlock","getTemplateInfo","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","EntityRecordItem","record","checked","onChange","name","kind","title","key","entityRecordTitle","hasPostMetaChanges","select","_select$getCurrentThe","template","getEditedEntityRecord","default_template_types","templateTypes","getCurrentTheme","children","__nextHasNoMarginBottom","label","className"],"sources":["@wordpress/editor/src/components/entities-saved-states/entity-record-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { CheckboxControl, PanelRow } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { getTemplateInfo } from '../../utils/get-template-info';\n\nexport default function EntityRecordItem( { record, checked, onChange } ) {\n\tconst { name, kind, title, key } = record;\n\n\t// Handle templates that might use default descriptive titles.\n\tconst { entityRecordTitle, hasPostMetaChanges } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( 'postType' !== kind || 'wp_template' !== name ) {\n\t\t\t\treturn {\n\t\t\t\t\tentityRecordTitle: title,\n\t\t\t\t\thasPostMetaChanges: unlock(\n\t\t\t\t\t\tselect( editorStore )\n\t\t\t\t\t).hasPostMetaChanges( name, key ),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst template = select( coreStore ).getEditedEntityRecord(\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\tkey\n\t\t\t);\n\n\t\t\tconst { default_template_types: templateTypes = [] } =\n\t\t\t\tselect( coreStore ).getCurrentTheme() ?? {};\n\n\t\t\treturn {\n\t\t\t\tentityRecordTitle: getTemplateInfo( {\n\t\t\t\t\ttemplate,\n\t\t\t\t\ttemplateTypes,\n\t\t\t\t} ).title,\n\t\t\t\thasPostMetaChanges: unlock(\n\t\t\t\t\tselect( editorStore )\n\t\t\t\t).hasPostMetaChanges( name, key ),\n\t\t\t};\n\t\t},\n\t\t[ name, kind, title, key ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<PanelRow>\n\t\t\t\t<CheckboxControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={\n\t\t\t\t\t\tdecodeEntities( entityRecordTitle ) || __( 'Untitled' )\n\t\t\t\t\t}\n\t\t\t\t\tchecked={ checked }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tclassName=\"entities-saved-states__change-control\"\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t\t{ hasPostMetaChanges && (\n\t\t\t\t<ul className=\"entities-saved-states__changes\">\n\t\t\t\t\t<li>{ __( 'Post Meta.' ) }</li>\n\t\t\t\t</ul>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,EAAEC,QAAQ,QAAQ,uBAAuB;AACjE,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,cAAc,QAAQ,0BAA0B;;AAEzD;AACA;AACA;AACA,SAASF,KAAK,IAAIG,WAAW,QAAQ,aAAa;AAClD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,eAAe,QAAQ,+BAA+B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAEhE,eAAe,SAASC,gBAAgBA,CAAE;EAAEC,MAAM;EAAEC,OAAO;EAAEC;AAAS,CAAC,EAAG;EACzE,MAAM;IAAEC,IAAI;IAAEC,IAAI;IAAEC,KAAK;IAAEC;EAAI,CAAC,GAAGN,MAAM;;EAEzC;EACA,MAAM;IAAEO,iBAAiB;IAAEC;EAAmB,CAAC,GAAGtB,SAAS,CACxDuB,MAAM,IAAM;IAAA,IAAAC,qBAAA;IACb,IAAK,UAAU,KAAKN,IAAI,IAAI,aAAa,KAAKD,IAAI,EAAG;MACpD,OAAO;QACNI,iBAAiB,EAAEF,KAAK;QACxBG,kBAAkB,EAAEjB,MAAM,CACzBkB,MAAM,CAAEnB,WAAY,CACrB,CAAC,CAACkB,kBAAkB,CAAEL,IAAI,EAAEG,GAAI;MACjC,CAAC;IACF;IAEA,MAAMK,QAAQ,GAAGF,MAAM,CAAErB,SAAU,CAAC,CAACwB,qBAAqB,CACzDR,IAAI,EACJD,IAAI,EACJG,GACD,CAAC;IAED,MAAM;MAAEO,sBAAsB,EAAEC,aAAa,GAAG;IAAG,CAAC,IAAAJ,qBAAA,GACnDD,MAAM,CAAErB,SAAU,CAAC,CAAC2B,eAAe,CAAC,CAAC,cAAAL,qBAAA,cAAAA,qBAAA,GAAI,CAAC,CAAC;IAE5C,OAAO;MACNH,iBAAiB,EAAEf,eAAe,CAAE;QACnCmB,QAAQ;QACRG;MACD,CAAE,CAAC,CAACT,KAAK;MACTG,kBAAkB,EAAEjB,MAAM,CACzBkB,MAAM,CAAEnB,WAAY,CACrB,CAAC,CAACkB,kBAAkB,CAAEL,IAAI,EAAEG,GAAI;IACjC,CAAC;EACF,CAAC,EACD,CAAEH,IAAI,EAAEC,IAAI,EAAEC,KAAK,EAAEC,GAAG,CACzB,CAAC;EAED,oBACCR,KAAA,CAAAF,SAAA;IAAAoB,QAAA,gBACCtB,IAAA,CAACV,QAAQ;MAAAgC,QAAA,eACRtB,IAAA,CAACX,eAAe;QACfkC,uBAAuB;QACvBC,KAAK,EACJ7B,cAAc,CAAEkB,iBAAkB,CAAC,IAAItB,EAAE,CAAE,UAAW,CACtD;QACDgB,OAAO,EAAGA,OAAS;QACnBC,QAAQ,EAAGA,QAAU;QACrBiB,SAAS,EAAC;MAAuC,CACjD;IAAC,CACO,CAAC,EACTX,kBAAkB,iBACnBd,IAAA;MAAIyB,SAAS,EAAC,gCAAgC;MAAAH,QAAA,eAC7CtB,IAAA;QAAAsB,QAAA,EAAM/B,EAAE,CAAE,YAAa;MAAC,CAAM;IAAC,CAC5B,CACJ;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
@@ -23,7 +23,7 @@ function getEntityDescription(entity, count) {
|
|
|
23
23
|
case 'site':
|
|
24
24
|
return 1 === count ? __('This change will affect your whole site.') : __('These changes will affect your whole site.');
|
|
25
25
|
case 'wp_template':
|
|
26
|
-
return __('This change will affect
|
|
26
|
+
return __('This change will affect other parts of your site that use this template.');
|
|
27
27
|
case 'page':
|
|
28
28
|
case 'post':
|
|
29
29
|
return __('The following has been modified.');
|
|
@@ -73,6 +73,7 @@ export default function EntityTypeList({
|
|
|
73
73
|
return /*#__PURE__*/_jsxs(PanelBody, {
|
|
74
74
|
title: entityLabel,
|
|
75
75
|
initialOpen: true,
|
|
76
|
+
className: "entities-saved-states__panel-body",
|
|
76
77
|
children: [/*#__PURE__*/_jsx(EntityDescription, {
|
|
77
78
|
record: firstRecord,
|
|
78
79
|
count: count
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","useSelect","PanelBody","PanelRow","store","coreStore","privateApis","blockEditorPrivateApis","useContext","EntityRecordItem","unlock","jsx","_jsx","jsxs","_jsxs","getGlobalStylesChanges","GlobalStylesContext","getEntityDescription","entity","count","GlobalStylesDescription","record","user","currentEditorGlobalStyles","savedRecord","select","getEntityRecord","kind","name","key","globalStylesChanges","maxResults","length","className","children","map","change","EntityDescription","description","EntityTypeList","list","unselectedEntities","setUnselectedEntities","firstRecord","entityConfig","getEntityConfig","entityLabel","label","title","initialOpen","checked","some","elt","property","onChange","value"],"sources":["@wordpress/editor/src/components/entities-saved-states/entity-type-list.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { PanelBody, PanelRow } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport EntityRecordItem from './entity-record-item';\nimport { unlock } from '../../lock-unlock';\n\nconst { getGlobalStylesChanges, GlobalStylesContext } = unlock(\n\tblockEditorPrivateApis\n);\n\nfunction getEntityDescription( entity, count ) {\n\tswitch ( entity ) {\n\t\tcase 'site':\n\t\t\treturn 1 === count\n\t\t\t\t? __( 'This change will affect your whole site.' )\n\t\t\t\t: __( 'These changes will affect your whole site.' );\n\t\tcase 'wp_template':\n\t\t\treturn __(\n\t\t\t\t'This change will affect
|
|
1
|
+
{"version":3,"names":["__","useSelect","PanelBody","PanelRow","store","coreStore","privateApis","blockEditorPrivateApis","useContext","EntityRecordItem","unlock","jsx","_jsx","jsxs","_jsxs","getGlobalStylesChanges","GlobalStylesContext","getEntityDescription","entity","count","GlobalStylesDescription","record","user","currentEditorGlobalStyles","savedRecord","select","getEntityRecord","kind","name","key","globalStylesChanges","maxResults","length","className","children","map","change","EntityDescription","description","EntityTypeList","list","unselectedEntities","setUnselectedEntities","firstRecord","entityConfig","getEntityConfig","entityLabel","label","title","initialOpen","checked","some","elt","property","onChange","value"],"sources":["@wordpress/editor/src/components/entities-saved-states/entity-type-list.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { PanelBody, PanelRow } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport EntityRecordItem from './entity-record-item';\nimport { unlock } from '../../lock-unlock';\n\nconst { getGlobalStylesChanges, GlobalStylesContext } = unlock(\n\tblockEditorPrivateApis\n);\n\nfunction getEntityDescription( entity, count ) {\n\tswitch ( entity ) {\n\t\tcase 'site':\n\t\t\treturn 1 === count\n\t\t\t\t? __( 'This change will affect your whole site.' )\n\t\t\t\t: __( 'These changes will affect your whole site.' );\n\t\tcase 'wp_template':\n\t\t\treturn __(\n\t\t\t\t'This change will affect other parts of your site that use this template.'\n\t\t\t);\n\t\tcase 'page':\n\t\tcase 'post':\n\t\t\treturn __( 'The following has been modified.' );\n\t}\n}\n\nfunction GlobalStylesDescription( { record } ) {\n\tconst { user: currentEditorGlobalStyles } =\n\t\tuseContext( GlobalStylesContext );\n\tconst savedRecord = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord(\n\t\t\t\trecord.kind,\n\t\t\t\trecord.name,\n\t\t\t\trecord.key\n\t\t\t),\n\t\t[ record.kind, record.name, record.key ]\n\t);\n\n\tconst globalStylesChanges = getGlobalStylesChanges(\n\t\tcurrentEditorGlobalStyles,\n\t\tsavedRecord,\n\t\t{\n\t\t\tmaxResults: 10,\n\t\t}\n\t);\n\treturn globalStylesChanges.length ? (\n\t\t<ul className=\"entities-saved-states__changes\">\n\t\t\t{ globalStylesChanges.map( ( change ) => (\n\t\t\t\t<li key={ change }>{ change }</li>\n\t\t\t) ) }\n\t\t</ul>\n\t) : null;\n}\n\nfunction EntityDescription( { record, count } ) {\n\tif ( 'globalStyles' === record?.name ) {\n\t\treturn null;\n\t}\n\tconst description = getEntityDescription( record?.name, count );\n\treturn description ? <PanelRow>{ description }</PanelRow> : null;\n}\n\nexport default function EntityTypeList( {\n\tlist,\n\tunselectedEntities,\n\tsetUnselectedEntities,\n} ) {\n\tconst count = list.length;\n\tconst firstRecord = list[ 0 ];\n\tconst entityConfig = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityConfig(\n\t\t\t\tfirstRecord.kind,\n\t\t\t\tfirstRecord.name\n\t\t\t),\n\t\t[ firstRecord.kind, firstRecord.name ]\n\t);\n\n\tlet entityLabel = entityConfig.label;\n\tif ( firstRecord?.name === 'wp_template_part' ) {\n\t\tentityLabel =\n\t\t\t1 === count ? __( 'Template Part' ) : __( 'Template Parts' );\n\t}\n\n\treturn (\n\t\t<PanelBody\n\t\t\ttitle={ entityLabel }\n\t\t\tinitialOpen\n\t\t\tclassName=\"entities-saved-states__panel-body\"\n\t\t>\n\t\t\t<EntityDescription record={ firstRecord } count={ count } />\n\t\t\t{ list.map( ( record ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<EntityRecordItem\n\t\t\t\t\t\tkey={ record.key || record.property }\n\t\t\t\t\t\trecord={ record }\n\t\t\t\t\t\tchecked={\n\t\t\t\t\t\t\t! unselectedEntities.some(\n\t\t\t\t\t\t\t\t( elt ) =>\n\t\t\t\t\t\t\t\t\telt.kind === record.kind &&\n\t\t\t\t\t\t\t\t\telt.name === record.name &&\n\t\t\t\t\t\t\t\t\telt.key === record.key &&\n\t\t\t\t\t\t\t\t\telt.property === record.property\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetUnselectedEntities( record, value )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t\t{ 'globalStyles' === firstRecord?.name && (\n\t\t\t\t<GlobalStylesDescription record={ firstRecord } />\n\t\t\t) }\n\t\t</PanelBody>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,SAAS,EAAEC,QAAQ,QAAQ,uBAAuB;AAC3D,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;AAC/E,SAASC,UAAU,QAAQ,oBAAoB;;AAE/C;AACA;AACA;AACA,OAAOC,gBAAgB,MAAM,sBAAsB;AACnD,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE3C,MAAM;EAAEC,sBAAsB;EAAEC;AAAoB,CAAC,GAAGN,MAAM,CAC7DH,sBACD,CAAC;AAED,SAASU,oBAAoBA,CAAEC,MAAM,EAAEC,KAAK,EAAG;EAC9C,QAASD,MAAM;IACd,KAAK,MAAM;MACV,OAAO,CAAC,KAAKC,KAAK,GACfnB,EAAE,CAAE,0CAA2C,CAAC,GAChDA,EAAE,CAAE,4CAA6C,CAAC;IACtD,KAAK,aAAa;MACjB,OAAOA,EAAE,CACR,0EACD,CAAC;IACF,KAAK,MAAM;IACX,KAAK,MAAM;MACV,OAAOA,EAAE,CAAE,kCAAmC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