summaryrefslogtreecommitdiffstats
path: root/wp-includes/js/dist/editor.js
diff options
context:
space:
mode:
Diffstat (limited to 'wp-includes/js/dist/editor.js')
-rw-r--r--wp-includes/js/dist/editor.js18500
1 files changed, 14879 insertions, 3621 deletions
diff --git a/wp-includes/js/dist/editor.js b/wp-includes/js/dist/editor.js
index 609c9c0..9fff46d 100644
--- a/wp-includes/js/dist/editor.js
+++ b/wp-includes/js/dist/editor.js
@@ -290,72 +290,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
/***/ }),
-/***/ 5755:
-/***/ ((module, exports) => {
-
-var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
- Copyright (c) 2018 Jed Watson.
- Licensed under the MIT License (MIT), see
- http://jedwatson.github.io/classnames
-*/
-/* global define */
-
-(function () {
- 'use strict';
-
- var hasOwn = {}.hasOwnProperty;
- var nativeCodeString = '[native code]';
-
- function classNames() {
- var classes = [];
-
- for (var i = 0; i < arguments.length; i++) {
- var arg = arguments[i];
- if (!arg) continue;
-
- var argType = typeof arg;
-
- if (argType === 'string' || argType === 'number') {
- classes.push(arg);
- } else if (Array.isArray(arg)) {
- if (arg.length) {
- var inner = classNames.apply(null, arg);
- if (inner) {
- classes.push(inner);
- }
- }
- } else if (argType === 'object') {
- if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
- classes.push(arg.toString());
- continue;
- }
-
- for (var key in arg) {
- if (hasOwn.call(arg, key) && arg[key]) {
- classes.push(key);
- }
- }
- }
- }
-
- return classes.join(' ');
- }
-
- if ( true && module.exports) {
- classNames.default = classNames;
- module.exports = classNames;
- } else if (true) {
- // register as 'classnames', consistent with npm package name
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
- return classNames;
- }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else {}
-}());
-
-
-/***/ }),
-
/***/ 6109:
/***/ ((module) => {
@@ -390,6 +324,201 @@ module.exports = computedStyle;
/***/ }),
+/***/ 66:
+/***/ ((module) => {
+
+"use strict";
+
+
+var isMergeableObject = function isMergeableObject(value) {
+ return isNonNullObject(value)
+ && !isSpecial(value)
+};
+
+function isNonNullObject(value) {
+ return !!value && typeof value === 'object'
+}
+
+function isSpecial(value) {
+ var stringValue = Object.prototype.toString.call(value);
+
+ return stringValue === '[object RegExp]'
+ || stringValue === '[object Date]'
+ || isReactElement(value)
+}
+
+// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
+var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
+var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
+
+function isReactElement(value) {
+ return value.$$typeof === REACT_ELEMENT_TYPE
+}
+
+function emptyTarget(val) {
+ return Array.isArray(val) ? [] : {}
+}
+
+function cloneUnlessOtherwiseSpecified(value, options) {
+ return (options.clone !== false && options.isMergeableObject(value))
+ ? deepmerge(emptyTarget(value), value, options)
+ : value
+}
+
+function defaultArrayMerge(target, source, options) {
+ return target.concat(source).map(function(element) {
+ return cloneUnlessOtherwiseSpecified(element, options)
+ })
+}
+
+function getMergeFunction(key, options) {
+ if (!options.customMerge) {
+ return deepmerge
+ }
+ var customMerge = options.customMerge(key);
+ return typeof customMerge === 'function' ? customMerge : deepmerge
+}
+
+function getEnumerableOwnPropertySymbols(target) {
+ return Object.getOwnPropertySymbols
+ ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
+ return Object.propertyIsEnumerable.call(target, symbol)
+ })
+ : []
+}
+
+function getKeys(target) {
+ return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
+}
+
+function propertyIsOnObject(object, property) {
+ try {
+ return property in object
+ } catch(_) {
+ return false
+ }
+}
+
+// Protects from prototype poisoning and unexpected merging up the prototype chain.
+function propertyIsUnsafe(target, key) {
+ return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
+ && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
+ && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.
+}
+
+function mergeObject(target, source, options) {
+ var destination = {};
+ if (options.isMergeableObject(target)) {
+ getKeys(target).forEach(function(key) {
+ destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
+ });
+ }
+ getKeys(source).forEach(function(key) {
+ if (propertyIsUnsafe(target, key)) {
+ return
+ }
+
+ if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
+ destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
+ } else {
+ destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
+ }
+ });
+ return destination
+}
+
+function deepmerge(target, source, options) {
+ options = options || {};
+ options.arrayMerge = options.arrayMerge || defaultArrayMerge;
+ options.isMergeableObject = options.isMergeableObject || isMergeableObject;
+ // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
+ // implementations can use it. The caller may not replace it.
+ options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
+
+ var sourceIsArray = Array.isArray(source);
+ var targetIsArray = Array.isArray(target);
+ var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
+
+ if (!sourceAndTargetTypesMatch) {
+ return cloneUnlessOtherwiseSpecified(source, options)
+ } else if (sourceIsArray) {
+ return options.arrayMerge(target, source, options)
+ } else {
+ return mergeObject(target, source, options)
+ }
+}
+
+deepmerge.all = function deepmergeAll(array, options) {
+ if (!Array.isArray(array)) {
+ throw new Error('first argument should be an array')
+ }
+
+ return array.reduce(function(prev, next) {
+ return deepmerge(prev, next, options)
+ }, {})
+};
+
+var deepmerge_1 = deepmerge;
+
+module.exports = deepmerge_1;
+
+
+/***/ }),
+
+/***/ 5215:
+/***/ ((module) => {
+
+"use strict";
+
+
+// do not edit .js files directly - edit src/index.jst
+
+
+
+module.exports = function equal(a, b) {
+ if (a === b) return true;
+
+ if (a && b && typeof a == 'object' && typeof b == 'object') {
+ if (a.constructor !== b.constructor) return false;
+
+ var length, i, keys;
+ if (Array.isArray(a)) {
+ length = a.length;
+ if (length != b.length) return false;
+ for (i = length; i-- !== 0;)
+ if (!equal(a[i], b[i])) return false;
+ return true;
+ }
+
+
+
+ if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
+ if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
+ if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
+
+ keys = Object.keys(a);
+ length = keys.length;
+ if (length !== Object.keys(b).length) return false;
+
+ for (i = length; i-- !== 0;)
+ if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
+
+ for (i = length; i-- !== 0;) {
+ var key = keys[i];
+
+ if (!equal(a[key], b[key])) return false;
+ }
+
+ return true;
+ }
+
+ // true if both NaN, false otherwise
+ return a!==a && b!==b;
+};
+
+
+/***/ }),
+
/***/ 461:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
@@ -1349,8 +1478,8 @@ __webpack_require__.d(__webpack_exports__, {
CopyHandler: () => (/* reexport */ CopyHandler),
DefaultBlockAppender: () => (/* reexport */ DefaultBlockAppender),
DocumentBar: () => (/* reexport */ DocumentBar),
- DocumentOutline: () => (/* reexport */ document_outline),
- DocumentOutlineCheck: () => (/* reexport */ check),
+ DocumentOutline: () => (/* reexport */ DocumentOutline),
+ DocumentOutlineCheck: () => (/* reexport */ DocumentOutlineCheck),
EditorHistoryRedo: () => (/* reexport */ editor_history_redo),
EditorHistoryUndo: () => (/* reexport */ editor_history_undo),
EditorKeyboardShortcuts: () => (/* reexport */ EditorKeyboardShortcuts),
@@ -1374,22 +1503,30 @@ __webpack_require__.d(__webpack_exports__, {
ObserveTyping: () => (/* reexport */ ObserveTyping),
PageAttributesCheck: () => (/* reexport */ page_attributes_check),
PageAttributesOrder: () => (/* reexport */ PageAttributesOrderWithChecks),
- PageAttributesPanel: () => (/* reexport */ panel),
+ PageAttributesPanel: () => (/* reexport */ PageAttributesPanel),
PageAttributesParent: () => (/* reexport */ page_attributes_parent),
PageTemplate: () => (/* reexport */ classic_theme),
PanelColorSettings: () => (/* reexport */ PanelColorSettings),
PlainText: () => (/* reexport */ PlainText),
+ PluginBlockSettingsMenuItem: () => (/* reexport */ plugin_block_settings_menu_item),
+ PluginDocumentSettingPanel: () => (/* reexport */ plugin_document_setting_panel),
+ PluginMoreMenuItem: () => (/* reexport */ plugin_more_menu_item),
+ PluginPostPublishPanel: () => (/* reexport */ plugin_post_publish_panel),
+ PluginPostStatusInfo: () => (/* reexport */ plugin_post_status_info),
+ PluginPrePublishPanel: () => (/* reexport */ plugin_pre_publish_panel),
+ PluginSidebar: () => (/* reexport */ PluginSidebar),
+ PluginSidebarMoreMenuItem: () => (/* reexport */ PluginSidebarMoreMenuItem),
PostAuthor: () => (/* reexport */ post_author),
PostAuthorCheck: () => (/* reexport */ PostAuthorCheck),
- PostAuthorPanel: () => (/* reexport */ post_author_panel),
+ PostAuthorPanel: () => (/* reexport */ panel),
PostComments: () => (/* reexport */ post_comments),
- PostDiscussionPanel: () => (/* reexport */ post_discussion_panel),
- PostExcerpt: () => (/* reexport */ post_excerpt),
+ PostDiscussionPanel: () => (/* reexport */ PostDiscussionPanel),
+ PostExcerpt: () => (/* reexport */ PostExcerpt),
PostExcerptCheck: () => (/* reexport */ post_excerpt_check),
PostExcerptPanel: () => (/* reexport */ PostExcerptPanel),
PostFeaturedImage: () => (/* reexport */ post_featured_image),
PostFeaturedImageCheck: () => (/* reexport */ post_featured_image_check),
- PostFeaturedImagePanel: () => (/* reexport */ post_featured_image_panel),
+ PostFeaturedImagePanel: () => (/* reexport */ PostFeaturedImagePanel),
PostFormat: () => (/* reexport */ PostFormat),
PostFormatCheck: () => (/* reexport */ post_format_check),
PostLastRevision: () => (/* reexport */ post_last_revision),
@@ -1401,14 +1538,14 @@ __webpack_require__.d(__webpack_exports__, {
PostPingbacks: () => (/* reexport */ post_pingbacks),
PostPreviewButton: () => (/* reexport */ PostPreviewButton),
PostPublishButton: () => (/* reexport */ post_publish_button),
- PostPublishButtonLabel: () => (/* reexport */ label),
+ PostPublishButtonLabel: () => (/* reexport */ PublishButtonLabel),
PostPublishPanel: () => (/* reexport */ post_publish_panel),
PostSavedState: () => (/* reexport */ PostSavedState),
PostSchedule: () => (/* reexport */ PostSchedule),
PostScheduleCheck: () => (/* reexport */ PostScheduleCheck),
PostScheduleLabel: () => (/* reexport */ PostScheduleLabel),
PostSchedulePanel: () => (/* reexport */ PostSchedulePanel),
- PostSlug: () => (/* reexport */ post_slug),
+ PostSlug: () => (/* reexport */ PostSlug),
PostSlugCheck: () => (/* reexport */ PostSlugCheck),
PostSticky: () => (/* reexport */ PostSticky),
PostStickyCheck: () => (/* reexport */ PostStickyCheck),
@@ -1424,7 +1561,7 @@ __webpack_require__.d(__webpack_exports__, {
PostTitle: () => (/* reexport */ post_title),
PostTitleRaw: () => (/* reexport */ post_title_raw),
PostTrash: () => (/* reexport */ PostTrash),
- PostTrashCheck: () => (/* reexport */ post_trash_check),
+ PostTrashCheck: () => (/* reexport */ PostTrashCheck),
PostTypeSupportCheck: () => (/* reexport */ post_type_support_check),
PostURL: () => (/* reexport */ PostURL),
PostURLCheck: () => (/* reexport */ PostURLCheck),
@@ -1440,7 +1577,7 @@ __webpack_require__.d(__webpack_exports__, {
SkipToSelectedBlock: () => (/* reexport */ SkipToSelectedBlock),
TableOfContents: () => (/* reexport */ table_of_contents),
TextEditorGlobalKeyboardShortcuts: () => (/* reexport */ TextEditorGlobalKeyboardShortcuts),
- ThemeSupportCheck: () => (/* reexport */ theme_support_check),
+ ThemeSupportCheck: () => (/* reexport */ ThemeSupportCheck),
TimeToRead: () => (/* reexport */ TimeToRead),
URLInput: () => (/* reexport */ URLInput),
URLInputButton: () => (/* reexport */ URLInputButton),
@@ -1521,6 +1658,7 @@ __webpack_require__.d(selectors_namespaceObject, {
getEditedPostSlug: () => (getEditedPostSlug),
getEditedPostVisibility: () => (getEditedPostVisibility),
getEditorBlocks: () => (getEditorBlocks),
+ getEditorMode: () => (getEditorMode),
getEditorSelection: () => (getEditorSelection),
getEditorSelectionEnd: () => (getEditorSelectionEnd),
getEditorSelectionStart: () => (getEditorSelectionStart),
@@ -1593,6 +1731,7 @@ __webpack_require__.d(selectors_namespaceObject, {
isPostSavingLocked: () => (isPostSavingLocked),
isPreviewingPost: () => (isPreviewingPost),
isPublishSidebarEnabled: () => (isPublishSidebarEnabled),
+ isPublishSidebarOpened: () => (isPublishSidebarOpened),
isPublishingPost: () => (isPublishingPost),
isSavingNonPostEntityChanges: () => (isSavingNonPostEntityChanges),
isSavingPost: () => (isSavingPost),
@@ -1609,6 +1748,7 @@ __webpack_require__.d(actions_namespaceObject, {
__unstableSaveForPreview: () => (__unstableSaveForPreview),
autosave: () => (autosave),
clearSelectedBlock: () => (clearSelectedBlock),
+ closePublishSidebar: () => (closePublishSidebar),
createUndoLevel: () => (createUndoLevel),
disablePublishSidebar: () => (disablePublishSidebar),
editPost: () => (editPost),
@@ -1626,6 +1766,7 @@ __webpack_require__.d(actions_namespaceObject, {
moveBlocksDown: () => (moveBlocksDown),
moveBlocksUp: () => (moveBlocksUp),
multiSelect: () => (multiSelect),
+ openPublishSidebar: () => (openPublishSidebar),
receiveBlocks: () => (receiveBlocks),
redo: () => (redo),
refreshPost: () => (refreshPost),
@@ -1652,10 +1793,13 @@ __webpack_require__.d(actions_namespaceObject, {
startTyping: () => (startTyping),
stopMultiSelect: () => (stopMultiSelect),
stopTyping: () => (stopTyping),
+ switchEditorMode: () => (switchEditorMode),
synchronizeTemplate: () => (synchronizeTemplate),
toggleBlockMode: () => (toggleBlockMode),
+ toggleDistractionFree: () => (toggleDistractionFree),
toggleEditorPanelEnabled: () => (toggleEditorPanelEnabled),
toggleEditorPanelOpened: () => (toggleEditorPanelOpened),
+ togglePublishSidebar: () => (togglePublishSidebar),
toggleSelection: () => (toggleSelection),
trashPost: () => (trashPost),
undo: () => (undo),
@@ -1675,6 +1819,9 @@ __webpack_require__.r(private_actions_namespaceObject);
__webpack_require__.d(private_actions_namespaceObject, {
createTemplate: () => (createTemplate),
hideBlockTypes: () => (hideBlockTypes),
+ removeTemplates: () => (removeTemplates),
+ revertTemplate: () => (revertTemplate),
+ saveDirtyEntities: () => (saveDirtyEntities),
setCurrentTemplateId: () => (setCurrentTemplateId),
showBlockTypes: () => (showBlockTypes)
});
@@ -1683,8 +1830,53 @@ __webpack_require__.d(private_actions_namespaceObject, {
var private_selectors_namespaceObject = {};
__webpack_require__.r(private_selectors_namespaceObject);
__webpack_require__.d(private_selectors_namespaceObject, {
+ getCurrentTemplateTemplateParts: () => (getCurrentTemplateTemplateParts),
+ getInserterSidebarToggleRef: () => (getInserterSidebarToggleRef),
getInsertionPoint: () => (getInsertionPoint),
- getListViewToggleRef: () => (getListViewToggleRef)
+ getListViewToggleRef: () => (getListViewToggleRef),
+ getPostIcon: () => (getPostIcon),
+ hasPostMetaChanges: () => (hasPostMetaChanges)
+});
+
+// NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/actions.js
+var store_actions_namespaceObject = {};
+__webpack_require__.r(store_actions_namespaceObject);
+__webpack_require__.d(store_actions_namespaceObject, {
+ closeModal: () => (closeModal),
+ disableComplementaryArea: () => (disableComplementaryArea),
+ enableComplementaryArea: () => (enableComplementaryArea),
+ openModal: () => (openModal),
+ pinItem: () => (pinItem),
+ setDefaultComplementaryArea: () => (setDefaultComplementaryArea),
+ setFeatureDefaults: () => (setFeatureDefaults),
+ setFeatureValue: () => (setFeatureValue),
+ toggleFeature: () => (toggleFeature),
+ unpinItem: () => (unpinItem)
+});
+
+// NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/selectors.js
+var store_selectors_namespaceObject = {};
+__webpack_require__.r(store_selectors_namespaceObject);
+__webpack_require__.d(store_selectors_namespaceObject, {
+ getActiveComplementaryArea: () => (getActiveComplementaryArea),
+ isComplementaryAreaLoading: () => (isComplementaryAreaLoading),
+ isFeatureActive: () => (isFeatureActive),
+ isItemPinned: () => (isItemPinned),
+ isModalActive: () => (isModalActive)
+});
+
+// NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/index.js
+var build_module_namespaceObject = {};
+__webpack_require__.r(build_module_namespaceObject);
+__webpack_require__.d(build_module_namespaceObject, {
+ ActionItem: () => (action_item),
+ ComplementaryArea: () => (complementary_area),
+ ComplementaryAreaMoreMenuItem: () => (ComplementaryAreaMoreMenuItem),
+ FullscreenMode: () => (fullscreen_mode),
+ InterfaceSkeleton: () => (interface_skeleton),
+ NavigableRegion: () => (NavigableRegion),
+ PinnedItems: () => (pinned_items),
+ store: () => (store)
});
;// CONCATENATED MODULE: external ["wp","blocks"]
@@ -1701,26 +1893,97 @@ const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"];
const {
lock,
unlock
-} = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/editor');
+} = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/editor');
;// CONCATENATED MODULE: external ["wp","i18n"]
const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
+;// CONCATENATED MODULE: external ["wp","blockEditor"]
+const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/bindings/pattern-overrides.js
/**
* WordPress dependencies
*/
+
+const CONTENT = 'content';
/* harmony default export */ const pattern_overrides = ({
name: 'core/pattern-overrides',
label: (0,external_wp_i18n_namespaceObject._x)('Pattern Overrides', 'block bindings source'),
- useSource: null,
- lockAttributesEditing: false
+ getValue({
+ registry,
+ clientId,
+ context,
+ attributeName
+ }) {
+ const patternOverridesContent = context['pattern/overrides'];
+ const {
+ getBlockAttributes
+ } = registry.select(external_wp_blockEditor_namespaceObject.store);
+ const currentBlockAttributes = getBlockAttributes(clientId);
+ if (!patternOverridesContent) {
+ return currentBlockAttributes[attributeName];
+ }
+ const overridableValue = patternOverridesContent?.[currentBlockAttributes?.metadata?.name]?.[attributeName];
+
+ // If there is no pattern client ID, or it is not overwritten, return the default value.
+ if (overridableValue === undefined) {
+ return currentBlockAttributes[attributeName];
+ }
+ return overridableValue === '' ? undefined : overridableValue;
+ },
+ setValues({
+ registry,
+ clientId,
+ attributes
+ }) {
+ const {
+ getBlockAttributes,
+ getBlockParentsByBlockName,
+ getBlocks
+ } = registry.select(external_wp_blockEditor_namespaceObject.store);
+ const currentBlockAttributes = getBlockAttributes(clientId);
+ const blockName = currentBlockAttributes?.metadata?.name;
+ if (!blockName) {
+ return;
+ }
+ const [patternClientId] = getBlockParentsByBlockName(clientId, 'core/block', true);
+
+ // If there is no pattern client ID, sync blocks with the same name and same attributes.
+ if (!patternClientId) {
+ const syncBlocksWithSameName = blocks => {
+ for (const block of blocks) {
+ if (block.attributes?.metadata?.name === blockName) {
+ registry.dispatch(external_wp_blockEditor_namespaceObject.store).updateBlockAttributes(block.clientId, attributes);
+ }
+ syncBlocksWithSameName(block.innerBlocks);
+ }
+ };
+ syncBlocksWithSameName(getBlocks());
+ return;
+ }
+ const currentBindingValue = getBlockAttributes(patternClientId)?.[CONTENT];
+ registry.dispatch(external_wp_blockEditor_namespaceObject.store).updateBlockAttributes(patternClientId, {
+ [CONTENT]: {
+ ...currentBindingValue,
+ [blockName]: {
+ ...currentBindingValue?.[blockName],
+ ...Object.entries(attributes).reduce((acc, [key, value]) => {
+ // TODO: We need a way to represent `undefined` in the serialized overrides.
+ // Also see: https://github.com/WordPress/gutenberg/pull/57249#discussion_r1452987871
+ // We use an empty string to represent undefined for now until
+ // we support a richer format for overrides and the block bindings API.
+ acc[key] = value === undefined ? '' : value;
+ return acc;
+ }, {})
+ }
+ }
+ });
+ },
+ canUserEditValue: () => true
});
;// CONCATENATED MODULE: external ["wp","coreData"]
const external_wp_coreData_namespaceObject = window["wp"]["coreData"];
-;// CONCATENATED MODULE: external ["wp","blockEditor"]
-const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/defaults.js
/**
* WordPress dependencies
@@ -2109,6 +2372,30 @@ function listViewToggleRef(state = {
}) {
return state;
}
+
+/**
+ * This reducer does nothing aside initializing a ref to the inserter sidebar toggle.
+ * We will have a unique ref per "editor" instance.
+ *
+ * @param {Object} state
+ * @return {Object} Reference to the inserter sidebar toggle button.
+ */
+function inserterSidebarToggleRef(state = {
+ current: null
+}) {
+ return state;
+}
+function publishSidebarActive(state = false, action) {
+ switch (action.type) {
+ case 'OPEN_PUBLISH_SIDEBAR':
+ return true;
+ case 'CLOSE_PUBLISH_SIDEBAR':
+ return false;
+ case 'TOGGLE_PUBLISH_SIDEBAR':
+ return !state;
+ }
+ return state;
+}
/* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
postId,
postType,
@@ -2124,308 +2411,12 @@ function listViewToggleRef(state = {
deviceType,
removedPanels,
blockInserterPanel,
+ inserterSidebarToggleRef,
listViewPanel,
- listViewToggleRef
+ listViewToggleRef,
+ publishSidebarActive
}));
-;// CONCATENATED MODULE: ./node_modules/rememo/rememo.js
-
-
-/** @typedef {(...args: any[]) => *[]} GetDependants */
-
-/** @typedef {() => void} Clear */
-
-/**
- * @typedef {{
- * getDependants: GetDependants,
- * clear: Clear
- * }} EnhancedSelector
- */
-
-/**
- * Internal cache entry.
- *
- * @typedef CacheNode
- *
- * @property {?CacheNode|undefined} [prev] Previous node.
- * @property {?CacheNode|undefined} [next] Next node.
- * @property {*[]} args Function arguments for cache entry.
- * @property {*} val Function result.
- */
-
-/**
- * @typedef Cache
- *
- * @property {Clear} clear Function to clear cache.
- * @property {boolean} [isUniqueByDependants] Whether dependants are valid in
- * considering cache uniqueness. A cache is unique if dependents are all arrays
- * or objects.
- * @property {CacheNode?} [head] Cache head.
- * @property {*[]} [lastDependants] Dependants from previous invocation.
- */
-
-/**
- * Arbitrary value used as key for referencing cache object in WeakMap tree.
- *
- * @type {{}}
- */
-var LEAF_KEY = {};
-
-/**
- * Returns the first argument as the sole entry in an array.
- *
- * @template T
- *
- * @param {T} value Value to return.
- *
- * @return {[T]} Value returned as entry in array.
- */
-function arrayOf(value) {
- return [value];
-}
-
-/**
- * Returns true if the value passed is object-like, or false otherwise. A value
- * is object-like if it can support property assignment, e.g. object or array.
- *
- * @param {*} value Value to test.
- *
- * @return {boolean} Whether value is object-like.
- */
-function isObjectLike(value) {
- return !!value && 'object' === typeof value;
-}
-
-/**
- * Creates and returns a new cache object.
- *
- * @return {Cache} Cache object.
- */
-function createCache() {
- /** @type {Cache} */
- var cache = {
- clear: function () {
- cache.head = null;
- },
- };
-
- return cache;
-}
-
-/**
- * Returns true if entries within the two arrays are strictly equal by
- * reference from a starting index.
- *
- * @param {*[]} a First array.
- * @param {*[]} b Second array.
- * @param {number} fromIndex Index from which to start comparison.
- *
- * @return {boolean} Whether arrays are shallowly equal.
- */
-function isShallowEqual(a, b, fromIndex) {
- var i;
-
- if (a.length !== b.length) {
- return false;
- }
-
- for (i = fromIndex; i < a.length; i++) {
- if (a[i] !== b[i]) {
- return false;
- }
- }
-
- return true;
-}
-
-/**
- * Returns a memoized selector function. The getDependants function argument is
- * called before the memoized selector and is expected to return an immutable
- * reference or array of references on which the selector depends for computing
- * its own return value. The memoize cache is preserved only as long as those
- * dependant references remain the same. If getDependants returns a different
- * reference(s), the cache is cleared and the selector value regenerated.
- *
- * @template {(...args: *[]) => *} S
- *
- * @param {S} selector Selector function.
- * @param {GetDependants=} getDependants Dependant getter returning an array of
- * references used in cache bust consideration.
- */
-/* harmony default export */ function rememo(selector, getDependants) {
- /** @type {WeakMap<*,*>} */
- var rootCache;
-
- /** @type {GetDependants} */
- var normalizedGetDependants = getDependants ? getDependants : arrayOf;
-
- /**
- * Returns the cache for a given dependants array. When possible, a WeakMap
- * will be used to create a unique cache for each set of dependants. This
- * is feasible due to the nature of WeakMap in allowing garbage collection
- * to occur on entries where the key object is no longer referenced. Since
- * WeakMap requires the key to be an object, this is only possible when the
- * dependant is object-like. The root cache is created as a hierarchy where
- * each top-level key is the first entry in a dependants set, the value a
- * WeakMap where each key is the next dependant, and so on. This continues
- * so long as the dependants are object-like. If no dependants are object-
- * like, then the cache is shared across all invocations.
- *
- * @see isObjectLike
- *
- * @param {*[]} dependants Selector dependants.
- *
- * @return {Cache} Cache object.
- */
- function getCache(dependants) {
- var caches = rootCache,
- isUniqueByDependants = true,
- i,
- dependant,
- map,
- cache;
-
- for (i = 0; i < dependants.length; i++) {
- dependant = dependants[i];
-
- // Can only compose WeakMap from object-like key.
- if (!isObjectLike(dependant)) {
- isUniqueByDependants = false;
- break;
- }
-
- // Does current segment of cache already have a WeakMap?
- if (caches.has(dependant)) {
- // Traverse into nested WeakMap.
- caches = caches.get(dependant);
- } else {
- // Create, set, and traverse into a new one.
- map = new WeakMap();
- caches.set(dependant, map);
- caches = map;
- }
- }
-
- // We use an arbitrary (but consistent) object as key for the last item
- // in the WeakMap to serve as our running cache.
- if (!caches.has(LEAF_KEY)) {
- cache = createCache();
- cache.isUniqueByDependants = isUniqueByDependants;
- caches.set(LEAF_KEY, cache);
- }
-
- return caches.get(LEAF_KEY);
- }
-
- /**
- * Resets root memoization cache.
- */
- function clear() {
- rootCache = new WeakMap();
- }
-
- /* eslint-disable jsdoc/check-param-names */
- /**
- * The augmented selector call, considering first whether dependants have
- * changed before passing it to underlying memoize function.
- *
- * @param {*} source Source object for derivation.
- * @param {...*} extraArgs Additional arguments to pass to selector.
- *
- * @return {*} Selector result.
- */
- /* eslint-enable jsdoc/check-param-names */
- function callSelector(/* source, ...extraArgs */) {
- var len = arguments.length,
- cache,
- node,
- i,
- args,
- dependants;
-
- // Create copy of arguments (avoid leaking deoptimization).
- args = new Array(len);
- for (i = 0; i < len; i++) {
- args[i] = arguments[i];
- }
-
- dependants = normalizedGetDependants.apply(null, args);
- cache = getCache(dependants);
-
- // If not guaranteed uniqueness by dependants (primitive type), shallow
- // compare against last dependants and, if references have changed,
- // destroy cache to recalculate result.
- if (!cache.isUniqueByDependants) {
- if (
- cache.lastDependants &&
- !isShallowEqual(dependants, cache.lastDependants, 0)
- ) {
- cache.clear();
- }
-
- cache.lastDependants = dependants;
- }
-
- node = cache.head;
- while (node) {
- // Check whether node arguments match arguments
- if (!isShallowEqual(node.args, args, 1)) {
- node = node.next;
- continue;
- }
-
- // At this point we can assume we've found a match
-
- // Surface matched node to head if not already
- if (node !== cache.head) {
- // Adjust siblings to point to each other.
- /** @type {CacheNode} */ (node.prev).next = node.next;
- if (node.next) {
- node.next.prev = node.prev;
- }
-
- node.next = cache.head;
- node.prev = null;
- /** @type {CacheNode} */ (cache.head).prev = node;
- cache.head = node;
- }
-
- // Return immediately
- return node.val;
- }
-
- // No cached value found. Continue to insertion phase:
-
- node = /** @type {CacheNode} */ ({
- // Generate the result from original function
- val: selector.apply(null, args),
- });
-
- // Avoid including the source object in the cache.
- args[0] = null;
- node.args = args;
-
- // Don't need to check whether node is already head, since it would
- // have been returned above already if it was
-
- // Shift existing head down list
- if (cache.head) {
- cache.head.prev = node;
- node.next = cache.head;
- }
-
- cache.head = node;
-
- return node.val;
- }
-
- callSelector.getDependants = normalizedGetDependants;
- callSelector.clear = clear;
- clear();
-
- return /** @type {S & EnhancedSelector} */ (callSelector);
-}
-
;// CONCATENATED MODULE: external ["wp","date"]
const external_wp_date_namespaceObject = window["wp"]["date"];
;// CONCATENATED MODULE: external ["wp","url"]
@@ -2435,22 +2426,23 @@ const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
;// CONCATENATED MODULE: external ["wp","element"]
const external_wp_element_namespaceObject = window["wp"]["element"];
-// EXTERNAL MODULE: external "React"
-var external_React_ = __webpack_require__(1609);
;// CONCATENATED MODULE: external ["wp","primitives"]
const external_wp_primitives_namespaceObject = window["wp"]["primitives"];
+;// CONCATENATED MODULE: external "ReactJSXRuntime"
+const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js
-
/**
* WordPress dependencies
*/
-const layout = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+const layout = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
-}));
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
+ })
+});
/* harmony default export */ const library_layout = (layout);
;// CONCATENATED MODULE: external ["wp","preferences"]
@@ -2475,62 +2467,78 @@ const TRASH_POST_NOTICE_ID = 'TRASH_POST_NOTICE_ID';
const PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/;
const ONE_MINUTE_IN_MS = 60 * 1000;
const AUTOSAVE_PROPERTIES = ['title', 'excerpt', 'content'];
+const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = 'uncategorized';
+const TEMPLATE_POST_TYPE = 'wp_template';
+const TEMPLATE_PART_POST_TYPE = 'wp_template_part';
+const PATTERN_POST_TYPE = 'wp_block';
+const NAVIGATION_POST_TYPE = 'wp_navigation';
+const TEMPLATE_ORIGINS = {
+ custom: 'custom',
+ theme: 'theme',
+ plugin: 'plugin'
+};
+const TEMPLATE_POST_TYPES = ['wp_template', 'wp_template_part'];
+const GLOBAL_POST_TYPES = [...TEMPLATE_POST_TYPES, 'wp_block', 'wp_navigation'];
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/header.js
-
/**
* WordPress dependencies
*/
-const header = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+const header = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M18.5 10.5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
-}));
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M18.5 10.5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
+ })
+});
/* harmony default export */ const library_header = (header);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/footer.js
-
/**
* WordPress dependencies
*/
-const footer = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+const footer = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- fillRule: "evenodd",
- d: "M18 5.5h-8v8h8.5V6a.5.5 0 00-.5-.5zm-9.5 8h-3V6a.5.5 0 01.5-.5h2.5v8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
-}));
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ fillRule: "evenodd",
+ d: "M18 5.5h-8v8h8.5V6a.5.5 0 00-.5-.5zm-9.5 8h-3V6a.5.5 0 01.5-.5h2.5v8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
+ })
+});
/* harmony default export */ const library_footer = (footer);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/sidebar.js
-
/**
* WordPress dependencies
*/
-const sidebar = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+const sidebar = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
-}));
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
+ })
+});
/* harmony default export */ const library_sidebar = (sidebar);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js
-
/**
* WordPress dependencies
*/
-const symbolFilled = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+const symbolFilled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z"
-}));
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z"
+ })
+});
/* harmony default export */ const symbol_filled = (symbolFilled);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/get-template-part-icon.js
@@ -2558,11 +2566,6 @@ function getTemplatePartIcon(iconName) {
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/selectors.js
/**
- * External dependencies
- */
-
-
-/**
* WordPress dependencies
*/
@@ -2653,10 +2656,7 @@ const isEditedPostDirty = (0,external_wp_data_namespaceObject.createRegistrySele
// inferred to contain unsaved values.
const postType = getCurrentPostType(state);
const postId = getCurrentPostId(state);
- if (select(external_wp_coreData_namespaceObject.store).hasEditsForEntityRecord('postType', postType, postId)) {
- return true;
- }
- return false;
+ return select(external_wp_coreData_namespaceObject.store).hasEditsForEntityRecord('postType', postType, postId);
});
/**
@@ -2817,7 +2817,7 @@ function getCurrentPostAttribute(state, attributeName) {
*
* @return {*} Post attribute value.
*/
-const getNestedEditedPostProperty = rememo((state, attributeName) => {
+const getNestedEditedPostProperty = (0,external_wp_data_namespaceObject.createSelector)((state, attributeName) => {
const edits = getPostEdits(state);
if (!edits.hasOwnProperty(attributeName)) {
return getCurrentPostAttribute(state, attributeName);
@@ -3273,7 +3273,9 @@ function getEditedPostPreviewLink(state) {
*/
const getSuggestedPostFormat = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
const blocks = select(external_wp_blockEditor_namespaceObject.store).getBlocks();
- if (blocks.length > 2) return null;
+ if (blocks.length > 2) {
+ return null;
+ }
let name;
// If there is only one block in the content of the post grab its name
// so we can derive a suitable post format from it.
@@ -3397,7 +3399,7 @@ function getEditedPostSlug(state) {
}
/**
- * Returns the permalink for a post, split into it's three parts: the prefix,
+ * Returns the permalink for a post, split into its three parts: the prefix,
* the postName, and the suffix.
*
* @param {Object} state Editor state.
@@ -3502,7 +3504,7 @@ function canUserUseUnfilteredHTML(state) {
*
* @return {boolean} Whether the pre-publish panel should be shown or not.
*/
-const isPublishSidebarEnabled = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => !!select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'isPublishSidebarEnabled'));
+const isPublishSidebarEnabled = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => !!select(external_wp_preferences_namespaceObject.store).get('core', 'isPublishSidebarEnabled'));
/**
* Return the current block list.
@@ -3510,7 +3512,7 @@ const isPublishSidebarEnabled = (0,external_wp_data_namespaceObject.createRegist
* @param {Object} state
* @return {Array} Block list.
*/
-const getEditorBlocks = rememo(state => {
+const getEditorBlocks = (0,external_wp_data_namespaceObject.createSelector)(state => {
return getEditedPostAttribute(state, 'blocks') || (0,external_wp_blocks_namespaceObject.parse)(getEditedPostContent(state));
}, state => [getEditedPostAttribute(state, 'blocks'), getEditedPostContent(state)]);
@@ -3677,6 +3679,18 @@ function isInserterOpened(state) {
return !!state.blockInserterPanel;
}
+/**
+ * Returns the current editing mode.
+ *
+ * @param {Object} state Global application state.
+ *
+ * @return {string} Editing mode.
+ */
+const getEditorMode = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
+ var _select$get;
+ return (_select$get = select(external_wp_preferences_namespaceObject.store).get('core', 'editorMode')) !== null && _select$get !== void 0 ? _select$get : 'visual';
+});
+
/*
* Backward compatibility
*/
@@ -3991,9 +4005,10 @@ function __experimentalGetDefaultTemplateTypes(state) {
*
* @return {Array} The template part areas.
*/
-const __experimentalGetDefaultTemplatePartAreas = rememo(state => {
- const areas = getEditorSettings(state)?.defaultTemplatePartAreas || [];
- return areas?.map(item => {
+const __experimentalGetDefaultTemplatePartAreas = (0,external_wp_data_namespaceObject.createSelector)(state => {
+ var _getEditorSettings$de;
+ const areas = (_getEditorSettings$de = getEditorSettings(state)?.defaultTemplatePartAreas) !== null && _getEditorSettings$de !== void 0 ? _getEditorSettings$de : [];
+ return areas.map(item => {
return {
...item,
icon: getTemplatePartIcon(item.icon)
@@ -4009,14 +4024,14 @@ const __experimentalGetDefaultTemplatePartAreas = rememo(state => {
*
* @return {Object} The template type.
*/
-const __experimentalGetDefaultTemplateType = rememo((state, slug) => {
+const __experimentalGetDefaultTemplateType = (0,external_wp_data_namespaceObject.createSelector)((state, slug) => {
var _Object$values$find;
const templateTypes = __experimentalGetDefaultTemplateTypes(state);
if (!templateTypes) {
return EMPTY_OBJECT;
}
return (_Object$values$find = Object.values(templateTypes).find(type => type.slug === slug)) !== null && _Object$values$find !== void 0 ? _Object$values$find : EMPTY_OBJECT;
-}, (state, slug) => [__experimentalGetDefaultTemplateTypes(state), slug]);
+}, state => [__experimentalGetDefaultTemplateTypes(state)]);
/**
* Given a template entity, return information about it which is ready to be
@@ -4026,7 +4041,7 @@ const __experimentalGetDefaultTemplateType = rememo((state, slug) => {
* @param {Object} template The template for which we need information.
* @return {Object} Information about the template, including title, description, and icon.
*/
-function __experimentalGetTemplateInfo(state, template) {
+const __experimentalGetTemplateInfo = (0,external_wp_data_namespaceObject.createSelector)((state, template) => {
if (!template) {
return EMPTY_OBJECT;
}
@@ -4048,7 +4063,7 @@ function __experimentalGetTemplateInfo(state, template) {
description: templateDescription || defaultDescription,
icon: templateIcon
};
-}
+}, state => [__experimentalGetDefaultTemplateTypes(state), __experimentalGetDefaultTemplatePartAreas(state)]);
/**
* Returns a post type label depending on the current post.
@@ -4065,6 +4080,19 @@ const getPostTypeLabel = (0,external_wp_data_namespaceObject.createRegistrySelec
return postType?.labels?.singular_name;
});
+/**
+ * Returns true if the publish sidebar is opened.
+ *
+ * @param {Object} state Global application state
+ *
+ * @return {boolean} Whether the publish sidebar is open.
+ */
+function isPublishSidebarOpened(state) {
+ return state.publishSidebarActive;
+}
+
+;// CONCATENATED MODULE: external ["wp","a11y"]
+const external_wp_a11y_namespaceObject = window["wp"]["a11y"];
;// CONCATENATED MODULE: external ["wp","apiFetch"]
const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"];
var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject);
@@ -4246,6 +4274,8 @@ function getNotificationArgumentsForTrashFail(data) {
+
+
/**
* Internal dependencies
*/
@@ -4620,7 +4650,7 @@ function updatePostLock(lock) {
const enablePublishSidebar = () => ({
registry
}) => {
- registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'isPublishSidebarEnabled', true);
+ registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'isPublishSidebarEnabled', true);
};
/**
@@ -4629,7 +4659,7 @@ const enablePublishSidebar = () => ({
const disablePublishSidebar = () => ({
registry
}) => {
- registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'isPublishSidebarEnabled', false);
+ registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'isPublishSidebarEnabled', false);
};
/**
@@ -4799,7 +4829,6 @@ function updateEditorSettings(settings) {
/**
* Returns an action used to set the rendering mode of the post editor. We support multiple rendering modes:
*
- * - `all`: This is the default mode. It renders the post editor with all the features available. If a template is provided, it's preferred over the post.
* - `post-only`: This mode extracts the post blocks from the template and renders only those. The idea is to allow the user to edit the post/page in isolation without the wrapping template.
* - `template-locked`: This mode renders both the template and the post blocks but the template blocks are locked and can't be edited. The post blocks are editable.
*
@@ -4934,6 +4963,105 @@ function setIsListViewOpened(isOpen) {
}
/**
+ * Action that toggles Distraction free mode.
+ * Distraction free mode expects there are no sidebars, as due to the
+ * z-index values set, you can't close sidebars.
+ */
+const toggleDistractionFree = () => ({
+ dispatch,
+ registry
+}) => {
+ const isDistractionFree = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree');
+ if (isDistractionFree) {
+ registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'fixedToolbar', false);
+ }
+ if (!isDistractionFree) {
+ registry.batch(() => {
+ registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'fixedToolbar', true);
+ dispatch.setIsInserterOpened(false);
+ dispatch.setIsListViewOpened(false);
+ });
+ }
+ registry.batch(() => {
+ registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'distractionFree', !isDistractionFree);
+ registry.dispatch(external_wp_notices_namespaceObject.store).createInfoNotice(isDistractionFree ? (0,external_wp_i18n_namespaceObject.__)('Distraction free off.') : (0,external_wp_i18n_namespaceObject.__)('Distraction free on.'), {
+ id: 'core/editor/distraction-free-mode/notice',
+ type: 'snackbar',
+ actions: [{
+ label: (0,external_wp_i18n_namespaceObject.__)('Undo'),
+ onClick: () => {
+ registry.batch(() => {
+ registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'fixedToolbar', isDistractionFree ? true : false);
+ registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core', 'distractionFree');
+ });
+ }
+ }]
+ });
+ });
+};
+
+/**
+ * Triggers an action used to switch editor mode.
+ *
+ * @param {string} mode The editor mode.
+ */
+const switchEditorMode = mode => ({
+ dispatch,
+ registry
+}) => {
+ registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'editorMode', mode);
+
+ // Unselect blocks when we switch to a non visual mode.
+ if (mode !== 'visual') {
+ registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock();
+ }
+ if (mode === 'visual') {
+ (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Visual editor selected'), 'assertive');
+ } else if (mode === 'text') {
+ const isDistractionFree = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree');
+ if (isDistractionFree) {
+ dispatch.toggleDistractionFree();
+ }
+ (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Code editor selected'), 'assertive');
+ }
+};
+
+/**
+ * Returns an action object used in signalling that the user opened the publish
+ * sidebar.
+ *
+ * @return {Object} Action object
+ */
+function openPublishSidebar() {
+ return {
+ type: 'OPEN_PUBLISH_SIDEBAR'
+ };
+}
+
+/**
+ * Returns an action object used in signalling that the user closed the
+ * publish sidebar.
+ *
+ * @return {Object} Action object.
+ */
+function closePublishSidebar() {
+ return {
+ type: 'CLOSE_PUBLISH_SIDEBAR'
+ };
+}
+
+/**
+ * Returns an action object used in signalling that the user toggles the publish sidebar.
+ *
+ * @return {Object} Action object
+ */
+function togglePublishSidebar() {
+ return {
+ type: 'TOGGLE_PUBLISH_SIDEBAR'
+ };
+}
+
+/**
* Backward compatibility
*/
@@ -5103,6 +5231,29 @@ const insertDefaultBlock = getBlockEditorAction('insertDefaultBlock');
*/
const updateBlockListSettings = getBlockEditorAction('updateBlockListSettings');
+;// CONCATENATED MODULE: external ["wp","htmlEntities"]
+const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"];
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/utils/is-template-revertable.js
+/**
+ * Internal dependencies
+ */
+
+
+// Copy of the function from packages/edit-site/src/utils/is-template-revertable.js
+
+/**
+ * Check if a template or template part is revertable to its original theme-provided file.
+ *
+ * @param {Object} templateOrTemplatePart The entity to check.
+ * @return {boolean} Whether the entity is revertable.
+ */
+function isTemplateRevertable(templateOrTemplatePart) {
+ if (!templateOrTemplatePart) {
+ return false;
+ }
+ return templateOrTemplatePart.source === TEMPLATE_ORIGINS.custom && templateOrTemplatePart.has_theme_file;
+}
+
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/private-actions.js
/**
* WordPress dependencies
@@ -5112,6 +5263,16 @@ const updateBlockListSettings = getBlockEditorAction('updateBlockListSettings');
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
/**
* Returns an action object used to set which template is currently being used/edited.
*
@@ -5178,17 +5339,557 @@ const hideBlockTypes = blockNames => ({
registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'hiddenBlockTypes', [...mergedBlockNames]);
};
+/**
+ * Save entity records marked as dirty.
+ *
+ * @param {Object} options Options for the action.
+ * @param {Function} [options.onSave] Callback when saving happens.
+ * @param {object[]} [options.dirtyEntityRecords] Array of dirty entities.
+ * @param {object[]} [options.entitiesToSkip] Array of entities to skip saving.
+ * @param {Function} [options.close] Callback when the actions is called. It should be consolidated with `onSave`.
+ */
+const saveDirtyEntities = ({
+ onSave,
+ dirtyEntityRecords = [],
+ entitiesToSkip = [],
+ close
+} = {}) => ({
+ registry
+}) => {
+ const PUBLISH_ON_SAVE_ENTITIES = [{
+ kind: 'postType',
+ name: 'wp_navigation'
+ }];
+ const saveNoticeId = 'site-editor-save-success';
+ const homeUrl = registry.select(external_wp_coreData_namespaceObject.store).getUnstableBase()?.home;
+ registry.dispatch(external_wp_notices_namespaceObject.store).removeNotice(saveNoticeId);
+ const entitiesToSave = dirtyEntityRecords.filter(({
+ kind,
+ name,
+ key,
+ property
+ }) => {
+ return !entitiesToSkip.some(elt => elt.kind === kind && elt.name === name && elt.key === key && elt.property === property);
+ });
+ close?.(entitiesToSave);
+ const siteItemsToSave = [];
+ const pendingSavedRecords = [];
+ entitiesToSave.forEach(({
+ kind,
+ name,
+ key,
+ property
+ }) => {
+ if ('root' === kind && 'site' === name) {
+ siteItemsToSave.push(property);
+ } else {
+ if (PUBLISH_ON_SAVE_ENTITIES.some(typeToPublish => typeToPublish.kind === kind && typeToPublish.name === name)) {
+ registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord(kind, name, key, {
+ status: 'publish'
+ });
+ }
+ pendingSavedRecords.push(registry.dispatch(external_wp_coreData_namespaceObject.store).saveEditedEntityRecord(kind, name, key));
+ }
+ });
+ if (siteItemsToSave.length) {
+ pendingSavedRecords.push(registry.dispatch(external_wp_coreData_namespaceObject.store).__experimentalSaveSpecifiedEntityEdits('root', 'site', undefined, siteItemsToSave));
+ }
+ registry.dispatch(external_wp_blockEditor_namespaceObject.store).__unstableMarkLastChangeAsPersistent();
+ Promise.all(pendingSavedRecords).then(values => {
+ return onSave ? onSave(values) : values;
+ }).then(values => {
+ if (values.some(value => typeof value === 'undefined')) {
+ registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('Saving failed.'));
+ } else {
+ registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Site updated.'), {
+ type: 'snackbar',
+ id: saveNoticeId,
+ actions: [{
+ label: (0,external_wp_i18n_namespaceObject.__)('View site'),
+ url: homeUrl
+ }]
+ });
+ }
+ }).catch(error => registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(`${(0,external_wp_i18n_namespaceObject.__)('Saving failed.')} ${error}`));
+};
+
+/**
+ * Reverts a template to its original theme-provided file.
+ *
+ * @param {Object} template The template to revert.
+ * @param {Object} [options]
+ * @param {boolean} [options.allowUndo] Whether to allow the user to undo
+ * reverting the template. Default true.
+ */
+const revertTemplate = (template, {
+ allowUndo = true
+} = {}) => async ({
+ registry
+}) => {
+ const noticeId = 'edit-site-template-reverted';
+ registry.dispatch(external_wp_notices_namespaceObject.store).removeNotice(noticeId);
+ if (!isTemplateRevertable(template)) {
+ registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('This template is not revertable.'), {
+ type: 'snackbar'
+ });
+ return;
+ }
+ try {
+ const templateEntityConfig = registry.select(external_wp_coreData_namespaceObject.store).getEntityConfig('postType', template.type);
+ if (!templateEntityConfig) {
+ registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error. Please reload.'), {
+ type: 'snackbar'
+ });
+ return;
+ }
+ const fileTemplatePath = (0,external_wp_url_namespaceObject.addQueryArgs)(`${templateEntityConfig.baseURL}/${template.id}`, {
+ context: 'edit',
+ source: 'theme'
+ });
+ const fileTemplate = await external_wp_apiFetch_default()({
+ path: fileTemplatePath
+ });
+ if (!fileTemplate) {
+ registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error. Please reload.'), {
+ type: 'snackbar'
+ });
+ return;
+ }
+ const serializeBlocks = ({
+ blocks: blocksForSerialization = []
+ }) => (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization);
+ const edited = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', template.type, template.id);
+
+ // We are fixing up the undo level here to make sure we can undo
+ // the revert in the header toolbar correctly.
+ registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, template.id, {
+ content: serializeBlocks,
+ // Required to make the `undo` behave correctly.
+ blocks: edited.blocks,
+ // Required to revert the blocks in the editor.
+ source: 'custom' // required to avoid turning the editor into a dirty state
+ }, {
+ undoIgnore: true // Required to merge this edit with the last undo level.
+ });
+ const blocks = (0,external_wp_blocks_namespaceObject.parse)(fileTemplate?.content?.raw);
+ registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, fileTemplate.id, {
+ content: serializeBlocks,
+ blocks,
+ source: 'theme'
+ });
+ if (allowUndo) {
+ const undoRevert = () => {
+ registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, edited.id, {
+ content: serializeBlocks,
+ blocks: edited.blocks,
+ source: 'custom'
+ });
+ };
+ registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Template reset.'), {
+ type: 'snackbar',
+ id: noticeId,
+ actions: [{
+ label: (0,external_wp_i18n_namespaceObject.__)('Undo'),
+ onClick: undoRevert
+ }]
+ });
+ }
+ } catch (error) {
+ const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('Template revert failed. Please reload.');
+ registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(errorMessage, {
+ type: 'snackbar'
+ });
+ }
+};
+
+/**
+ * Action that removes an array of templates, template parts or patterns.
+ *
+ * @param {Array} items An array of template,template part or pattern objects to remove.
+ */
+const removeTemplates = items => async ({
+ registry
+}) => {
+ const isResetting = items.every(item => !!item && (item.has_theme_file || item.templatePart && item.templatePart.has_theme_file));
+ const promiseResult = await Promise.allSettled(items.map(item => {
+ return registry.dispatch(external_wp_coreData_namespaceObject.store).deleteEntityRecord('postType', item.type, item.id, {
+ force: true
+ }, {
+ throwOnError: true
+ });
+ }));
+
+ // If all the promises were fulfilled with sucess.
+ if (promiseResult.every(({
+ status
+ }) => status === 'fulfilled')) {
+ let successMessage;
+ if (items.length === 1) {
+ // Depending on how the entity was retrieved its title might be
+ // an object or simple string.
+ const title = typeof items[0].title === 'string' ? items[0].title : items[0].title?.rendered;
+ successMessage = isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The template/part's name. */
+ (0,external_wp_i18n_namespaceObject.__)('"%s" reset.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title)) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The template/part's name. */
+ (0,external_wp_i18n_namespaceObject.__)('"%s" deleted.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title));
+ } else {
+ successMessage = isResetting ? (0,external_wp_i18n_namespaceObject.__)('Items reset.') : (0,external_wp_i18n_namespaceObject.__)('Items deleted.');
+ }
+ registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice(successMessage, {
+ type: 'snackbar',
+ id: 'editor-template-deleted-success'
+ });
+ } else {
+ // If there was at lease one failure.
+ let errorMessage;
+ // If we were trying to delete a single template.
+ if (promiseResult.length === 1) {
+ if (promiseResult[0].reason?.message) {
+ errorMessage = promiseResult[0].reason.message;
+ } else {
+ errorMessage = isResetting ? (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the item.') : (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the item.');
+ }
+ // If we were trying to delete a multiple templates
+ } else {
+ const errorMessages = new Set();
+ const failedPromises = promiseResult.filter(({
+ status
+ }) => status === 'rejected');
+ for (const failedPromise of failedPromises) {
+ if (failedPromise.reason?.message) {
+ errorMessages.add(failedPromise.reason.message);
+ }
+ }
+ if (errorMessages.size === 0) {
+ errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the items.');
+ } else if (errorMessages.size === 1) {
+ errorMessage = isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: an error message */
+ (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the items: %s'), [...errorMessages][0]) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: an error message */
+ (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the items: %s'), [...errorMessages][0]);
+ } else {
+ errorMessage = isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: a list of comma separated error messages */
+ (0,external_wp_i18n_namespaceObject.__)('Some errors occurred while reverting the items: %s'), [...errorMessages].join(',')) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: a list of comma separated error messages */
+ (0,external_wp_i18n_namespaceObject.__)('Some errors occurred while deleting the items: %s'), [...errorMessages].join(','));
+ }
+ }
+ registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(errorMessage, {
+ type: 'snackbar'
+ });
+ }
+};
+
+// EXTERNAL MODULE: ./node_modules/fast-deep-equal/index.js
+var fast_deep_equal = __webpack_require__(5215);
+var fast_deep_equal_default = /*#__PURE__*/__webpack_require__.n(fast_deep_equal);
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol.js
+/**
+ * WordPress dependencies
+ */
+
+
+const symbol = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z"
+ })
+});
+/* harmony default export */ const library_symbol = (symbol);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/navigation.js
+/**
+ * WordPress dependencies
+ */
+
+
+const navigation = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ viewBox: "0 0 24 24",
+ xmlns: "http://www.w3.org/2000/svg",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z"
+ })
+});
+/* harmony default export */ const library_navigation = (navigation);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/page.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+const page = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z"
+ })]
+});
+/* harmony default export */ const library_page = (page);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/verse.js
+/**
+ * WordPress dependencies
+ */
+
+
+const verse = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ viewBox: "0 0 24 24",
+ xmlns: "http://www.w3.org/2000/svg",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M17.8 2l-.9.3c-.1 0-3.6 1-5.2 2.1C10 5.5 9.3 6.5 8.9 7.1c-.6.9-1.7 4.7-1.7 6.3l-.9 2.3c-.2.4 0 .8.4 1 .1 0 .2.1.3.1.3 0 .6-.2.7-.5l.6-1.5c.3 0 .7-.1 1.2-.2.7-.1 1.4-.3 2.2-.5.8-.2 1.6-.5 2.4-.8.7-.3 1.4-.7 1.9-1.2s.8-1.2 1-1.9c.2-.7.3-1.6.4-2.4.1-.8.1-1.7.2-2.5 0-.8.1-1.5.2-2.1V2zm-1.9 5.6c-.1.8-.2 1.5-.3 2.1-.2.6-.4 1-.6 1.3-.3.3-.8.6-1.4.9-.7.3-1.4.5-2.2.8-.6.2-1.3.3-1.8.4L15 7.5c.3-.3.6-.7 1-1.1 0 .4 0 .8-.1 1.2zM6 20h8v-1.5H6V20z"
+ })
+});
+/* harmony default export */ const library_verse = (verse);
+
+;// CONCATENATED MODULE: ./node_modules/memize/dist/index.js
+/**
+ * Memize options object.
+ *
+ * @typedef MemizeOptions
+ *
+ * @property {number} [maxSize] Maximum size of the cache.
+ */
+
+/**
+ * Internal cache entry.
+ *
+ * @typedef MemizeCacheNode
+ *
+ * @property {?MemizeCacheNode|undefined} [prev] Previous node.
+ * @property {?MemizeCacheNode|undefined} [next] Next node.
+ * @property {Array<*>} args Function arguments for cache
+ * entry.
+ * @property {*} val Function result.
+ */
+
+/**
+ * Properties of the enhanced function for controlling cache.
+ *
+ * @typedef MemizeMemoizedFunction
+ *
+ * @property {()=>void} clear Clear the cache.
+ */
+
+/**
+ * Accepts a function to be memoized, and returns a new memoized function, with
+ * optional options.
+ *
+ * @template {(...args: any[]) => any} F
+ *
+ * @param {F} fn Function to memoize.
+ * @param {MemizeOptions} [options] Options object.
+ *
+ * @return {((...args: Parameters<F>) => ReturnType<F>) & MemizeMemoizedFunction} Memoized function.
+ */
+function memize(fn, options) {
+ var size = 0;
+
+ /** @type {?MemizeCacheNode|undefined} */
+ var head;
+
+ /** @type {?MemizeCacheNode|undefined} */
+ var tail;
+
+ options = options || {};
+
+ function memoized(/* ...args */) {
+ var node = head,
+ len = arguments.length,
+ args,
+ i;
+
+ searchCache: while (node) {
+ // Perform a shallow equality test to confirm that whether the node
+ // under test is a candidate for the arguments passed. Two arrays
+ // are shallowly equal if their length matches and each entry is
+ // strictly equal between the two sets. Avoid abstracting to a
+ // function which could incur an arguments leaking deoptimization.
+
+ // Check whether node arguments match arguments length
+ if (node.args.length !== arguments.length) {
+ node = node.next;
+ continue;
+ }
+
+ // Check whether node arguments match arguments values
+ for (i = 0; i < len; i++) {
+ if (node.args[i] !== arguments[i]) {
+ node = node.next;
+ continue searchCache;
+ }
+ }
+
+ // At this point we can assume we've found a match
+
+ // Surface matched node to head if not already
+ if (node !== head) {
+ // As tail, shift to previous. Must only shift if not also
+ // head, since if both head and tail, there is no previous.
+ if (node === tail) {
+ tail = node.prev;
+ }
+
+ // Adjust siblings to point to each other. If node was tail,
+ // this also handles new tail's empty `next` assignment.
+ /** @type {MemizeCacheNode} */ (node.prev).next = node.next;
+ if (node.next) {
+ node.next.prev = node.prev;
+ }
+
+ node.next = head;
+ node.prev = null;
+ /** @type {MemizeCacheNode} */ (head).prev = node;
+ head = node;
+ }
+
+ // Return immediately
+ return node.val;
+ }
+
+ // No cached value found. Continue to insertion phase:
+
+ // Create a copy of arguments (avoid leaking deoptimization)
+ args = new Array(len);
+ for (i = 0; i < len; i++) {
+ args[i] = arguments[i];
+ }
+
+ node = {
+ args: args,
+
+ // Generate the result from original function
+ val: fn.apply(null, args),
+ };
+
+ // Don't need to check whether node is already head, since it would
+ // have been returned above already if it was
+
+ // Shift existing head down list
+ if (head) {
+ head.prev = node;
+ node.next = head;
+ } else {
+ // If no head, follows that there's no tail (at initial or reset)
+ tail = node;
+ }
+
+ // Trim tail if we're reached max size and are pending cache insertion
+ if (size === /** @type {MemizeOptions} */ (options).maxSize) {
+ tail = /** @type {MemizeCacheNode} */ (tail).prev;
+ /** @type {MemizeCacheNode} */ (tail).next = null;
+ } else {
+ size++;
+ }
+
+ head = node;
+
+ return node.val;
+ }
+
+ memoized.clear = function () {
+ head = null;
+ tail = null;
+ size = 0;
+ };
+
+ // Ignore reason: There's not a clear solution to create an intersection of
+ // the function with additional properties, where the goal is to retain the
+ // function signature of the incoming argument and add control properties
+ // on the return value.
+
+ // @ts-ignore
+ return memoized;
+}
+
+
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/utils/get-filtered-template-parts.js
+/**
+ * External dependencies
+ */
+
+
+/**
+ * WordPress dependencies
+ */
+
+const EMPTY_ARRAY = [];
+
+/**
+ * Get a flattened and filtered list of template parts and the matching block for that template part.
+ *
+ * Takes a list of blocks defined within a template, and a list of template parts, and returns a
+ * flattened list of template parts and the matching block for that template part.
+ *
+ * @param {Array} blocks Blocks to flatten.
+ * @param {?Array} templateParts Available template parts.
+ * @return {Array} An array of template parts and their blocks.
+ */
+function getFilteredTemplatePartBlocks(blocks = EMPTY_ARRAY, templateParts) {
+ const templatePartsById = templateParts ?
+ // Key template parts by their ID.
+ templateParts.reduce((newTemplateParts, part) => ({
+ ...newTemplateParts,
+ [part.id]: part
+ }), {}) : {};
+ const result = [];
+
+ // Iterate over all blocks, recursing into inner blocks.
+ // Output will be based on a depth-first traversal.
+ const stack = [...blocks];
+ while (stack.length) {
+ const {
+ innerBlocks,
+ ...block
+ } = stack.shift();
+ // Place inner blocks at the beginning of the stack to preserve order.
+ stack.unshift(...innerBlocks);
+ if ((0,external_wp_blocks_namespaceObject.isTemplatePart)(block)) {
+ const {
+ attributes: {
+ theme,
+ slug
+ }
+ } = block;
+ const templatePartId = `${theme}//${slug}`;
+ const templatePart = templatePartsById[templatePartId];
+
+ // Only add to output if the found template part block is in the list of available template parts.
+ if (templatePart) {
+ result.push({
+ templatePart,
+ block
+ });
+ }
+ }
+ }
+ return result;
+}
+const memoizedGetFilteredTemplatePartBlocks = memize(getFilteredTemplatePartBlocks);
+
+
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/private-selectors.js
/**
+ * External dependencies
+ */
+
+
+/**
* WordPress dependencies
*/
+
+
/**
* Internal dependencies
*/
+
+
const EMPTY_INSERTION_POINT = {
rootClientId: undefined,
insertionIndex: undefined,
@@ -5202,7 +5903,7 @@ const EMPTY_INSERTION_POINT = {
*
* @return {Object} The root client ID, index to insert at and starting filter value.
*/
-const getInsertionPoint = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
+const getInsertionPoint = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)(state => {
if (typeof state.blockInserterPanel === 'object') {
return state.blockInserterPanel;
}
@@ -5217,10 +5918,87 @@ const getInsertionPoint = (0,external_wp_data_namespaceObject.createRegistrySele
}
}
return EMPTY_INSERTION_POINT;
-});
+}, state => {
+ const [postContentClientId] = select(external_wp_blockEditor_namespaceObject.store).getBlocksByName('core/post-content');
+ return [state.blockInserterPanel, getRenderingMode(state), postContentClientId];
+}));
function getListViewToggleRef(state) {
return state.listViewToggleRef;
}
+function getInserterSidebarToggleRef(state) {
+ return state.inserterSidebarToggleRef;
+}
+const CARD_ICONS = {
+ wp_block: library_symbol,
+ wp_navigation: library_navigation,
+ page: library_page,
+ post: library_verse
+};
+const getPostIcon = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, postType, options) => {
+ {
+ if (postType === 'wp_template_part' || postType === 'wp_template') {
+ return __experimentalGetDefaultTemplatePartAreas(state).find(item => options.area === item.area)?.icon || library_layout;
+ }
+ if (CARD_ICONS[postType]) {
+ return CARD_ICONS[postType];
+ }
+ const postTypeEntity = select(external_wp_coreData_namespaceObject.store).getPostType(postType);
+ // `icon` is the `menu_icon` property of a post type. We
+ // only handle `dashicons` for now, even if the `menu_icon`
+ // also supports urls and svg as values.
+ if (postTypeEntity?.icon?.startsWith('dashicons-')) {
+ return postTypeEntity.icon.slice(10);
+ }
+ return library_page;
+ }
+});
+
+/**
+ * Returns the template parts and their blocks for the current edited template.
+ *
+ * @param {Object} state Global application state.
+ * @return {Array} Template parts and their blocks in an array.
+ */
+const getCurrentTemplateTemplateParts = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
+ const templateParts = select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', TEMPLATE_PART_POST_TYPE, {
+ per_page: -1
+ });
+ const clientIds = select(external_wp_blockEditor_namespaceObject.store).getBlocksByName('core/template-part');
+ const blocks = select(external_wp_blockEditor_namespaceObject.store).getBlocksByClientId(clientIds);
+ return memoizedGetFilteredTemplatePartBlocks(blocks, templateParts);
+});
+
+/**
+ * Returns true if there are unsaved changes to the
+ * post's meta fields, and false otherwise.
+ *
+ * @param {Object} state Global application state.
+ * @param {string} postType The post type of the post.
+ * @param {number} postId The ID of the post.
+ *
+ * @return {boolean} Whether there are edits or not in the meta fields of the relevant post.
+ */
+const hasPostMetaChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, postType, postId) => {
+ const {
+ type: currentPostType,
+ id: currentPostId
+ } = getCurrentPost(state);
+ // If no postType or postId is passed, use the current post.
+ const edits = select(external_wp_coreData_namespaceObject.store).getEntityRecordNonTransientEdits('postType', postType || currentPostType, postId || currentPostId);
+ if (!edits?.meta) {
+ return false;
+ }
+
+ // Compare if anything apart from `footnotes` has changed.
+ const originalPostMeta = select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', postType || currentPostType, postId || currentPostId)?.meta;
+ return !fast_deep_equal_default()({
+ ...originalPostMeta,
+ footnotes: undefined
+ }, {
+ ...edits.meta,
+ footnotes: undefined
+ });
+});
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/index.js
/**
@@ -5280,35 +6058,58 @@ unlock(store_store).registerPrivateSelectors(private_selectors_namespaceObject);
/* harmony default export */ const post_meta = ({
name: 'core/post-meta',
label: (0,external_wp_i18n_namespaceObject._x)('Post Meta', 'block bindings source'),
- useSource(props, sourceAttributes) {
- const {
- getCurrentPostType
- } = (0,external_wp_data_namespaceObject.useSelect)(store_store);
- const {
- context
- } = props;
- const {
- key: metaKey
- } = sourceAttributes;
- const postType = context.postType ? context.postType : getCurrentPostType();
- const [meta, setMeta] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', context.postType, 'meta', context.postId);
+ getPlaceholder({
+ args
+ }) {
+ return args.key;
+ },
+ getValue({
+ registry,
+ context,
+ args
+ }) {
+ return registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', context?.postType, context?.postId).meta?.[args.key];
+ },
+ setValue({
+ registry,
+ context,
+ args,
+ value
+ }) {
+ registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', context?.postType, context?.postId, {
+ meta: {
+ [args.key]: value
+ }
+ });
+ },
+ canUserEditValue({
+ select,
+ context,
+ args
+ }) {
+ // Lock editing in query loop.
+ if (context?.query || context?.queryId) {
+ return false;
+ }
+ const postType = context?.postType || select(store_store).getCurrentPostType();
+
+ // Check that editing is happening in the post editor and not a template.
if (postType === 'wp_template') {
- return {
- placeholder: metaKey
- };
+ return false;
}
- const metaValue = meta[metaKey];
- const updateMetaValue = newValue => {
- setMeta({
- ...meta,
- [metaKey]: newValue
- });
- };
- return {
- placeholder: metaKey,
- value: metaValue,
- updateValue: updateMetaValue
- };
+
+ // Check that the custom field is not protected and available in the REST API.
+ const isFieldExposed = !!select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', postType, context?.postId)?.meta?.[args.key];
+ if (!isFieldExposed) {
+ return false;
+ }
+
+ // Check that the user has the capability to edit post meta.
+ const canUserEdit = select(external_wp_coreData_namespaceObject.store).canUserEditEntityRecord('postType', context?.postType, context?.postId);
+ if (!canUserEdit) {
+ return false;
+ }
+ return true;
}
});
@@ -5328,12 +6129,11 @@ const {
registerBlockBindingsSource
} = unlock((0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store));
registerBlockBindingsSource(post_meta);
-if (false) {}
+registerBlockBindingsSource(pattern_overrides);
;// CONCATENATED MODULE: external ["wp","compose"]
const external_wp_compose_namespaceObject = window["wp"]["compose"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/custom-sources-backwards-compatibility.js
-
/**
* WordPress dependencies
*/
@@ -5370,6 +6170,7 @@ const external_wp_compose_namespaceObject = window["wp"]["compose"];
*
* @return {WPHigherOrderComponent} Higher-order component.
*/
+
const createWithMetaAttributeSource = metaAttributes => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => ({
attributes,
setAttributes,
@@ -5381,7 +6182,7 @@ const createWithMetaAttributeSource = metaAttributes => (0,external_wp_compose_n
...attributes,
...Object.fromEntries(Object.entries(metaAttributes).map(([attributeKey, metaKey]) => [attributeKey, meta[metaKey]]))
}), [attributes, meta]);
- return (0,external_React_.createElement)(BlockEdit, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, {
attributes: mergedAttributes,
setAttributes: nextAttributes => {
const nextMeta = Object.fromEntries(Object.entries(nextAttributes !== null && nextAttributes !== void 0 ? nextAttributes : {}).filter(
@@ -5423,7 +6224,6 @@ function shimAttributeSource(settings) {
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/editor/custom-sources-backwards-compatibility/shim-attribute-source', shimAttributeSource);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/user.js
-
/**
* WordPress dependencies
*/
@@ -5433,19 +6233,25 @@ function shimAttributeSource(settings) {
/** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */
+
+
function getUserLabel(user) {
- const avatar = user.avatar_urls && user.avatar_urls[24] ? (0,external_React_.createElement)("img", {
+ const avatar = user.avatar_urls && user.avatar_urls[24] ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", {
className: "editor-autocompleters__user-avatar",
alt: "",
src: user.avatar_urls[24]
- }) : (0,external_React_.createElement)("span", {
+ }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
className: "editor-autocompleters__no-avatar"
});
- return (0,external_React_.createElement)(external_React_.Fragment, null, avatar, (0,external_React_.createElement)("span", {
- className: "editor-autocompleters__user-name"
- }, user.name), (0,external_React_.createElement)("span", {
- className: "editor-autocompleters__user-slug"
- }, user.slug));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [avatar, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "editor-autocompleters__user-name",
+ children: user.name
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "editor-autocompleters__user-slug",
+ children: user.slug
+ })]
+ });
}
/**
@@ -5498,10 +6304,19 @@ function setDefaultCompleters(completers = []) {
}
(0,external_wp_hooks_namespaceObject.addFilter)('editor.Autocomplete.completers', 'editor/autocompleters/set-default-completers', setDefaultCompleters);
+;// CONCATENATED MODULE: external ["wp","mediaUtils"]
+const external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"];
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/media-upload.js
+/**
+ * WordPress dependencies
+ */
+
+
+(0,external_wp_hooks_namespaceObject.addFilter)('editor.MediaUpload', 'core/editor/components/media-upload', () => external_wp_mediaUtils_namespaceObject.MediaUpload);
+
;// CONCATENATED MODULE: external ["wp","patterns"]
const external_wp_patterns_namespaceObject = window["wp"]["patterns"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/pattern-overrides.js
-
/**
* WordPress dependencies
*/
@@ -5511,16 +6326,24 @@ const external_wp_patterns_namespaceObject = window["wp"]["patterns"];
+
/**
* Internal dependencies
*/
+
+/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */
+
+
+
const {
- useSetPatternBindings,
+ PatternOverridesControls,
ResetOverridesControl,
+ PatternOverridesBlockControls,
PATTERN_TYPES,
- PARTIAL_SYNCING_SUPPORTED_BLOCKS
+ PARTIAL_SYNCING_SUPPORTED_BLOCKS,
+ PATTERN_SYNC_TYPES
} = unlock(external_wp_patterns_namespaceObject.privateApis);
/**
@@ -5533,32 +6356,51 @@ const {
* @return {Component} Wrapped component.
*/
const withPatternOverrideControls = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => {
- const isSupportedBlock = Object.keys(PARTIAL_SYNCING_SUPPORTED_BLOCKS).includes(props.name);
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(BlockEdit, {
- ...props
- }), isSupportedBlock && (0,external_React_.createElement)(BindingUpdater, {
- ...props
- }), props.isSelected && isSupportedBlock && (0,external_React_.createElement)(ControlsWithStoreSubscription, {
- ...props
- }));
-});
-function BindingUpdater(props) {
- const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentPostType(), []);
- useSetPatternBindings(props, postType);
- return null;
-}
+ const isSupportedBlock = !!PARTIAL_SYNCING_SUPPORTED_BLOCKS[props.name];
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, {
+ ...props
+ }), props.isSelected && isSupportedBlock && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ControlsWithStoreSubscription, {
+ ...props
+ }), isSupportedBlock && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternOverridesBlockControls, {})]
+ });
+}, 'withPatternOverrideControls');
// Split into a separate component to avoid a store subscription
// on every block.
function ControlsWithStoreSubscription(props) {
const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)();
- const isEditingPattern = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentPostType() === PATTERN_TYPES.user, []);
+ const {
+ hasPatternOverridesSource,
+ isEditingSyncedPattern
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getBlockBindingsSource
+ } = unlock(select(external_wp_blocks_namespaceObject.store));
+ const {
+ getCurrentPostType,
+ getEditedPostAttribute
+ } = select(store_store);
+ return {
+ // For editing link to the site editor if the theme and user permissions support it.
+ hasPatternOverridesSource: !!getBlockBindingsSource('core/pattern-overrides'),
+ isEditingSyncedPattern: getCurrentPostType() === PATTERN_TYPES.user && getEditedPostAttribute('meta')?.wp_pattern_sync_status !== PATTERN_SYNC_TYPES.unsynced && getEditedPostAttribute('wp_pattern_sync_status') !== PATTERN_SYNC_TYPES.unsynced
+ };
+ }, []);
const bindings = props.attributes.metadata?.bindings;
const hasPatternBindings = !!bindings && Object.values(bindings).some(binding => binding.source === 'core/pattern-overrides');
- const shouldShowResetOverridesControl = !isEditingPattern && !!props.attributes.metadata?.name && blockEditingMode !== 'disabled' && hasPatternBindings;
- return (0,external_React_.createElement)(external_React_.Fragment, null, shouldShowResetOverridesControl && (0,external_React_.createElement)(ResetOverridesControl, {
- ...props
- }));
+ const shouldShowPatternOverridesControls = isEditingSyncedPattern && blockEditingMode === 'default';
+ const shouldShowResetOverridesControl = !isEditingSyncedPattern && !!props.attributes.metadata?.name && blockEditingMode !== 'disabled' && hasPatternBindings;
+ if (!hasPatternOverridesSource) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [shouldShowPatternOverridesControls && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternOverridesControls, {
+ ...props
+ }), shouldShowResetOverridesControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResetOverridesControl, {
+ ...props
+ })]
+ });
}
(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/editor/with-pattern-override-controls', withPatternOverrideControls);
@@ -5570,8 +6412,1310 @@ function ControlsWithStoreSubscription(props) {
+
;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"]
const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"];
+;// CONCATENATED MODULE: ./node_modules/clsx/dist/clsx.mjs
+function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const dist_clsx = (clsx);
+;// CONCATENATED MODULE: external ["wp","components"]
+const external_wp_components_namespaceObject = window["wp"]["components"];
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js
+/**
+ * WordPress dependencies
+ */
+
+
+const check = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"
+ })
+});
+/* harmony default export */ const library_check = (check);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-filled.js
+/**
+ * WordPress dependencies
+ */
+
+
+const starFilled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"
+ })
+});
+/* harmony default export */ const star_filled = (starFilled);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-empty.js
+/**
+ * WordPress dependencies
+ */
+
+
+const starEmpty = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ fillRule: "evenodd",
+ d: "M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z",
+ clipRule: "evenodd"
+ })
+});
+/* harmony default export */ const star_empty = (starEmpty);
+
+;// CONCATENATED MODULE: external ["wp","viewport"]
+const external_wp_viewport_namespaceObject = window["wp"]["viewport"];
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js
+/**
+ * WordPress dependencies
+ */
+
+
+const closeSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"
+ })
+});
+/* harmony default export */ const close_small = (closeSmall);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/deprecated.js
+/**
+ * WordPress dependencies
+ */
+
+function normalizeComplementaryAreaScope(scope) {
+ if (['core/edit-post', 'core/edit-site'].includes(scope)) {
+ external_wp_deprecated_default()(`${scope} interface scope`, {
+ alternative: 'core interface scope',
+ hint: 'core/edit-post and core/edit-site are merging.',
+ version: '6.6'
+ });
+ return 'core';
+ }
+ return scope;
+}
+function normalizeComplementaryAreaName(scope, name) {
+ if (scope === 'core' && name === 'edit-site/template') {
+ external_wp_deprecated_default()(`edit-site/template sidebar`, {
+ alternative: 'edit-post/document',
+ version: '6.6'
+ });
+ return 'edit-post/document';
+ }
+ if (scope === 'core' && name === 'edit-site/block-inspector') {
+ external_wp_deprecated_default()(`edit-site/block-inspector sidebar`, {
+ alternative: 'edit-post/block',
+ version: '6.6'
+ });
+ return 'edit-post/block';
+ }
+ return name;
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/actions.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+/**
+ * Set a default complementary area.
+ *
+ * @param {string} scope Complementary area scope.
+ * @param {string} area Area identifier.
+ *
+ * @return {Object} Action object.
+ */
+const setDefaultComplementaryArea = (scope, area) => {
+ scope = normalizeComplementaryAreaScope(scope);
+ area = normalizeComplementaryAreaName(scope, area);
+ return {
+ type: 'SET_DEFAULT_COMPLEMENTARY_AREA',
+ scope,
+ area
+ };
+};
+
+/**
+ * Enable the complementary area.
+ *
+ * @param {string} scope Complementary area scope.
+ * @param {string} area Area identifier.
+ */
+const enableComplementaryArea = (scope, area) => ({
+ registry,
+ dispatch
+}) => {
+ // Return early if there's no area.
+ if (!area) {
+ return;
+ }
+ scope = normalizeComplementaryAreaScope(scope);
+ area = normalizeComplementaryAreaName(scope, area);
+ const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible');
+ if (!isComplementaryAreaVisible) {
+ registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'isComplementaryAreaVisible', true);
+ }
+ dispatch({
+ type: 'ENABLE_COMPLEMENTARY_AREA',
+ scope,
+ area
+ });
+};
+
+/**
+ * Disable the complementary area.
+ *
+ * @param {string} scope Complementary area scope.
+ */
+const disableComplementaryArea = scope => ({
+ registry
+}) => {
+ scope = normalizeComplementaryAreaScope(scope);
+ const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible');
+ if (isComplementaryAreaVisible) {
+ registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'isComplementaryAreaVisible', false);
+ }
+};
+
+/**
+ * Pins an item.
+ *
+ * @param {string} scope Item scope.
+ * @param {string} item Item identifier.
+ *
+ * @return {Object} Action object.
+ */
+const pinItem = (scope, item) => ({
+ registry
+}) => {
+ // Return early if there's no item.
+ if (!item) {
+ return;
+ }
+ scope = normalizeComplementaryAreaScope(scope);
+ item = normalizeComplementaryAreaName(scope, item);
+ const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems');
+
+ // The item is already pinned, there's nothing to do.
+ if (pinnedItems?.[item] === true) {
+ return;
+ }
+ registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', {
+ ...pinnedItems,
+ [item]: true
+ });
+};
+
+/**
+ * Unpins an item.
+ *
+ * @param {string} scope Item scope.
+ * @param {string} item Item identifier.
+ */
+const unpinItem = (scope, item) => ({
+ registry
+}) => {
+ // Return early if there's no item.
+ if (!item) {
+ return;
+ }
+ scope = normalizeComplementaryAreaScope(scope);
+ item = normalizeComplementaryAreaName(scope, item);
+ const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems');
+ registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', {
+ ...pinnedItems,
+ [item]: false
+ });
+};
+
+/**
+ * Returns an action object used in signalling that a feature should be toggled.
+ *
+ * @param {string} scope The feature scope (e.g. core/edit-post).
+ * @param {string} featureName The feature name.
+ */
+function toggleFeature(scope, featureName) {
+ return function ({
+ registry
+ }) {
+ external_wp_deprecated_default()(`dispatch( 'core/interface' ).toggleFeature`, {
+ since: '6.0',
+ alternative: `dispatch( 'core/preferences' ).toggle`
+ });
+ registry.dispatch(external_wp_preferences_namespaceObject.store).toggle(scope, featureName);
+ };
+}
+
+/**
+ * Returns an action object used in signalling that a feature should be set to
+ * a true or false value
+ *
+ * @param {string} scope The feature scope (e.g. core/edit-post).
+ * @param {string} featureName The feature name.
+ * @param {boolean} value The value to set.
+ *
+ * @return {Object} Action object.
+ */
+function setFeatureValue(scope, featureName, value) {
+ return function ({
+ registry
+ }) {
+ external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureValue`, {
+ since: '6.0',
+ alternative: `dispatch( 'core/preferences' ).set`
+ });
+ registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, featureName, !!value);
+ };
+}
+
+/**
+ * Returns an action object used in signalling that defaults should be set for features.
+ *
+ * @param {string} scope The feature scope (e.g. core/edit-post).
+ * @param {Object<string, boolean>} defaults A key/value map of feature names to values.
+ *
+ * @return {Object} Action object.
+ */
+function setFeatureDefaults(scope, defaults) {
+ return function ({
+ registry
+ }) {
+ external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureDefaults`, {
+ since: '6.0',
+ alternative: `dispatch( 'core/preferences' ).setDefaults`
+ });
+ registry.dispatch(external_wp_preferences_namespaceObject.store).setDefaults(scope, defaults);
+ };
+}
+
+/**
+ * Returns an action object used in signalling that the user opened a modal.
+ *
+ * @param {string} name A string that uniquely identifies the modal.
+ *
+ * @return {Object} Action object.
+ */
+function openModal(name) {
+ return {
+ type: 'OPEN_MODAL',
+ name
+ };
+}
+
+/**
+ * Returns an action object signalling that the user closed a modal.
+ *
+ * @return {Object} Action object.
+ */
+function closeModal() {
+ return {
+ type: 'CLOSE_MODAL'
+ };
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/selectors.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+/**
+ * Returns the complementary area that is active in a given scope.
+ *
+ * @param {Object} state Global application state.
+ * @param {string} scope Item scope.
+ *
+ * @return {string | null | undefined} The complementary area that is active in the given scope.
+ */
+const getActiveComplementaryArea = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => {
+ scope = normalizeComplementaryAreaScope(scope);
+ const isComplementaryAreaVisible = select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible');
+
+ // Return `undefined` to indicate that the user has never toggled
+ // visibility, this is the vanilla default. Other code relies on this
+ // nuance in the return value.
+ if (isComplementaryAreaVisible === undefined) {
+ return undefined;
+ }
+
+ // Return `null` to indicate the user hid the complementary area.
+ if (isComplementaryAreaVisible === false) {
+ return null;
+ }
+ return state?.complementaryAreas?.[scope];
+});
+const isComplementaryAreaLoading = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => {
+ scope = normalizeComplementaryAreaScope(scope);
+ const isVisible = select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible');
+ const identifier = state?.complementaryAreas?.[scope];
+ return isVisible && identifier === undefined;
+});
+
+/**
+ * Returns a boolean indicating if an item is pinned or not.
+ *
+ * @param {Object} state Global application state.
+ * @param {string} scope Scope.
+ * @param {string} item Item to check.
+ *
+ * @return {boolean} True if the item is pinned and false otherwise.
+ */
+const isItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, item) => {
+ var _pinnedItems$item;
+ scope = normalizeComplementaryAreaScope(scope);
+ item = normalizeComplementaryAreaName(scope, item);
+ const pinnedItems = select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems');
+ return (_pinnedItems$item = pinnedItems?.[item]) !== null && _pinnedItems$item !== void 0 ? _pinnedItems$item : true;
+});
+
+/**
+ * Returns a boolean indicating whether a feature is active for a particular
+ * scope.
+ *
+ * @param {Object} state The store state.
+ * @param {string} scope The scope of the feature (e.g. core/edit-post).
+ * @param {string} featureName The name of the feature.
+ *
+ * @return {boolean} Is the feature enabled?
+ */
+const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, featureName) => {
+ external_wp_deprecated_default()(`select( 'core/interface' ).isFeatureActive( scope, featureName )`, {
+ since: '6.0',
+ alternative: `select( 'core/preferences' ).get( scope, featureName )`
+ });
+ return !!select(external_wp_preferences_namespaceObject.store).get(scope, featureName);
+});
+
+/**
+ * Returns true if a modal is active, or false otherwise.
+ *
+ * @param {Object} state Global application state.
+ * @param {string} modalName A string that uniquely identifies the modal.
+ *
+ * @return {boolean} Whether the modal is active.
+ */
+function isModalActive(state, modalName) {
+ return state.activeModal === modalName;
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/reducer.js
+/**
+ * WordPress dependencies
+ */
+
+function complementaryAreas(state = {}, action) {
+ switch (action.type) {
+ case 'SET_DEFAULT_COMPLEMENTARY_AREA':
+ {
+ const {
+ scope,
+ area
+ } = action;
+
+ // If there's already an area, don't overwrite it.
+ if (state[scope]) {
+ return state;
+ }
+ return {
+ ...state,
+ [scope]: area
+ };
+ }
+ case 'ENABLE_COMPLEMENTARY_AREA':
+ {
+ const {
+ scope,
+ area
+ } = action;
+ return {
+ ...state,
+ [scope]: area
+ };
+ }
+ }
+ return state;
+}
+
+/**
+ * Reducer for storing the name of the open modal, or null if no modal is open.
+ *
+ * @param {Object} state Previous state.
+ * @param {Object} action Action object containing the `name` of the modal
+ *
+ * @return {Object} Updated state
+ */
+function activeModal(state = null, action) {
+ switch (action.type) {
+ case 'OPEN_MODAL':
+ return action.name;
+ case 'CLOSE_MODAL':
+ return null;
+ }
+ return state;
+}
+/* harmony default export */ const store_reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
+ complementaryAreas,
+ activeModal
+}));
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/constants.js
+/**
+ * The identifier for the data store.
+ *
+ * @type {string}
+ */
+const constants_STORE_NAME = 'core/interface';
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+/**
+ * Store definition for the interface namespace.
+ *
+ * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
+ *
+ * @type {Object}
+ */
+const store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, {
+ reducer: store_reducer,
+ actions: store_actions_namespaceObject,
+ selectors: store_selectors_namespaceObject
+});
+
+// Once we build a more generic persistence plugin that works across types of stores
+// we'd be able to replace this with a register call.
+(0,external_wp_data_namespaceObject.register)(store);
+
+;// CONCATENATED MODULE: external ["wp","plugins"]
+const external_wp_plugins_namespaceObject = window["wp"]["plugins"];
+;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-context/index.js
+/**
+ * WordPress dependencies
+ */
+
+/* harmony default export */ const complementary_area_context = ((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
+ return {
+ icon: ownProps.icon || context.icon,
+ identifier: ownProps.identifier || `${context.name}/${ownProps.name}`
+ };
+}));
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-toggle/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+function ComplementaryAreaToggle({
+ as = external_wp_components_namespaceObject.Button,
+ scope,
+ identifier,
+ icon,
+ selectedIcon,
+ name,
+ ...props
+}) {
+ const ComponentToUse = as;
+ const isSelected = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getActiveComplementaryArea(scope) === identifier, [identifier, scope]);
+ const {
+ enableComplementaryArea,
+ disableComplementaryArea
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComponentToUse, {
+ icon: selectedIcon && isSelected ? selectedIcon : icon,
+ "aria-controls": identifier.replace('/', ':'),
+ onClick: () => {
+ if (isSelected) {
+ disableComplementaryArea(scope);
+ } else {
+ enableComplementaryArea(scope, identifier);
+ }
+ },
+ ...props
+ });
+}
+/* harmony default export */ const complementary_area_toggle = (complementary_area_context(ComplementaryAreaToggle));
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-header/index.js
+/**
+ * External dependencies
+ */
+
+
+/**
+ * WordPress dependencies
+ */
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+const ComplementaryAreaHeader = ({
+ smallScreenTitle,
+ children,
+ className,
+ toggleButtonProps
+}) => {
+ const toggleButton = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area_toggle, {
+ icon: close_small,
+ ...toggleButtonProps
+ });
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "components-panel__header interface-complementary-area-header__small",
+ children: [smallScreenTitle && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", {
+ className: "interface-complementary-area-header__small-title",
+ children: smallScreenTitle
+ }), toggleButton]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: dist_clsx('components-panel__header', 'interface-complementary-area-header', className),
+ tabIndex: -1,
+ children: [children, toggleButton]
+ })]
+ });
+};
+/* harmony default export */ const complementary_area_header = (ComplementaryAreaHeader);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/action-item/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+const noop = () => {};
+function ActionItemSlot({
+ name,
+ as: Component = external_wp_components_namespaceObject.ButtonGroup,
+ fillProps = {},
+ bubblesVirtually,
+ ...props
+}) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, {
+ name: name,
+ bubblesVirtually: bubblesVirtually,
+ fillProps: fillProps,
+ children: fills => {
+ if (!external_wp_element_namespaceObject.Children.toArray(fills).length) {
+ return null;
+ }
+
+ // Special handling exists for backward compatibility.
+ // It ensures that menu items created by plugin authors aren't
+ // duplicated with automatically injected menu items coming
+ // from pinnable plugin sidebars.
+ // @see https://github.com/WordPress/gutenberg/issues/14457
+ const initializedByPlugins = [];
+ external_wp_element_namespaceObject.Children.forEach(fills, ({
+ props: {
+ __unstableExplicitMenuItem,
+ __unstableTarget
+ }
+ }) => {
+ if (__unstableTarget && __unstableExplicitMenuItem) {
+ initializedByPlugins.push(__unstableTarget);
+ }
+ });
+ const children = external_wp_element_namespaceObject.Children.map(fills, child => {
+ if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(child.props.__unstableTarget)) {
+ return null;
+ }
+ return child;
+ });
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, {
+ ...props,
+ children: children
+ });
+ }
+ });
+}
+function ActionItem({
+ name,
+ as: Component = external_wp_components_namespaceObject.Button,
+ onClick,
+ ...props
+}) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, {
+ name: name,
+ children: ({
+ onClick: fpOnClick
+ }) => {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, {
+ onClick: onClick || fpOnClick ? (...args) => {
+ (onClick || noop)(...args);
+ (fpOnClick || noop)(...args);
+ } : undefined,
+ ...props
+ });
+ }
+ });
+}
+ActionItem.Slot = ActionItemSlot;
+/* harmony default export */ const action_item = (ActionItem);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-more-menu-item/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+const PluginsMenuItem = ({
+ // Menu item is marked with unstable prop for backward compatibility.
+ // They are removed so they don't leak to DOM elements.
+ // @see https://github.com/WordPress/gutenberg/issues/14457
+ __unstableExplicitMenuItem,
+ __unstableTarget,
+ ...restProps
+}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ ...restProps
+});
+function ComplementaryAreaMoreMenuItem({
+ scope,
+ target,
+ __unstableExplicitMenuItem,
+ ...props
+}) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area_toggle, {
+ as: toggleProps => {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(action_item, {
+ __unstableExplicitMenuItem: __unstableExplicitMenuItem,
+ __unstableTarget: `${scope}/${target}`,
+ as: PluginsMenuItem,
+ name: `${scope}/plugin-more-menu`,
+ ...toggleProps
+ });
+ },
+ role: "menuitemcheckbox",
+ selectedIcon: library_check,
+ name: target,
+ scope: scope,
+ ...props
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/pinned-items/index.js
+/**
+ * External dependencies
+ */
+
+
+/**
+ * WordPress dependencies
+ */
+
+
+function PinnedItems({
+ scope,
+ ...props
+}) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, {
+ name: `PinnedItems/${scope}`,
+ ...props
+ });
+}
+function PinnedItemsSlot({
+ scope,
+ className,
+ ...props
+}) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, {
+ name: `PinnedItems/${scope}`,
+ ...props,
+ children: fills => fills?.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: dist_clsx(className, 'interface-pinned-items'),
+ children: fills
+ })
+ });
+}
+PinnedItems.Slot = PinnedItemsSlot;
+/* harmony default export */ const pinned_items = (PinnedItems);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area/index.js
+/**
+ * External dependencies
+ */
+
+
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+
+
+
+
+const ANIMATION_DURATION = 0.3;
+function ComplementaryAreaSlot({
+ scope,
+ ...props
+}) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, {
+ name: `ComplementaryArea/${scope}`,
+ ...props
+ });
+}
+const SIDEBAR_WIDTH = 280;
+const variants = {
+ open: {
+ width: SIDEBAR_WIDTH
+ },
+ closed: {
+ width: 0
+ },
+ mobileOpen: {
+ width: '100vw'
+ }
+};
+function ComplementaryAreaFill({
+ activeArea,
+ isActive,
+ scope,
+ children,
+ className,
+ id
+}) {
+ const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
+ const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
+ // This is used to delay the exit animation to the next tick.
+ // The reason this is done is to allow us to apply the right transition properties
+ // When we switch from an open sidebar to another open sidebar.
+ // we don't want to animate in this case.
+ const previousActiveArea = (0,external_wp_compose_namespaceObject.usePrevious)(activeArea);
+ const previousIsActive = (0,external_wp_compose_namespaceObject.usePrevious)(isActive);
+ const [, setState] = (0,external_wp_element_namespaceObject.useState)({});
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
+ setState({});
+ }, [isActive]);
+ const transition = {
+ type: 'tween',
+ duration: disableMotion || isMobileViewport || !!previousActiveArea && !!activeArea && activeArea !== previousActiveArea ? 0 : ANIMATION_DURATION,
+ ease: [0.6, 0, 0.4, 1]
+ };
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, {
+ name: `ComplementaryArea/${scope}`,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, {
+ initial: false,
+ children: (previousIsActive || isActive) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, {
+ variants: variants,
+ initial: "closed",
+ animate: isMobileViewport ? 'mobileOpen' : 'open',
+ exit: "closed",
+ transition: transition,
+ className: "interface-complementary-area__fill",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ id: id,
+ className: className,
+ style: {
+ width: isMobileViewport ? '100vw' : SIDEBAR_WIDTH
+ },
+ children: children
+ })
+ })
+ })
+ });
+}
+function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) {
+ const previousIsSmall = (0,external_wp_element_namespaceObject.useRef)(false);
+ const shouldOpenWhenNotSmall = (0,external_wp_element_namespaceObject.useRef)(false);
+ const {
+ enableComplementaryArea,
+ disableComplementaryArea
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
+ // If the complementary area is active and the editor is switching from
+ // a big to a small window size.
+ if (isActive && isSmall && !previousIsSmall.current) {
+ disableComplementaryArea(scope);
+ // Flag the complementary area to be reopened when the window size
+ // goes from small to big.
+ shouldOpenWhenNotSmall.current = true;
+ } else if (
+ // If there is a flag indicating the complementary area should be
+ // enabled when we go from small to big window size and we are going
+ // from a small to big window size.
+ shouldOpenWhenNotSmall.current && !isSmall && previousIsSmall.current) {
+ // Remove the flag indicating the complementary area should be
+ // enabled.
+ shouldOpenWhenNotSmall.current = false;
+ enableComplementaryArea(scope, identifier);
+ } else if (
+ // If the flag is indicating the current complementary should be
+ // reopened but another complementary area becomes active, remove
+ // the flag.
+ shouldOpenWhenNotSmall.current && activeArea && activeArea !== identifier) {
+ shouldOpenWhenNotSmall.current = false;
+ }
+ if (isSmall !== previousIsSmall.current) {
+ previousIsSmall.current = isSmall;
+ }
+ }, [isActive, isSmall, scope, identifier, activeArea, disableComplementaryArea, enableComplementaryArea]);
+}
+function ComplementaryArea({
+ children,
+ className,
+ closeLabel = (0,external_wp_i18n_namespaceObject.__)('Close plugin'),
+ identifier,
+ header,
+ headerClassName,
+ icon,
+ isPinnable = true,
+ panelClassName,
+ scope,
+ name,
+ smallScreenTitle,
+ title,
+ toggleShortcut,
+ isActiveByDefault
+}) {
+ // This state is used to delay the rendering of the Fill
+ // until the initial effect runs.
+ // This prevents the animation from running on mount if
+ // the complementary area is active by default.
+ const [isReady, setIsReady] = (0,external_wp_element_namespaceObject.useState)(false);
+ const {
+ isLoading,
+ isActive,
+ isPinned,
+ activeArea,
+ isSmall,
+ isLarge,
+ showIconLabels
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getActiveComplementaryArea,
+ isComplementaryAreaLoading,
+ isItemPinned
+ } = select(store);
+ const {
+ get
+ } = select(external_wp_preferences_namespaceObject.store);
+ const _activeArea = getActiveComplementaryArea(scope);
+ return {
+ isLoading: isComplementaryAreaLoading(scope),
+ isActive: _activeArea === identifier,
+ isPinned: isItemPinned(scope, identifier),
+ activeArea: _activeArea,
+ isSmall: select(external_wp_viewport_namespaceObject.store).isViewportMatch('< medium'),
+ isLarge: select(external_wp_viewport_namespaceObject.store).isViewportMatch('large'),
+ showIconLabels: get('core', 'showIconLabels')
+ };
+ }, [identifier, scope]);
+ useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall);
+ const {
+ enableComplementaryArea,
+ disableComplementaryArea,
+ pinItem,
+ unpinItem
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
+ // Set initial visibility: For large screens, enable if it's active by
+ // default. For small screens, always initially disable.
+ if (isActiveByDefault && activeArea === undefined && !isSmall) {
+ enableComplementaryArea(scope, identifier);
+ } else if (activeArea === undefined && isSmall) {
+ disableComplementaryArea(scope, identifier);
+ }
+ setIsReady(true);
+ }, [activeArea, isActiveByDefault, scope, identifier, isSmall, enableComplementaryArea, disableComplementaryArea]);
+ if (!isReady) {
+ return;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [isPinnable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(pinned_items, {
+ scope: scope,
+ children: isPinned && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area_toggle, {
+ scope: scope,
+ identifier: identifier,
+ isPressed: isActive && (!showIconLabels || isLarge),
+ "aria-expanded": isActive,
+ "aria-disabled": isLoading,
+ label: title,
+ icon: showIconLabels ? library_check : icon,
+ showTooltip: !showIconLabels,
+ variant: showIconLabels ? 'tertiary' : undefined,
+ size: "compact"
+ })
+ }), name && isPinnable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryAreaMoreMenuItem, {
+ target: name,
+ scope: scope,
+ icon: icon,
+ children: title
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ComplementaryAreaFill, {
+ activeArea: activeArea,
+ isActive: isActive,
+ className: dist_clsx('interface-complementary-area', className),
+ scope: scope,
+ id: identifier.replace('/', ':'),
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area_header, {
+ className: headerClassName,
+ closeLabel: closeLabel,
+ onClose: () => disableComplementaryArea(scope),
+ smallScreenTitle: smallScreenTitle,
+ toggleButtonProps: {
+ label: closeLabel,
+ size: 'small',
+ shortcut: toggleShortcut,
+ scope,
+ identifier
+ },
+ children: header || /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", {
+ className: "interface-complementary-area-header__title",
+ children: title
+ }), isPinnable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ className: "interface-complementary-area__pin-unpin-item",
+ icon: isPinned ? star_filled : star_empty,
+ label: isPinned ? (0,external_wp_i18n_namespaceObject.__)('Unpin from toolbar') : (0,external_wp_i18n_namespaceObject.__)('Pin to toolbar'),
+ onClick: () => (isPinned ? unpinItem : pinItem)(scope, identifier),
+ isPressed: isPinned,
+ "aria-expanded": isPinned,
+ size: "compact"
+ })]
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Panel, {
+ className: panelClassName,
+ children: children
+ })]
+ })]
+ });
+}
+const ComplementaryAreaWrapped = complementary_area_context(ComplementaryArea);
+ComplementaryAreaWrapped.Slot = ComplementaryAreaSlot;
+/* harmony default export */ const complementary_area = (ComplementaryAreaWrapped);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/fullscreen-mode/index.js
+/**
+ * WordPress dependencies
+ */
+
+const FullscreenMode = ({
+ isActive
+}) => {
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
+ let isSticky = false;
+ // `is-fullscreen-mode` is set in PHP as a body class by Gutenberg, and this causes
+ // `sticky-menu` to be applied by WordPress and prevents the admin menu being scrolled
+ // even if `is-fullscreen-mode` is then removed. Let's remove `sticky-menu` here as
+ // a consequence of the FullscreenMode setup.
+ if (document.body.classList.contains('sticky-menu')) {
+ isSticky = true;
+ document.body.classList.remove('sticky-menu');
+ }
+ return () => {
+ if (isSticky) {
+ document.body.classList.add('sticky-menu');
+ }
+ };
+ }, []);
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
+ if (isActive) {
+ document.body.classList.add('is-fullscreen-mode');
+ } else {
+ document.body.classList.remove('is-fullscreen-mode');
+ }
+ return () => {
+ if (isActive) {
+ document.body.classList.remove('is-fullscreen-mode');
+ }
+ };
+ }, [isActive]);
+ return null;
+};
+/* harmony default export */ const fullscreen_mode = (FullscreenMode);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/navigable-region/index.js
+/**
+ * External dependencies
+ */
+
+
+function NavigableRegion({
+ children,
+ className,
+ ariaLabel,
+ as: Tag = 'div',
+ ...props
+}) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tag, {
+ className: dist_clsx('interface-navigable-region', className),
+ "aria-label": ariaLabel,
+ role: "region",
+ tabIndex: "-1",
+ ...props,
+ children: children
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/interface-skeleton/index.js
+/**
+ * External dependencies
+ */
+
+
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+const interface_skeleton_ANIMATION_DURATION = 0.25;
+const commonTransition = {
+ type: 'tween',
+ duration: interface_skeleton_ANIMATION_DURATION,
+ ease: [0.6, 0, 0.4, 1]
+};
+function useHTMLClass(className) {
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
+ const element = document && document.querySelector(`html:not(.${className})`);
+ if (!element) {
+ return;
+ }
+ element.classList.toggle(className);
+ return () => {
+ element.classList.toggle(className);
+ };
+ }, [className]);
+}
+const headerVariants = {
+ hidden: {
+ opacity: 1,
+ marginTop: -60
+ },
+ visible: {
+ opacity: 1,
+ marginTop: 0
+ },
+ distractionFreeHover: {
+ opacity: 1,
+ marginTop: 0,
+ transition: {
+ ...commonTransition,
+ delay: 0.2,
+ delayChildren: 0.2
+ }
+ },
+ distractionFreeHidden: {
+ opacity: 0,
+ marginTop: -60
+ },
+ distractionFreeDisabled: {
+ opacity: 0,
+ marginTop: 0,
+ transition: {
+ ...commonTransition,
+ delay: 0.8,
+ delayChildren: 0.8
+ }
+ }
+};
+function InterfaceSkeleton({
+ isDistractionFree,
+ footer,
+ header,
+ editorNotices,
+ sidebar,
+ secondarySidebar,
+ content,
+ actions,
+ labels,
+ className,
+ enableRegionNavigation = true,
+ // Todo: does this need to be a prop.
+ // Can we use a dependency to keyboard-shortcuts directly?
+ shortcuts
+}, ref) {
+ const [secondarySidebarResizeListener, secondarySidebarSize] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
+ const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
+ const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
+ const defaultTransition = {
+ type: 'tween',
+ duration: disableMotion ? 0 : interface_skeleton_ANIMATION_DURATION,
+ ease: [0.6, 0, 0.4, 1]
+ };
+ const navigateRegionsProps = (0,external_wp_components_namespaceObject.__unstableUseNavigateRegions)(shortcuts);
+ useHTMLClass('interface-interface-skeleton__html-container');
+ const defaultLabels = {
+ /* translators: accessibility text for the top bar landmark region. */
+ header: (0,external_wp_i18n_namespaceObject._x)('Header', 'header landmark area'),
+ /* translators: accessibility text for the content landmark region. */
+ body: (0,external_wp_i18n_namespaceObject.__)('Content'),
+ /* translators: accessibility text for the secondary sidebar landmark region. */
+ secondarySidebar: (0,external_wp_i18n_namespaceObject.__)('Block Library'),
+ /* translators: accessibility text for the settings landmark region. */
+ sidebar: (0,external_wp_i18n_namespaceObject.__)('Settings'),
+ /* translators: accessibility text for the publish landmark region. */
+ actions: (0,external_wp_i18n_namespaceObject.__)('Publish'),
+ /* translators: accessibility text for the footer landmark region. */
+ footer: (0,external_wp_i18n_namespaceObject.__)('Footer')
+ };
+ const mergedLabels = {
+ ...defaultLabels,
+ ...labels
+ };
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ ...(enableRegionNavigation ? navigateRegionsProps : {}),
+ ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, enableRegionNavigation ? navigateRegionsProps.ref : undefined]),
+ className: dist_clsx(className, 'interface-interface-skeleton', navigateRegionsProps.className, !!footer && 'has-footer'),
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "interface-interface-skeleton__editor",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, {
+ initial: false,
+ children: !!header && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigableRegion, {
+ as: external_wp_components_namespaceObject.__unstableMotion.div,
+ className: "interface-interface-skeleton__header",
+ "aria-label": mergedLabels.header,
+ initial: isDistractionFree ? 'distractionFreeHidden' : 'hidden',
+ whileHover: isDistractionFree ? 'distractionFreeHover' : 'visible',
+ animate: isDistractionFree ? 'distractionFreeDisabled' : 'visible',
+ exit: isDistractionFree ? 'distractionFreeHidden' : 'hidden',
+ variants: headerVariants,
+ transition: defaultTransition,
+ children: header
+ })
+ }), isDistractionFree && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "interface-interface-skeleton__header",
+ children: editorNotices
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "interface-interface-skeleton__body",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, {
+ initial: false,
+ children: !!secondarySidebar && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigableRegion, {
+ className: "interface-interface-skeleton__secondary-sidebar",
+ ariaLabel: mergedLabels.secondarySidebar,
+ as: external_wp_components_namespaceObject.__unstableMotion.div,
+ initial: "closed",
+ animate: isMobileViewport ? 'mobileOpen' : 'open',
+ exit: "closed",
+ variants: {
+ open: {
+ width: secondarySidebarSize.width
+ },
+ closed: {
+ width: 0
+ },
+ mobileOpen: {
+ width: '100vw'
+ }
+ },
+ transition: defaultTransition,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ style: {
+ position: 'absolute',
+ width: isMobileViewport ? '100vw' : 'fit-content',
+ height: '100%',
+ right: 0
+ },
+ children: [secondarySidebarResizeListener, secondarySidebar]
+ })
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigableRegion, {
+ className: "interface-interface-skeleton__content",
+ ariaLabel: mergedLabels.body,
+ children: content
+ }), !!sidebar && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigableRegion, {
+ className: "interface-interface-skeleton__sidebar",
+ ariaLabel: mergedLabels.sidebar,
+ children: sidebar
+ }), !!actions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigableRegion, {
+ className: "interface-interface-skeleton__actions",
+ ariaLabel: mergedLabels.actions,
+ children: actions
+ })]
+ })]
+ }), !!footer && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigableRegion, {
+ className: "interface-interface-skeleton__footer",
+ ariaLabel: mergedLabels.footer,
+ children: footer
+ })]
+ });
+}
+/* harmony default export */ const interface_skeleton = ((0,external_wp_element_namespaceObject.forwardRef)(InterfaceSkeleton));
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/index.js
+
+
+
+
+
+
+
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/index.js
+
+
+
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/index.js
/**
* WordPress dependencies
@@ -5579,22 +7723,60 @@ const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShor
+
+
/**
* Internal dependencies
*/
+
+/**
+ * Component handles the keyboard shortcuts for the editor.
+ *
+ * It provides functionality for various keyboard shortcuts such as toggling editor mode,
+ * toggling distraction-free mode, undo/redo, saving the post, toggling list view,
+ * and toggling the sidebar.
+ */
function EditorKeyboardShortcuts() {
+ const isModeToggleDisabled = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ richEditingEnabled,
+ codeEditingEnabled
+ } = select(store_store).getEditorSettings();
+ return !richEditingEnabled || !codeEditingEnabled;
+ }, []);
+ const {
+ getBlockSelectionStart
+ } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
+ const {
+ getActiveComplementaryArea
+ } = (0,external_wp_data_namespaceObject.useSelect)(store);
+ const {
+ enableComplementaryArea,
+ disableComplementaryArea
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
const {
redo,
undo,
savePost,
- setIsListViewOpened
+ setIsListViewOpened,
+ switchEditorMode,
+ toggleDistractionFree
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
const {
isEditedPostDirty,
isPostSavingLocked,
- isListViewOpened
+ isListViewOpened,
+ getEditorMode
} = (0,external_wp_data_namespaceObject.useSelect)(store_store);
+ (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/toggle-mode', () => {
+ switchEditorMode(getEditorMode() === 'visual' ? 'text' : 'visual');
+ }, {
+ isDisabled: isModeToggleDisabled
+ });
+ (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/toggle-distraction-free', () => {
+ toggleDistractionFree();
+ });
(0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/undo', event => {
undo();
event.preventDefault();
@@ -5631,6 +7813,18 @@ function EditorKeyboardShortcuts() {
setIsListViewOpened(true);
}
});
+ (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/toggle-sidebar', event => {
+ // This shortcut has no known clashes, but use preventDefault to prevent any
+ // obscure shortcuts from triggering.
+ event.preventDefault();
+ const isEditorSidebarOpened = ['edit-post/document', 'edit-post/block'].includes(getActiveComplementaryArea('core'));
+ if (isEditorSidebarOpened) {
+ disableComplementaryArea('core');
+ } else {
+ const sidebarToOpen = getBlockSelectionStart() ? 'edit-post/block' : 'edit-post/document';
+ enableComplementaryArea('core', sidebarToOpen);
+ }
+ });
return null;
}
@@ -5650,18 +7844,6 @@ function EditorKeyboardShortcuts() {
* Internal dependencies
*/
-
-/**
- * AutosaveMonitor invokes `props.autosave()` within at most `interval` seconds after an unsaved change is detected.
- *
- * The logic is straightforward: a check is performed every `props.interval` seconds. If any changes are detected, `props.autosave()` is called.
- * The time between the change and the autosave varies but is no larger than `props.interval` seconds. Refer to the code below for more details, such as
- * the specific way of detecting changes.
- *
- * There are two caveats:
- * * If `props.isAutosaveable` happens to be false at a time of checking for changes, the check is retried every second.
- * * The timer may be disabled by setting `props.disableIntervalChecks` to `true`. In that mode, any change will immediately trigger `props.autosave()`.
- */
class AutosaveMonitor extends external_wp_element_namespaceObject.Component {
constructor(props) {
super(props);
@@ -5718,6 +7900,30 @@ class AutosaveMonitor extends external_wp_element_namespaceObject.Component {
return null;
}
}
+
+/**
+ * Monitors the changes made to the edited post and triggers autosave if necessary.
+ *
+ * The logic is straightforward: a check is performed every `props.interval` seconds. If any changes are detected, `props.autosave()` is called.
+ * The time between the change and the autosave varies but is no larger than `props.interval` seconds. Refer to the code below for more details, such as
+ * the specific way of detecting changes.
+ *
+ * There are two caveats:
+ * * If `props.isAutosaveable` happens to be false at a time of checking for changes, the check is retried every second.
+ * * The timer may be disabled by setting `props.disableIntervalChecks` to `true`. In that mode, any change will immediately trigger `props.autosave()`.
+ *
+ * @param {Object} props - The properties passed to the component.
+ * @param {Function} props.autosave - The function to call when changes need to be saved.
+ * @param {number} props.interval - The maximum time in seconds between an unsaved change and an autosave.
+ * @param {boolean} props.isAutosaveable - If false, the check for changes is retried every second.
+ * @param {boolean} props.disableIntervalChecks - If true, disables the timer and any change will immediately trigger `props.autosave()`.
+ * @param {boolean} props.isDirty - Indicates if there are unsaved changes.
+ *
+ * @example
+ * ```jsx
+ * <AutosaveMonitor interval={30000} />
+ * ```
+ */
/* harmony default export */ const autosave_monitor = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, ownProps) => {
const {
getReferenceByDistinctEdits
@@ -5747,81 +7953,34 @@ class AutosaveMonitor extends external_wp_element_namespaceObject.Component {
}
}))])(AutosaveMonitor));
-// EXTERNAL MODULE: ./node_modules/classnames/index.js
-var classnames = __webpack_require__(5755);
-var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
-;// CONCATENATED MODULE: external ["wp","components"]
-const external_wp_components_namespaceObject = window["wp"]["components"];
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol.js
-
-/**
- * WordPress dependencies
- */
-
-const symbol = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z"
-}));
-/* harmony default export */ const library_symbol = (symbol);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/navigation.js
-
-/**
- * WordPress dependencies
- */
-
-const navigation = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/svg"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z"
-}));
-/* harmony default export */ const library_navigation = (navigation);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/page.js
-
-/**
- * WordPress dependencies
- */
-
-const page = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z"
-}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z"
-}));
-/* harmony default export */ const library_page = (page);
-
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right-small.js
-
/**
* WordPress dependencies
*/
-const chevronRightSmall = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+const chevronRightSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z"
-}));
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z"
+ })
+});
/* harmony default export */ const chevron_right_small = (chevronRightSmall);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left-small.js
-
/**
* WordPress dependencies
*/
-const chevronLeftSmall = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+const chevronLeftSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z"
-}));
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z"
+ })
+});
/* harmony default export */ const chevron_left_small = (chevronLeftSmall);
;// CONCATENATED MODULE: external ["wp","keycodes"]
@@ -5829,7 +7988,6 @@ const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"];
;// CONCATENATED MODULE: external ["wp","commands"]
const external_wp_commands_namespaceObject = window["wp"]["commands"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-bar/index.js
-
/**
* External dependencies
*/
@@ -5848,11 +8006,17 @@ const external_wp_commands_namespaceObject = window["wp"]["commands"];
+
+
/**
* Internal dependencies
*/
-const typeLabels = {
+
+
+
+
+const TYPE_LABELS = {
// translators: 1: Pattern title.
wp_pattern: (0,external_wp_i18n_namespaceObject.__)('Editing pattern: %s'),
// translators: 1: Navigation menu title.
@@ -5862,147 +8026,179 @@ const typeLabels = {
// translators: 1: Template part title.
wp_template_part: (0,external_wp_i18n_namespaceObject.__)('Editing template part: %s')
};
-const icons = {
- wp_block: library_symbol,
- wp_navigation: library_navigation
-};
+const MotionButton = (0,external_wp_components_namespaceObject.__unstableMotion)(external_wp_components_namespaceObject.Button);
+
+/**
+ * This component renders a navigation bar at the top of the editor. It displays the title of the current document,
+ * a back button (if applicable), and a command center button. It also handles different states of the document,
+ * such as "not found" or "unsynced".
+ *
+ * @example
+ * ```jsx
+ * <DocumentBar />
+ * ```
+ *
+ * @return {JSX.Element} The rendered DocumentBar component.
+ */
function DocumentBar() {
const {
postType,
- postId,
+ documentTitle,
+ isNotFound,
+ isUnsyncedPattern,
+ templateIcon,
+ templateTitle,
onNavigateToPreviousEntityRecord
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
- getCurrentPostId,
getCurrentPostType,
- getEditorSettings: getSettings
+ getCurrentPostId,
+ getEditorSettings,
+ __experimentalGetTemplateInfo: getTemplateInfo
} = select(store_store);
+ const {
+ getEditedEntityRecord,
+ isResolving: isResolvingSelector
+ } = select(external_wp_coreData_namespaceObject.store);
+ const _postType = getCurrentPostType();
+ const _postId = getCurrentPostId();
+ const _document = getEditedEntityRecord('postType', _postType, _postId);
+ const _templateInfo = getTemplateInfo(_document);
return {
- postType: getCurrentPostType(),
- postId: getCurrentPostId(),
- onNavigateToPreviousEntityRecord: getSettings().onNavigateToPreviousEntityRecord,
- getEditorSettings: getSettings
+ postType: _postType,
+ documentTitle: _document.title,
+ isNotFound: !_document && !isResolvingSelector('getEditedEntityRecord', 'postType', _postType, _postId),
+ isUnsyncedPattern: _document?.wp_pattern_sync_status === 'unsynced',
+ templateIcon: unlock(select(store_store)).getPostIcon(_postType, {
+ area: _document?.area
+ }),
+ templateTitle: _templateInfo.title,
+ onNavigateToPreviousEntityRecord: getEditorSettings().onNavigateToPreviousEntityRecord
};
}, []);
- const handleOnBack = () => {
- if (onNavigateToPreviousEntityRecord) {
- onNavigateToPreviousEntityRecord();
- }
- };
- return (0,external_React_.createElement)(BaseDocumentActions, {
- postType: postType,
- postId: postId,
- onBack: onNavigateToPreviousEntityRecord ? handleOnBack : undefined
- });
-}
-function BaseDocumentActions({
- postType,
- postId,
- onBack
-}) {
- var _icons$postType;
const {
open: openCommandCenter
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_commands_namespaceObject.store);
- const {
- editedRecord: doc,
- isResolving
- } = (0,external_wp_coreData_namespaceObject.useEntityRecord)('postType', postType, postId);
- const {
- templateIcon,
- templateTitle
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- __experimentalGetTemplateInfo: getTemplateInfo
- } = select(store_store);
- const templateInfo = getTemplateInfo(doc);
- return {
- templateIcon: templateInfo.icon,
- templateTitle: templateInfo.title
- };
- });
- const isNotFound = !doc && !isResolving;
- const icon = (_icons$postType = icons[postType]) !== null && _icons$postType !== void 0 ? _icons$postType : library_page;
- const [isAnimated, setIsAnimated] = (0,external_wp_element_namespaceObject.useState)(false);
- const isMounting = (0,external_wp_element_namespaceObject.useRef)(true);
- const isTemplate = ['wp_template', 'wp_template_part'].includes(postType);
- const isGlobalEntity = ['wp_template', 'wp_navigation', 'wp_template_part', 'wp_block'].includes(postType);
+ const isReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
+ const isTemplate = TEMPLATE_POST_TYPES.includes(postType);
+ const isGlobalEntity = GLOBAL_POST_TYPES.includes(postType);
+ const hasBackButton = !!onNavigateToPreviousEntityRecord;
+ const title = isTemplate ? templateTitle : documentTitle;
+ const mounted = (0,external_wp_element_namespaceObject.useRef)(false);
(0,external_wp_element_namespaceObject.useEffect)(() => {
- if (!isMounting.current) {
- setIsAnimated(true);
- }
- isMounting.current = false;
- }, [postType, postId]);
- const title = isTemplate ? templateTitle : doc.title;
- return (0,external_React_.createElement)("div", {
- className: classnames_default()('editor-document-bar', {
- 'has-back-button': !!onBack,
- 'is-animated': isAnimated,
- 'is-global': isGlobalEntity
- })
- }, onBack && (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- className: "editor-document-bar__back",
- icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_small : chevron_left_small,
- onClick: event => {
- event.stopPropagation();
- onBack();
- },
- size: "compact"
- }, (0,external_wp_i18n_namespaceObject.__)('Back')), isNotFound && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, null, (0,external_wp_i18n_namespaceObject.__)('Document not found')), !isNotFound && (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- className: "editor-document-bar__command",
- onClick: () => openCommandCenter(),
- size: "compact"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- className: "editor-document-bar__title",
- spacing: 1,
- justify: "center"
- }, (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, {
- icon: isTemplate ? templateIcon : icon
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- size: "body",
- as: "h1",
- "aria-label": typeLabels[postType] ?
- // eslint-disable-next-line @wordpress/valid-sprintf
- (0,external_wp_i18n_namespaceObject.sprintf)(typeLabels[postType], title) : undefined
- }, title)), (0,external_React_.createElement)("span", {
- className: "editor-document-bar__shortcut"
- }, external_wp_keycodes_namespaceObject.displayShortcut.primary('k'))));
+ mounted.current = true;
+ }, []);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: dist_clsx('editor-document-bar', {
+ 'has-back-button': hasBackButton,
+ 'is-global': isGlobalEntity && !isUnsyncedPattern
+ }),
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, {
+ children: hasBackButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MotionButton, {
+ className: "editor-document-bar__back",
+ icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_small : chevron_left_small,
+ onClick: event => {
+ event.stopPropagation();
+ onNavigateToPreviousEntityRecord();
+ },
+ size: "compact",
+ initial: mounted.current ? {
+ opacity: 0,
+ transform: 'translateX(15%)'
+ } : false // Don't show entry animation when DocumentBar mounts.
+ ,
+ animate: {
+ opacity: 1,
+ transform: 'translateX(0%)'
+ },
+ exit: {
+ opacity: 0,
+ transform: 'translateX(15%)'
+ },
+ transition: isReducedMotion ? {
+ duration: 0
+ } : undefined,
+ children: (0,external_wp_i18n_namespaceObject.__)('Back')
+ })
+ }), isNotFound ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ children: (0,external_wp_i18n_namespaceObject.__)('Document not found')
+ }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Button, {
+ className: "editor-document-bar__command",
+ onClick: () => openCommandCenter(),
+ size: "compact",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, {
+ className: "editor-document-bar__title"
+ // Force entry animation when the back button is added or removed.
+ ,
+
+ initial: mounted.current ? {
+ opacity: 0,
+ transform: hasBackButton ? 'translateX(15%)' : 'translateX(-15%)'
+ } : false // Don't show entry animation when DocumentBar mounts.
+ ,
+ animate: {
+ opacity: 1,
+ transform: 'translateX(0%)'
+ },
+ transition: isReducedMotion ? {
+ duration: 0
+ } : undefined,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, {
+ icon: templateIcon
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ size: "body",
+ as: "h1",
+ "aria-label": TYPE_LABELS[postType] ?
+ // eslint-disable-next-line @wordpress/valid-sprintf
+ (0,external_wp_i18n_namespaceObject.sprintf)(TYPE_LABELS[postType], title) : undefined,
+ children: title ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title) : (0,external_wp_i18n_namespaceObject.__)('No Title')
+ })]
+ }, hasBackButton), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "editor-document-bar__shortcut",
+ children: external_wp_keycodes_namespaceObject.displayShortcut.primary('k')
+ })]
+ })]
+ });
}
;// CONCATENATED MODULE: external ["wp","richText"]
const external_wp_richText_namespaceObject = window["wp"]["richText"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/item.js
-
/**
* External dependencies
*/
+
+
const TableOfContentsItem = ({
children,
isValid,
level,
href,
onSelect
-}) => (0,external_React_.createElement)("li", {
- className: classnames_default()('document-outline__item', `is-${level.toLowerCase()}`, {
+}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", {
+ className: dist_clsx('document-outline__item', `is-${level.toLowerCase()}`, {
'is-invalid': !isValid
+ }),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("a", {
+ href: href,
+ className: "document-outline__button",
+ onClick: onSelect,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "document-outline__emdash",
+ "aria-hidden": "true"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", {
+ className: "document-outline__level",
+ children: level
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "document-outline__item-content",
+ children: children
+ })]
})
-}, (0,external_React_.createElement)("a", {
- href: href,
- className: "document-outline__button",
- onClick: onSelect
-}, (0,external_React_.createElement)("span", {
- className: "document-outline__emdash",
- "aria-hidden": "true"
-}), (0,external_React_.createElement)("strong", {
- className: "document-outline__level"
-}, level), (0,external_React_.createElement)("span", {
- className: "document-outline__item-content"
-}, children)));
+});
/* harmony default export */ const document_outline_item = (TableOfContentsItem);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/index.js
-
/**
* WordPress dependencies
*/
@@ -6013,7 +8209,6 @@ const TableOfContentsItem = ({
-
/**
* Internal dependencies
*/
@@ -6023,99 +8218,98 @@ const TableOfContentsItem = ({
/**
* Module constants
*/
-const emptyHeadingContent = (0,external_React_.createElement)("em", null, (0,external_wp_i18n_namespaceObject.__)('(Empty heading)'));
-const incorrectLevelContent = [(0,external_React_.createElement)("br", {
- key: "incorrect-break"
-}), (0,external_React_.createElement)("em", {
- key: "incorrect-message"
-}, (0,external_wp_i18n_namespaceObject.__)('(Incorrect heading level)'))];
-const singleH1Headings = [(0,external_React_.createElement)("br", {
- key: "incorrect-break-h1"
-}), (0,external_React_.createElement)("em", {
- key: "incorrect-message-h1"
-}, (0,external_wp_i18n_namespaceObject.__)('(Your theme may already use a H1 for the post title)'))];
-const multipleH1Headings = [(0,external_React_.createElement)("br", {
- key: "incorrect-break-multiple-h1"
-}), (0,external_React_.createElement)("em", {
- key: "incorrect-message-multiple-h1"
-}, (0,external_wp_i18n_namespaceObject.__)('(Multiple H1 headings are not recommended)'))];
+
+
+const emptyHeadingContent = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("em", {
+ children: (0,external_wp_i18n_namespaceObject.__)('(Empty heading)')
+});
+const incorrectLevelContent = [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}, "incorrect-break"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("em", {
+ children: (0,external_wp_i18n_namespaceObject.__)('(Incorrect heading level)')
+}, "incorrect-message")];
+const singleH1Headings = [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}, "incorrect-break-h1"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("em", {
+ children: (0,external_wp_i18n_namespaceObject.__)('(Your theme may already use a H1 for the post title)')
+}, "incorrect-message-h1")];
+const multipleH1Headings = [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}, "incorrect-break-multiple-h1"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("em", {
+ children: (0,external_wp_i18n_namespaceObject.__)('(Multiple H1 headings are not recommended)')
+}, "incorrect-message-multiple-h1")];
function EmptyOutlineIllustration() {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.SVG, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.SVG, {
width: "138",
height: "148",
viewBox: "0 0 138 148",
fill: "none",
- xmlns: "http://www.w3.org/2000/svg"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Rect, {
- width: "138",
- height: "148",
- rx: "4",
- fill: "#F0F6FC"
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Line, {
- x1: "44",
- y1: "28",
- x2: "24",
- y2: "28",
- stroke: "#DDDDDD"
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Rect, {
- x: "48",
- y: "16",
- width: "27",
- height: "23",
- rx: "4",
- fill: "#DDDDDD"
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Path, {
- d: "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",
- fill: "black"
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Line, {
- x1: "55",
- y1: "59",
- x2: "24",
- y2: "59",
- stroke: "#DDDDDD"
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Rect, {
- x: "59",
- y: "47",
- width: "29",
- height: "23",
- rx: "4",
- fill: "#DDDDDD"
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Path, {
- d: "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",
- fill: "black"
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Line, {
- x1: "80",
- y1: "90",
- x2: "24",
- y2: "90",
- stroke: "#DDDDDD"
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Rect, {
- x: "84",
- y: "78",
- width: "30",
- height: "23",
- rx: "4",
- fill: "#F0B849"
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Path, {
- d: "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",
- fill: "black"
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Line, {
- x1: "66",
- y1: "121",
- x2: "24",
- y2: "121",
- stroke: "#DDDDDD"
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Rect, {
- x: "70",
- y: "109",
- width: "29",
- height: "23",
- rx: "4",
- fill: "#DDDDDD"
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Path, {
- d: "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",
- fill: "black"
- }));
+ xmlns: "http://www.w3.org/2000/svg",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, {
+ width: "138",
+ height: "148",
+ rx: "4",
+ fill: "#F0F6FC"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, {
+ x1: "44",
+ y1: "28",
+ x2: "24",
+ y2: "28",
+ stroke: "#DDDDDD"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, {
+ x: "48",
+ y: "16",
+ width: "27",
+ height: "23",
+ rx: "4",
+ fill: "#DDDDDD"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, {
+ d: "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",
+ fill: "black"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, {
+ x1: "55",
+ y1: "59",
+ x2: "24",
+ y2: "59",
+ stroke: "#DDDDDD"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, {
+ x: "59",
+ y: "47",
+ width: "29",
+ height: "23",
+ rx: "4",
+ fill: "#DDDDDD"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, {
+ d: "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",
+ fill: "black"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, {
+ x1: "80",
+ y1: "90",
+ x2: "24",
+ y2: "90",
+ stroke: "#DDDDDD"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, {
+ x: "84",
+ y: "78",
+ width: "30",
+ height: "23",
+ rx: "4",
+ fill: "#F0B849"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, {
+ d: "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",
+ fill: "black"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, {
+ x1: "66",
+ y1: "121",
+ x2: "24",
+ y2: "121",
+ stroke: "#DDDDDD"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, {
+ x: "70",
+ y: "109",
+ width: "29",
+ height: "23",
+ rx: "4",
+ fill: "#DDDDDD"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, {
+ d: "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",
+ fill: "black"
+ })]
+ });
}
/**
@@ -6139,22 +8333,55 @@ const computeOutlineHeadings = (blocks = []) => {
return computeOutlineHeadings(block.innerBlocks);
});
};
-const isEmptyHeading = heading => !heading.attributes.content || heading.attributes.content.length === 0;
-const DocumentOutline = ({
- blocks = [],
- title,
+const isEmptyHeading = heading => !heading.attributes.content || heading.attributes.content.trim().length === 0;
+
+/**
+ * Renders a document outline component.
+ *
+ * @param {Object} props Props.
+ * @param {Function} props.onSelect Function to be called when an outline item is selected.
+ * @param {boolean} props.isTitleSupported Indicates whether the title is supported.
+ * @param {boolean} props.hasOutlineItemsDisabled Indicates whether the outline items are disabled.
+ *
+ * @return {Component} The component to be rendered.
+ */
+function DocumentOutline({
onSelect,
isTitleSupported,
hasOutlineItemsDisabled
-}) => {
- const headings = computeOutlineHeadings(blocks);
+}) {
const {
selectBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
+ const {
+ blocks,
+ title
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ var _postType$supports$ti;
+ const {
+ getBlocks
+ } = select(external_wp_blockEditor_namespaceObject.store);
+ const {
+ getEditedPostAttribute
+ } = select(store_store);
+ const {
+ getPostType
+ } = select(external_wp_coreData_namespaceObject.store);
+ const postType = getPostType(getEditedPostAttribute('type'));
+ return {
+ title: getEditedPostAttribute('title'),
+ blocks: getBlocks(),
+ isTitleSupported: (_postType$supports$ti = postType?.supports?.title) !== null && _postType$supports$ti !== void 0 ? _postType$supports$ti : false
+ };
+ });
+ const headings = computeOutlineHeadings(blocks);
if (headings.length < 1) {
- return (0,external_React_.createElement)("div", {
- className: "editor-document-outline has-no-headings"
- }, (0,external_React_.createElement)(EmptyOutlineIllustration, null), (0,external_React_.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Navigate the structure of your document and address issues like empty or incorrect heading levels.')));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "editor-document-outline has-no-headings",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EmptyOutlineIllustration, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ children: (0,external_wp_i18n_namespaceObject.__)('Navigate the structure of your document and address issues like empty or incorrect heading levels.')
+ })]
+ });
}
let prevHeadingLevel = 1;
@@ -6166,53 +8393,39 @@ const DocumentOutline = ({
[heading.level]: (acc[heading.level] || 0) + 1
}), {});
const hasMultipleH1 = countByLevel[1] > 1;
- return (0,external_React_.createElement)("div", {
- className: "document-outline"
- }, (0,external_React_.createElement)("ul", null, hasTitle && (0,external_React_.createElement)(document_outline_item, {
- level: (0,external_wp_i18n_namespaceObject.__)('Title'),
- isValid: true,
- onSelect: onSelect,
- href: `#${titleNode.id}`,
- isDisabled: hasOutlineItemsDisabled
- }, title), headings.map((item, index) => {
- // Headings remain the same, go up by one, or down by any amount.
- // Otherwise there are missing levels.
- const isIncorrectLevel = item.level > prevHeadingLevel + 1;
- const isValid = !item.isEmpty && !isIncorrectLevel && !!item.level && (item.level !== 1 || !hasMultipleH1 && !hasTitle);
- prevHeadingLevel = item.level;
- return (0,external_React_.createElement)(document_outline_item, {
- key: index,
- level: `H${item.level}`,
- isValid: isValid,
- isDisabled: hasOutlineItemsDisabled,
- href: `#block-${item.clientId}`,
- onSelect: () => {
- selectBlock(item.clientId);
- onSelect?.();
- }
- }, item.isEmpty ? emptyHeadingContent : (0,external_wp_richText_namespaceObject.getTextContent)((0,external_wp_richText_namespaceObject.create)({
- html: item.attributes.content
- })), isIncorrectLevel && incorrectLevelContent, item.level === 1 && hasMultipleH1 && multipleH1Headings, hasTitle && item.level === 1 && !hasMultipleH1 && singleH1Headings);
- })));
-};
-/* harmony default export */ const document_outline = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => {
- var _postType$supports$ti;
- const {
- getBlocks
- } = select(external_wp_blockEditor_namespaceObject.store);
- const {
- getEditedPostAttribute
- } = select(store_store);
- const {
- getPostType
- } = select(external_wp_coreData_namespaceObject.store);
- const postType = getPostType(getEditedPostAttribute('type'));
- return {
- title: getEditedPostAttribute('title'),
- blocks: getBlocks(),
- isTitleSupported: (_postType$supports$ti = postType?.supports?.title) !== null && _postType$supports$ti !== void 0 ? _postType$supports$ti : false
- };
-}))(DocumentOutline));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "document-outline",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("ul", {
+ children: [hasTitle && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(document_outline_item, {
+ level: (0,external_wp_i18n_namespaceObject.__)('Title'),
+ isValid: true,
+ onSelect: onSelect,
+ href: `#${titleNode.id}`,
+ isDisabled: hasOutlineItemsDisabled,
+ children: title
+ }), headings.map((item, index) => {
+ // Headings remain the same, go up by one, or down by any amount.
+ // Otherwise there are missing levels.
+ const isIncorrectLevel = item.level > prevHeadingLevel + 1;
+ const isValid = !item.isEmpty && !isIncorrectLevel && !!item.level && (item.level !== 1 || !hasMultipleH1 && !hasTitle);
+ prevHeadingLevel = item.level;
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(document_outline_item, {
+ level: `H${item.level}`,
+ isValid: isValid,
+ isDisabled: hasOutlineItemsDisabled,
+ href: `#block-${item.clientId}`,
+ onSelect: () => {
+ selectBlock(item.clientId);
+ onSelect?.();
+ },
+ children: [item.isEmpty ? emptyHeadingContent : (0,external_wp_richText_namespaceObject.getTextContent)((0,external_wp_richText_namespaceObject.create)({
+ html: item.attributes.content
+ })), isIncorrectLevel && incorrectLevelContent, item.level === 1 && hasMultipleH1 && multipleH1Headings, hasTitle && item.level === 1 && !hasMultipleH1 && singleH1Headings]
+ }, index);
+ })]
+ })
+ });
+}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/check.js
/**
@@ -6220,22 +8433,31 @@ const DocumentOutline = ({
*/
+
+/**
+ * Component check if there are any headings (core/heading blocks) present in the document.
+ *
+ * @param {Object} props Props.
+ * @param {Element} props.children Children to be rendered.
+ *
+ * @return {Component|null} The component to be rendered or null if there are headings.
+ */
function DocumentOutlineCheck({
- blocks,
children
}) {
- const headings = blocks.filter(block => block.name === 'core/heading');
- if (headings.length < 1) {
+ const hasHeadings = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getGlobalBlockCount
+ } = select(external_wp_blockEditor_namespaceObject.store);
+ return getGlobalBlockCount('core/heading') > 0;
+ });
+ if (hasHeadings) {
return null;
}
return children;
}
-/* harmony default export */ const check = ((0,external_wp_data_namespaceObject.withSelect)(select => ({
- blocks: select(external_wp_blockEditor_namespaceObject.store).getBlocks()
-}))(DocumentOutlineCheck));
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/register-shortcuts.js
-
/**
* WordPress dependencies
*/
@@ -6245,6 +8467,13 @@ function DocumentOutlineCheck({
+
+/**
+ * Component for registering editor keyboard shortcuts.
+ *
+ * @return {Element} The component to be rendered.
+ */
+
function EditorKeyboardShortcutsRegister() {
// Registering the shortcuts.
const {
@@ -6252,6 +8481,15 @@ function EditorKeyboardShortcutsRegister() {
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store);
(0,external_wp_element_namespaceObject.useEffect)(() => {
registerShortcut({
+ name: 'core/editor/toggle-mode',
+ category: 'global',
+ description: (0,external_wp_i18n_namespaceObject.__)('Switch between visual editor and code editor.'),
+ keyCombination: {
+ modifier: 'secondary',
+ character: 'm'
+ }
+ });
+ registerShortcut({
name: 'core/editor/save',
category: 'global',
description: (0,external_wp_i18n_namespaceObject.__)('Save your changes.'),
@@ -6289,47 +8527,104 @@ function EditorKeyboardShortcutsRegister() {
registerShortcut({
name: 'core/editor/toggle-list-view',
category: 'global',
- description: (0,external_wp_i18n_namespaceObject.__)('Open the block list view.'),
+ description: (0,external_wp_i18n_namespaceObject.__)('Open the List View.'),
keyCombination: {
modifier: 'access',
character: 'o'
}
});
+ registerShortcut({
+ name: 'core/editor/toggle-distraction-free',
+ category: 'global',
+ description: (0,external_wp_i18n_namespaceObject.__)('Toggle distraction free mode.'),
+ keyCombination: {
+ modifier: 'primaryShift',
+ character: '\\'
+ }
+ });
+ registerShortcut({
+ name: 'core/editor/toggle-sidebar',
+ category: 'global',
+ description: (0,external_wp_i18n_namespaceObject.__)('Show or hide the Settings sidebar.'),
+ keyCombination: {
+ modifier: 'primaryShift',
+ character: ','
+ }
+ });
+ registerShortcut({
+ name: 'core/editor/keyboard-shortcuts',
+ category: 'main',
+ description: (0,external_wp_i18n_namespaceObject.__)('Display these keyboard shortcuts.'),
+ keyCombination: {
+ modifier: 'access',
+ character: 'h'
+ }
+ });
+ registerShortcut({
+ name: 'core/editor/next-region',
+ category: 'global',
+ description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the next part of the editor.'),
+ keyCombination: {
+ modifier: 'ctrl',
+ character: '`'
+ },
+ aliases: [{
+ modifier: 'access',
+ character: 'n'
+ }]
+ });
+ registerShortcut({
+ name: 'core/editor/previous-region',
+ category: 'global',
+ description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous part of the editor.'),
+ keyCombination: {
+ modifier: 'ctrlShift',
+ character: '`'
+ },
+ aliases: [{
+ modifier: 'access',
+ character: 'p'
+ }, {
+ modifier: 'ctrlShift',
+ character: '~'
+ }]
+ });
}, [registerShortcut]);
- return (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts.Register, null);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts.Register, {});
}
/* harmony default export */ const register_shortcuts = (EditorKeyboardShortcutsRegister);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/redo.js
-
/**
* WordPress dependencies
*/
-const redo_redo = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+const redo_redo = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z"
-}));
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z"
+ })
+});
/* harmony default export */ const library_redo = (redo_redo);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/undo.js
-
/**
* WordPress dependencies
*/
-const undo_undo = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+const undo_undo = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z"
-}));
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z"
+ })
+});
/* harmony default export */ const library_undo = (undo_undo);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-history/redo.js
-
/**
* WordPress dependencies
*/
@@ -6344,13 +8639,14 @@ const undo_undo = (0,external_React_.createElement)(external_wp_primitives_names
* Internal dependencies
*/
+
function EditorHistoryRedo(props, ref) {
const shortcut = (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('z') : external_wp_keycodes_namespaceObject.displayShortcut.primary('y');
const hasRedo = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).hasEditorRedo(), []);
const {
redo
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
...props,
ref: ref,
icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_redo : library_undo
@@ -6366,10 +8662,20 @@ function EditorHistoryRedo(props, ref) {
className: "editor-history__redo"
});
}
+
+/** @typedef {import('react').Ref<HTMLElement>} Ref */
+
+/**
+ * Renders the redo button for the editor history.
+ *
+ * @param {Object} props - Props.
+ * @param {Ref} ref - Forwarded ref.
+ *
+ * @return {Component} The component to be rendered.
+ */
/* harmony default export */ const editor_history_redo = ((0,external_wp_element_namespaceObject.forwardRef)(EditorHistoryRedo));
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-history/undo.js
-
/**
* WordPress dependencies
*/
@@ -6384,12 +8690,13 @@ function EditorHistoryRedo(props, ref) {
* Internal dependencies
*/
+
function EditorHistoryUndo(props, ref) {
const hasUndo = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).hasEditorUndo(), []);
const {
undo
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
...props,
ref: ref,
icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_undo : library_redo
@@ -6405,10 +8712,20 @@ function EditorHistoryUndo(props, ref) {
className: "editor-history__undo"
});
}
+
+/** @typedef {import('react').Ref<HTMLElement>} Ref */
+
+/**
+ * Renders the undo button for the editor history.
+ *
+ * @param {Object} props - Props.
+ * @param {Ref} ref - Forwarded ref.
+ *
+ * @return {Component} The component to be rendered.
+ */
/* harmony default export */ const editor_history_undo = ((0,external_wp_element_namespaceObject.forwardRef)(EditorHistoryUndo));
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/template-validation-notice/index.js
-
/**
* WordPress dependencies
*/
@@ -6417,48 +8734,49 @@ function EditorHistoryUndo(props, ref) {
-function TemplateValidationNotice({
- isValid,
- ...props
-}) {
+
+
+
+function TemplateValidationNotice() {
+ const [showConfirmDialog, setShowConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false);
+ const isValid = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ return select(external_wp_blockEditor_namespaceObject.store).isValidTemplate();
+ }, []);
+ const {
+ setTemplateValidity,
+ synchronizeTemplate
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
if (isValid) {
return null;
}
- const confirmSynchronization = () => {
- if (
- // eslint-disable-next-line no-alert
- window.confirm((0,external_wp_i18n_namespaceObject.__)('Resetting the template may result in loss of content, do you want to continue?'))) {
- props.synchronizeTemplate();
- }
- };
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Notice, {
- className: "editor-template-validation-notice",
- isDismissible: false,
- status: "warning",
- actions: [{
- label: (0,external_wp_i18n_namespaceObject.__)('Keep it as is'),
- onClick: props.resetTemplateValidity
- }, {
- label: (0,external_wp_i18n_namespaceObject.__)('Reset the template'),
- onClick: confirmSynchronization
- }]
- }, (0,external_wp_i18n_namespaceObject.__)('The content of your post doesn’t match the template assigned to your post type.'));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, {
+ className: "editor-template-validation-notice",
+ isDismissible: false,
+ status: "warning",
+ actions: [{
+ label: (0,external_wp_i18n_namespaceObject.__)('Keep it as is'),
+ onClick: () => setTemplateValidity(true)
+ }, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Reset the template'),
+ onClick: () => setShowConfirmDialog(true)
+ }],
+ children: (0,external_wp_i18n_namespaceObject.__)('The content of your post doesn’t match the template assigned to your post type.')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, {
+ isOpen: showConfirmDialog,
+ confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Reset'),
+ onConfirm: () => {
+ setShowConfirmDialog(false);
+ synchronizeTemplate();
+ },
+ onCancel: () => setShowConfirmDialog(false),
+ size: "medium",
+ children: (0,external_wp_i18n_namespaceObject.__)('Resetting the template may result in loss of content, do you want to continue?')
+ })]
+ });
}
-/* harmony default export */ const template_validation_notice = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => ({
- isValid: select(external_wp_blockEditor_namespaceObject.store).isValidTemplate()
-})), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
- const {
- setTemplateValidity,
- synchronizeTemplate
- } = dispatch(external_wp_blockEditor_namespaceObject.store);
- return {
- resetTemplateValidity: () => setTemplateValidity(true),
- synchronizeTemplate
- };
-})])(TemplateValidationNotice));
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-notices/index.js
-
/**
* WordPress dependencies
*/
@@ -6470,6 +8788,20 @@ function TemplateValidationNotice({
* Internal dependencies
*/
+
+/**
+ * This component renders the notices displayed in the editor. It displays pinned notices first, followed by dismissible
+ *
+ * @example
+ * ```jsx
+ * <EditorNotices />
+ * ```
+ *
+ * @return {JSX.Element} The rendered EditorNotices component.
+ */
+
+
+
function EditorNotices() {
const {
notices
@@ -6487,19 +8819,21 @@ function EditorNotices() {
isDismissible,
type
}) => !isDismissible && type === 'default');
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.NoticeList, {
- notices: nonDismissibleNotices,
- className: "components-editor-notices__pinned"
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.NoticeList, {
- notices: dismissibleNotices,
- className: "components-editor-notices__dismissible",
- onRemove: removeNotice
- }, (0,external_React_.createElement)(template_validation_notice, null)));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.NoticeList, {
+ notices: nonDismissibleNotices,
+ className: "components-editor-notices__pinned"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.NoticeList, {
+ notices: dismissibleNotices,
+ className: "components-editor-notices__dismissible",
+ onRemove: removeNotice,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateValidationNotice, {})
+ })]
+ });
}
/* harmony default export */ const editor_notices = (EditorNotices);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-snackbars/index.js
-
/**
* WordPress dependencies
*/
@@ -6508,7 +8842,14 @@ function EditorNotices() {
// Last three notices. Slices from the tail end of the list.
+
const MAX_VISIBLE_NOTICES = -3;
+
+/**
+ * Renders the editor snackbars component.
+ *
+ * @return {JSX.Element} The rendered component.
+ */
function EditorSnackbars() {
const notices = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_notices_namespaceObject.store).getNotices(), []);
const {
@@ -6517,17 +8858,14 @@ function EditorSnackbars() {
const snackbarNotices = notices.filter(({
type
}) => type === 'snackbar').slice(MAX_VISIBLE_NOTICES);
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.SnackbarList, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SnackbarList, {
notices: snackbarNotices,
className: "components-editor-notices__snackbar",
onRemove: removeNotice
});
}
-;// CONCATENATED MODULE: external ["wp","htmlEntities"]
-const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-record-item.js
-
/**
* WordPress dependencies
*/
@@ -6541,6 +8879,10 @@ const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"];
* Internal dependencies
*/
+
+
+
+
function EntityRecordItem({
record,
checked,
@@ -6554,23 +8896,40 @@ function EntityRecordItem({
} = record;
// Handle templates that might use default descriptive titles.
- const entityRecordTitle = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ entityRecordTitle,
+ hasPostMetaChanges
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
if ('postType' !== kind || 'wp_template' !== name) {
- return title;
+ return {
+ entityRecordTitle: title,
+ hasPostMetaChanges: unlock(select(store_store)).hasPostMetaChanges(name, key)
+ };
}
const template = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord(kind, name, key);
- return select(store_store).__experimentalGetTemplateInfo(template).title;
+ return {
+ entityRecordTitle: select(store_store).__experimentalGetTemplateInfo(template).title,
+ hasPostMetaChanges: unlock(select(store_store)).hasPostMetaChanges(name, key)
+ };
}, [name, kind, title, key]);
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
- __nextHasNoMarginBottom: true,
- label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(entityRecordTitle) || (0,external_wp_i18n_namespaceObject.__)('Untitled'),
- checked: checked,
- onChange: onChange
- }));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelRow, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, {
+ __nextHasNoMarginBottom: true,
+ label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(entityRecordTitle) || (0,external_wp_i18n_namespaceObject.__)('Untitled'),
+ checked: checked,
+ onChange: onChange
+ })
+ }), hasPostMetaChanges && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", {
+ className: "entities-saved-states__changes",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", {
+ children: (0,external_wp_i18n_namespaceObject.__)('Post Meta.')
+ })
+ })]
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-type-list.js
-
/**
* WordPress dependencies
*/
@@ -6586,6 +8945,8 @@ function EntityRecordItem({
*/
+
+
const {
getGlobalStylesChanges,
GlobalStylesContext
@@ -6611,11 +8972,12 @@ function GlobalStylesDescription({
const globalStylesChanges = getGlobalStylesChanges(currentEditorGlobalStyles, savedRecord, {
maxResults: 10
});
- return globalStylesChanges.length ? (0,external_React_.createElement)("ul", {
- className: "entities-saved-states__changes"
- }, globalStylesChanges.map(change => (0,external_React_.createElement)("li", {
- key: change
- }, change))) : null;
+ return globalStylesChanges.length ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", {
+ className: "entities-saved-states__changes",
+ children: globalStylesChanges.map(change => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", {
+ children: change
+ }, change))
+ }) : null;
}
function EntityDescription({
record,
@@ -6625,7 +8987,9 @@ function EntityDescription({
return null;
}
const description = getEntityDescription(record?.name, count);
- return description ? (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelRow, null, description) : null;
+ return description ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelRow, {
+ children: description
+ }) : null;
}
function EntityTypeList({
list,
@@ -6639,22 +9003,22 @@ function EntityTypeList({
if (firstRecord?.name === 'wp_template_part') {
entityLabel = 1 === count ? (0,external_wp_i18n_namespaceObject.__)('Template Part') : (0,external_wp_i18n_namespaceObject.__)('Template Parts');
}
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, {
title: entityLabel,
- initialOpen: true
- }, (0,external_React_.createElement)(EntityDescription, {
- record: firstRecord,
- count: count
- }), list.map(record => {
- return (0,external_React_.createElement)(EntityRecordItem, {
- key: record.key || record.property,
- record: record,
- checked: !unselectedEntities.some(elt => elt.kind === record.kind && elt.name === record.name && elt.key === record.key && elt.property === record.property),
- onChange: value => setUnselectedEntities(record, value)
- });
- }), 'globalStyles' === firstRecord?.name && (0,external_React_.createElement)(GlobalStylesDescription, {
- record: firstRecord
- }));
+ initialOpen: true,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntityDescription, {
+ record: firstRecord,
+ count: count
+ }), list.map(record => {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntityRecordItem, {
+ record: record,
+ checked: !unselectedEntities.some(elt => elt.kind === record.kind && elt.name === record.name && elt.key === record.key && elt.property === record.property),
+ onChange: value => setUnselectedEntities(record, value)
+ }, record.key || record.property);
+ }), 'globalStyles' === firstRecord?.name && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesDescription, {
+ record: firstRecord
+ })]
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/hooks/use-is-dirty.js
@@ -6664,45 +9028,39 @@ function EntityTypeList({
-
-const TRANSLATED_SITE_PROPERTIES = {
- title: (0,external_wp_i18n_namespaceObject.__)('Title'),
- description: (0,external_wp_i18n_namespaceObject.__)('Tagline'),
- site_logo: (0,external_wp_i18n_namespaceObject.__)('Logo'),
- site_icon: (0,external_wp_i18n_namespaceObject.__)('Icon'),
- show_on_front: (0,external_wp_i18n_namespaceObject.__)('Show on front'),
- page_on_front: (0,external_wp_i18n_namespaceObject.__)('Page on front'),
- posts_per_page: (0,external_wp_i18n_namespaceObject.__)('Maximum posts per page'),
- default_comment_status: (0,external_wp_i18n_namespaceObject.__)('Allow comments on new posts')
-};
const useIsDirty = () => {
const {
editedEntities,
- siteEdits
+ siteEdits,
+ siteEntityConfig
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
__experimentalGetDirtyEntityRecords,
- getEntityRecordEdits
+ getEntityRecordEdits,
+ getEntityConfig
} = select(external_wp_coreData_namespaceObject.store);
return {
editedEntities: __experimentalGetDirtyEntityRecords(),
- siteEdits: getEntityRecordEdits('root', 'site')
+ siteEdits: getEntityRecordEdits('root', 'site'),
+ siteEntityConfig: getEntityConfig('root', 'site')
};
}, []);
const dirtyEntityRecords = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ var _siteEntityConfig$met;
// Remove site object and decouple into its edited pieces.
const editedEntitiesWithoutSite = editedEntities.filter(record => !(record.kind === 'root' && record.name === 'site'));
+ const siteEntityLabels = (_siteEntityConfig$met = siteEntityConfig?.meta?.labels) !== null && _siteEntityConfig$met !== void 0 ? _siteEntityConfig$met : {};
const editedSiteEntities = [];
for (const property in siteEdits) {
editedSiteEntities.push({
kind: 'root',
name: 'site',
- title: TRANSLATED_SITE_PROPERTIES[property] || property,
+ title: siteEntityLabels[property] || property,
property
});
}
return [...editedEntitiesWithoutSite, ...editedSiteEntities];
- }, [editedEntities, siteEdits]);
+ }, [editedEntities, siteEdits, siteEntityConfig]);
// Unchecked entities to be ignored by save function.
const [unselectedEntities, _setUnselectedEntities] = (0,external_wp_element_namespaceObject.useState)([]);
@@ -6733,7 +9091,6 @@ const useIsDirty = () => {
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/index.js
-
/**
* WordPress dependencies
*/
@@ -6743,27 +9100,26 @@ const useIsDirty = () => {
-
-
-
/**
* Internal dependencies
*/
-const PUBLISH_ON_SAVE_ENTITIES = [{
- kind: 'postType',
- name: 'wp_navigation'
-}];
+
+
+
+
function identity(values) {
return values;
}
function EntitiesSavedStates({
- close
+ close,
+ renderDialog = undefined
}) {
const isDirtyProps = useIsDirty();
- return (0,external_React_.createElement)(EntitiesSavedStatesExtensible, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntitiesSavedStatesExtensible, {
close: close,
+ renderDialog: renderDialog,
...isDirtyProps
});
}
@@ -6773,6 +9129,7 @@ function EntitiesSavedStatesExtensible({
onSave = identity,
saveEnabled: saveEnabledProp = undefined,
saveLabel = (0,external_wp_i18n_namespaceObject.__)('Save'),
+ renderDialog = undefined,
dirtyEntityRecords,
isDirty,
setUnselectedEntities,
@@ -6780,19 +9137,8 @@ function EntitiesSavedStatesExtensible({
}) {
const saveButtonRef = (0,external_wp_element_namespaceObject.useRef)();
const {
- editEntityRecord,
- saveEditedEntityRecord,
- __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- const {
- __unstableMarkLastChangeAsPersistent
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
- const {
- createSuccessNotice,
- createErrorNotice,
- removeNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
-
+ saveDirtyEntities
+ } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
// To group entities by type.
const partitionedSavables = dirtyEntityRecords.reduce((acc, record) => {
const {
@@ -6814,114 +9160,73 @@ function EntitiesSavedStatesExtensible({
} = partitionedSavables;
const sortedPartitionedSavables = [siteSavables, templateSavables, templatePartSavables, ...Object.values(contentSavables)].filter(Array.isArray);
const saveEnabled = saveEnabledProp !== null && saveEnabledProp !== void 0 ? saveEnabledProp : isDirty;
- const {
- homeUrl
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getUnstableBase // Site index.
- } = select(external_wp_coreData_namespaceObject.store);
- return {
- homeUrl: getUnstableBase()?.home
- };
- }, []);
- const saveCheckedEntities = () => {
- const saveNoticeId = 'site-editor-save-success';
- removeNotice(saveNoticeId);
- const entitiesToSave = dirtyEntityRecords.filter(({
- kind,
- name,
- key,
- property
- }) => {
- return !unselectedEntities.some(elt => elt.kind === kind && elt.name === name && elt.key === key && elt.property === property);
- });
- close(entitiesToSave);
- const siteItemsToSave = [];
- const pendingSavedRecords = [];
- entitiesToSave.forEach(({
- kind,
- name,
- key,
- property
- }) => {
- if ('root' === kind && 'site' === name) {
- siteItemsToSave.push(property);
- } else {
- if (PUBLISH_ON_SAVE_ENTITIES.some(typeToPublish => typeToPublish.kind === kind && typeToPublish.name === name)) {
- editEntityRecord(kind, name, key, {
- status: 'publish'
- });
- }
- pendingSavedRecords.push(saveEditedEntityRecord(kind, name, key));
- }
- });
- if (siteItemsToSave.length) {
- pendingSavedRecords.push(saveSpecifiedEntityEdits('root', 'site', undefined, siteItemsToSave));
- }
- __unstableMarkLastChangeAsPersistent();
- Promise.all(pendingSavedRecords).then(values => {
- return onSave(values);
- }).then(values => {
- if (values.some(value => typeof value === 'undefined')) {
- createErrorNotice((0,external_wp_i18n_namespaceObject.__)('Saving failed.'));
- } else {
- createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Site updated.'), {
- type: 'snackbar',
- id: saveNoticeId,
- actions: [{
- label: (0,external_wp_i18n_namespaceObject.__)('View site'),
- url: homeUrl
- }]
- });
- }
- }).catch(error => createErrorNotice(`${(0,external_wp_i18n_namespaceObject.__)('Saving failed.')} ${error}`));
- };
-
// Explicitly define this with no argument passed. Using `close` on
// its own will use the event object in place of the expected saved entities.
const dismissPanel = (0,external_wp_element_namespaceObject.useCallback)(() => close(), [close]);
const [saveDialogRef, saveDialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({
onClose: () => dismissPanel()
});
- return (0,external_React_.createElement)("div", {
+ const dialogLabel = (0,external_wp_compose_namespaceObject.useInstanceId)(EntitiesSavedStatesExtensible, 'label');
+ const dialogDescription = (0,external_wp_compose_namespaceObject.useInstanceId)(EntitiesSavedStatesExtensible, 'description');
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
ref: saveDialogRef,
...saveDialogProps,
- className: "entities-saved-states__panel"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, {
- className: "entities-saved-states__panel-header",
- gap: 2
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, {
- isBlock: true,
- as: external_wp_components_namespaceObject.Button,
- ref: saveButtonRef,
- variant: "primary",
- disabled: !saveEnabled,
- onClick: saveCheckedEntities,
- className: "editor-entities-saved-states__save-button"
- }, saveLabel), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, {
- isBlock: true,
- as: external_wp_components_namespaceObject.Button,
- variant: "secondary",
- onClick: dismissPanel
- }, (0,external_wp_i18n_namespaceObject.__)('Cancel'))), (0,external_React_.createElement)("div", {
- className: "entities-saved-states__text-prompt"
- }, (0,external_React_.createElement)("strong", {
- className: "entities-saved-states__text-prompt--header"
- }, (0,external_wp_i18n_namespaceObject.__)('Are you ready to save?')), additionalPrompt, (0,external_React_.createElement)("p", null, isDirty ? (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of site changes waiting to be saved. */
- (0,external_wp_i18n_namespaceObject._n)('There is <strong>%d site change</strong> waiting to be saved.', 'There are <strong>%d site changes</strong> waiting to be saved.', sortedPartitionedSavables.length), sortedPartitionedSavables.length), {
- strong: (0,external_React_.createElement)("strong", null)
- }) : (0,external_wp_i18n_namespaceObject.__)('Select the items you want to save.'))), sortedPartitionedSavables.map(list => {
- return (0,external_React_.createElement)(EntityTypeList, {
- key: list[0].name,
- list: list,
- unselectedEntities: unselectedEntities,
- setUnselectedEntities: setUnselectedEntities
- });
- }));
+ className: "entities-saved-states__panel",
+ role: renderDialog ? 'dialog' : undefined,
+ "aria-labelledby": renderDialog ? dialogLabel : undefined,
+ "aria-describedby": renderDialog ? dialogDescription : undefined,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, {
+ className: "entities-saved-states__panel-header",
+ gap: 2,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ isBlock: true,
+ as: external_wp_components_namespaceObject.Button,
+ ref: saveButtonRef,
+ variant: "primary",
+ disabled: !saveEnabled,
+ __experimentalIsFocusable: true,
+ onClick: () => saveDirtyEntities({
+ onSave,
+ dirtyEntityRecords,
+ entitiesToSkip: unselectedEntities,
+ close
+ }),
+ className: "editor-entities-saved-states__save-button",
+ children: saveLabel
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ isBlock: true,
+ as: external_wp_components_namespaceObject.Button,
+ variant: "secondary",
+ onClick: dismissPanel,
+ children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "entities-saved-states__text-prompt",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "entities-saved-states__text-prompt--header-wrapper",
+ id: renderDialog ? dialogLabel : undefined,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", {
+ className: "entities-saved-states__text-prompt--header",
+ children: (0,external_wp_i18n_namespaceObject.__)('Are you ready to save?')
+ }), additionalPrompt]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ id: renderDialog ? dialogDescription : undefined,
+ children: isDirty ? (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of site changes waiting to be saved. */
+ (0,external_wp_i18n_namespaceObject._n)('There is <strong>%d site change</strong> waiting to be saved.', 'There are <strong>%d site changes</strong> waiting to be saved.', sortedPartitionedSavables.length), sortedPartitionedSavables.length), {
+ strong: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", {})
+ }) : (0,external_wp_i18n_namespaceObject.__)('Select the items you want to save.')
+ })]
+ }), sortedPartitionedSavables.map(list => {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntityTypeList, {
+ list: list,
+ unselectedEntities: unselectedEntities,
+ setUnselectedEntities: setUnselectedEntities
+ }, list[0].name);
+ })]
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/error-boundary/index.js
-
/**
* WordPress dependencies
*/
@@ -6937,6 +9242,7 @@ function EntitiesSavedStatesExtensible({
* Internal dependencies
*/
+
function getContent() {
try {
// While `select` in a component is generally discouraged, it is
@@ -6953,10 +9259,11 @@ function CopyButton({
children
}) {
const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text);
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
variant: "secondary",
- ref: ref
- }, children);
+ ref: ref,
+ children: children
+ });
}
class ErrorBoundary extends external_wp_element_namespaceObject.Component {
constructor() {
@@ -6980,23 +9287,34 @@ class ErrorBoundary extends external_wp_element_namespaceObject.Component {
if (!error) {
return this.props.children;
}
- const actions = [(0,external_React_.createElement)(CopyButton, {
- key: "copy-post",
- text: getContent
- }, (0,external_wp_i18n_namespaceObject.__)('Copy Post Text')), (0,external_React_.createElement)(CopyButton, {
- key: "copy-error",
- text: error.stack
- }, (0,external_wp_i18n_namespaceObject.__)('Copy Error'))];
- return (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.Warning, {
+ const actions = [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyButton, {
+ text: getContent,
+ children: (0,external_wp_i18n_namespaceObject.__)('Copy Post Text')
+ }, "copy-post"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyButton, {
+ text: error.stack,
+ children: (0,external_wp_i18n_namespaceObject.__)('Copy Error')
+ }, "copy-error")];
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.Warning, {
className: "editor-error-boundary",
- actions: actions
- }, (0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error.'));
+ actions: actions,
+ children: (0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error.')
+ });
}
}
+
+/**
+ * ErrorBoundary is used to catch JavaScript errors anywhere in a child component tree, log those errors, and display a fallback UI.
+ *
+ * It uses the lifecycle methods getDerivedStateFromError and componentDidCatch to catch errors in a child component tree.
+ *
+ * getDerivedStateFromError is used to render a fallback UI after an error has been thrown, and componentDidCatch is used to log error information.
+ *
+ * @class ErrorBoundary
+ * @augments Component
+ */
/* harmony default export */ const error_boundary = (ErrorBoundary);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/local-autosave-monitor/index.js
-
/**
* WordPress dependencies
*/
@@ -7013,6 +9331,7 @@ class ErrorBoundary extends external_wp_element_namespaceObject.Component {
+
const requestIdleCallback = window.requestIdleCallback ? window.requestIdleCallback : window.requestAnimationFrame;
let hasStorageSupport;
@@ -7166,11 +9485,24 @@ function LocalAutosaveMonitor() {
useAutosaveNotice();
useAutosavePurge();
const localAutosaveInterval = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditorSettings().localAutosaveInterval, []);
- return (0,external_React_.createElement)(autosave_monitor, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(autosave_monitor, {
interval: localAutosaveInterval,
autosave: deferredAutosave
});
}
+
+/**
+ * Monitors local autosaves of a post in the editor.
+ * It uses several hooks and functions to manage autosave behavior:
+ * - `useAutosaveNotice` hook: Manages the creation of a notice prompting the user to restore a local autosave, if one exists.
+ * - `useAutosavePurge` hook: Ejects a local autosave after a successful save occurs.
+ * - `hasSessionStorageSupport` function: Checks if the current environment supports browser sessionStorage.
+ * - `LocalAutosaveMonitor` component: Uses the `AutosaveMonitor` component to perform autosaves at a specified interval.
+ *
+ * The module also checks for sessionStorage support and conditionally exports the `LocalAutosaveMonitor` component based on that.
+ *
+ * @module LocalAutosaveMonitor
+ */
/* harmony default export */ const local_autosave_monitor = ((0,external_wp_compose_namespaceObject.ifCondition)(hasSessionStorageSupport)(LocalAutosaveMonitor));
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/check.js
@@ -7184,6 +9516,15 @@ function LocalAutosaveMonitor() {
* Internal dependencies
*/
+
+/**
+ * Wrapper component that renders its children only if the post type supports page attributes.
+ *
+ * @param {Object} props - The component props.
+ * @param {Element} props.children - The child components to render.
+ *
+ * @return {Component|null} The rendered child components or null if page attributes are not supported.
+ */
function PageAttributesCheck({
children
}) {
@@ -7206,6 +9547,38 @@ function PageAttributesCheck({
}
/* harmony default export */ const page_attributes_check = (PageAttributesCheck);
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-panel-row/index.js
+/**
+ * External dependencies
+ */
+
+
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+const PostPanelRow = (0,external_wp_element_namespaceObject.forwardRef)(({
+ className,
+ label,
+ children
+}, ref) => {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ className: dist_clsx('editor-post-panel__row', className),
+ ref: ref,
+ children: [label && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "editor-post-panel__row-label",
+ children: label
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "editor-post-panel__row-control",
+ children: children
+ })]
+ });
+});
+/* harmony default export */ const post_panel_row = (PostPanelRow);
+
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-type-support-check/index.js
/**
* WordPress dependencies
@@ -7243,7 +9616,7 @@ function PostTypeSupportCheck({
} = select(external_wp_coreData_namespaceObject.store);
return getPostType(getEditedPostAttribute('type'));
}, []);
- let isSupported = true;
+ let isSupported = !!postType;
if (postType) {
isSupported = (Array.isArray(supportKeys) ? supportKeys : [supportKeys]).some(key => !!postType.supports[key]);
}
@@ -7255,7 +9628,6 @@ function PostTypeSupportCheck({
/* harmony default export */ const post_type_support_check = (PostTypeSupportCheck);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/order.js
-
/**
* WordPress dependencies
*/
@@ -7264,11 +9636,15 @@ function PostTypeSupportCheck({
+
/**
* Internal dependencies
*/
+
+
+
function PageAttributesOrder() {
const order = (0,external_wp_data_namespaceObject.useSelect)(select => {
var _select$getEditedPost;
@@ -7288,21 +9664,98 @@ function PageAttributesOrder() {
}
};
const value = orderInput !== null && orderInput !== void 0 ? orderInput : order;
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexBlock, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNumberControl, {
- __next40pxDefaultSize: true,
- label: (0,external_wp_i18n_namespaceObject.__)('Order'),
- value: value,
- onChange: setUpdatedOrder,
- labelPosition: "side",
- onBlur: () => {
- setOrderInput(null);
- }
- })));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, {
+ __next40pxDefaultSize: true,
+ label: (0,external_wp_i18n_namespaceObject.__)('Order'),
+ help: (0,external_wp_i18n_namespaceObject.__)('Set the page order.'),
+ value: value,
+ onChange: setUpdatedOrder,
+ hideLabelFromVision: true,
+ onBlur: () => {
+ setOrderInput(null);
+ }
+ })
+ })
+ });
}
+
+/**
+ * Renders the Page Attributes Order component. A number input in an editor interface
+ * for setting the order of a given page.
+ *
+ * @return {Component} The component to be rendered.
+ */
function PageAttributesOrderWithChecks() {
- return (0,external_React_.createElement)(post_type_support_check, {
- supportKeys: "page-attributes"
- }, (0,external_React_.createElement)(PageAttributesOrder, null));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, {
+ supportKeys: "page-attributes",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageAttributesOrder, {})
+ });
+}
+function PostOrderToggle({
+ isOpen,
+ onClick
+}) {
+ const order = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ var _select$getEditedPost2;
+ return (_select$getEditedPost2 = select(store_store).getEditedPostAttribute('menu_order')) !== null && _select$getEditedPost2 !== void 0 ? _select$getEditedPost2 : 0;
+ }, []);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ size: "compact",
+ className: "editor-post-order__panel-toggle",
+ variant: "tertiary",
+ "aria-expanded": isOpen
+ // translators: %s: Current post parent.
+ ,
+ "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Change order: %s'), order),
+ onClick: onClick,
+ children: order
+ });
+}
+function OrderRow() {
+ // Use internal state instead of a ref to make sure that the component
+ // re-renders when the popover's anchor updates.
+ const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
+ // Memoize popoverProps to avoid returning a new object every time.
+ const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
+ // Anchor the popover to the middle of the entire row so that it doesn't
+ // move around when the label changes.
+ anchor: popoverAnchor,
+ placement: 'left-start',
+ offset: 36,
+ shift: true
+ }), [popoverAnchor]);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Order'),
+ ref: setPopoverAnchor,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
+ popoverProps: popoverProps,
+ className: "editor-post-order__panel-dropdown",
+ contentClassName: "editor-post-order__panel-dialog",
+ focusOnMount: true,
+ renderToggle: ({
+ isOpen,
+ onToggle
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostOrderToggle, {
+ isOpen: isOpen,
+ onClick: onToggle
+ }),
+ renderContent: ({
+ onClose
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "editor-post-order",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Order'),
+ onClose: onClose
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ children: [(0,external_wp_i18n_namespaceObject.__)('This attribute determines the order of pages in the Pages List block.'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ children: (0,external_wp_i18n_namespaceObject.__)('Pages with the same order value will sorted alphabetically. Negative order values are also supported.')
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageAttributesOrder, {})]
+ })
+ })
+ });
}
// EXTERNAL MODULE: ./node_modules/remove-accents/index.js
@@ -7388,7 +9841,6 @@ const unescapeTerms = terms => {
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/parent.js
-
/**
* External dependencies
*/
@@ -7405,11 +9857,15 @@ const unescapeTerms = terms => {
+
/**
* Internal dependencies
*/
+
+
+
function getTitle(post) {
return post?.title?.rendered ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(post.title.rendered) : `#${post.id} (${(0,external_wp_i18n_namespaceObject.__)('no title')})`;
}
@@ -7424,6 +9880,13 @@ const getItemPriority = (name, searchValue) => {
}
return Infinity;
};
+
+/**
+ * Renders the Page Attributes Parent component. A dropdown menu in an editor interface
+ * for selecting the parent page of a given page.
+ *
+ * @return {Component|null} The component to be rendered. Return null if post type is not hierarchical.
+ */
function PageAttributesParent() {
const {
editPost
@@ -7532,29 +9995,106 @@ function PageAttributesParent() {
parent: selectedPostId
});
};
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.ComboboxControl, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ComboboxControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
className: "editor-page-attributes__parent",
label: (0,external_wp_i18n_namespaceObject.__)('Parent'),
+ help: (0,external_wp_i18n_namespaceObject.__)('Choose a parent page.'),
value: parentPostId,
options: parentOptions,
onFilterValueChange: (0,external_wp_compose_namespaceObject.debounce)(handleKeydown, 300),
- onChange: handleChange
+ onChange: handleChange,
+ hideLabelFromVision: true
+ });
+}
+function PostParentToggle({
+ isOpen,
+ onClick
+}) {
+ const parentPost = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getEditedPostAttribute
+ } = select(store_store);
+ const parentPostId = getEditedPostAttribute('parent');
+ if (!parentPostId) {
+ return null;
+ }
+ const {
+ getEntityRecord
+ } = select(external_wp_coreData_namespaceObject.store);
+ const postTypeSlug = getEditedPostAttribute('type');
+ return getEntityRecord('postType', postTypeSlug, parentPostId);
+ }, []);
+ const parentTitle = (0,external_wp_element_namespaceObject.useMemo)(() => !parentPost ? (0,external_wp_i18n_namespaceObject.__)('None') : getTitle(parentPost), [parentPost]);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ size: "compact",
+ className: "editor-post-parent__panel-toggle",
+ variant: "tertiary",
+ "aria-expanded": isOpen
+ // translators: %s: Current post parent.
+ ,
+ "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Change parent: %s'), parentTitle),
+ onClick: onClick,
+ children: parentTitle
+ });
+}
+function ParentRow() {
+ // Use internal state instead of a ref to make sure that the component
+ // re-renders when the popover's anchor updates.
+ const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
+ // Memoize popoverProps to avoid returning a new object every time.
+ const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
+ // Anchor the popover to the middle of the entire row so that it doesn't
+ // move around when the label changes.
+ anchor: popoverAnchor,
+ placement: 'left-start',
+ offset: 36,
+ shift: true
+ }), [popoverAnchor]);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Parent'),
+ ref: setPopoverAnchor,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
+ popoverProps: popoverProps,
+ className: "editor-post-parent__panel-dropdown",
+ contentClassName: "editor-post-parent__panel-dialog",
+ focusOnMount: true,
+ renderToggle: ({
+ isOpen,
+ onToggle
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostParentToggle, {
+ isOpen: isOpen,
+ onClick: onToggle
+ }),
+ renderContent: ({
+ onClose
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "editor-post-parent",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Parent'),
+ onClose: onClose
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ children: [/* translators: The domain name should be a reserved domain name to prevent linking to third party sites outside the WordPress project's control. You may also wish to use wordpress.org or a wordpress.org sub-domain. */
+ (0,external_wp_i18n_namespaceObject.__)("Child pages inherit characteristics from their parent, such as URL structure. For instance, if 'Web Design' is a child of 'Services', its URL would be example.org/services/web-design."), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("p", {
+ children: [(0,external_wp_i18n_namespaceObject.__)('They also show up as sub-items in the default navigation menu. '), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, {
+ href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/page-post-settings-sidebar/#page-attributes'),
+ children: (0,external_wp_i18n_namespaceObject.__)('Learn more')
+ })]
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageAttributesParent, {})]
+ })
+ })
});
}
/* harmony default export */ const page_attributes_parent = (PageAttributesParent);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/panel.js
-
/**
* WordPress dependencies
*/
-
-
-
/**
* Internal dependencies
*/
@@ -7562,61 +10102,64 @@ function PageAttributesParent() {
+
+
+
const PANEL_NAME = 'page-attributes';
-function PageAttributesPanel() {
- var _postType$labels$attr;
+function AttributesPanel() {
const {
isEnabled,
- isOpened,
postType
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getEditedPostAttribute,
- isEditorPanelEnabled,
- isEditorPanelOpened
+ isEditorPanelEnabled
} = select(store_store);
const {
getPostType
} = select(external_wp_coreData_namespaceObject.store);
return {
isEnabled: isEditorPanelEnabled(PANEL_NAME),
- isOpened: isEditorPanelOpened(PANEL_NAME),
postType: getPostType(getEditedPostAttribute('type'))
};
}, []);
- const {
- toggleEditorPanelOpened
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
if (!isEnabled || !postType) {
return null;
}
- const onTogglePanel = (...args) => toggleEditorPanelOpened(PANEL_NAME, ...args);
- return (0,external_React_.createElement)(page_attributes_check, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, {
- title: (_postType$labels$attr = postType?.labels?.attributes) !== null && _postType$labels$attr !== void 0 ? _postType$labels$attr : (0,external_wp_i18n_namespaceObject.__)('Page attributes'),
- opened: isOpened,
- onToggle: onTogglePanel
- }, (0,external_React_.createElement)(page_attributes_parent, null), (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_React_.createElement)(PageAttributesOrderWithChecks, null))));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ParentRow, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OrderRow, {})]
+ });
}
-/* harmony default export */ const panel = (PageAttributesPanel);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/add-template.js
+/**
+ * Renders the Page Attributes Panel component.
+ *
+ * @return {Component} The component to be rendered.
+ */
+function PageAttributesPanel() {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(page_attributes_check, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AttributesPanel, {})
+ });
+}
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/add-template.js
/**
* WordPress dependencies
*/
-const addTemplate = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+const addTemplate = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/svg"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- fillRule: "evenodd",
- clipRule: "evenodd",
- d: "M18.5 5.5V8H20V5.5H22.5V4H20V1.5H18.5V4H16V5.5H18.5ZM13.9624 4H6C4.89543 4 4 4.89543 4 6V18C4 19.1046 4.89543 20 6 20H18C19.1046 20 20 19.1046 20 18V10.0391H18.5V18C18.5 18.2761 18.2761 18.5 18 18.5H10L10 10.4917L16.4589 10.5139L16.4641 9.01389L5.5 8.97618V6C5.5 5.72386 5.72386 5.5 6 5.5H13.9624V4ZM5.5 10.4762V18C5.5 18.2761 5.72386 18.5 6 18.5H8.5L8.5 10.4865L5.5 10.4762Z"
-}));
+ xmlns: "http://www.w3.org/2000/svg",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ fillRule: "evenodd",
+ clipRule: "evenodd",
+ d: "M18.5 5.5V8H20V5.5H22.5V4H20V1.5H18.5V4H16V5.5H18.5ZM13.9624 4H6C4.89543 4 4 4.89543 4 6V18C4 19.1046 4.89543 20 6 20H18C19.1046 20 20 19.1046 20 18V10.0391H18.5V18C18.5 18.2761 18.2761 18.5 18 18.5H10L10 10.4917L16.4589 10.5139L16.4641 9.01389L5.5 8.97618V6C5.5 5.72386 5.72386 5.5 6 5.5H13.9624V4ZM5.5 10.4762V18C5.5 18.2761 5.72386 18.5 6 18.5H8.5L8.5 10.4865L5.5 10.4762Z"
+ })
+});
/* harmony default export */ const add_template = (addTemplate);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/create-new-template-modal.js
-
/**
* WordPress dependencies
*/
@@ -7632,6 +10175,8 @@ const addTemplate = (0,external_React_.createElement)(external_wp_primitives_nam
*/
+
+
const DEFAULT_TITLE = (0,external_wp_i18n_namespaceObject.__)('Custom Template');
function CreateNewTemplateModal({
onClose
@@ -7693,33 +10238,39 @@ function CreateNewTemplateModal({
});
cancel();
};
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Modal, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, {
title: (0,external_wp_i18n_namespaceObject.__)('Create custom template'),
- onRequestClose: cancel
- }, (0,external_React_.createElement)("form", {
- className: "editor-post-template__create-form",
- onSubmit: submit
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: "3"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, {
- __nextHasNoMarginBottom: true,
- label: (0,external_wp_i18n_namespaceObject.__)('Name'),
- value: title,
- onChange: setTitle,
- placeholder: DEFAULT_TITLE,
- disabled: isBusy,
- help: (0,external_wp_i18n_namespaceObject.__)('Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.')
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "right"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "tertiary",
- onClick: cancel
- }, (0,external_wp_i18n_namespaceObject.__)('Cancel')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "primary",
- type: "submit",
- isBusy: isBusy,
- "aria-disabled": isBusy
- }, (0,external_wp_i18n_namespaceObject.__)('Create'))))));
+ onRequestClose: cancel,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", {
+ className: "editor-post-template__create-form",
+ onSubmit: submit,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: "3",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, {
+ __nextHasNoMarginBottom: true,
+ label: (0,external_wp_i18n_namespaceObject.__)('Name'),
+ value: title,
+ onChange: setTitle,
+ placeholder: DEFAULT_TITLE,
+ disabled: isBusy,
+ help: (0,external_wp_i18n_namespaceObject.__)('Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "right",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "tertiary",
+ onClick: cancel,
+ children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "primary",
+ type: "submit",
+ isBusy: isBusy,
+ "aria-disabled": isBusy,
+ children: (0,external_wp_i18n_namespaceObject.__)('Create')
+ })]
+ })]
+ })
+ })
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/hooks.js
@@ -7802,7 +10353,6 @@ function useCurrentTemplateSlug() {
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/classic-theme.js
-
/**
* WordPress dependencies
*/
@@ -7821,6 +10371,8 @@ function useCurrentTemplateSlug() {
+
+
const POPOVER_PROPS = {
className: 'editor-post-template__dropdown',
placement: 'bottom-start'
@@ -7841,15 +10393,24 @@ function PostTemplateToggle({
const template = select(external_wp_coreData_namespaceObject.store).canUser('create', 'templates') && select(store_store).getCurrentTemplateId();
return template?.title || template?.slug || availableTemplates?.[templateSlug];
}, []);
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
- className: "edit-post-post-template__toggle",
variant: "tertiary",
"aria-expanded": isOpen,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Template options'),
- onClick: onClick
- }, templateTitle !== null && templateTitle !== void 0 ? templateTitle : (0,external_wp_i18n_namespaceObject.__)('Default template'));
+ onClick: onClick,
+ children: templateTitle !== null && templateTitle !== void 0 ? templateTitle : (0,external_wp_i18n_namespaceObject.__)('Default template')
+ });
}
+
+/**
+ * Renders the dropdown content for selecting a post template.
+ *
+ * @param {Object} props The component props.
+ * @param {Function} props.onClose The function to close the dropdown.
+ *
+ * @return {JSX.Element} The rendered dropdown content.
+ */
function PostTemplateDropdownContent({
onClose
}) {
@@ -7905,87 +10466,822 @@ function PostTemplateDropdownContent({
createSuccessNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
const [isCreateModalOpen, setIsCreateModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
- return (0,external_React_.createElement)("div", {
- className: "editor-post-template__classic-theme-dropdown"
- }, (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
- title: (0,external_wp_i18n_namespaceObject.__)('Template'),
- help: (0,external_wp_i18n_namespaceObject.__)('Templates define the way content is displayed when viewing your site.'),
- actions: canCreate ? [{
- icon: add_template,
- label: (0,external_wp_i18n_namespaceObject.__)('Add template'),
- onClick: () => setIsCreateModalOpen(true)
- }] : [],
- onClose: onClose
- }), !allowSwitchingTemplate ? (0,external_React_.createElement)(external_wp_components_namespaceObject.Notice, {
- status: "warning",
- isDismissible: false
- }, (0,external_wp_i18n_namespaceObject.__)('The posts page template cannot be changed.')) : (0,external_React_.createElement)(external_wp_components_namespaceObject.SelectControl, {
- __next40pxDefaultSize: true,
- __nextHasNoMarginBottom: true,
- hideLabelFromVision: true,
- label: (0,external_wp_i18n_namespaceObject.__)('Template'),
- value: (_selectedOption$value = selectedOption?.value) !== null && _selectedOption$value !== void 0 ? _selectedOption$value : '',
- options: options,
- onChange: slug => editPost({
- template: slug || ''
- })
- }), canEdit && onNavigateToEntityRecord && (0,external_React_.createElement)("p", null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "link",
- onClick: () => {
- onNavigateToEntityRecord({
- postId: currentTemplateId,
- postType: 'wp_template'
- });
- onClose();
- createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Editing template. Changes made here affect all posts and pages that use the template.'), {
- type: 'snackbar',
- actions: [{
- label: (0,external_wp_i18n_namespaceObject.__)('Go back'),
- onClick: () => getEditorSettings().onNavigateToPreviousEntityRecord()
- }]
- });
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Edit template'))), isCreateModalOpen && (0,external_React_.createElement)(CreateNewTemplateModal, {
- onClose: () => setIsCreateModalOpen(false)
- }));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "editor-post-template__classic-theme-dropdown",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Template'),
+ help: (0,external_wp_i18n_namespaceObject.__)('Templates define the way content is displayed when viewing your site.'),
+ actions: canCreate ? [{
+ icon: add_template,
+ label: (0,external_wp_i18n_namespaceObject.__)('Add template'),
+ onClick: () => setIsCreateModalOpen(true)
+ }] : [],
+ onClose: onClose
+ }), !allowSwitchingTemplate ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, {
+ status: "warning",
+ isDismissible: false,
+ children: (0,external_wp_i18n_namespaceObject.__)('The posts page template cannot be changed.')
+ }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, {
+ __next40pxDefaultSize: true,
+ __nextHasNoMarginBottom: true,
+ hideLabelFromVision: true,
+ label: (0,external_wp_i18n_namespaceObject.__)('Template'),
+ value: (_selectedOption$value = selectedOption?.value) !== null && _selectedOption$value !== void 0 ? _selectedOption$value : '',
+ options: options,
+ onChange: slug => editPost({
+ template: slug || ''
+ })
+ }), canEdit && onNavigateToEntityRecord && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "link",
+ onClick: () => {
+ onNavigateToEntityRecord({
+ postId: currentTemplateId,
+ postType: 'wp_template'
+ });
+ onClose();
+ createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Editing template. Changes made here affect all posts and pages that use the template.'), {
+ type: 'snackbar',
+ actions: [{
+ label: (0,external_wp_i18n_namespaceObject.__)('Go back'),
+ onClick: () => getEditorSettings().onNavigateToPreviousEntityRecord()
+ }]
+ });
+ },
+ children: (0,external_wp_i18n_namespaceObject.__)('Edit template')
+ })
+ }), isCreateModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateNewTemplateModal, {
+ onClose: () => setIsCreateModalOpen(false)
+ })]
+ });
}
function ClassicThemeControl() {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Dropdown, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
popoverProps: POPOVER_PROPS,
focusOnMount: true,
renderToggle: ({
isOpen,
onToggle
- }) => (0,external_React_.createElement)(PostTemplateToggle, {
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTemplateToggle, {
isOpen: isOpen,
onClick: onToggle
}),
renderContent: ({
onClose
- }) => (0,external_React_.createElement)(PostTemplateDropdownContent, {
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTemplateDropdownContent, {
onClose: onClose
})
});
}
+
+/**
+ * Provides a dropdown menu for selecting and managing post templates.
+ *
+ * The dropdown menu includes a button for toggling the menu, a list of available templates, and options for creating and editing templates.
+ *
+ * @return {JSX.Element} The rendered ClassicThemeControl component.
+ */
/* harmony default export */ const classic_theme = (ClassicThemeControl);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js
+;// CONCATENATED MODULE: external ["wp","warning"]
+const external_wp_warning_namespaceObject = window["wp"]["warning"];
+var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp_warning_namespaceObject);
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/preferences-modal/enable-panel.js
+/**
+ * WordPress dependencies
+ */
+
+
+
/**
+ * Internal dependencies
+ */
+
+
+const {
+ PreferenceBaseOption
+} = unlock(external_wp_preferences_namespaceObject.privateApis);
+/* harmony default export */ const enable_panel = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, {
+ panelName
+}) => {
+ const {
+ isEditorPanelEnabled,
+ isEditorPanelRemoved
+ } = select(store_store);
+ return {
+ isRemoved: isEditorPanelRemoved(panelName),
+ isChecked: isEditorPanelEnabled(panelName)
+ };
+}), (0,external_wp_compose_namespaceObject.ifCondition)(({
+ isRemoved
+}) => !isRemoved), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, {
+ panelName
+}) => ({
+ onChange: () => dispatch(store_store).toggleEditorPanelEnabled(panelName)
+})))(PreferenceBaseOption));
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/preferences-modal/enable-plugin-document-setting-panel.js
+/**
* WordPress dependencies
*/
-const check_check = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"
-}));
-/* harmony default export */ const library_check = (check_check);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/swap-template-button.js
+/**
+ * Internal dependencies
+ */
+
+
+const {
+ Fill,
+ Slot
+} = (0,external_wp_components_namespaceObject.createSlotFill)('EnablePluginDocumentSettingPanelOption');
+const EnablePluginDocumentSettingPanelOption = ({
+ label,
+ panelName
+}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_panel, {
+ label: label,
+ panelName: panelName
+ })
+});
+EnablePluginDocumentSettingPanelOption.Slot = Slot;
+/* harmony default export */ const enable_plugin_document_setting_panel = (EnablePluginDocumentSettingPanelOption);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/plugin-document-setting-panel/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+const {
+ Fill: plugin_document_setting_panel_Fill,
+ Slot: plugin_document_setting_panel_Slot
+} = (0,external_wp_components_namespaceObject.createSlotFill)('PluginDocumentSettingPanel');
+
+/**
+ * Renders items below the Status & Availability panel in the Document Sidebar.
+ *
+ * @param {Object} props Component properties.
+ * @param {string} props.name Required. A machine-friendly name for the panel.
+ * @param {string} [props.className] An optional class name added to the row.
+ * @param {string} [props.title] The title of the panel
+ * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
+ * @param {Element} props.children Children to be rendered
+ *
+ * @example
+ * ```js
+ * // Using ES5 syntax
+ * var el = React.createElement;
+ * var __ = wp.i18n.__;
+ * var registerPlugin = wp.plugins.registerPlugin;
+ * var PluginDocumentSettingPanel = wp.editor.PluginDocumentSettingPanel;
+ *
+ * function MyDocumentSettingPlugin() {
+ * return el(
+ * PluginDocumentSettingPanel,
+ * {
+ * className: 'my-document-setting-plugin',
+ * title: 'My Panel',
+ * name: 'my-panel',
+ * },
+ * __( 'My Document Setting Panel' )
+ * );
+ * }
+ *
+ * registerPlugin( 'my-document-setting-plugin', {
+ * render: MyDocumentSettingPlugin
+ * } );
+ * ```
+ *
+ * @example
+ * ```jsx
+ * // Using ESNext syntax
+ * import { registerPlugin } from '@wordpress/plugins';
+ * import { PluginDocumentSettingPanel } from '@wordpress/editor';
+ *
+ * const MyDocumentSettingTest = () => (
+ * <PluginDocumentSettingPanel className="my-document-setting-plugin" title="My Panel" name="my-panel">
+ * <p>My Document Setting Panel</p>
+ * </PluginDocumentSettingPanel>
+ * );
+ *
+ * registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } );
+ * ```
+ *
+ * @return {Component} The component to be rendered.
+ */
+const PluginDocumentSettingPanel = ({
+ name,
+ className,
+ title,
+ icon,
+ children
+}) => {
+ const {
+ name: pluginName
+ } = (0,external_wp_plugins_namespaceObject.usePluginContext)();
+ const panelName = `${pluginName}/${name}`;
+ const {
+ opened,
+ isEnabled
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ isEditorPanelOpened,
+ isEditorPanelEnabled
+ } = select(store_store);
+ return {
+ opened: isEditorPanelOpened(panelName),
+ isEnabled: isEditorPanelEnabled(panelName)
+ };
+ }, [panelName]);
+ const {
+ toggleEditorPanelOpened
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
+ if (undefined === name) {
+ true ? external_wp_warning_default()('PluginDocumentSettingPanel requires a name property.') : 0;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_plugin_document_setting_panel, {
+ label: title,
+ panelName: panelName
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_document_setting_panel_Fill, {
+ children: isEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, {
+ className: className,
+ title: title,
+ icon: icon,
+ opened: opened,
+ onToggle: () => toggleEditorPanelOpened(panelName),
+ children: children
+ })
+ })]
+ });
+};
+PluginDocumentSettingPanel.Slot = plugin_document_setting_panel_Slot;
+/* harmony default export */ const plugin_document_setting_panel = (PluginDocumentSettingPanel);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+const isEverySelectedBlockAllowed = (selected, allowed) => selected.filter(id => !allowed.includes(id)).length === 0;
+
+/**
+ * Plugins may want to add an item to the menu either for every block
+ * or only for the specific ones provided in the `allowedBlocks` component property.
+ *
+ * If there are multiple blocks selected the item will be rendered if every block
+ * is of one allowed type (not necessarily the same).
+ *
+ * @param {string[]} selectedBlocks Array containing the names of the blocks selected
+ * @param {string[]} allowedBlocks Array containing the names of the blocks allowed
+ * @return {boolean} Whether the item will be rendered or not.
+ */
+const shouldRenderItem = (selectedBlocks, allowedBlocks) => !Array.isArray(allowedBlocks) || isEverySelectedBlockAllowed(selectedBlocks, allowedBlocks);
+
+/**
+ * Renders a new item in the block settings menu.
+ *
+ * @param {Object} props Component props.
+ * @param {Array} [props.allowedBlocks] An array containing a list of block names for which the item should be shown. If not present, it'll be rendered for any block. If multiple blocks are selected, it'll be shown if and only if all of them are in the allowed list.
+ * @param {WPBlockTypeIconRender} [props.icon] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element.
+ * @param {string} props.label The menu item text.
+ * @param {Function} props.onClick Callback function to be executed when the user click the menu item.
+ * @param {boolean} [props.small] Whether to render the label or not.
+ * @param {string} [props.role] The ARIA role for the menu item.
+ *
+ * @example
+ * ```js
+ * // Using ES5 syntax
+ * var __ = wp.i18n.__;
+ * var PluginBlockSettingsMenuItem = wp.editor.PluginBlockSettingsMenuItem;
+ *
+ * function doOnClick(){
+ * // To be called when the user clicks the menu item.
+ * }
+ *
+ * function MyPluginBlockSettingsMenuItem() {
+ * return React.createElement(
+ * PluginBlockSettingsMenuItem,
+ * {
+ * allowedBlocks: [ 'core/paragraph' ],
+ * icon: 'dashicon-name',
+ * label: __( 'Menu item text' ),
+ * onClick: doOnClick,
+ * }
+ * );
+ * }
+ * ```
+ *
+ * @example
+ * ```jsx
+ * // Using ESNext syntax
+ * import { __ } from '@wordpress/i18n';
+ * import { PluginBlockSettingsMenuItem } from '@wordpress/editor';
+ *
+ * const doOnClick = ( ) => {
+ * // To be called when the user clicks the menu item.
+ * };
+ *
+ * const MyPluginBlockSettingsMenuItem = () => (
+ * <PluginBlockSettingsMenuItem
+ * allowedBlocks={ [ 'core/paragraph' ] }
+ * icon='dashicon-name'
+ * label={ __( 'Menu item text' ) }
+ * onClick={ doOnClick } />
+ * );
+ * ```
+ *
+ * @return {Component} The component to be rendered.
+ */
+const PluginBlockSettingsMenuItem = ({
+ allowedBlocks,
+ icon,
+ label,
+ onClick,
+ small,
+ role
+}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, {
+ children: ({
+ selectedBlocks,
+ onClose
+ }) => {
+ if (!shouldRenderItem(selectedBlocks, allowedBlocks)) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ onClick: (0,external_wp_compose_namespaceObject.compose)(onClick, onClose),
+ icon: icon,
+ label: small ? label : undefined,
+ role: role,
+ children: !small && label
+ });
+ }
+});
+/* harmony default export */ const plugin_block_settings_menu_item = (PluginBlockSettingsMenuItem);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/plugin-more-menu-item/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+/**
+ * Renders a menu item in `Plugins` group in `More Menu` drop down, and can be used to as a button or link depending on the props provided.
+ * The text within the component appears as the menu item label.
+ *
+ * @param {Object} props Component properties.
+ * @param {string} [props.href] When `href` is provided then the menu item is represented as an anchor rather than button. It corresponds to the `href` attribute of the anchor.
+ * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label.
+ * @param {Function} [props.onClick=noop] The callback function to be executed when the user clicks the menu item.
+ * @param {...*} [props.other] Any additional props are passed through to the underlying [Button](/packages/components/src/button/README.md) component.
+ *
+ * @example
+ * ```js
+ * // Using ES5 syntax
+ * var __ = wp.i18n.__;
+ * var PluginMoreMenuItem = wp.editor.PluginMoreMenuItem;
+ * var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
+ *
+ * function onButtonClick() {
+ * alert( 'Button clicked.' );
+ * }
+ *
+ * function MyButtonMoreMenuItem() {
+ * return wp.element.createElement(
+ * PluginMoreMenuItem,
+ * {
+ * icon: moreIcon,
+ * onClick: onButtonClick,
+ * },
+ * __( 'My button title' )
+ * );
+ * }
+ * ```
+ *
+ * @example
+ * ```jsx
+ * // Using ESNext syntax
+ * import { __ } from '@wordpress/i18n';
+ * import { PluginMoreMenuItem } from '@wordpress/editor';
+ * import { more } from '@wordpress/icons';
+ *
+ * function onButtonClick() {
+ * alert( 'Button clicked.' );
+ * }
+ *
+ * const MyButtonMoreMenuItem = () => (
+ * <PluginMoreMenuItem
+ * icon={ more }
+ * onClick={ onButtonClick }
+ * >
+ * { __( 'My button title' ) }
+ * </PluginMoreMenuItem>
+ * );
+ * ```
+ *
+ * @return {Component} The component to be rendered.
+ */
+/* harmony default export */ const plugin_more_menu_item = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
+ var _ownProps$as;
+ return {
+ as: (_ownProps$as = ownProps.as) !== null && _ownProps$as !== void 0 ? _ownProps$as : external_wp_components_namespaceObject.MenuItem,
+ icon: ownProps.icon || context.icon,
+ name: 'core/plugin-more-menu'
+ };
+}))(action_item));
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/plugin-post-publish-panel/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+const {
+ Fill: plugin_post_publish_panel_Fill,
+ Slot: plugin_post_publish_panel_Slot
+} = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPostPublishPanel');
+
+/**
+ * Renders provided content to the post-publish panel in the publish flow
+ * (side panel that opens after a user publishes the post).
+ *
+ * @param {Object} props Component properties.
+ * @param {string} [props.className] An optional class name added to the panel.
+ * @param {string} [props.title] Title displayed at the top of the panel.
+ * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened. When no title is provided it is always opened.
+ * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
+ * @param {Element} props.children Children to be rendered
+ *
+ * @example
+ * ```jsx
+ * // Using ESNext syntax
+ * import { __ } from '@wordpress/i18n';
+ * import { PluginPostPublishPanel } from '@wordpress/editor';
+ *
+ * const MyPluginPostPublishPanel = () => (
+ * <PluginPostPublishPanel
+ * className="my-plugin-post-publish-panel"
+ * title={ __( 'My panel title' ) }
+ * initialOpen={ true }
+ * >
+ * { __( 'My panel content' ) }
+ * </PluginPostPublishPanel>
+ * );
+ * ```
+ *
+ * @return {Component} The component to be rendered.
+ */
+const PluginPostPublishPanel = ({
+ children,
+ className,
+ title,
+ initialOpen = false,
+ icon
+}) => {
+ const {
+ icon: pluginIcon
+ } = (0,external_wp_plugins_namespaceObject.usePluginContext)();
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_post_publish_panel_Fill, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, {
+ className: className,
+ initialOpen: initialOpen || !title,
+ title: title,
+ icon: icon !== null && icon !== void 0 ? icon : pluginIcon,
+ children: children
+ })
+ });
+};
+PluginPostPublishPanel.Slot = plugin_post_publish_panel_Slot;
+/* harmony default export */ const plugin_post_publish_panel = (PluginPostPublishPanel);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/plugin-post-status-info/index.js
+/**
+ * Defines as extensibility slot for the Summary panel.
+ */
+
+/**
+ * WordPress dependencies
+ */
+
+
+const {
+ Fill: plugin_post_status_info_Fill,
+ Slot: plugin_post_status_info_Slot
+} = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPostStatusInfo');
+
+/**
+ * Renders a row in the Summary panel of the Document sidebar.
+ * It should be noted that this is named and implemented around the function it serves
+ * and not its location, which may change in future iterations.
+ *
+ * @param {Object} props Component properties.
+ * @param {string} [props.className] An optional class name added to the row.
+ * @param {Element} props.children Children to be rendered.
+ *
+ * @example
+ * ```js
+ * // Using ES5 syntax
+ * var __ = wp.i18n.__;
+ * var PluginPostStatusInfo = wp.editor.PluginPostStatusInfo;
+ *
+ * function MyPluginPostStatusInfo() {
+ * return React.createElement(
+ * PluginPostStatusInfo,
+ * {
+ * className: 'my-plugin-post-status-info',
+ * },
+ * __( 'My post status info' )
+ * )
+ * }
+ * ```
+ *
+ * @example
+ * ```jsx
+ * // Using ESNext syntax
+ * import { __ } from '@wordpress/i18n';
+ * import { PluginPostStatusInfo } from '@wordpress/editor';
+ *
+ * const MyPluginPostStatusInfo = () => (
+ * <PluginPostStatusInfo
+ * className="my-plugin-post-status-info"
+ * >
+ * { __( 'My post status info' ) }
+ * </PluginPostStatusInfo>
+ * );
+ * ```
+ *
+ * @return {Component} The component to be rendered.
+ */
+const PluginPostStatusInfo = ({
+ children,
+ className
+}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_post_status_info_Fill, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelRow, {
+ className: className,
+ children: children
+ })
+});
+PluginPostStatusInfo.Slot = plugin_post_status_info_Slot;
+/* harmony default export */ const plugin_post_status_info = (PluginPostStatusInfo);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/plugin-pre-publish-panel/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+const {
+ Fill: plugin_pre_publish_panel_Fill,
+ Slot: plugin_pre_publish_panel_Slot
+} = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPrePublishPanel');
/**
+ * Renders provided content to the pre-publish side panel in the publish flow
+ * (side panel that opens when a user first pushes "Publish" from the main editor).
+ *
+ * @param {Object} props Component props.
+ * @param {string} [props.className] An optional class name added to the panel.
+ * @param {string} [props.title] Title displayed at the top of the panel.
+ * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened.
+ * When no title is provided it is always opened.
+ * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/)
+ * icon slug string, or an SVG WP element, to be rendered when
+ * the sidebar is pinned to toolbar.
+ * @param {Element} props.children Children to be rendered
+ *
+ * @example
+ * ```jsx
+ * // Using ESNext syntax
+ * import { __ } from '@wordpress/i18n';
+ * import { PluginPrePublishPanel } from '@wordpress/editor';
+ *
+ * const MyPluginPrePublishPanel = () => (
+ * <PluginPrePublishPanel
+ * className="my-plugin-pre-publish-panel"
+ * title={ __( 'My panel title' ) }
+ * initialOpen={ true }
+ * >
+ * { __( 'My panel content' ) }
+ * </PluginPrePublishPanel>
+ * );
+ * ```
+ *
+ * @return {Component} The component to be rendered.
+ */
+const PluginPrePublishPanel = ({
+ children,
+ className,
+ title,
+ initialOpen = false,
+ icon
+}) => {
+ const {
+ icon: pluginIcon
+ } = (0,external_wp_plugins_namespaceObject.usePluginContext)();
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_pre_publish_panel_Fill, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, {
+ className: className,
+ initialOpen: initialOpen || !title,
+ title: title,
+ icon: icon !== null && icon !== void 0 ? icon : pluginIcon,
+ children: children
+ })
+ });
+};
+PluginPrePublishPanel.Slot = plugin_pre_publish_panel_Slot;
+/* harmony default export */ const plugin_pre_publish_panel = (PluginPrePublishPanel);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/plugin-sidebar/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+/**
+ * Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar.
+ * It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`.
+ * If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API:
+ *
+ * ```js
+ * wp.data.dispatch( 'core/edit-post' ).openGeneralSidebar( 'plugin-name/sidebar-name' );
+ * ```
+ *
+ * @see PluginSidebarMoreMenuItem
+ *
+ * @param {Object} props Element props.
+ * @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin.
+ * @param {string} [props.className] An optional class name added to the sidebar body.
+ * @param {string} props.title Title displayed at the top of the sidebar.
+ * @param {boolean} [props.isPinnable=true] Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item.
+ * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
+ *
+ * @example
+ * ```js
+ * // Using ES5 syntax
+ * var __ = wp.i18n.__;
+ * var el = React.createElement;
+ * var PanelBody = wp.components.PanelBody;
+ * var PluginSidebar = wp.editor.PluginSidebar;
+ * var moreIcon = React.createElement( 'svg' ); //... svg element.
+ *
+ * function MyPluginSidebar() {
+ * return el(
+ * PluginSidebar,
+ * {
+ * name: 'my-sidebar',
+ * title: 'My sidebar title',
+ * icon: moreIcon,
+ * },
+ * el(
+ * PanelBody,
+ * {},
+ * __( 'My sidebar content' )
+ * )
+ * );
+ * }
+ * ```
+ *
+ * @example
+ * ```jsx
+ * // Using ESNext syntax
+ * import { __ } from '@wordpress/i18n';
+ * import { PanelBody } from '@wordpress/components';
+ * import { PluginSidebar } from '@wordpress/editor';
+ * import { more } from '@wordpress/icons';
+ *
+ * const MyPluginSidebar = () => (
+ * <PluginSidebar
+ * name="my-sidebar"
+ * title="My sidebar title"
+ * icon={ more }
+ * >
+ * <PanelBody>
+ * { __( 'My sidebar content' ) }
+ * </PanelBody>
+ * </PluginSidebar>
+ * );
+ * ```
+ */
+
+function PluginSidebar({
+ className,
+ ...props
+}) {
+ const {
+ postTitle,
+ shortcut
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ return {
+ postTitle: select(store_store).getEditedPostAttribute('title'),
+ shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/editor/toggle-sidebar')
+ };
+ }, []);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area, {
+ panelClassName: className,
+ className: "editor-sidebar",
+ smallScreenTitle: postTitle || (0,external_wp_i18n_namespaceObject.__)('(no title)'),
+ scope: "core",
+ toggleShortcut: shortcut,
+ ...props
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/plugin-sidebar-more-menu-item/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+/**
+ * Renders a menu item in `Plugins` group in `More Menu` drop down,
+ * and can be used to activate the corresponding `PluginSidebar` component.
+ * The text within the component appears as the menu item label.
+ *
+ * @param {Object} props Component props.
+ * @param {string} props.target A string identifying the target sidebar you wish to be activated by this menu item. Must be the same as the `name` prop you have given to that sidebar.
+ * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label.
+ *
+ * @example
+ * ```js
+ * // Using ES5 syntax
+ * var __ = wp.i18n.__;
+ * var PluginSidebarMoreMenuItem = wp.editor.PluginSidebarMoreMenuItem;
+ * var moreIcon = React.createElement( 'svg' ); //... svg element.
+ *
+ * function MySidebarMoreMenuItem() {
+ * return React.createElement(
+ * PluginSidebarMoreMenuItem,
+ * {
+ * target: 'my-sidebar',
+ * icon: moreIcon,
+ * },
+ * __( 'My sidebar title' )
+ * )
+ * }
+ * ```
+ *
+ * @example
+ * ```jsx
+ * // Using ESNext syntax
+ * import { __ } from '@wordpress/i18n';
+ * import { PluginSidebarMoreMenuItem } from '@wordpress/editor';
+ * import { more } from '@wordpress/icons';
+ *
+ * const MySidebarMoreMenuItem = () => (
+ * <PluginSidebarMoreMenuItem
+ * target="my-sidebar"
+ * icon={ more }
+ * >
+ * { __( 'My sidebar title' ) }
+ * </PluginSidebarMoreMenuItem>
+ * );
+ * ```
+ *
+ * @return {Component} The component to be rendered.
+ */
+
+function PluginSidebarMoreMenuItem(props) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryAreaMoreMenuItem
+ // Menu item is marked with unstable prop for backward compatibility.
+ // @see https://github.com/WordPress/gutenberg/issues/14457
+ , {
+ __unstableExplicitMenuItem: true,
+ scope: "core",
+ ...props
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/swap-template-button.js
+/**
* WordPress dependencies
*/
@@ -8002,13 +11298,13 @@ const check_check = (0,external_React_.createElement)(external_wp_primitives_nam
* Internal dependencies
*/
+
+
+
function SwapTemplateButton({
onClick
}) {
const [showModal, setShowModal] = (0,external_wp_element_namespaceObject.useState)(false);
- const onClose = (0,external_wp_element_namespaceObject.useCallback)(() => {
- setShowModal(false);
- }, []);
const {
postType,
postId
@@ -8026,22 +11322,27 @@ function SwapTemplateButton({
}, {
undoIgnore: true
});
- onClose(); // Close the template suggestions modal first.
+ setShowModal(false); // Close the template suggestions modal first.
onClick();
};
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- onClick: () => setShowModal(true)
- }, (0,external_wp_i18n_namespaceObject.__)('Swap template')), showModal && (0,external_React_.createElement)(external_wp_components_namespaceObject.Modal, {
- title: (0,external_wp_i18n_namespaceObject.__)('Choose a template'),
- onRequestClose: onClose,
- overlayClassName: "editor-post-template__swap-template-modal",
- isFullScreen: true
- }, (0,external_React_.createElement)("div", {
- className: "editor-post-template__swap-template-modal-content"
- }, (0,external_React_.createElement)(TemplatesList, {
- postType: postType,
- onSelect: onTemplateSelect
- }))));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ onClick: () => setShowModal(true),
+ children: (0,external_wp_i18n_namespaceObject.__)('Swap template')
+ }), showModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Choose a template'),
+ onRequestClose: () => setShowModal(false),
+ overlayClassName: "editor-post-template__swap-template-modal",
+ isFullScreen: true,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "editor-post-template__swap-template-modal-content",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplatesList, {
+ postType: postType,
+ onSelect: onTemplateSelect
+ })
+ })
+ })]
+ });
}
function TemplatesList({
postType,
@@ -8055,7 +11356,7 @@ function TemplatesList({
id: template.id
})), [availableTemplates]);
const shownTemplates = (0,external_wp_compose_namespaceObject.useAsyncList)(templatesAsPatterns);
- return (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, {
label: (0,external_wp_i18n_namespaceObject.__)('Templates'),
blockPatterns: templatesAsPatterns,
shownPatterns: shownTemplates,
@@ -8064,7 +11365,6 @@ function TemplatesList({
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/reset-default-template.js
-
/**
* WordPress dependencies
*/
@@ -8077,6 +11377,7 @@ function TemplatesList({
* Internal dependencies
*/
+
function ResetDefaultTemplate({
onClick
}) {
@@ -8093,7 +11394,7 @@ function ResetDefaultTemplate({
if (!currentTemplateSlug || !allowSwitchingTemplate) {
return null;
}
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
onClick: () => {
editEntityRecord('postType', postType, postId, {
template: ''
@@ -8101,12 +11402,12 @@ function ResetDefaultTemplate({
undoIgnore: true
});
onClick();
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Use default template'));
+ },
+ children: (0,external_wp_i18n_namespaceObject.__)('Use default template')
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/create-new-template.js
-
/**
* WordPress dependencies
*/
@@ -8121,6 +11422,9 @@ function ResetDefaultTemplate({
*/
+
+
+
function CreateNewTemplate({
onClick
}) {
@@ -8141,20 +11445,22 @@ function CreateNewTemplate({
if (!canCreateTemplates || !allowSwitchingTemplate) {
return null;
}
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- onClick: () => {
- setIsCreateModalOpen(true);
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Create new template')), isCreateModalOpen && (0,external_React_.createElement)(CreateNewTemplateModal, {
- onClose: () => {
- setIsCreateModalOpen(false);
- onClick();
- }
- }));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ onClick: () => {
+ setIsCreateModalOpen(true);
+ },
+ children: (0,external_wp_i18n_namespaceObject.__)('Create new template')
+ }), isCreateModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateNewTemplateModal, {
+ onClose: () => {
+ setIsCreateModalOpen(false);
+ onClick();
+ }
+ })]
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/block-theme.js
-
/**
* WordPress dependencies
*/
@@ -8174,6 +11480,9 @@ function CreateNewTemplate({
+
+
+
const block_theme_POPOVER_PROPS = {
className: 'editor-post-template__dropdown',
placement: 'bottom-start'
@@ -8209,6 +11518,10 @@ function BlockThemeControl({
const {
setRenderingMode
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
+ const canCreateTemplate = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ var _select$canUser;
+ return (_select$canUser = select(external_wp_coreData_namespaceObject.store).canUser('create', 'templates')) !== null && _select$canUser !== void 0 ? _select$canUser : false;
+ });
if (!hasResolved) {
return null;
}
@@ -8219,90 +11532,78 @@ function BlockThemeControl({
label: (0,external_wp_i18n_namespaceObject.__)('Go back'),
onClick: () => getEditorSettings().onNavigateToPreviousEntityRecord()
}] : undefined;
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, {
popoverProps: block_theme_POPOVER_PROPS,
focusOnMount: true,
toggleProps: {
- __next40pxDefaultSize: true,
- variant: 'tertiary'
+ size: 'compact',
+ variant: 'tertiary',
+ tooltipPosition: 'middle left'
},
label: (0,external_wp_i18n_namespaceObject.__)('Template options'),
text: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title),
- icon: null
- }, ({
- onClose
- }) => (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- onClick: () => {
- onNavigateToEntityRecord({
- postId: template.id,
- postType: 'wp_template'
- });
- onClose();
- createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Editing template. Changes made here affect all posts and pages that use the template.'), {
- type: 'snackbar',
- actions: notificationAction
- });
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Edit template')), (0,external_React_.createElement)(SwapTemplateButton, {
- onClick: onClose
- }), (0,external_React_.createElement)(ResetDefaultTemplate, {
- onClick: onClose
- }), (0,external_React_.createElement)(CreateNewTemplate, {
- onClick: onClose
- })), (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- icon: !isTemplateHidden ? library_check : undefined,
- isSelected: !isTemplateHidden,
- role: "menuitemcheckbox",
- onClick: () => {
- setRenderingMode(isTemplateHidden ? 'template-locked' : 'post-only');
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Template preview')))));
+ icon: null,
+ children: ({
+ onClose
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, {
+ children: [canCreateTemplate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ onClick: () => {
+ onNavigateToEntityRecord({
+ postId: template.id,
+ postType: 'wp_template'
+ });
+ onClose();
+ createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Editing template. Changes made here affect all posts and pages that use the template.'), {
+ type: 'snackbar',
+ actions: notificationAction
+ });
+ },
+ children: (0,external_wp_i18n_namespaceObject.__)('Edit template')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SwapTemplateButton, {
+ onClick: onClose
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResetDefaultTemplate, {
+ onClick: onClose
+ }), canCreateTemplate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateNewTemplate, {
+ onClick: onClose
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ icon: !isTemplateHidden ? library_check : undefined,
+ isSelected: !isTemplateHidden,
+ role: "menuitemcheckbox",
+ onClick: () => {
+ setRenderingMode(isTemplateHidden ? 'template-locked' : 'post-only');
+ },
+ children: (0,external_wp_i18n_namespaceObject.__)('Show template')
+ })
+ })]
+ })
+ });
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-panel-row/index.js
-
-/**
- * External dependencies
- */
-
-
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/panel.js
/**
* WordPress dependencies
*/
-const PostPanelRow = (0,external_wp_element_namespaceObject.forwardRef)(({
- className,
- label,
- children
-}, ref) => {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- className: classnames_default()('editor-post-panel__row', className),
- ref: ref
- }, label && (0,external_React_.createElement)("div", {
- className: "editor-post-panel__row-label"
- }, label), (0,external_React_.createElement)("div", {
- className: "editor-post-panel__row-control"
- }, children));
-});
-/* harmony default export */ const post_panel_row = (PostPanelRow);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/panel.js
/**
- * WordPress dependencies
+ * Internal dependencies
*/
+
/**
- * Internal dependencies
+ * Displays the template controls based on the current editor settings and user permissions.
+ *
+ * @return {JSX.Element|null} The rendered PostTemplatePanel component.
*/
-
-
-
function PostTemplatePanel() {
const {
templateId,
@@ -8340,16 +11641,18 @@ function PostTemplatePanel() {
return (_select$canUser2 = select(external_wp_coreData_namespaceObject.store).canUser('read', 'templates')) !== null && _select$canUser2 !== void 0 ? _select$canUser2 : false;
}, []);
if ((!isBlockTheme || !canViewTemplates) && isVisible) {
- return (0,external_React_.createElement)(post_panel_row, {
- label: (0,external_wp_i18n_namespaceObject.__)('Template')
- }, (0,external_React_.createElement)(classic_theme, null));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Template'),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(classic_theme, {})
+ });
}
if (isBlockTheme && !!templateId) {
- return (0,external_React_.createElement)(post_panel_row, {
- label: (0,external_wp_i18n_namespaceObject.__)('Template')
- }, (0,external_React_.createElement)(BlockThemeControl, {
- id: templateId
- }));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Template'),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockThemeControl, {
+ id: templateId
+ })
+ });
}
return null;
}
@@ -8427,12 +11730,12 @@ function useAuthorsQuery(search) {
}, [authors, postAuthor]);
return {
authorId,
- authorOptions
+ authorOptions,
+ postAuthor
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/combobox.js
-
/**
* WordPress dependencies
*/
@@ -8447,6 +11750,7 @@ function useAuthorsQuery(search) {
*/
+
function PostAuthorCombobox() {
const [fieldValue, setFieldValue] = (0,external_wp_element_namespaceObject.useState)();
const {
@@ -8479,7 +11783,7 @@ function PostAuthorCombobox() {
const handleKeydown = inputValue => {
setFieldValue(inputValue);
};
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.ComboboxControl, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ComboboxControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Author'),
@@ -8487,12 +11791,12 @@ function PostAuthorCombobox() {
value: authorId,
onFilterValueChange: (0,external_wp_compose_namespaceObject.debounce)(handleKeydown, 300),
onChange: handleSelect,
- allowReset: false
+ allowReset: false,
+ hideLabelFromVision: true
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/select.js
-
/**
* WordPress dependencies
*/
@@ -8505,6 +11809,7 @@ function PostAuthorCombobox() {
*/
+
function PostAuthorSelect() {
const {
editPost
@@ -8519,19 +11824,19 @@ function PostAuthorSelect() {
author
});
};
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.SelectControl, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, {
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true,
className: "post-author-selector",
label: (0,external_wp_i18n_namespaceObject.__)('Author'),
options: authorOptions,
onChange: setAuthorId,
- value: authorId
+ value: authorId,
+ hideLabelFromVision: true
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/index.js
-
/**
* WordPress dependencies
*/
@@ -8544,21 +11849,27 @@ function PostAuthorSelect() {
+
const minimumUsersForCombobox = 25;
+
+/**
+ * Renders the component for selecting the post author.
+ *
+ * @return {Component} The component to be rendered.
+ */
function PostAuthor() {
const showCombobox = (0,external_wp_data_namespaceObject.useSelect)(select => {
const authors = select(external_wp_coreData_namespaceObject.store).getUsers(AUTHORS_QUERY);
return authors?.length >= minimumUsersForCombobox;
}, []);
if (showCombobox) {
- return (0,external_React_.createElement)(PostAuthorCombobox, null);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostAuthorCombobox, {});
}
- return (0,external_React_.createElement)(PostAuthorSelect, null);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostAuthorSelect, {});
}
/* harmony default export */ const post_author = (PostAuthor);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/check.js
-
/**
* WordPress dependencies
*/
@@ -8571,6 +11882,17 @@ function PostAuthor() {
+
+/**
+ * Wrapper component that renders its children only if the post type supports the author.
+ *
+ * @param {Object} props The component props.
+ * @param {Element} props.children Children to be rendered.
+ *
+ * @return {Component|null} The component to be rendered. Return `null` if the post type doesn't
+ * supports the author or if there are no authors available.
+ */
+
function PostAuthorCheck({
children
}) {
@@ -8589,12 +11911,20 @@ function PostAuthorCheck({
if (!hasAssignAuthorAction || !hasAuthors) {
return null;
}
- return (0,external_React_.createElement)(post_type_support_check, {
- supportKeys: "author"
- }, children);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, {
+ supportKeys: "author",
+ children: children
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/panel.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
/**
* Internal dependencies
@@ -8602,15 +11932,81 @@ function PostAuthorCheck({
+
+
+
+function PostAuthorToggle({
+ isOpen,
+ onClick
+}) {
+ const {
+ postAuthor
+ } = useAuthorsQuery();
+ const authorName = postAuthor?.name || '';
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ size: "compact",
+ className: "editor-post-author__panel-toggle",
+ variant: "tertiary",
+ "aria-expanded": isOpen
+ // translators: %s: Current post link.
+ ,
+ "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Change author: %s'), authorName),
+ onClick: onClick,
+ children: authorName
+ });
+}
+
+/**
+ * Renders the Post Author Panel component.
+ *
+ * @return {Component} The component to be rendered.
+ */
function panel_PostAuthor() {
- return (0,external_React_.createElement)(PostAuthorCheck, null, (0,external_React_.createElement)(post_panel_row, {
- className: "editor-post-author__panel"
- }, (0,external_React_.createElement)(post_author, null)));
+ // Use internal state instead of a ref to make sure that the component
+ // re-renders when the popover's anchor updates.
+ const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
+ // Memoize popoverProps to avoid returning a new object every time.
+ const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
+ // Anchor the popover to the middle of the entire row so that it doesn't
+ // move around when the label changes.
+ anchor: popoverAnchor,
+ placement: 'left-start',
+ offset: 36,
+ shift: true
+ }), [popoverAnchor]);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostAuthorCheck, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Author'),
+ ref: setPopoverAnchor,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
+ popoverProps: popoverProps,
+ contentClassName: "editor-post-author__panel-dialog",
+ focusOnMount: true,
+ renderToggle: ({
+ isOpen,
+ onToggle
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostAuthorToggle, {
+ isOpen: isOpen,
+ onClick: onToggle
+ }),
+ renderContent: ({
+ onClose
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "editor-post-author",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Author'),
+ onClose: onClose
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_author, {
+ onClose: onClose
+ })]
+ })
+ })
+ })
+ });
}
-/* harmony default export */ const post_author_panel = (panel_PostAuthor);
+/* harmony default export */ const panel = (panel_PostAuthor);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-comments/index.js
-
/**
* WordPress dependencies
*/
@@ -8622,6 +12018,32 @@ function panel_PostAuthor() {
* Internal dependencies
*/
+
+
+
+const COMMENT_OPTIONS = [{
+ label: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [(0,external_wp_i18n_namespaceObject.__)('Open'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ variant: "muted",
+ size: 12,
+ children: (0,external_wp_i18n_namespaceObject.__)('Visitors can add new comments and replies.')
+ })]
+ }),
+ value: 'open'
+}, {
+ label: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [(0,external_wp_i18n_namespaceObject.__)('Closed'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ variant: "muted",
+ size: 12,
+ children: (0,external_wp_i18n_namespaceObject.__)('Visitors cannot add new comments or replies.')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ variant: "muted",
+ size: 12,
+ children: (0,external_wp_i18n_namespaceObject.__)('Existing comments remain visible.')
+ })]
+ }),
+ value: 'closed'
+}];
function PostComments() {
const commentStatus = (0,external_wp_data_namespaceObject.useSelect)(select => {
var _select$getEditedPost;
@@ -8630,20 +12052,32 @@ function PostComments() {
const {
editPost
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- const onToggleComments = () => editPost({
- comment_status: commentStatus === 'open' ? 'closed' : 'open'
+ const handleStatus = newCommentStatus => editPost({
+ comment_status: newCommentStatus
});
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
- __nextHasNoMarginBottom: true,
- label: (0,external_wp_i18n_namespaceObject.__)('Allow comments'),
- checked: commentStatus === 'open',
- onChange: onToggleComments
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 4,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RadioControl, {
+ className: "editor-change-status__options",
+ hideLabelFromVision: true,
+ label: (0,external_wp_i18n_namespaceObject.__)('Comment status'),
+ options: COMMENT_OPTIONS,
+ onChange: handleStatus,
+ selected: commentStatus
+ })
+ })
});
}
+
+/**
+ * A form for managing comment status.
+ *
+ * @return {JSX.Element} The rendered PostComments component.
+ */
/* harmony default export */ const post_comments = (PostComments);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pingbacks/index.js
-
/**
* WordPress dependencies
*/
@@ -8655,6 +12089,7 @@ function PostComments() {
* Internal dependencies
*/
+
function PostPingbacks() {
const pingStatus = (0,external_wp_data_namespaceObject.useSelect)(select => {
var _select$getEditedPost;
@@ -8666,17 +12101,27 @@ function PostPingbacks() {
const onTogglePingback = () => editPost({
ping_status: pingStatus === 'open' ? 'closed' : 'open'
});
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, {
__nextHasNoMarginBottom: true,
- label: (0,external_wp_i18n_namespaceObject.__)('Allow pingbacks & trackbacks'),
+ label: (0,external_wp_i18n_namespaceObject.__)('Enable pingbacks & trackbacks'),
checked: pingStatus === 'open',
- onChange: onTogglePingback
+ onChange: onTogglePingback,
+ help: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, {
+ href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/trackbacks-and-pingbacks/'),
+ children: (0,external_wp_i18n_namespaceObject.__)('Learn more about pingbacks & trackbacks')
+ })
});
}
+
+/**
+ * Renders a control for enabling or disabling pingbacks and trackbacks
+ * in a WordPress post.
+ *
+ * @module PostPingbacks
+ */
/* harmony default export */ const post_pingbacks = (PostPingbacks);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-discussion/panel.js
-
/**
* WordPress dependencies
*/
@@ -8684,6 +12129,9 @@ function PostPingbacks() {
+
+
+
/**
* Internal dependencies
*/
@@ -8691,43 +12139,141 @@ function PostPingbacks() {
+
+
+
const panel_PANEL_NAME = 'discussion-panel';
-function PostDiscussionPanel() {
+function ModalContents({
+ onClose
+}) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "editor-post-discussion",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Discussion'),
+ onClose: onClose
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 4,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, {
+ supportKeys: "comments",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_comments, {})
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, {
+ supportKeys: "trackbacks",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_pingbacks, {})
+ })]
+ })]
+ });
+}
+function PostDiscussionToggle({
+ isOpen,
+ onClick
+}) {
const {
- isEnabled,
- isOpened
+ commentStatus,
+ pingStatus,
+ commentsSupported,
+ trackbacksSupported
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ var _getEditedPostAttribu, _getEditedPostAttribu2;
const {
- isEditorPanelEnabled,
- isEditorPanelOpened
+ getEditedPostAttribute
} = select(store_store);
+ const {
+ getPostType
+ } = select(external_wp_coreData_namespaceObject.store);
+ const postType = getPostType(getEditedPostAttribute('type'));
return {
- isEnabled: isEditorPanelEnabled(panel_PANEL_NAME),
- isOpened: isEditorPanelOpened(panel_PANEL_NAME)
+ commentStatus: (_getEditedPostAttribu = getEditedPostAttribute('comment_status')) !== null && _getEditedPostAttribu !== void 0 ? _getEditedPostAttribu : 'open',
+ pingStatus: (_getEditedPostAttribu2 = getEditedPostAttribute('ping_status')) !== null && _getEditedPostAttribu2 !== void 0 ? _getEditedPostAttribu2 : 'open',
+ commentsSupported: !!postType.supports.comments,
+ trackbacksSupported: !!postType.supports.trackbacks
};
}, []);
+ let label;
+ if (commentStatus === 'open') {
+ if (pingStatus === 'open') {
+ label = (0,external_wp_i18n_namespaceObject.__)('Open');
+ } else {
+ label = trackbacksSupported ? (0,external_wp_i18n_namespaceObject.__)('Comments only') : (0,external_wp_i18n_namespaceObject.__)('Open');
+ }
+ } else if (pingStatus === 'open') {
+ label = commentsSupported ? (0,external_wp_i18n_namespaceObject.__)('Pings only') : (0,external_wp_i18n_namespaceObject.__)('Pings enabled');
+ } else {
+ label = (0,external_wp_i18n_namespaceObject.__)('Closed');
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ size: "compact",
+ className: "editor-post-discussion__panel-toggle",
+ variant: "tertiary",
+ "aria-label": (0,external_wp_i18n_namespaceObject.__)('Change discussion options'),
+ "aria-expanded": isOpen,
+ onClick: onClick,
+ children: label
+ });
+}
+
+/**
+ * This component allows to update comment and pingback
+ * settings for the current post. Internally there are
+ * checks whether the current post has support for the
+ * above and if the `discussion-panel` panel is enabled.
+ *
+ * @return {JSX.Element|null} The rendered PostDiscussionPanel component.
+ */
+function PostDiscussionPanel() {
const {
- toggleEditorPanelOpened
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
+ isEnabled
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ isEditorPanelEnabled
+ } = select(store_store);
+ return {
+ isEnabled: isEditorPanelEnabled(panel_PANEL_NAME)
+ };
+ }, []);
+
+ // Use internal state instead of a ref to make sure that the component
+ // re-renders when the popover's anchor updates.
+ const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
+ // Memoize popoverProps to avoid returning a new object every time.
+ const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
+ // Anchor the popover to the middle of the entire row so that it doesn't
+ // move around when the label changes.
+ anchor: popoverAnchor,
+ placement: 'left-start',
+ offset: 36,
+ shift: true
+ }), [popoverAnchor]);
if (!isEnabled) {
return null;
}
- return (0,external_React_.createElement)(post_type_support_check, {
- supportKeys: ['comments', 'trackbacks']
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, {
- title: (0,external_wp_i18n_namespaceObject.__)('Discussion'),
- opened: isOpened,
- onToggle: () => toggleEditorPanelOpened(panel_PANEL_NAME)
- }, (0,external_React_.createElement)(post_type_support_check, {
- supportKeys: "comments"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_React_.createElement)(post_comments, null))), (0,external_React_.createElement)(post_type_support_check, {
- supportKeys: "trackbacks"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_React_.createElement)(post_pingbacks, null)))));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, {
+ supportKeys: ['comments', 'trackbacks'],
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Discussion'),
+ ref: setPopoverAnchor,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
+ popoverProps: popoverProps,
+ className: "editor-post-discussion__panel-dropdown",
+ contentClassName: "editor-post-discussion__panel-dialog",
+ focusOnMount: true,
+ renderToggle: ({
+ isOpen,
+ onToggle
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostDiscussionToggle, {
+ isOpen: isOpen,
+ onClick: onToggle
+ }),
+ renderContent: ({
+ onClose
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ModalContents, {
+ onClose: onClose
+ })
+ })
+ })
+ });
}
-/* harmony default export */ const post_discussion_panel = (PostDiscussionPanel);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-excerpt/index.js
-
/**
* WordPress dependencies
*/
@@ -8735,67 +12281,102 @@ function PostDiscussionPanel() {
+
+
/**
* Internal dependencies
*/
-function PostExcerpt() {
- const excerpt = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('excerpt'), []);
+
+/**
+ * Renders an editable textarea for the post excerpt.
+ * Templates, template parts and patterns use the `excerpt` field as a description semantically.
+ * Additionally templates and template parts override the `excerpt` field as `description` in
+ * REST API. So this component handles proper labeling and updating the edited entity.
+ *
+ * @param {Object} props - Component props.
+ * @param {boolean} [props.hideLabelFromVision=false] - Whether to visually hide the textarea's label.
+ * @param {boolean} [props.updateOnBlur=false] - Whether to update the post on change or use local state and update on blur.
+ */
+
+function PostExcerpt({
+ hideLabelFromVision = false,
+ updateOnBlur = false
+}) {
+ const {
+ excerpt,
+ shouldUseDescriptionLabel,
+ usedAttribute
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getCurrentPostType,
+ getEditedPostAttribute
+ } = select(store_store);
+ const postType = getCurrentPostType();
+ // This special case is unfortunate, but the REST API of wp_template and wp_template_part
+ // support the excerpt field throught the "description" field rather than "excerpt".
+ const _usedAttribute = ['wp_template', 'wp_template_part'].includes(postType) ? 'description' : 'excerpt';
+ return {
+ excerpt: getEditedPostAttribute(_usedAttribute),
+ // There are special cases where we want to label the excerpt as a description.
+ shouldUseDescriptionLabel: ['wp_template', 'wp_template_part', 'wp_block'].includes(postType),
+ usedAttribute: _usedAttribute
+ };
+ }, []);
const {
editPost
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- return (0,external_React_.createElement)("div", {
- className: "editor-post-excerpt"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.TextareaControl, {
- __nextHasNoMarginBottom: true,
- label: (0,external_wp_i18n_namespaceObject.__)('Write an excerpt (optional)'),
- className: "editor-post-excerpt__textarea",
- onChange: value => editPost({
- excerpt: value
- }),
- value: excerpt
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.ExternalLink, {
- href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/page-post-settings-sidebar/#excerpt')
- }, (0,external_wp_i18n_namespaceObject.__)('Learn more about manual excerpts')));
+ const [localExcerpt, setLocalExcerpt] = (0,external_wp_element_namespaceObject.useState)((0,external_wp_htmlEntities_namespaceObject.decodeEntities)(excerpt));
+ const updatePost = value => {
+ editPost({
+ [usedAttribute]: value
+ });
+ };
+ const label = shouldUseDescriptionLabel ? (0,external_wp_i18n_namespaceObject.__)('Write a description (optional)') : (0,external_wp_i18n_namespaceObject.__)('Write an excerpt (optional)');
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "editor-post-excerpt",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextareaControl, {
+ __nextHasNoMarginBottom: true,
+ label: label,
+ hideLabelFromVision: hideLabelFromVision,
+ className: "editor-post-excerpt__textarea",
+ onChange: updateOnBlur ? setLocalExcerpt : updatePost,
+ onBlur: updateOnBlur ? () => updatePost(localExcerpt) : undefined,
+ value: updateOnBlur ? localExcerpt : excerpt,
+ help: !shouldUseDescriptionLabel ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, {
+ href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/page-post-settings-sidebar/#excerpt'),
+ children: (0,external_wp_i18n_namespaceObject.__)('Learn more about manual excerpts')
+ }) : (0,external_wp_i18n_namespaceObject.__)('Write a description')
+ })
+ });
}
-/* harmony default export */ const post_excerpt = (PostExcerpt);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-excerpt/check.js
-
/**
- * WordPress dependencies
+ * Internal dependencies
*/
/**
- * Internal dependencies
+ * Component for checking if the post type supports the excerpt field.
+ *
+ * @param {Object} props Props.
+ * @param {Element} props.children Children to be rendered.
+ *
+ * @return {Component} The component to be rendered.
*/
-
function PostExcerptCheck({
children
}) {
- const postType = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getEditedPostAttribute
- } = select(store_store);
- return getEditedPostAttribute('type');
- }, []);
-
- // This special case is unfortunate, but the REST API of wp_template and wp_template_part
- // support the excerpt field throught the "description" field rather than "excerpt" which means
- // the default ExcerptPanel won't work for these.
- if (['wp_template', 'wp_template_part'].includes(postType)) {
- return null;
- }
- return (0,external_React_.createElement)(post_type_support_check, {
- supportKeys: "excerpt"
- }, children);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, {
+ supportKeys: "excerpt",
+ children: children
+ });
}
/* harmony default export */ const post_excerpt_check = (PostExcerptCheck);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-excerpt/plugin.js
-
/**
* Defines as extensibility slot for the Excerpt panel.
*/
@@ -8804,9 +12385,10 @@ function PostExcerptCheck({
* WordPress dependencies
*/
+
const {
- Fill,
- Slot
+ Fill: plugin_Fill,
+ Slot: plugin_Slot
} = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPostExcerpt');
/**
@@ -8820,7 +12402,7 @@ const {
* ```js
* // Using ES5 syntax
* var __ = wp.i18n.__;
- * var PluginPostExcerpt = wp.editPost.PluginPostExcerpt;
+ * var PluginPostExcerpt = wp.editPost.__experimentalPluginPostExcerpt;
*
* function MyPluginPostExcerpt() {
* return React.createElement(
@@ -8837,7 +12419,7 @@ const {
* ```jsx
* // Using ESNext syntax
* import { __ } from '@wordpress/i18n';
- * import { PluginPostExcerpt } from '@wordpress/edit-post';
+ * import { __experimentalPluginPostExcerpt as PluginPostExcerpt } from '@wordpress/edit-post';
*
* const MyPluginPostExcerpt = () => (
* <PluginPostExcerpt className="my-plugin-post-excerpt">
@@ -8852,15 +12434,17 @@ const PluginPostExcerpt = ({
children,
className
}) => {
- return (0,external_React_.createElement)(Fill, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelRow, {
- className: className
- }, children));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_Fill, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelRow, {
+ className: className,
+ children: children
+ })
+ });
};
-PluginPostExcerpt.Slot = Slot;
+PluginPostExcerpt.Slot = plugin_Slot;
/* harmony default export */ const post_excerpt_plugin = (PluginPostExcerpt);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-excerpt/panel.js
-
/**
* WordPress dependencies
*/
@@ -8868,6 +12452,10 @@ PluginPostExcerpt.Slot = Slot;
+
+
+
+
/**
* Internal dependencies
*/
@@ -8876,22 +12464,29 @@ PluginPostExcerpt.Slot = Slot;
+
/**
* Module Constants
*/
+
+
+
const post_excerpt_panel_PANEL_NAME = 'post-excerpt';
-function PostExcerptPanel() {
+function ExcerptPanel() {
const {
isOpened,
- isEnabled
+ isEnabled,
+ postType
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
isEditorPanelOpened,
- isEditorPanelEnabled
+ isEditorPanelEnabled,
+ getCurrentPostType
} = select(store_store);
return {
isOpened: isEditorPanelOpened(post_excerpt_panel_PANEL_NAME),
- isEnabled: isEditorPanelEnabled(post_excerpt_panel_PANEL_NAME)
+ isEnabled: isEditorPanelEnabled(post_excerpt_panel_PANEL_NAME),
+ postType: getCurrentPostType()
};
}, []);
const {
@@ -8901,11 +12496,132 @@ function PostExcerptPanel() {
if (!isEnabled) {
return null;
}
- return (0,external_React_.createElement)(post_excerpt_check, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, {
- title: (0,external_wp_i18n_namespaceObject.__)('Excerpt'),
+
+ // There are special cases where we want to label the excerpt as a description.
+ const shouldUseDescriptionLabel = ['wp_template', 'wp_template_part', 'wp_block'].includes(postType);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, {
+ title: shouldUseDescriptionLabel ? (0,external_wp_i18n_namespaceObject.__)('Description') : (0,external_wp_i18n_namespaceObject.__)('Excerpt'),
opened: isOpened,
- onToggle: toggleExcerptPanel
- }, (0,external_React_.createElement)(post_excerpt_plugin.Slot, null, fills => (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(post_excerpt, null), fills))));
+ onToggle: toggleExcerptPanel,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_plugin.Slot, {
+ children: fills => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostExcerpt, {}), fills]
+ })
+ })
+ });
+}
+
+/**
+ * Is rendered if the post type supports excerpts and allows editing the excerpt.
+ *
+ * @return {JSX.Element} The rendered PostExcerptPanel component.
+ */
+function PostExcerptPanel() {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_check, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ExcerptPanel, {})
+ });
+}
+function PrivatePostExcerptPanel() {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_check, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateExcerpt, {})
+ });
+}
+function PrivateExcerpt() {
+ const {
+ shouldRender,
+ excerpt,
+ shouldBeUsedAsDescription,
+ allowEditing
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getCurrentPostType,
+ getCurrentPostId,
+ getEditedPostAttribute,
+ isEditorPanelEnabled
+ } = select(store_store);
+ const postType = getCurrentPostType();
+ const isTemplateOrTemplatePart = ['wp_template', 'wp_template_part'].includes(postType);
+ const isPattern = postType === 'wp_block';
+ // These post types use the `excerpt` field as a description semantically, so we need to
+ // handle proper labeling and some flows where we should always render them as text.
+ const _shouldBeUsedAsDescription = isTemplateOrTemplatePart || isPattern;
+ const _usedAttribute = isTemplateOrTemplatePart ? 'description' : 'excerpt';
+ // We need to fetch the entity in this case to check if we'll allow editing.
+ const template = isTemplateOrTemplatePart && select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', postType, getCurrentPostId());
+ // For post types that use excerpt as description, we do not abide
+ // by the `isEnabled` panel flag in order to render them as text.
+ const _shouldRender = isEditorPanelEnabled(post_excerpt_panel_PANEL_NAME) || _shouldBeUsedAsDescription;
+ return {
+ excerpt: getEditedPostAttribute(_usedAttribute),
+ shouldRender: _shouldRender,
+ shouldBeUsedAsDescription: _shouldBeUsedAsDescription,
+ // If we should render, allow editing for all post types that are not used as description.
+ // For the rest allow editing only for user generated entities.
+ allowEditing: _shouldRender && (!_shouldBeUsedAsDescription || isPattern || template && template.source === TEMPLATE_ORIGINS.custom && !template.has_theme_file)
+ };
+ }, []);
+ const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
+ const label = shouldBeUsedAsDescription ? (0,external_wp_i18n_namespaceObject.__)('Description') : (0,external_wp_i18n_namespaceObject.__)('Excerpt');
+ // Memoize popoverProps to avoid returning a new object every time.
+ const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
+ // Anchor the popover to the middle of the entire row so that it doesn't
+ // move around when the label changes.
+ anchor: popoverAnchor,
+ 'aria-label': label,
+ headerTitle: label,
+ placement: 'left-start',
+ offset: 36,
+ shift: true
+ }), [popoverAnchor, label]);
+ if (!shouldRender) {
+ return false;
+ }
+ const excerptText = !!excerpt && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ align: "left",
+ numberOfLines: 4,
+ truncate: true,
+ children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(excerpt)
+ });
+ if (!allowEditing) {
+ return excerptText;
+ }
+ const excerptPlaceholder = shouldBeUsedAsDescription ? (0,external_wp_i18n_namespaceObject.__)('Add a description…') : (0,external_wp_i18n_namespaceObject.__)('Add an excerpt…');
+ const triggerEditLabel = shouldBeUsedAsDescription ? (0,external_wp_i18n_namespaceObject.__)('Edit description') : (0,external_wp_i18n_namespaceObject.__)('Edit excerpt');
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ children: [excerptText, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
+ className: "editor-post-excerpt__dropdown",
+ contentClassName: "editor-post-excerpt__dropdown__content",
+ popoverProps: popoverProps,
+ focusOnMount: true,
+ ref: setPopoverAnchor,
+ renderToggle: ({
+ onToggle
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ className: "editor-post-excerpt__dropdown__trigger",
+ onClick: onToggle,
+ variant: "link",
+ children: excerptText ? triggerEditLabel : excerptPlaceholder
+ }),
+ renderContent: ({
+ onClose
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
+ title: label,
+ onClose: onClose
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 4,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_plugin.Slot, {
+ children: fills => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostExcerpt, {
+ hideLabelFromVision: true,
+ updateOnBlur: true
+ }), fills]
+ })
+ })
+ })]
+ })
+ })]
+ });
}
;// CONCATENATED MODULE: external ["wp","blob"]
@@ -8922,11 +12638,18 @@ const external_wp_blob_namespaceObject = window["wp"]["blob"];
*/
function ThemeSupportCheck({
- themeSupports,
children,
- postType,
supportKeys
}) {
+ const {
+ postType,
+ themeSupports
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ return {
+ postType: select(store_store).getEditedPostAttribute('type'),
+ themeSupports: select(external_wp_coreData_namespaceObject.store).getThemeSupports()
+ };
+ }, []);
const isSupported = (Array.isArray(supportKeys) ? supportKeys : [supportKeys]).some(key => {
var _themeSupports$key;
const supported = (_themeSupports$key = themeSupports?.[key]) !== null && _themeSupports$key !== void 0 ? _themeSupports$key : false;
@@ -8944,39 +12667,38 @@ function ThemeSupportCheck({
}
return children;
}
-/* harmony default export */ const theme_support_check = ((0,external_wp_data_namespaceObject.withSelect)(select => {
- const {
- getThemeSupports
- } = select(external_wp_coreData_namespaceObject.store);
- const {
- getEditedPostAttribute
- } = select(store_store);
- return {
- postType: getEditedPostAttribute('type'),
- themeSupports: getThemeSupports()
- };
-})(ThemeSupportCheck));
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/check.js
-
/**
* Internal dependencies
*/
+
+/**
+ * Wrapper component that renders its children only if the post type supports a featured image
+ * and the theme supports post thumbnails.
+ *
+ * @param {Object} props Props.
+ * @param {Element} props.children Children to be rendered.
+ *
+ * @return {Component} The component to be rendered.
+ */
+
function PostFeaturedImageCheck({
children
}) {
- return (0,external_React_.createElement)(theme_support_check, {
- supportKeys: "post-thumbnails"
- }, (0,external_React_.createElement)(post_type_support_check, {
- supportKeys: "thumbnail"
- }, children));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ThemeSupportCheck, {
+ supportKeys: "post-thumbnails",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, {
+ supportKeys: "thumbnail",
+ children: children
+ })
+ });
}
/* harmony default export */ const post_featured_image_check = (PostFeaturedImageCheck);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/index.js
-
/**
* WordPress dependencies
*/
@@ -8995,12 +12717,16 @@ function PostFeaturedImageCheck({
*/
+
+
const ALLOWED_MEDIA_TYPES = ['image'];
// Used when labels from post type were not yet loaded or when they are not present.
const DEFAULT_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)('Featured image');
-const DEFAULT_SET_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)('Set featured image');
-const instructions = (0,external_React_.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('To edit the featured image, you need permission to upload media.'));
+const DEFAULT_SET_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)('Add a featured image');
+const instructions = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ children: (0,external_wp_i18n_namespaceObject.__)('To edit the featured image, you need permission to upload media.')
+});
function getMediaDetails(media, postId) {
var _media$media_details$, _media$media_details$2;
if (!media) {
@@ -9048,8 +12774,6 @@ function PostFeaturedImage({
getSettings
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
const {
- mediaWidth,
- mediaHeight,
mediaSourceUrl
} = getMediaDetails(media, currentPostId);
function onDropFiles(filesList) {
@@ -9072,56 +12796,63 @@ function PostFeaturedImage({
}
});
}
- return (0,external_React_.createElement)(post_featured_image_check, null, noticeUI, (0,external_React_.createElement)("div", {
- className: "editor-post-featured-image"
- }, media && (0,external_React_.createElement)("div", {
- id: `editor-post-featured-image-${featuredImageId}-describedby`,
- className: "hidden"
- }, media.alt_text && (0,external_wp_i18n_namespaceObject.sprintf)(
- // Translators: %s: The selected image alt text.
- (0,external_wp_i18n_namespaceObject.__)('Current image: %s'), media.alt_text), !media.alt_text && (0,external_wp_i18n_namespaceObject.sprintf)(
- // Translators: %s: The selected image filename.
- (0,external_wp_i18n_namespaceObject.__)('The current image has no alternative text. The file name is: %s'), media.media_details.sizes?.full?.file || media.slug)), (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.MediaUploadCheck, {
- fallback: instructions
- }, (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.MediaUpload, {
- title: postType?.labels?.featured_image || DEFAULT_FEATURE_IMAGE_LABEL,
- onSelect: onUpdateImage,
- unstableFeaturedImageFlow: true,
- allowedTypes: ALLOWED_MEDIA_TYPES,
- modalClass: "editor-post-featured-image__media-modal",
- render: ({
- open
- }) => (0,external_React_.createElement)("div", {
- className: "editor-post-featured-image__container"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- ref: toggleRef,
- className: !featuredImageId ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview',
- onClick: open,
- "aria-label": !featuredImageId ? null : (0,external_wp_i18n_namespaceObject.__)('Edit or replace the image'),
- "aria-describedby": !featuredImageId ? null : `editor-post-featured-image-${featuredImageId}-describedby`
- }, !!featuredImageId && media && (0,external_React_.createElement)(external_wp_components_namespaceObject.ResponsiveWrapper, {
- naturalWidth: mediaWidth,
- naturalHeight: mediaHeight,
- isInline: true
- }, (0,external_React_.createElement)("img", {
- src: mediaSourceUrl,
- alt: ""
- })), isLoading && (0,external_React_.createElement)(external_wp_components_namespaceObject.Spinner, null), !featuredImageId && !isLoading && (postType?.labels?.set_featured_image || DEFAULT_SET_FEATURE_IMAGE_LABEL)), !!featuredImageId && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- className: "editor-post-featured-image__actions"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- className: "editor-post-featured-image__action",
- onClick: open
- }, (0,external_wp_i18n_namespaceObject.__)('Replace')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- className: "editor-post-featured-image__action",
- onClick: () => {
- onRemoveImage();
- toggleRef.current.focus();
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Remove'))), (0,external_React_.createElement)(external_wp_components_namespaceObject.DropZone, {
- onFilesDrop: onDropFiles
- })),
- value: featuredImageId
- }))));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(post_featured_image_check, {
+ children: [noticeUI, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "editor-post-featured-image",
+ children: [media && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ id: `editor-post-featured-image-${featuredImageId}-describedby`,
+ className: "hidden",
+ children: [media.alt_text && (0,external_wp_i18n_namespaceObject.sprintf)(
+ // Translators: %s: The selected image alt text.
+ (0,external_wp_i18n_namespaceObject.__)('Current image: %s'), media.alt_text), !media.alt_text && (0,external_wp_i18n_namespaceObject.sprintf)(
+ // Translators: %s: The selected image filename.
+ (0,external_wp_i18n_namespaceObject.__)('The current image has no alternative text. The file name is: %s'), media.media_details.sizes?.full?.file || media.slug)]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.MediaUploadCheck, {
+ fallback: instructions,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.MediaUpload, {
+ title: postType?.labels?.featured_image || DEFAULT_FEATURE_IMAGE_LABEL,
+ onSelect: onUpdateImage,
+ unstableFeaturedImageFlow: true,
+ allowedTypes: ALLOWED_MEDIA_TYPES,
+ modalClass: "editor-post-featured-image__media-modal",
+ render: ({
+ open
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "editor-post-featured-image__container",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Button, {
+ ref: toggleRef,
+ className: !featuredImageId ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview',
+ onClick: open,
+ "aria-label": !featuredImageId ? null : (0,external_wp_i18n_namespaceObject.__)('Edit or replace the image'),
+ "aria-describedby": !featuredImageId ? null : `editor-post-featured-image-${featuredImageId}-describedby`,
+ children: [!!featuredImageId && media && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", {
+ className: "editor-post-featured-image__preview-image",
+ src: mediaSourceUrl,
+ alt: ""
+ }), isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}), !featuredImageId && !isLoading && (postType?.labels?.set_featured_image || DEFAULT_SET_FEATURE_IMAGE_LABEL)]
+ }), !!featuredImageId && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ className: "editor-post-featured-image__actions",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ className: "editor-post-featured-image__action",
+ onClick: open,
+ children: (0,external_wp_i18n_namespaceObject.__)('Replace')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ className: "editor-post-featured-image__action",
+ onClick: () => {
+ onRemoveImage();
+ toggleRef.current.focus();
+ },
+ children: (0,external_wp_i18n_namespaceObject.__)('Remove')
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropZone, {
+ onFilesDrop: onDropFiles
+ })]
+ }),
+ value: featuredImageId
+ })
+ })]
+ })]
+ });
}
const applyWithSelect = (0,external_wp_data_namespaceObject.withSelect)(select => {
const {
@@ -9178,10 +12909,25 @@ const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)((dis
}
};
});
+
+/**
+ * Renders the component for managing the featured image of a post.
+ *
+ * @param {Object} props Props.
+ * @param {number} props.currentPostId ID of the current post.
+ * @param {number} props.featuredImageId ID of the featured image.
+ * @param {Function} props.onUpdateImage Function to call when the image is updated.
+ * @param {Function} props.onRemoveImage Function to call when the image is removed.
+ * @param {Object} props.media The media object representing the featured image.
+ * @param {string} props.postType Post type.
+ * @param {Element} props.noticeUI UI for displaying notices.
+ * @param {Object} props.noticeOperations Operations for managing notices.
+ *
+ * @return {Element} Component to be rendered .
+ */
/* harmony default export */ const post_featured_image = ((0,external_wp_compose_namespaceObject.compose)(external_wp_components_namespaceObject.withNotices, applyWithSelect, applyWithDispatch, (0,external_wp_components_namespaceObject.withFilters)('editor.PostFeaturedImage'))(PostFeaturedImage));
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/panel.js
-
/**
* WordPress dependencies
*/
@@ -9196,8 +12942,21 @@ const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)((dis
+
const post_featured_image_panel_PANEL_NAME = 'featured-image';
-function FeaturedImage() {
+
+/**
+ * Renders the panel for the post featured image.
+ *
+ * @param {Object} props Props.
+ * @param {boolean} props.withPanelBody Whether to include the panel body. Default true.
+ *
+ * @return {Component|null} The component to be rendered.
+ * Return Null if the editor panel is disabled for featured image.
+ */
+function PostFeaturedImagePanel({
+ withPanelBody = true
+}) {
var _postType$labels$feat;
const {
postType,
@@ -9224,16 +12983,22 @@ function FeaturedImage() {
if (!isEnabled) {
return null;
}
- return (0,external_React_.createElement)(post_featured_image_check, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, {
- title: (_postType$labels$feat = postType?.labels?.featured_image) !== null && _postType$labels$feat !== void 0 ? _postType$labels$feat : (0,external_wp_i18n_namespaceObject.__)('Featured image'),
- opened: isOpened,
- onToggle: () => toggleEditorPanelOpened(post_featured_image_panel_PANEL_NAME)
- }, (0,external_React_.createElement)(post_featured_image, null)));
+ if (!withPanelBody) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image_check, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image, {})
+ });
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image_check, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, {
+ title: (_postType$labels$feat = postType?.labels?.featured_image) !== null && _postType$labels$feat !== void 0 ? _postType$labels$feat : (0,external_wp_i18n_namespaceObject.__)('Featured image'),
+ opened: isOpened,
+ onToggle: () => toggleEditorPanelOpened(post_featured_image_panel_PANEL_NAME),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image, {})
+ })
+ });
}
-/* harmony default export */ const post_featured_image_panel = (FeaturedImage);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-format/check.js
-
/**
* WordPress dependencies
*/
@@ -9244,6 +13009,7 @@ function FeaturedImage() {
*/
+
function PostFormatCheck({
children
}) {
@@ -9251,14 +13017,23 @@ function PostFormatCheck({
if (disablePostFormats) {
return null;
}
- return (0,external_React_.createElement)(post_type_support_check, {
- supportKeys: "post-formats"
- }, children);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, {
+ supportKeys: "post-formats",
+ children: children
+ });
}
+
+/**
+ * Component check if there are any post formats.
+ *
+ * @param {Object} props The component props.
+ * @param {Element} props.children The child elements to render.
+ *
+ * @return {Component|null} The rendered component or null if post formats are disabled.
+ */
/* harmony default export */ const post_format_check = (PostFormatCheck);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-format/index.js
-
/**
* WordPress dependencies
*/
@@ -9275,6 +13050,8 @@ function PostFormatCheck({
// All WP post formats, sorted alphabetically by translated name.
+
+
const POST_FORMATS = [{
id: 'aside',
caption: (0,external_wp_i18n_namespaceObject.__)('Aside')
@@ -9316,6 +13093,17 @@ const POST_FORMATS = [{
}
return 0;
});
+
+/**
+ * `PostFormat` a component that allows changing the post format while also providing a suggestion for the current post.
+ *
+ * @example
+ * ```jsx
+ * <PostFormat />
+ * ```
+ *
+ * @return {JSX.Element} The rendered PostFormat component.
+ */
function PostFormat() {
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostFormat);
const postFormatSelectorId = `post-format-selector-${instanceId}`;
@@ -9348,43 +13136,49 @@ function PostFormat() {
const onUpdatePostFormat = format => editPost({
format
});
- return (0,external_React_.createElement)(post_format_check, null, (0,external_React_.createElement)("div", {
- className: "editor-post-format"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.SelectControl, {
- __nextHasNoMarginBottom: true,
- label: (0,external_wp_i18n_namespaceObject.__)('Post Format'),
- value: postFormat,
- onChange: format => onUpdatePostFormat(format),
- id: postFormatSelectorId,
- options: formats.map(format => ({
- label: format.caption,
- value: format.id
- }))
- }), suggestion && suggestion.id !== postFormat && (0,external_React_.createElement)("p", {
- className: "editor-post-format__suggestion"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "link",
- onClick: () => onUpdatePostFormat(suggestion.id)
- }, (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: post format */
- (0,external_wp_i18n_namespaceObject.__)('Apply suggested format: %s'), suggestion.caption)))));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_format_check, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "editor-post-format",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RadioControl, {
+ className: "editor-post-format__options",
+ label: (0,external_wp_i18n_namespaceObject.__)('Post Format'),
+ selected: postFormat,
+ onChange: format => onUpdatePostFormat(format),
+ id: postFormatSelectorId,
+ options: formats.map(format => ({
+ label: format.caption,
+ value: format.id
+ })),
+ hideLabelFromVision: true
+ }), suggestion && suggestion.id !== postFormat && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ className: "editor-post-format__suggestion",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "link",
+ onClick: () => onUpdatePostFormat(suggestion.id),
+ children: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: post format */
+ (0,external_wp_i18n_namespaceObject.__)('Apply suggested format: %s'), suggestion.caption)
+ })
+ })]
+ })
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/backup.js
-
/**
* WordPress dependencies
*/
-const backup = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+const backup = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z"
-}));
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z"
+ })
+});
/* harmony default export */ const library_backup = (backup);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/check.js
-
/**
* WordPress dependencies
*/
@@ -9395,6 +13189,16 @@ const backup = (0,external_React_.createElement)(external_wp_primitives_namespac
*/
+
+/**
+ * Wrapper component that renders its children if the post has more than one revision.
+ *
+ * @param {Object} props Props.
+ * @param {Element} props.children Children to be rendered.
+ *
+ * @return {Component|null} Rendered child components if post has more than one revision, otherwise null.
+ */
+
function PostLastRevisionCheck({
children
}) {
@@ -9414,14 +13218,14 @@ function PostLastRevisionCheck({
if (!lastRevisionId || revisionsCount < 2) {
return null;
}
- return (0,external_React_.createElement)(post_type_support_check, {
- supportKeys: "revisions"
- }, children);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, {
+ supportKeys: "revisions",
+ children: children
+ });
}
/* harmony default export */ const post_last_revision_check = (PostLastRevisionCheck);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/index.js
-
/**
* WordPress dependencies
*/
@@ -9436,11 +13240,10 @@ function PostLastRevisionCheck({
*/
-function LastRevision() {
- const {
- lastRevisionId,
- revisionsCount
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+
+
+function usePostLastRevisionInfo() {
+ return (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getCurrentPostLastRevisionId,
getCurrentPostRevisionsCount
@@ -9450,21 +13253,53 @@ function LastRevision() {
revisionsCount: getCurrentPostRevisionsCount()
};
}, []);
- return (0,external_React_.createElement)(post_last_revision_check, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- href: (0,external_wp_url_namespaceObject.addQueryArgs)('revision.php', {
- revision: lastRevisionId
- }),
- className: "editor-post-last-revision__title",
- icon: library_backup,
- iconPosition: "right",
- text: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: number of revisions */
- (0,external_wp_i18n_namespaceObject.__)('Revisions (%s)'), revisionsCount)
- }));
}
-/* harmony default export */ const post_last_revision = (LastRevision);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/panel.js
+/**
+ * Renders the component for displaying the last revision of a post.
+ *
+ * @return {Component} The component to be rendered.
+ */
+function PostLastRevision() {
+ const {
+ lastRevisionId,
+ revisionsCount
+ } = usePostLastRevisionInfo();
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_last_revision_check, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ href: (0,external_wp_url_namespaceObject.addQueryArgs)('revision.php', {
+ revision: lastRevisionId
+ }),
+ className: "editor-post-last-revision__title",
+ icon: library_backup,
+ iconPosition: "right",
+ text: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: number of revisions */
+ (0,external_wp_i18n_namespaceObject.__)('Revisions (%s)'), revisionsCount)
+ })
+ });
+}
+function PrivatePostLastRevision() {
+ const {
+ lastRevisionId,
+ revisionsCount
+ } = usePostLastRevisionInfo();
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_last_revision_check, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Revisions'),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ href: (0,external_wp_url_namespaceObject.addQueryArgs)('revision.php', {
+ revision: lastRevisionId
+ }),
+ className: "editor-private-post-last-revision__button",
+ text: revisionsCount,
+ variant: "tertiary"
+ })
+ })
+ });
+}
+/* harmony default export */ const post_last_revision = (PostLastRevision);
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/panel.js
/**
* WordPress dependencies
*/
@@ -9475,15 +13310,24 @@ function LastRevision() {
*/
+
+/**
+ * Renders the panel for displaying the last revision of a post.
+ *
+ * @return {Component} The component to be rendered.
+ */
+
function PostLastRevisionPanel() {
- return (0,external_React_.createElement)(post_last_revision_check, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, {
- className: "editor-post-last-revision__panel"
- }, (0,external_React_.createElement)(post_last_revision, null)));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_last_revision_check, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, {
+ className: "editor-post-last-revision__panel",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_last_revision, {})
+ })
+ });
}
/* harmony default export */ const post_last_revision_panel = (PostLastRevisionPanel);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-locked-modal/index.js
-
/**
* WordPress dependencies
*/
@@ -9500,6 +13344,16 @@ function PostLastRevisionPanel() {
* Internal dependencies
*/
+
+/**
+ * A modal component that is displayed when a post is locked for editing by another user.
+ * The modal provides information about the lock status and options to take over or exit the editor.
+ *
+ * @return {JSX.Element|null} The rendered PostLockedModal component.
+ */
+
+
+
function PostLockedModal() {
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostLockedModal);
const hookName = 'core/editor/post-locked-modal-' + instanceId;
@@ -9637,44 +13491,61 @@ function PostLockedModal() {
post_type: postType?.slug
});
const allPostsLabel = (0,external_wp_i18n_namespaceObject.__)('Exit editor');
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Modal, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, {
title: isTakeover ? (0,external_wp_i18n_namespaceObject.__)('Someone else has taken over this post') : (0,external_wp_i18n_namespaceObject.__)('This post is already being edited'),
focusOnMount: true,
shouldCloseOnClickOutside: false,
shouldCloseOnEsc: false,
isDismissible: false,
- size: "medium"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- alignment: "top",
- spacing: 6
- }, !!userAvatar && (0,external_React_.createElement)("img", {
- src: userAvatar,
- alt: (0,external_wp_i18n_namespaceObject.__)('Avatar'),
- className: "editor-post-locked-modal__avatar",
- width: 64,
- height: 64
- }), (0,external_React_.createElement)("div", null, !!isTakeover && (0,external_React_.createElement)("p", null, (0,external_wp_element_namespaceObject.createInterpolateElement)(userDisplayName ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: user's display name */
- (0,external_wp_i18n_namespaceObject.__)('<strong>%s</strong> now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'), userDisplayName) : (0,external_wp_i18n_namespaceObject.__)('Another user now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'), {
- strong: (0,external_React_.createElement)("strong", null),
- PreviewLink: (0,external_React_.createElement)(external_wp_components_namespaceObject.ExternalLink, {
- href: previewLink
- }, (0,external_wp_i18n_namespaceObject.__)('preview'))
- })), !isTakeover && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("p", null, (0,external_wp_element_namespaceObject.createInterpolateElement)(userDisplayName ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: user's display name */
- (0,external_wp_i18n_namespaceObject.__)('<strong>%s</strong> is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'), userDisplayName) : (0,external_wp_i18n_namespaceObject.__)('Another user is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'), {
- strong: (0,external_React_.createElement)("strong", null),
- PreviewLink: (0,external_React_.createElement)(external_wp_components_namespaceObject.ExternalLink, {
- href: previewLink
- }, (0,external_wp_i18n_namespaceObject.__)('preview'))
- })), (0,external_React_.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('If you take over, the other user will lose editing control to the post, but their changes will be saved.'))), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- className: "editor-post-locked-modal__buttons",
- justify: "flex-end"
- }, !isTakeover && (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "tertiary",
- href: unlockUrl
- }, (0,external_wp_i18n_namespaceObject.__)('Take over')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "primary",
- href: allPostsUrl
- }, allPostsLabel)))));
+ size: "medium",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ alignment: "top",
+ spacing: 6,
+ children: [!!userAvatar && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", {
+ src: userAvatar,
+ alt: (0,external_wp_i18n_namespaceObject.__)('Avatar'),
+ className: "editor-post-locked-modal__avatar",
+ width: 64,
+ height: 64
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ children: [!!isTakeover && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ children: (0,external_wp_element_namespaceObject.createInterpolateElement)(userDisplayName ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: user's display name */
+ (0,external_wp_i18n_namespaceObject.__)('<strong>%s</strong> now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'), userDisplayName) : (0,external_wp_i18n_namespaceObject.__)('Another user now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'), {
+ strong: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", {}),
+ PreviewLink: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, {
+ href: previewLink,
+ children: (0,external_wp_i18n_namespaceObject.__)('preview')
+ })
+ })
+ }), !isTakeover && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ children: (0,external_wp_element_namespaceObject.createInterpolateElement)(userDisplayName ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: user's display name */
+ (0,external_wp_i18n_namespaceObject.__)('<strong>%s</strong> is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'), userDisplayName) : (0,external_wp_i18n_namespaceObject.__)('Another user is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'), {
+ strong: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", {}),
+ PreviewLink: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, {
+ href: previewLink,
+ children: (0,external_wp_i18n_namespaceObject.__)('preview')
+ })
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ children: (0,external_wp_i18n_namespaceObject.__)('If you take over, the other user will lose editing control to the post, but their changes will be saved.')
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ className: "editor-post-locked-modal__buttons",
+ justify: "flex-end",
+ children: [!isTakeover && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "tertiary",
+ href: unlockUrl,
+ children: (0,external_wp_i18n_namespaceObject.__)('Take over')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "primary",
+ href: allPostsUrl,
+ children: allPostsLabel
+ })]
+ })]
+ })]
+ })
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pending-status/check.js
@@ -9687,6 +13558,17 @@ function PostLockedModal() {
* Internal dependencies
*/
+
+/**
+ * This component checks the publishing status of the current post.
+ * If the post is already published or the user doesn't have the
+ * capability to publish, it returns null.
+ *
+ * @param {Object} props Component properties.
+ * @param {Element} props.children Children to be rendered.
+ *
+ * @return {JSX.Element|null} The rendered child elements or null if the post is already published or the user doesn't have the capability to publish.
+ */
function PostPendingStatusCheck({
children
}) {
@@ -9712,7 +13594,6 @@ function PostPendingStatusCheck({
/* harmony default export */ const post_pending_status_check = (PostPendingStatusCheck);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pending-status/index.js
-
/**
* WordPress dependencies
*/
@@ -9725,6 +13606,13 @@ function PostPendingStatusCheck({
*/
+
+/**
+ * A component for displaying and toggling the pending status of a post.
+ *
+ * @return {JSX.Element} The rendered component.
+ */
+
function PostPendingStatus() {
const status = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('status'), []);
const {
@@ -9736,17 +13624,18 @@ function PostPendingStatus() {
status: updatedStatus
});
};
- return (0,external_React_.createElement)(post_pending_status_check, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
- __nextHasNoMarginBottom: true,
- label: (0,external_wp_i18n_namespaceObject.__)('Pending review'),
- checked: status === 'pending',
- onChange: togglePendingStatus
- }));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_pending_status_check, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, {
+ __nextHasNoMarginBottom: true,
+ label: (0,external_wp_i18n_namespaceObject.__)('Pending review'),
+ checked: status === 'pending',
+ onChange: togglePendingStatus
+ })
+ });
}
/* harmony default export */ const post_pending_status = (PostPendingStatus);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-preview-button/index.js
-
/**
* WordPress dependencies
*/
@@ -9761,21 +13650,28 @@ function PostPendingStatus() {
* Internal dependencies
*/
+
+
+
function writeInterstitialMessage(targetDocument) {
- let markup = (0,external_wp_element_namespaceObject.renderToString)((0,external_React_.createElement)("div", {
- className: "editor-post-preview-button__interstitial-message"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 96 96"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Path, {
- className: "outer",
- d: "M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36",
- fill: "none"
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Path, {
- className: "inner",
- d: "M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z",
- fill: "none"
- })), (0,external_React_.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Generating preview…'))));
+ let markup = (0,external_wp_element_namespaceObject.renderToString)( /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "editor-post-preview-button__interstitial-message",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 96 96",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, {
+ className: "outer",
+ d: "M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36",
+ fill: "none"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, {
+ className: "inner",
+ d: "M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z",
+ fill: "none"
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ children: (0,external_wp_i18n_namespaceObject.__)('Generating preview…')
+ })]
+ }));
markup += `
<style>
body {
@@ -9841,6 +13737,22 @@ function writeInterstitialMessage(targetDocument) {
targetDocument.title = (0,external_wp_i18n_namespaceObject.__)('Generating preview…');
targetDocument.close();
}
+
+/**
+ * Renders a button that opens a new window or tab for the preview,
+ * writes the interstitial message to this window, and then navigates
+ * to the actual preview link. The button is not rendered if the post
+ * is not viewable and disabled if the post is not saveable.
+ *
+ * @param {Object} props The component props.
+ * @param {string} props.className The class name for the button.
+ * @param {string} props.textContent The text content for the button.
+ * @param {boolean} props.forceIsAutosaveable Whether to force autosave.
+ * @param {string} props.role The role attribute for the button.
+ * @param {Function} props.onPreview The callback function for preview event.
+ *
+ * @return {JSX.Element|null} The rendered button component.
+ */
function PostPreviewButton({
className,
textContent,
@@ -9901,18 +13813,24 @@ function PostPreviewButton({
// changes that were autosaved since the post was last published. Otherwise,
// just link to the post's URL.
const href = previewLink || currentPostLink;
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
variant: !className ? 'tertiary' : undefined,
className: className || 'editor-post-preview',
href: href,
target: targetId,
+ __experimentalIsFocusable: true,
disabled: !isSaveable,
onClick: openPreviewWindow,
- role: role
- }, textContent || (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_wp_i18n_namespaceObject._x)('Preview', 'imperative verb'), (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
- as: "span"
- }, /* translators: accessibility text */
- (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)'))));
+ role: role,
+ size: "compact",
+ children: textContent || /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [(0,external_wp_i18n_namespaceObject._x)('Preview', 'imperative verb'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, {
+ as: "span",
+ children: /* translators: accessibility text */
+ (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)')
+ })]
+ })
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-button/label.js
@@ -9927,63 +13845,66 @@ function PostPreviewButton({
* Internal dependencies
*/
-function PublishButtonLabel({
- isPublished,
- isBeingScheduled,
- isSaving,
- isPublishing,
- hasPublishAction,
- isAutosaving,
- hasNonPostEntityChanges
-}) {
+function PublishButtonLabel() {
+ const isSmallerThanMediumViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
+ const {
+ isPublished,
+ isBeingScheduled,
+ isSaving,
+ isPublishing,
+ hasPublishAction,
+ isAutosaving,
+ hasNonPostEntityChanges,
+ postStatusHasChanged,
+ postStatus
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ var _getCurrentPost$_link;
+ const {
+ isCurrentPostPublished,
+ isEditedPostBeingScheduled,
+ isSavingPost,
+ isPublishingPost,
+ getCurrentPost,
+ getCurrentPostType,
+ isAutosavingPost,
+ getPostEdits,
+ getEditedPostAttribute
+ } = select(store_store);
+ return {
+ isPublished: isCurrentPostPublished(),
+ isBeingScheduled: isEditedPostBeingScheduled(),
+ isSaving: isSavingPost(),
+ isPublishing: isPublishingPost(),
+ hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false,
+ postType: getCurrentPostType(),
+ isAutosaving: isAutosavingPost(),
+ hasNonPostEntityChanges: select(store_store).hasNonPostEntityChanges(),
+ postStatusHasChanged: !!getPostEdits()?.status,
+ postStatus: getEditedPostAttribute('status')
+ };
+ }, []);
if (isPublishing) {
/* translators: button label text should, if possible, be under 16 characters. */
return (0,external_wp_i18n_namespaceObject.__)('Publishing…');
- } else if (isPublished && isSaving && !isAutosaving) {
- /* translators: button label text should, if possible, be under 16 characters. */
- return (0,external_wp_i18n_namespaceObject.__)('Updating…');
- } else if (isBeingScheduled && isSaving && !isAutosaving) {
+ } else if ((isPublished || isBeingScheduled) && isSaving && !isAutosaving) {
/* translators: button label text should, if possible, be under 16 characters. */
- return (0,external_wp_i18n_namespaceObject.__)('Scheduling…');
+ return (0,external_wp_i18n_namespaceObject.__)('Saving…');
}
if (!hasPublishAction) {
- return hasNonPostEntityChanges ? (0,external_wp_i18n_namespaceObject.__)('Submit for Review…') : (0,external_wp_i18n_namespaceObject.__)('Submit for Review');
- } else if (isPublished) {
- return hasNonPostEntityChanges ? (0,external_wp_i18n_namespaceObject.__)('Update…') : (0,external_wp_i18n_namespaceObject.__)('Update');
- } else if (isBeingScheduled) {
- return hasNonPostEntityChanges ? (0,external_wp_i18n_namespaceObject.__)('Schedule…') : (0,external_wp_i18n_namespaceObject.__)('Schedule');
+ // TODO: this is because "Submit for review" string is too long in some languages.
+ // @see https://github.com/WordPress/gutenberg/issues/10475
+ return isSmallerThanMediumViewport ? (0,external_wp_i18n_namespaceObject.__)('Publish') : (0,external_wp_i18n_namespaceObject.__)('Submit for Review');
+ }
+ if (hasNonPostEntityChanges || isPublished || postStatusHasChanged && !['future', 'publish'].includes(postStatus) || !postStatusHasChanged && postStatus === 'future') {
+ return (0,external_wp_i18n_namespaceObject.__)('Save');
+ }
+ if (isBeingScheduled) {
+ return (0,external_wp_i18n_namespaceObject.__)('Schedule');
}
return (0,external_wp_i18n_namespaceObject.__)('Publish');
}
-/* harmony default export */ const label = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
- var _getCurrentPost$_link;
- const {
- isCurrentPostPublished,
- isEditedPostBeingScheduled,
- isSavingPost,
- isPublishingPost,
- getCurrentPost,
- getCurrentPostType,
- isAutosavingPost
- } = select(store_store);
- return {
- isPublished: isCurrentPostPublished(),
- isBeingScheduled: isEditedPostBeingScheduled(),
- isSaving: isSavingPost(),
- isPublishing: isPublishingPost(),
- hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false,
- postType: getCurrentPostType(),
- isAutosaving: isAutosavingPost()
- };
-})])(PublishButtonLabel));
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-button/index.js
-
-/**
- * External dependencies
- */
-
-
/**
* WordPress dependencies
*/
@@ -9992,13 +13913,14 @@ function PublishButtonLabel({
-
/**
* Internal dependencies
*/
-const noop = () => {};
+
+
+const post_publish_button_noop = () => {};
class PostPublishButton extends external_wp_element_namespaceObject.Component {
constructor(props) {
super(props);
@@ -10046,7 +13968,7 @@ class PostPublishButton extends external_wp_element_namespaceObject.Component {
// with another function (() => myFunction). Passing the
// function on its own will cause an error when called.
setEntitiesSavedStatesCallback(() => this.closeEntitiesSavedStates);
- return noop;
+ return post_publish_button_noop;
}
return callback(...args);
};
@@ -10081,34 +14003,41 @@ class PostPublishButton extends external_wp_element_namespaceObject.Component {
isSaving,
isAutoSaving,
isToggle,
- onSave,
- onStatusChange,
- onSubmit = noop,
+ savePostStatus,
+ onSubmit = post_publish_button_noop,
onToggle,
visibility,
hasNonPostEntityChanges,
- isSavingNonPostEntityChanges
+ isSavingNonPostEntityChanges,
+ postStatus,
+ postStatusHasChanged
} = this.props;
const isButtonDisabled = (isSaving || !isSaveable || isPostSavingLocked || !isPublishable && !forceIsDirty) && (!hasNonPostEntityChanges || isSavingNonPostEntityChanges);
const isToggleDisabled = (isPublished || isSaving || !isSaveable || !isPublishable && !forceIsDirty) && (!hasNonPostEntityChanges || isSavingNonPostEntityChanges);
- let publishStatus;
- if (!hasPublishAction) {
+
+ // If the new status has not changed explicitely, we derive it from
+ // other factors, like having a publish action, etc.. We need to preserve
+ // this because it affects when to show the pre and post publish panels.
+ // If it has changed though explicitely, we need to respect that.
+ let publishStatus = 'publish';
+ if (postStatusHasChanged) {
+ publishStatus = postStatus;
+ } else if (!hasPublishAction) {
publishStatus = 'pending';
} else if (visibility === 'private') {
publishStatus = 'private';
} else if (isBeingScheduled) {
publishStatus = 'future';
- } else {
- publishStatus = 'publish';
}
const onClickButton = () => {
if (isButtonDisabled) {
return;
}
onSubmit();
- onStatusChange(publishStatus);
- onSave();
+ savePostStatus(publishStatus);
};
+
+ // Callback to open the publish panel.
const onClickToggle = () => {
if (isToggleDisabled) {
return;
@@ -10131,19 +14060,16 @@ class PostPublishButton extends external_wp_element_namespaceObject.Component {
size: 'compact',
onClick: this.createOnClick(onClickToggle)
};
- const toggleChildren = isBeingScheduled ? (0,external_wp_i18n_namespaceObject.__)('Schedule…') : (0,external_wp_i18n_namespaceObject.__)('Publish');
- const buttonChildren = (0,external_React_.createElement)(label, {
- hasNonPostEntityChanges: hasNonPostEntityChanges
- });
const componentProps = isToggle ? toggleProps : buttonProps;
- const componentChildren = isToggle ? toggleChildren : buttonChildren;
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- ref: this.buttonNode,
- ...componentProps,
- className: classnames_default()(componentProps.className, 'editor-post-publish-button__button', {
- 'has-changes-dot': hasNonPostEntityChanges
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ ref: this.buttonNode,
+ ...componentProps,
+ className: `${componentProps.className} editor-post-publish-button__button`,
+ size: "compact",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PublishButtonLabel, {})
})
- }, componentChildren));
+ });
}
}
/* harmony default export */ const post_publish_button = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
@@ -10161,7 +14087,9 @@ class PostPublishButton extends external_wp_element_namespaceObject.Component {
getCurrentPostType,
getCurrentPostId,
hasNonPostEntityChanges,
- isSavingNonPostEntityChanges
+ isSavingNonPostEntityChanges,
+ getEditedPostAttribute,
+ getPostEdits
} = select(store_store);
return {
isSaving: isSavingPost(),
@@ -10175,6 +14103,8 @@ class PostPublishButton extends external_wp_element_namespaceObject.Component {
hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false,
postType: getCurrentPostType(),
postId: getCurrentPostId(),
+ postStatus: getEditedPostAttribute('status'),
+ postStatusHasChanged: getPostEdits()?.status,
hasNonPostEntityChanges: hasNonPostEntityChanges(),
isSavingNonPostEntityChanges: isSavingNonPostEntityChanges()
};
@@ -10184,41 +14114,30 @@ class PostPublishButton extends external_wp_element_namespaceObject.Component {
savePost
} = dispatch(store_store);
return {
- onStatusChange: status => editPost({
- status
- }, {
- undoIgnore: true
- }),
- onSave: savePost
+ savePostStatus: status => {
+ editPost({
+ status
+ }, {
+ undoIgnore: true
+ });
+ savePost();
+ }
};
})])(PostPublishButton));
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js
-
-/**
- * WordPress dependencies
- */
-
-const closeSmall = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"
-}));
-/* harmony default export */ const close_small = (closeSmall);
-
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/wordpress.js
-
/**
* WordPress dependencies
*/
-const wordpress = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+const wordpress = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
- viewBox: "-2 -2 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z"
-}));
+ viewBox: "-2 -2 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z"
+ })
+});
/* harmony default export */ const library_wordpress = (wordpress);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/utils.js
@@ -10242,7 +14161,6 @@ const visibilityOptions = {
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/index.js
-
/**
* WordPress dependencies
*/
@@ -10258,6 +14176,16 @@ const visibilityOptions = {
*/
+
+/**
+ * Allows users to set the visibility of a post.
+ *
+ * @param {Object} props The component props.
+ * @param {Function} props.onClose Function to call when the popover is closed.
+ * @return {JSX.Element} The rendered component.
+ */
+
+
function PostVisibility({
onClose
}) {
@@ -10311,54 +14239,62 @@ function PostVisibility({
password: event.target.value
});
};
- return (0,external_React_.createElement)("div", {
- className: "editor-post-visibility"
- }, (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
- title: (0,external_wp_i18n_namespaceObject.__)('Visibility'),
- help: (0,external_wp_i18n_namespaceObject.__)('Control how this post is viewed.'),
- onClose: onClose
- }), (0,external_React_.createElement)("fieldset", {
- className: "editor-post-visibility__fieldset"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
- as: "legend"
- }, (0,external_wp_i18n_namespaceObject.__)('Visibility')), (0,external_React_.createElement)(PostVisibilityChoice, {
- instanceId: instanceId,
- value: "public",
- label: visibilityOptions.public.label,
- info: visibilityOptions.public.info,
- checked: visibility === 'public' && !hasPassword,
- onChange: setPublic
- }), (0,external_React_.createElement)(PostVisibilityChoice, {
- instanceId: instanceId,
- value: "private",
- label: visibilityOptions.private.label,
- info: visibilityOptions.private.info,
- checked: visibility === 'private',
- onChange: setPrivate
- }), (0,external_React_.createElement)(PostVisibilityChoice, {
- instanceId: instanceId,
- value: "password",
- label: visibilityOptions.password.label,
- info: visibilityOptions.password.info,
- checked: hasPassword,
- onChange: setPasswordProtected
- }), hasPassword && (0,external_React_.createElement)("div", {
- className: "editor-post-visibility__password"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
- as: "label",
- htmlFor: `editor-post-visibility__password-input-${instanceId}`
- }, (0,external_wp_i18n_namespaceObject.__)('Create password')), (0,external_React_.createElement)("input", {
- className: "editor-post-visibility__password-input",
- id: `editor-post-visibility__password-input-${instanceId}`,
- type: "text",
- onChange: updatePassword,
- value: password,
- placeholder: (0,external_wp_i18n_namespaceObject.__)('Use a secure password')
- }))), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalConfirmDialog, {
- isOpen: showPrivateConfirmDialog,
- onConfirm: confirmPrivate,
- onCancel: handleDialogCancel
- }, (0,external_wp_i18n_namespaceObject.__)('Would you like to privately publish this post now?')));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "editor-post-visibility",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Visibility'),
+ help: (0,external_wp_i18n_namespaceObject.__)('Control how this post is viewed.'),
+ onClose: onClose
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", {
+ className: "editor-post-visibility__fieldset",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, {
+ as: "legend",
+ children: (0,external_wp_i18n_namespaceObject.__)('Visibility')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostVisibilityChoice, {
+ instanceId: instanceId,
+ value: "public",
+ label: visibilityOptions.public.label,
+ info: visibilityOptions.public.info,
+ checked: visibility === 'public' && !hasPassword,
+ onChange: setPublic
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostVisibilityChoice, {
+ instanceId: instanceId,
+ value: "private",
+ label: visibilityOptions.private.label,
+ info: visibilityOptions.private.info,
+ checked: visibility === 'private',
+ onChange: setPrivate
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostVisibilityChoice, {
+ instanceId: instanceId,
+ value: "password",
+ label: visibilityOptions.password.label,
+ info: visibilityOptions.password.info,
+ checked: hasPassword,
+ onChange: setPasswordProtected
+ }), hasPassword && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "editor-post-visibility__password",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, {
+ as: "label",
+ htmlFor: `editor-post-visibility__password-input-${instanceId}`,
+ children: (0,external_wp_i18n_namespaceObject.__)('Create password')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("input", {
+ className: "editor-post-visibility__password-input",
+ id: `editor-post-visibility__password-input-${instanceId}`,
+ type: "text",
+ onChange: updatePassword,
+ value: password,
+ placeholder: (0,external_wp_i18n_namespaceObject.__)('Use a secure password')
+ })]
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, {
+ isOpen: showPrivateConfirmDialog,
+ onConfirm: confirmPrivate,
+ onCancel: handleDialogCancel,
+ confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Publish'),
+ size: "medium",
+ children: (0,external_wp_i18n_namespaceObject.__)('Would you like to privately publish this post now?')
+ })]
+ });
}
function PostVisibilityChoice({
instanceId,
@@ -10367,23 +14303,26 @@ function PostVisibilityChoice({
info,
...props
}) {
- return (0,external_React_.createElement)("div", {
- className: "editor-post-visibility__choice"
- }, (0,external_React_.createElement)("input", {
- type: "radio",
- name: `editor-post-visibility__setting-${instanceId}`,
- value: value,
- id: `editor-post-${value}-${instanceId}`,
- "aria-describedby": `editor-post-${value}-${instanceId}-description`,
- className: "editor-post-visibility__radio",
- ...props
- }), (0,external_React_.createElement)("label", {
- htmlFor: `editor-post-${value}-${instanceId}`,
- className: "editor-post-visibility__label"
- }, label), (0,external_React_.createElement)("p", {
- id: `editor-post-${value}-${instanceId}-description`,
- className: "editor-post-visibility__info"
- }, info));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "editor-post-visibility__choice",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("input", {
+ type: "radio",
+ name: `editor-post-visibility__setting-${instanceId}`,
+ value: value,
+ id: `editor-post-${value}-${instanceId}`,
+ "aria-describedby": `editor-post-${value}-${instanceId}-description`,
+ className: "editor-post-visibility__radio",
+ ...props
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("label", {
+ htmlFor: `editor-post-${value}-${instanceId}`,
+ className: "editor-post-visibility__label",
+ children: label
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ id: `editor-post-${value}-${instanceId}-description`,
+ className: "editor-post-visibility__info",
+ children: info
+ })]
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/label.js
@@ -10397,24 +14336,27 @@ function PostVisibilityChoice({
*/
+
+/**
+ * Returns the label for the current post visibility setting.
+ *
+ * @return {string} Post visibility label.
+ */
function PostVisibilityLabel() {
return usePostVisibilityLabel();
}
+
+/**
+ * Get the label for the current post visibility setting.
+ *
+ * @return {string} Post visibility label.
+ */
function usePostVisibilityLabel() {
const visibility = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostVisibility());
return visibilityOptions[visibility]?.label;
}
-;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/requiredArgs/index.js
-function requiredArgs(required, args) {
- if (args.length < required) {
- throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
- }
-}
-;// CONCATENATED MODULE: ./node_modules/date-fns/esm/toDate/index.js
-function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
-
-
+;// CONCATENATED MODULE: ./node_modules/date-fns/toDate.mjs
/**
* @name toDate
* @category Common Helpers
@@ -10431,9 +14373,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
*
* **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
*
- * @param {Date|Number} argument - the value to convert
- * @returns {Date} the parsed date in the local time zone
- * @throws {TypeError} 1 argument required
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
+ *
+ * @param argument - The value to convert
+ *
+ * @returns The parsed date in the local time zone
*
* @example
* // Clone the date:
@@ -10445,28 +14389,34 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
* const result = toDate(1392098430000)
* //=> Tue Feb 11 2014 11:30:30
*/
-
function toDate(argument) {
- requiredArgs(1, arguments);
- var argStr = Object.prototype.toString.call(argument); // Clone the date
+ const argStr = Object.prototype.toString.call(argument);
- if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
+ // Clone the date
+ if (
+ argument instanceof Date ||
+ (typeof argument === "object" && argStr === "[object Date]")
+ ) {
// Prevent the date to lose the milliseconds when passed to new Date() in IE10
- return new Date(argument.getTime());
- } else if (typeof argument === 'number' || argStr === '[object Number]') {
+ return new argument.constructor(+argument);
+ } else if (
+ typeof argument === "number" ||
+ argStr === "[object Number]" ||
+ typeof argument === "string" ||
+ argStr === "[object String]"
+ ) {
+ // TODO: Can we get rid of as?
return new Date(argument);
} else {
- if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
- // eslint-disable-next-line no-console
- console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"); // eslint-disable-next-line no-console
-
- console.warn(new Error().stack);
- }
-
+ // TODO: Can we get rid of as?
return new Date(NaN);
}
}
-;// CONCATENATED MODULE: ./node_modules/date-fns/esm/startOfMonth/index.js
+
+// Fallback for modularized imports:
+/* harmony default export */ const date_fns_toDate = ((/* unused pure expression or super */ null && (toDate)));
+
+;// CONCATENATED MODULE: ./node_modules/date-fns/startOfMonth.mjs
/**
@@ -10478,24 +14428,28 @@ function toDate(argument) {
* Return the start of a month for the given date.
* The result will be in the local timezone.
*
- * @param {Date|Number} date - the original date
- * @returns {Date} the start of a month
- * @throws {TypeError} 1 argument required
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
+ *
+ * @param date - The original date
+ *
+ * @returns The start of a month
*
* @example
* // The start of a month for 2 September 2014 11:55:00:
* const result = startOfMonth(new Date(2014, 8, 2, 11, 55, 0))
* //=> Mon Sep 01 2014 00:00:00
*/
-
-function startOfMonth(dirtyDate) {
- requiredArgs(1, arguments);
- var date = toDate(dirtyDate);
- date.setDate(1);
- date.setHours(0, 0, 0, 0);
- return date;
+function startOfMonth(date) {
+ const _date = toDate(date);
+ _date.setDate(1);
+ _date.setHours(0, 0, 0, 0);
+ return _date;
}
-;// CONCATENATED MODULE: ./node_modules/date-fns/esm/endOfMonth/index.js
+
+// Fallback for modularized imports:
+/* harmony default export */ const date_fns_startOfMonth = ((/* unused pure expression or super */ null && (startOfMonth)));
+
+;// CONCATENATED MODULE: ./node_modules/date-fns/endOfMonth.mjs
/**
@@ -10507,225 +14461,239 @@ function startOfMonth(dirtyDate) {
* Return the end of a month for the given date.
* The result will be in the local timezone.
*
- * @param {Date|Number} date - the original date
- * @returns {Date} the end of a month
- * @throws {TypeError} 1 argument required
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
+ *
+ * @param date - The original date
+ *
+ * @returns The end of a month
*
* @example
* // The end of a month for 2 September 2014 11:55:00:
* const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0))
* //=> Tue Sep 30 2014 23:59:59.999
*/
-
-function endOfMonth(dirtyDate) {
- requiredArgs(1, arguments);
- var date = toDate(dirtyDate);
- var month = date.getMonth();
- date.setFullYear(date.getFullYear(), month + 1, 0);
- date.setHours(23, 59, 59, 999);
- return date;
+function endOfMonth(date) {
+ const _date = toDate(date);
+ const month = _date.getMonth();
+ _date.setFullYear(_date.getFullYear(), month + 1, 0);
+ _date.setHours(23, 59, 59, 999);
+ return _date;
}
-;// CONCATENATED MODULE: ./node_modules/date-fns/esm/constants/index.js
+
+// Fallback for modularized imports:
+/* harmony default export */ const date_fns_endOfMonth = ((/* unused pure expression or super */ null && (endOfMonth)));
+
+;// CONCATENATED MODULE: ./node_modules/date-fns/constants.mjs
/**
- * Days in 1 week.
+ * @module constants
+ * @summary Useful constants
+ * @description
+ * Collection of useful date constants.
*
- * @name daysInWeek
+ * The constants could be imported from `date-fns/constants`:
+ *
+ * ```ts
+ * import { maxTime, minTime } from "./constants/date-fns/constants";
+ *
+ * function isAllowedTime(time) {
+ * return time <= maxTime && time >= minTime;
+ * }
+ * ```
+ */
+
+/**
* @constant
- * @type {number}
- * @default
+ * @name daysInWeek
+ * @summary Days in 1 week.
*/
-var daysInWeek = 7;
+const daysInWeek = 7;
+
/**
- * Days in 1 year
+ * @constant
+ * @name daysInYear
+ * @summary Days in 1 year.
+ *
+ * @description
+ * How many days in a year.
+ *
* One years equals 365.2425 days according to the formula:
*
* > Leap year occures every 4 years, except for years that are divisable by 100 and not divisable by 400.
* > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days
- *
- * @name daysInYear
+ */
+const daysInYear = 365.2425;
+
+/**
* @constant
- * @type {number}
- * @default
+ * @name maxTime
+ * @summary Maximum allowed time.
+ *
+ * @example
+ * import { maxTime } from "./constants/date-fns/constants";
+ *
+ * const isValid = 8640000000000001 <= maxTime;
+ * //=> false
+ *
+ * new Date(8640000000000001);
+ * //=> Invalid Date
*/
+const maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;
-var daysInYear = 365.2425;
/**
- * Maximum allowed time.
+ * @constant
+ * @name minTime
+ * @summary Minimum allowed time.
*
- * @name maxTime
+ * @example
+ * import { minTime } from "./constants/date-fns/constants";
+ *
+ * const isValid = -8640000000000001 >= minTime;
+ * //=> false
+ *
+ * new Date(-8640000000000001)
+ * //=> Invalid Date
+ */
+const minTime = -maxTime;
+
+/**
* @constant
- * @type {number}
- * @default
+ * @name millisecondsInWeek
+ * @summary Milliseconds in 1 week.
*/
+const millisecondsInWeek = 604800000;
-var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;
/**
- * Milliseconds in 1 minute
- *
- * @name millisecondsInMinute
* @constant
- * @type {number}
- * @default
+ * @name millisecondsInDay
+ * @summary Milliseconds in 1 day.
*/
+const millisecondsInDay = 86400000;
-var millisecondsInMinute = 60000;
/**
- * Milliseconds in 1 hour
- *
- * @name millisecondsInHour
* @constant
- * @type {number}
- * @default
+ * @name millisecondsInMinute
+ * @summary Milliseconds in 1 minute
*/
+const millisecondsInMinute = 60000;
-var millisecondsInHour = 3600000;
/**
- * Milliseconds in 1 second
- *
- * @name millisecondsInSecond
* @constant
- * @type {number}
- * @default
+ * @name millisecondsInHour
+ * @summary Milliseconds in 1 hour
*/
+const millisecondsInHour = 3600000;
-var millisecondsInSecond = 1000;
/**
- * Minimum allowed time.
- *
- * @name minTime
* @constant
- * @type {number}
- * @default
+ * @name millisecondsInSecond
+ * @summary Milliseconds in 1 second
*/
+const millisecondsInSecond = 1000;
-var minTime = -maxTime;
/**
- * Minutes in 1 hour
- *
- * @name minutesInHour
* @constant
- * @type {number}
- * @default
+ * @name minutesInYear
+ * @summary Minutes in 1 year.
*/
+const minutesInYear = 525600;
-var minutesInHour = 60;
/**
- * Months in 1 quarter
- *
- * @name monthsInQuarter
* @constant
- * @type {number}
- * @default
+ * @name minutesInMonth
+ * @summary Minutes in 1 month.
*/
+const minutesInMonth = 43200;
-var monthsInQuarter = 3;
/**
- * Months in 1 year
- *
- * @name monthsInYear
* @constant
- * @type {number}
- * @default
+ * @name minutesInDay
+ * @summary Minutes in 1 day.
*/
+const minutesInDay = 1440;
-var monthsInYear = 12;
/**
- * Quarters in 1 year
- *
- * @name quartersInYear
* @constant
- * @type {number}
- * @default
+ * @name minutesInHour
+ * @summary Minutes in 1 hour.
*/
+const minutesInHour = 60;
-var quartersInYear = 4;
/**
- * Seconds in 1 hour
- *
- * @name secondsInHour
* @constant
- * @type {number}
- * @default
+ * @name monthsInQuarter
+ * @summary Months in 1 quarter.
*/
+const monthsInQuarter = 3;
-var secondsInHour = 3600;
/**
- * Seconds in 1 minute
- *
- * @name secondsInMinute
* @constant
- * @type {number}
- * @default
+ * @name monthsInYear
+ * @summary Months in 1 year.
*/
+const monthsInYear = 12;
-var secondsInMinute = 60;
/**
- * Seconds in 1 day
- *
- * @name secondsInDay
* @constant
- * @type {number}
- * @default
+ * @name quartersInYear
+ * @summary Quarters in 1 year
*/
+const quartersInYear = 4;
-var secondsInDay = secondsInHour * 24;
/**
- * Seconds in 1 week
- *
- * @name secondsInWeek
* @constant
- * @type {number}
- * @default
+ * @name secondsInHour
+ * @summary Seconds in 1 hour.
*/
+const secondsInHour = 3600;
-var secondsInWeek = secondsInDay * 7;
/**
- * Seconds in 1 year
- *
- * @name secondsInYear
* @constant
- * @type {number}
- * @default
+ * @name secondsInMinute
+ * @summary Seconds in 1 minute.
*/
+const secondsInMinute = 60;
-var secondsInYear = secondsInDay * daysInYear;
/**
- * Seconds in 1 month
- *
- * @name secondsInMonth
* @constant
- * @type {number}
- * @default
+ * @name secondsInDay
+ * @summary Seconds in 1 day.
*/
+const secondsInDay = secondsInHour * 24;
-var secondsInMonth = secondsInYear / 12;
/**
- * Seconds in 1 quarter
- *
- * @name secondsInQuarter
* @constant
- * @type {number}
- * @default
+ * @name secondsInWeek
+ * @summary Seconds in 1 week.
*/
+const secondsInWeek = secondsInDay * 7;
-var secondsInQuarter = secondsInMonth * 3;
-;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/toInteger/index.js
-function toInteger(dirtyNumber) {
- if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
- return NaN;
- }
+/**
+ * @constant
+ * @name secondsInYear
+ * @summary Seconds in 1 year.
+ */
+const secondsInYear = secondsInDay * daysInYear;
- var number = Number(dirtyNumber);
+/**
+ * @constant
+ * @name secondsInMonth
+ * @summary Seconds in 1 month
+ */
+const secondsInMonth = secondsInYear / 12;
- if (isNaN(number)) {
- return number;
- }
+/**
+ * @constant
+ * @name secondsInQuarter
+ * @summary Seconds in 1 quarter.
+ */
+const secondsInQuarter = secondsInMonth * 3;
- return number < 0 ? Math.ceil(number) : Math.floor(number);
-}
-;// CONCATENATED MODULE: ./node_modules/date-fns/esm/parseISO/index.js
+;// CONCATENATED MODULE: ./node_modules/date-fns/parseISO.mjs
+/**
+ * The {@link parseISO} function options.
+ */
/**
* @name parseISO
@@ -10741,12 +14709,12 @@ function toInteger(dirtyNumber) {
* If the argument isn't a string, the function cannot parse the string or
* the values are invalid, it returns Invalid Date.
*
- * @param {String} argument - the value to convert
- * @param {Object} [options] - an object with options.
- * @param {0|1|2} [options.additionalDigits=2] - the additional number of digits in the extended year format
- * @returns {Date} the parsed date in the local time zone
- * @throws {TypeError} 1 argument required
- * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
+ *
+ * @param argument - The value to convert
+ * @param options - An object with options
+ *
+ * @returns The parsed date in the local time zone
*
* @example
* // Convert string '2014-02-11T11:30:30' to date:
@@ -10759,26 +14727,13 @@ function toInteger(dirtyNumber) {
* const result = parseISO('+02014101', { additionalDigits: 1 })
* //=> Fri Apr 11 2014 00:00:00
*/
-
function parseISO(argument, options) {
- var _options$additionalDi;
-
- requiredArgs(1, arguments);
- var additionalDigits = toInteger((_options$additionalDi = options === null || options === void 0 ? void 0 : options.additionalDigits) !== null && _options$additionalDi !== void 0 ? _options$additionalDi : 2);
-
- if (additionalDigits !== 2 && additionalDigits !== 1 && additionalDigits !== 0) {
- throw new RangeError('additionalDigits must be 0, 1 or 2');
- }
-
- if (!(typeof argument === 'string' || Object.prototype.toString.call(argument) === '[object String]')) {
- return new Date(NaN);
- }
-
- var dateStrings = splitDateString(argument);
- var date;
+ const additionalDigits = options?.additionalDigits ?? 2;
+ const dateStrings = splitDateString(argument);
+ let date;
if (dateStrings.date) {
- var parseYearResult = parseYear(dateStrings.date, additionalDigits);
+ const parseYearResult = parseYear(dateStrings.date, additionalDigits);
date = parseDate(parseYearResult.restDateString, parseYearResult.year);
}
@@ -10786,13 +14741,12 @@ function parseISO(argument, options) {
return new Date(NaN);
}
- var timestamp = date.getTime();
- var time = 0;
- var offset;
+ const timestamp = date.getTime();
+ let time = 0;
+ let offset;
if (dateStrings.time) {
time = parseTime(dateStrings.time);
-
if (isNaN(time)) {
return new Date(NaN);
}
@@ -10800,40 +14754,53 @@ function parseISO(argument, options) {
if (dateStrings.timezone) {
offset = parseTimezone(dateStrings.timezone);
-
if (isNaN(offset)) {
return new Date(NaN);
}
} else {
- var dirtyDate = new Date(timestamp + time); // js parsed string assuming it's in UTC timezone
+ const dirtyDate = new Date(timestamp + time);
+ // JS parsed string assuming it's in UTC timezone
// but we need it to be parsed in our timezone
// so we use utc values to build date in our timezone.
// Year values from 0 to 99 map to the years 1900 to 1999
// so set year explicitly with setFullYear.
-
- var result = new Date(0);
- result.setFullYear(dirtyDate.getUTCFullYear(), dirtyDate.getUTCMonth(), dirtyDate.getUTCDate());
- result.setHours(dirtyDate.getUTCHours(), dirtyDate.getUTCMinutes(), dirtyDate.getUTCSeconds(), dirtyDate.getUTCMilliseconds());
+ const result = new Date(0);
+ result.setFullYear(
+ dirtyDate.getUTCFullYear(),
+ dirtyDate.getUTCMonth(),
+ dirtyDate.getUTCDate(),
+ );
+ result.setHours(
+ dirtyDate.getUTCHours(),
+ dirtyDate.getUTCMinutes(),
+ dirtyDate.getUTCSeconds(),
+ dirtyDate.getUTCMilliseconds(),
+ );
return result;
}
return new Date(timestamp + time + offset);
}
-var patterns = {
+
+const patterns = {
dateTimeDelimiter: /[T ]/,
timeZoneDelimiter: /[Z ]/i,
- timezone: /([Z+-].*)$/
+ timezone: /([Z+-].*)$/,
};
-var dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
-var timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
-var timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
+
+const dateRegex =
+ /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
+const timeRegex =
+ /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
+const timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
function splitDateString(dateString) {
- var dateStrings = {};
- var array = dateString.split(patterns.dateTimeDelimiter);
- var timeString; // The regex match should only return at maximum two array elements.
- // [date], [time], or [date, time].
+ const dateStrings = {};
+ const array = dateString.split(patterns.dateTimeDelimiter);
+ let timeString;
+ // The regex match should only return at maximum two array elements.
+ // [date], [time], or [date, time].
if (array.length > 2) {
return dateStrings;
}
@@ -10843,18 +14810,19 @@ function splitDateString(dateString) {
} else {
dateStrings.date = array[0];
timeString = array[1];
-
if (patterns.timeZoneDelimiter.test(dateStrings.date)) {
dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0];
- timeString = dateString.substr(dateStrings.date.length, dateString.length);
+ timeString = dateString.substr(
+ dateStrings.date.length,
+ dateString.length,
+ );
}
}
if (timeString) {
- var token = patterns.timezone.exec(timeString);
-
+ const token = patterns.timezone.exec(timeString);
if (token) {
- dateStrings.time = timeString.replace(token[1], '');
+ dateStrings.time = timeString.replace(token[1], "");
dateStrings.timezone = token[1];
} else {
dateStrings.time = timeString;
@@ -10865,48 +14833,56 @@ function splitDateString(dateString) {
}
function parseYear(dateString, additionalDigits) {
- var regex = new RegExp('^(?:(\\d{4}|[+-]\\d{' + (4 + additionalDigits) + '})|(\\d{2}|[+-]\\d{' + (2 + additionalDigits) + '})$)');
- var captures = dateString.match(regex); // Invalid ISO-formatted year
+ const regex = new RegExp(
+ "^(?:(\\d{4}|[+-]\\d{" +
+ (4 + additionalDigits) +
+ "})|(\\d{2}|[+-]\\d{" +
+ (2 + additionalDigits) +
+ "})$)",
+ );
- if (!captures) return {
- year: NaN,
- restDateString: ''
- };
- var year = captures[1] ? parseInt(captures[1]) : null;
- var century = captures[2] ? parseInt(captures[2]) : null; // either year or century is null, not both
+ const captures = dateString.match(regex);
+ // Invalid ISO-formatted year
+ if (!captures) return { year: NaN, restDateString: "" };
+ const year = captures[1] ? parseInt(captures[1]) : null;
+ const century = captures[2] ? parseInt(captures[2]) : null;
+
+ // either year or century is null, not both
return {
year: century === null ? year : century * 100,
- restDateString: dateString.slice((captures[1] || captures[2]).length)
+ restDateString: dateString.slice((captures[1] || captures[2]).length),
};
}
function parseDate(dateString, year) {
// Invalid ISO-formatted year
if (year === null) return new Date(NaN);
- var captures = dateString.match(dateRegex); // Invalid ISO-formatted string
+ const captures = dateString.match(dateRegex);
+ // Invalid ISO-formatted string
if (!captures) return new Date(NaN);
- var isWeekDate = !!captures[4];
- var dayOfYear = parseDateUnit(captures[1]);
- var month = parseDateUnit(captures[2]) - 1;
- var day = parseDateUnit(captures[3]);
- var week = parseDateUnit(captures[4]);
- var dayOfWeek = parseDateUnit(captures[5]) - 1;
+
+ const isWeekDate = !!captures[4];
+ const dayOfYear = parseDateUnit(captures[1]);
+ const month = parseDateUnit(captures[2]) - 1;
+ const day = parseDateUnit(captures[3]);
+ const week = parseDateUnit(captures[4]);
+ const dayOfWeek = parseDateUnit(captures[5]) - 1;
if (isWeekDate) {
if (!validateWeekDate(year, week, dayOfWeek)) {
return new Date(NaN);
}
-
return dayOfISOWeekYear(year, week, dayOfWeek);
} else {
- var date = new Date(0);
-
- if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) {
+ const date = new Date(0);
+ if (
+ !validateDate(year, month, day) ||
+ !validateDayOfYearDate(year, dayOfYear)
+ ) {
return new Date(NaN);
}
-
date.setUTCFullYear(year, month, Math.max(dayOfYear, day));
return date;
}
@@ -10917,31 +14893,35 @@ function parseDateUnit(value) {
}
function parseTime(timeString) {
- var captures = timeString.match(timeRegex);
+ const captures = timeString.match(timeRegex);
if (!captures) return NaN; // Invalid ISO-formatted time
- var hours = parseTimeUnit(captures[1]);
- var minutes = parseTimeUnit(captures[2]);
- var seconds = parseTimeUnit(captures[3]);
+ const hours = parseTimeUnit(captures[1]);
+ const minutes = parseTimeUnit(captures[2]);
+ const seconds = parseTimeUnit(captures[3]);
if (!validateTime(hours, minutes, seconds)) {
return NaN;
}
- return hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1000;
+ return (
+ hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1000
+ );
}
function parseTimeUnit(value) {
- return value && parseFloat(value.replace(',', '.')) || 0;
+ return (value && parseFloat(value.replace(",", "."))) || 0;
}
function parseTimezone(timezoneString) {
- if (timezoneString === 'Z') return 0;
- var captures = timezoneString.match(timezoneRegex);
+ if (timezoneString === "Z") return 0;
+
+ const captures = timezoneString.match(timezoneRegex);
if (!captures) return 0;
- var sign = captures[1] === '+' ? -1 : 1;
- var hours = parseInt(captures[2]);
- var minutes = captures[3] && parseInt(captures[3]) || 0;
+
+ const sign = captures[1] === "+" ? -1 : 1;
+ const hours = parseInt(captures[2]);
+ const minutes = (captures[3] && parseInt(captures[3])) || 0;
if (!validateTimezone(hours, minutes)) {
return NaN;
@@ -10951,24 +14931,30 @@ function parseTimezone(timezoneString) {
}
function dayOfISOWeekYear(isoWeekYear, week, day) {
- var date = new Date(0);
+ const date = new Date(0);
date.setUTCFullYear(isoWeekYear, 0, 4);
- var fourthOfJanuaryDay = date.getUTCDay() || 7;
- var diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay;
+ const fourthOfJanuaryDay = date.getUTCDay() || 7;
+ const diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay;
date.setUTCDate(date.getUTCDate() + diff);
return date;
-} // Validation functions
-// February is null to handle the leap year (using ||)
+}
+// Validation functions
-var daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
+// February is null to handle the leap year (using ||)
+const daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
function isLeapYearIndex(year) {
- return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
+ return year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0);
}
function validateDate(year, month, date) {
- return month >= 0 && month <= 11 && date >= 1 && date <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28));
+ return (
+ month >= 0 &&
+ month <= 11 &&
+ date >= 1 &&
+ date <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28))
+ );
}
function validateDayOfYearDate(year, dayOfYear) {
@@ -10984,14 +14970,24 @@ function validateTime(hours, minutes, seconds) {
return minutes === 0 && seconds === 0;
}
- return seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25;
+ return (
+ seconds >= 0 &&
+ seconds < 60 &&
+ minutes >= 0 &&
+ minutes < 60 &&
+ hours >= 0 &&
+ hours < 25
+ );
}
function validateTimezone(_hours, minutes) {
return minutes >= 0 && minutes <= 59;
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/index.js
+// Fallback for modularized imports:
+/* harmony default export */ const date_fns_parseISO = ((/* unused pure expression or super */ null && (parseISO)));
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/index.js
/**
* External dependencies
*/
@@ -11010,8 +15006,31 @@ function validateTimezone(_hours, minutes) {
* Internal dependencies
*/
-function PostSchedule({
- onClose
+
+
+const {
+ PrivatePublishDateTimePicker
+} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
+
+/**
+ * Renders the PostSchedule component. It allows the user to schedule a post.
+ *
+ * @param {Object} props Props.
+ * @param {Function} props.onClose Function to close the component.
+ *
+ * @return {Component} The component to be rendered.
+ */
+function PostSchedule(props) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivatePostSchedule, {
+ ...props,
+ showPopoverHeaderActions: true,
+ isCompact: false
+ });
+}
+function PrivatePostSchedule({
+ onClose,
+ showPopoverHeaderActions,
+ isCompact
}) {
const {
postDate,
@@ -11050,13 +15069,15 @@ function PostSchedule({
.replace(/\\\\/g, '') // Replace "//" with empty strings.
.split('').reverse().join('') // Reverse the string and test for "a" not followed by a slash.
);
- return (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.__experimentalPublishDateTimePicker, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivatePublishDateTimePicker, {
currentDate: postDate,
onChange: onUpdateDate,
is12Hour: is12HourTime,
events: events,
onMonthPreviewed: date => setPreviewedMonth(parseISO(date)),
- onClose: onClose
+ onClose: onClose,
+ isCompact: isCompact,
+ showPopoverHeaderActions: showPopoverHeaderActions
});
}
@@ -11072,9 +15093,26 @@ function PostSchedule({
* Internal dependencies
*/
+
+/**
+ * Renders the PostScheduleLabel component.
+ *
+ * @param {Object} props Props.
+ *
+ * @return {Component} The component to be rendered.
+ */
function PostScheduleLabel(props) {
return usePostScheduleLabel(props);
}
+
+/**
+ * Custom hook to get the label for post schedule.
+ *
+ * @param {Object} options Options for the hook.
+ * @param {boolean} options.full Whether to get the full label or not. Default is false.
+ *
+ * @return {string} The label for post schedule.
+ */
function usePostScheduleLabel({
full = false
} = {}) {
@@ -11158,10 +15196,7 @@ function isSameDay(left, right) {
return left.getDate() === right.getDate() && left.getMonth() === right.getMonth() && left.getFullYear() === right.getFullYear();
}
-;// CONCATENATED MODULE: external ["wp","a11y"]
-const external_wp_a11y_namespaceObject = window["wp"]["a11y"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/most-used-terms.js
-
/**
* WordPress dependencies
*/
@@ -11173,6 +15208,8 @@ const external_wp_a11y_namespaceObject = window["wp"]["a11y"];
* Internal dependencies
*/
+
+
const MIN_MOST_USED_TERMS = 3;
const DEFAULT_QUERY = {
per_page: 10,
@@ -11200,24 +15237,27 @@ function MostUsedTerms({
return null;
}
const terms = unescapeTerms(_terms);
- return (0,external_React_.createElement)("div", {
- className: "editor-post-taxonomies__flat-term-most-used"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.BaseControl.VisualLabel, {
- as: "h3",
- className: "editor-post-taxonomies__flat-term-most-used-label"
- }, taxonomy.labels.most_used), (0,external_React_.createElement)("ul", {
- role: "list",
- className: "editor-post-taxonomies__flat-term-most-used-list"
- }, terms.map(term => (0,external_React_.createElement)("li", {
- key: term.id
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "link",
- onClick: () => onSelect(term)
- }, term.name)))));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "editor-post-taxonomies__flat-term-most-used",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, {
+ as: "h3",
+ className: "editor-post-taxonomies__flat-term-most-used-label",
+ children: taxonomy.labels.most_used
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", {
+ role: "list",
+ className: "editor-post-taxonomies__flat-term-most-used-list",
+ children: terms.map(term => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "link",
+ onClick: () => onSelect(term),
+ children: term.name
+ })
+ }, term.id))
+ })]
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/flat-term-selector.js
-
/**
* WordPress dependencies
*/
@@ -11243,7 +15283,10 @@ function MostUsedTerms({
*
* @type {Array<any>}
*/
-const EMPTY_ARRAY = [];
+
+
+
+const flat_term_selector_EMPTY_ARRAY = [];
/**
* Module constants
@@ -11256,7 +15299,7 @@ const flat_term_selector_DEFAULT_QUERY = {
};
const isSameTermName = (termA, termB) => unescapeString(termA).toLowerCase() === unescapeString(termB).toLowerCase();
const termNamesToIds = (names, terms) => {
- return names.map(termName => terms.find(term => isSameTermName(term.name, termName)).id);
+ return names.map(termName => terms.find(term => isSameTermName(term.name, termName))?.id).filter(id => id !== undefined);
};
function FlatTermSelector({
slug
@@ -11285,7 +15328,7 @@ function FlatTermSelector({
} = select(external_wp_coreData_namespaceObject.store);
const post = getCurrentPost();
const _taxonomy = getTaxonomy(slug);
- const _termIds = _taxonomy ? getEditedPostAttribute(_taxonomy.rest_base) : EMPTY_ARRAY;
+ const _termIds = _taxonomy ? getEditedPostAttribute(_taxonomy.rest_base) : flat_term_selector_EMPTY_ARRAY;
const query = {
...flat_term_selector_DEFAULT_QUERY,
include: _termIds.join(','),
@@ -11296,7 +15339,7 @@ function FlatTermSelector({
hasAssignAction: _taxonomy ? (_post$_links2 = post._links?.['wp:action-assign-' + _taxonomy.rest_base]) !== null && _post$_links2 !== void 0 ? _post$_links2 : false : false,
taxonomy: _taxonomy,
termIds: _termIds,
- terms: _termIds.length ? getEntityRecords('taxonomy', slug, query) : EMPTY_ARRAY,
+ terms: _termIds.length ? getEntityRecords('taxonomy', slug, query) : flat_term_selector_EMPTY_ARRAY,
hasResolvedTerms: hasFinishedResolution('getEntityRecords', ['taxonomy', slug, query])
};
}, [slug]);
@@ -11310,7 +15353,7 @@ function FlatTermSelector({
searchResults: !!search ? getEntityRecords('taxonomy', slug, {
...flat_term_selector_DEFAULT_QUERY,
search
- }) : EMPTY_ARRAY
+ }) : flat_term_selector_EMPTY_ARRAY
};
}, [search, slug]);
@@ -11373,7 +15416,8 @@ function FlatTermSelector({
// The selector will always re-fetch terms later.
setValues(uniqueTerms);
if (newTermNames.length === 0) {
- return onUpdateTerms(termNamesToIds(uniqueTerms, availableTerms));
+ onUpdateTerms(termNamesToIds(uniqueTerms, availableTerms));
+ return;
}
if (!hasCreateAction) {
return;
@@ -11382,11 +15426,14 @@ function FlatTermSelector({
name: termName
}))).then(newTerms => {
const newAvailableTerms = availableTerms.concat(newTerms);
- return onUpdateTerms(termNamesToIds(uniqueTerms, newAvailableTerms));
+ onUpdateTerms(termNamesToIds(uniqueTerms, newAvailableTerms));
}).catch(error => {
createErrorNotice(error.message, {
type: 'snackbar'
});
+ // In case of a failure, try assigning available terms.
+ // This will invalidate the optimistic update.
+ onUpdateTerms(termNamesToIds(uniqueTerms, availableTerms));
});
}
function appendTerm(newTerm) {
@@ -11409,28 +15456,29 @@ function FlatTermSelector({
(0,external_wp_i18n_namespaceObject._x)('%s removed', 'term'), singularName);
const removeTermLabel = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: term name. */
(0,external_wp_i18n_namespaceObject._x)('Remove %s', 'term'), singularName);
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.FormTokenField, {
- __next40pxDefaultSize: true,
- value: values,
- suggestions: suggestions,
- onChange: onChange,
- onInputChange: debouncedSearch,
- maxSuggestions: MAX_TERMS_SUGGESTIONS,
- label: newTermLabel,
- messages: {
- added: termAddedLabel,
- removed: termRemovedLabel,
- remove: removeTermLabel
- }
- }), (0,external_React_.createElement)(MostUsedTerms, {
- taxonomy: taxonomy,
- onSelect: appendTerm
- }));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FormTokenField, {
+ __next40pxDefaultSize: true,
+ value: values,
+ suggestions: suggestions,
+ onChange: onChange,
+ onInputChange: debouncedSearch,
+ maxSuggestions: MAX_TERMS_SUGGESTIONS,
+ label: newTermLabel,
+ messages: {
+ added: termAddedLabel,
+ removed: termRemovedLabel,
+ remove: removeTermLabel
+ }
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MostUsedTerms, {
+ taxonomy: taxonomy,
+ onSelect: appendTerm
+ })]
+ });
}
/* harmony default export */ const flat_term_selector = ((0,external_wp_components_namespaceObject.withFilters)('editor.PostTaxonomyType')(FlatTermSelector));
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-tags-panel.js
-
/**
* WordPress dependencies
*/
@@ -11445,17 +15493,22 @@ function FlatTermSelector({
*/
+
+
const TagsPanel = () => {
- const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), (0,external_React_.createElement)("span", {
+ const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
className: "editor-post-publish-panel__link",
- key: "label"
- }, (0,external_wp_i18n_namespaceObject.__)('Add tags'))];
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, {
+ children: (0,external_wp_i18n_namespaceObject.__)('Add tags')
+ }, "label")];
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, {
initialOpen: false,
- title: panelBodyTitle
- }, (0,external_React_.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.')), (0,external_React_.createElement)(flat_term_selector, {
- slug: 'post_tag'
- }));
+ title: panelBodyTitle,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ children: (0,external_wp_i18n_namespaceObject.__)('Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(flat_term_selector, {
+ slug: "post_tag"
+ })]
+ });
};
const MaybeTagsPanel = () => {
const {
@@ -11488,14 +15541,13 @@ const MaybeTagsPanel = () => {
* more than one tag.
*/
if (!hadTagsWhenOpeningThePanel) {
- return (0,external_React_.createElement)(TagsPanel, null);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TagsPanel, {});
}
return null;
};
/* harmony default export */ const maybe_tags_panel = (MaybeTagsPanel);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-post-format-panel.js
-
/**
* WordPress dependencies
*/
@@ -11509,6 +15561,8 @@ const MaybeTagsPanel = () => {
*/
+
+
const getSuggestion = (supportedFormats, suggestedPostFormat) => {
const formats = POST_FORMATS.filter(format => supportedFormats?.includes(format.id));
return formats.find(format => format.id === suggestedPostFormat);
@@ -11517,10 +15571,11 @@ const PostFormatSuggestion = ({
suggestedPostFormat,
suggestionText,
onUpdatePostFormat
-}) => (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
+}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
variant: "link",
- onClick: () => onUpdatePostFormat(suggestedPostFormat)
-}, suggestionText);
+ onClick: () => onUpdatePostFormat(suggestedPostFormat),
+ children: suggestionText
+});
function PostFormatPanel() {
const {
currentPostFormat,
@@ -11543,26 +15598,30 @@ function PostFormatPanel() {
const onUpdatePostFormat = format => editPost({
format
});
- const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), (0,external_React_.createElement)("span", {
+ const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
className: "editor-post-publish-panel__link",
- key: "label"
- }, (0,external_wp_i18n_namespaceObject.__)('Use a post format'))];
+ children: (0,external_wp_i18n_namespaceObject.__)('Use a post format')
+ }, "label")];
if (!suggestion || suggestion.id === currentPostFormat) {
return null;
}
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, {
initialOpen: false,
- title: panelBodyTitle
- }, (0,external_React_.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.')), (0,external_React_.createElement)("p", null, (0,external_React_.createElement)(PostFormatSuggestion, {
- onUpdatePostFormat: onUpdatePostFormat,
- suggestedPostFormat: suggestion.id,
- suggestionText: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: post format */
- (0,external_wp_i18n_namespaceObject.__)('Apply the "%1$s" format.'), suggestion.caption)
- })));
+ title: panelBodyTitle,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ children: (0,external_wp_i18n_namespaceObject.__)('Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostFormatSuggestion, {
+ onUpdatePostFormat: onUpdatePostFormat,
+ suggestedPostFormat: suggestion.id,
+ suggestionText: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: post format */
+ (0,external_wp_i18n_namespaceObject.__)('Apply the "%1$s" format.'), suggestion.caption)
+ })
+ })]
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/hierarchical-term-selector.js
-
/**
* WordPress dependencies
*/
@@ -11585,6 +15644,8 @@ function PostFormatPanel() {
/**
* Module Constants
*/
+
+
const hierarchical_term_selector_DEFAULT_QUERY = {
per_page: -1,
orderby: 'name',
@@ -11859,20 +15920,21 @@ function HierarchicalTermSelector({
};
const renderTerms = renderedTerms => {
return renderedTerms.map(term => {
- return (0,external_React_.createElement)("div", {
- key: term.id,
- className: "editor-post-taxonomies__hierarchical-terms-choice"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
- __nextHasNoMarginBottom: true,
- checked: terms.indexOf(term.id) !== -1,
- onChange: () => {
- const termId = parseInt(term.id, 10);
- onChange(termId);
- },
- label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(term.name)
- }), !!term.children.length && (0,external_React_.createElement)("div", {
- className: "editor-post-taxonomies__hierarchical-terms-subchoices"
- }, renderTerms(term.children)));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "editor-post-taxonomies__hierarchical-terms-choice",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, {
+ __nextHasNoMarginBottom: true,
+ checked: terms.indexOf(term.id) !== -1,
+ onChange: () => {
+ const termId = parseInt(term.id, 10);
+ onChange(termId);
+ },
+ label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(term.name)
+ }), !!term.children.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "editor-post-taxonomies__hierarchical-terms-subchoices",
+ children: renderTerms(term.children)
+ })]
+ }, term.id);
});
};
const labelWithFallback = (labelProperty, fallbackIsCategory, fallbackIsNotCategory) => {
@@ -11887,53 +15949,65 @@ function HierarchicalTermSelector({
const filterLabel = (_taxonomy$labels$sear = taxonomy?.labels?.search_items) !== null && _taxonomy$labels$sear !== void 0 ? _taxonomy$labels$sear : (0,external_wp_i18n_namespaceObject.__)('Search Terms');
const groupLabel = (_taxonomy$name = taxonomy?.name) !== null && _taxonomy$name !== void 0 ? _taxonomy$name : (0,external_wp_i18n_namespaceObject.__)('Terms');
const showFilter = availableTerms.length >= MIN_TERMS_COUNT_FOR_FILTER;
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, {
direction: "column",
- gap: "4"
- }, showFilter && (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, {
- __nextHasNoMarginBottom: true,
- label: filterLabel,
- value: filterValue,
- onChange: setFilter
- }), (0,external_React_.createElement)("div", {
- className: "editor-post-taxonomies__hierarchical-terms-list",
- tabIndex: "0",
- role: "group",
- "aria-label": groupLabel
- }, renderTerms('' !== filterValue ? filteredTermsTree : availableTermsTree)), !loading && hasCreateAction && (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- onClick: onToggleForm,
- className: "editor-post-taxonomies__hierarchical-terms-add",
- "aria-expanded": showForm,
- variant: "link"
- }, newTermButtonLabel)), showForm && (0,external_React_.createElement)("form", {
- onSubmit: onAddTerm
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, {
- direction: "column",
- gap: "4"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, {
- __nextHasNoMarginBottom: true,
- className: "editor-post-taxonomies__hierarchical-terms-input",
- label: newTermLabel,
- value: formName,
- onChange: onChangeFormName,
- required: true
- }), !!availableTerms.length && (0,external_React_.createElement)(external_wp_components_namespaceObject.TreeSelect, {
- __nextHasNoMarginBottom: true,
- label: parentSelectLabel,
- noOptionLabel: noParentOption,
- onChange: onChangeFormParent,
- selectedId: formParent,
- tree: availableTermsTree
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "secondary",
- type: "submit",
- className: "editor-post-taxonomies__hierarchical-terms-submit"
- }, newTermSubmitLabel)))));
+ gap: "4",
+ children: [showFilter && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, {
+ __nextHasNoMarginBottom: true,
+ label: filterLabel,
+ value: filterValue,
+ onChange: setFilter
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "editor-post-taxonomies__hierarchical-terms-list",
+ tabIndex: "0",
+ role: "group",
+ "aria-label": groupLabel,
+ children: renderTerms('' !== filterValue ? filteredTermsTree : availableTermsTree)
+ }), !loading && hasCreateAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ onClick: onToggleForm,
+ className: "editor-post-taxonomies__hierarchical-terms-add",
+ "aria-expanded": showForm,
+ variant: "link",
+ children: newTermButtonLabel
+ })
+ }), showForm && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", {
+ onSubmit: onAddTerm,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, {
+ direction: "column",
+ gap: "4",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, {
+ __next40pxDefaultSize: true,
+ __nextHasNoMarginBottom: true,
+ className: "editor-post-taxonomies__hierarchical-terms-input",
+ label: newTermLabel,
+ value: formName,
+ onChange: onChangeFormName,
+ required: true
+ }), !!availableTerms.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TreeSelect, {
+ __next40pxDefaultSize: true,
+ __nextHasNoMarginBottom: true,
+ label: parentSelectLabel,
+ noOptionLabel: noParentOption,
+ onChange: onChangeFormParent,
+ selectedId: formParent,
+ tree: availableTermsTree
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ __next40pxDefaultSize: true,
+ variant: "secondary",
+ type: "submit",
+ className: "editor-post-taxonomies__hierarchical-terms-submit",
+ children: newTermSubmitLabel
+ })
+ })]
+ })
+ })]
+ });
}
/* harmony default export */ const hierarchical_term_selector = ((0,external_wp_components_namespaceObject.withFilters)('editor.PostTaxonomyType')(HierarchicalTermSelector));
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-category-panel.js
-
/**
* WordPress dependencies
*/
@@ -11948,6 +16022,8 @@ function HierarchicalTermSelector({
*/
+
+
function MaybeCategoryPanel() {
const hasNoCategory = (0,external_wp_data_namespaceObject.useSelect)(select => {
const postType = select(store_store).getCurrentPostType();
@@ -11978,21 +16054,23 @@ function MaybeCategoryPanel() {
if (!shouldShowPanel) {
return null;
}
- const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), (0,external_React_.createElement)("span", {
+ const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
className: "editor-post-publish-panel__link",
- key: "label"
- }, (0,external_wp_i18n_namespaceObject.__)('Assign a category'))];
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, {
+ children: (0,external_wp_i18n_namespaceObject.__)('Assign a category')
+ }, "label")];
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, {
initialOpen: false,
- title: panelBodyTitle
- }, (0,external_React_.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Categories provide a helpful way to group related posts together and to quickly tell readers what a post is about.')), (0,external_React_.createElement)(hierarchical_term_selector, {
- slug: "category"
- }));
+ title: panelBodyTitle,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ children: (0,external_wp_i18n_namespaceObject.__)('Categories provide a helpful way to group related posts together and to quickly tell readers what a post is about.')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(hierarchical_term_selector, {
+ slug: "category"
+ })]
+ });
}
/* harmony default export */ const maybe_category_panel = (MaybeCategoryPanel);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-upload-media.js
-
/**
* WordPress dependencies
*/
@@ -12007,6 +16085,8 @@ function MaybeCategoryPanel() {
* Internal dependencies
*/
+
+
function flattenBlocks(blocks) {
const result = [];
blocks.forEach(block => {
@@ -12019,7 +16099,7 @@ function Image(block) {
const {
selectBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.img, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.img, {
tabIndex: 0,
role: "button",
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Select image block.'),
@@ -12032,7 +16112,6 @@ function Image(block) {
event.preventDefault();
}
},
- key: block.clientId,
alt: block.attributes.alt,
src: block.attributes.url,
animate: {
@@ -12052,7 +16131,7 @@ function Image(block) {
whileHover: {
scale: 1.08
}
- });
+ }, block.clientId);
}
function maybe_upload_media_PostFormatPanel() {
const [isUploading, setIsUploading] = (0,external_wp_element_namespaceObject.useState)(false);
@@ -12070,10 +16149,10 @@ function maybe_upload_media_PostFormatPanel() {
if (!mediaUpload || !externalImages.length) {
return null;
}
- const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), (0,external_React_.createElement)("span", {
+ const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
className: "editor-post-publish-panel__link",
- key: "label"
- }, (0,external_wp_i18n_namespaceObject.__)('External media'))];
+ children: (0,external_wp_i18n_namespaceObject.__)('External media')
+ }, "label")];
function uploadImages() {
setIsUploading(true);
Promise.all(externalImages.map(image => window.fetch(image.attributes.url.includes('?') ? image.attributes.url : image.attributes.url + '?').then(response => response.blob()).then(blob => new Promise((resolve, reject) => {
@@ -12097,28 +16176,33 @@ function maybe_upload_media_PostFormatPanel() {
setIsUploading(false);
});
}
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, {
initialOpen: true,
- title: panelBodyTitle
- }, (0,external_React_.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Upload external images to the Media Library. Images from different domains may load slowly, display incorrectly, or be removed unexpectedly.')), (0,external_React_.createElement)("div", {
- style: {
- display: 'inline-flex',
- flexWrap: 'wrap',
- gap: '8px'
- }
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableAnimatePresence, null, externalImages.map(image => {
- return (0,external_React_.createElement)(Image, {
- key: image.clientId,
- ...image
- });
- })), isUploading ? (0,external_React_.createElement)(external_wp_components_namespaceObject.Spinner, null) : (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "primary",
- onClick: uploadImages
- }, (0,external_wp_i18n_namespaceObject.__)('Upload'))));
+ title: panelBodyTitle,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ children: (0,external_wp_i18n_namespaceObject.__)('Upload external images to the Media Library. Images from different domains may load slowly, display incorrectly, or be removed unexpectedly.')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ style: {
+ display: 'inline-flex',
+ flexWrap: 'wrap',
+ gap: '8px'
+ },
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, {
+ children: externalImages.map(image => {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Image, {
+ ...image
+ }, image.clientId);
+ })
+ }), isUploading ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "primary",
+ onClick: uploadImages,
+ children: (0,external_wp_i18n_namespaceObject.__)('Upload')
+ })]
+ })]
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/prepublish.js
-
/**
* WordPress dependencies
*/
@@ -12142,6 +16226,9 @@ function maybe_upload_media_PostFormatPanel() {
+
+
+
function PostPublishPanelPrepublish({
children
}) {
@@ -12172,13 +16259,13 @@ function PostPublishPanelPrepublish({
siteHome: siteData.home && (0,external_wp_url_namespaceObject.filterURLForDisplay)(siteData.home)
};
}, []);
- let siteIcon = (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, {
+ let siteIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, {
className: "components-site-icon",
size: "36px",
icon: library_wordpress
});
if (siteIconUrl) {
- siteIcon = (0,external_React_.createElement)("img", {
+ siteIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", {
alt: (0,external_wp_i18n_namespaceObject.__)('Site Icon'),
className: "components-site-icon",
src: siteIconUrl
@@ -12198,34 +16285,48 @@ function PostPublishPanelPrepublish({
prePublishTitle = (0,external_wp_i18n_namespaceObject.__)('Are you ready to publish?');
prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)('Double-check your settings before publishing.');
}
- return (0,external_React_.createElement)("div", {
- className: "editor-post-publish-panel__prepublish"
- }, (0,external_React_.createElement)("div", null, (0,external_React_.createElement)("strong", null, prePublishTitle)), (0,external_React_.createElement)("p", null, prePublishBodyText), (0,external_React_.createElement)("div", {
- className: "components-site-card"
- }, siteIcon, (0,external_React_.createElement)("div", {
- className: "components-site-info"
- }, (0,external_React_.createElement)("span", {
- className: "components-site-name"
- }, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle) || (0,external_wp_i18n_namespaceObject.__)('(Untitled)')), (0,external_React_.createElement)("span", {
- className: "components-site-home"
- }, siteHome))), (0,external_React_.createElement)(maybe_upload_media_PostFormatPanel, null), hasPublishAction && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, {
- initialOpen: false,
- title: [(0,external_wp_i18n_namespaceObject.__)('Visibility:'), (0,external_React_.createElement)("span", {
- className: "editor-post-publish-panel__link",
- key: "label"
- }, (0,external_React_.createElement)(PostVisibilityLabel, null))]
- }, (0,external_React_.createElement)(PostVisibility, null)), (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, {
- initialOpen: false,
- title: [(0,external_wp_i18n_namespaceObject.__)('Publish:'), (0,external_React_.createElement)("span", {
- className: "editor-post-publish-panel__link",
- key: "label"
- }, (0,external_React_.createElement)(PostScheduleLabel, null))]
- }, (0,external_React_.createElement)(PostSchedule, null))), (0,external_React_.createElement)(PostFormatPanel, null), (0,external_React_.createElement)(maybe_tags_panel, null), (0,external_React_.createElement)(maybe_category_panel, null), children);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "editor-post-publish-panel__prepublish",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", {
+ children: prePublishTitle
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ children: prePublishBodyText
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "components-site-card",
+ children: [siteIcon, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "components-site-info",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "components-site-name",
+ children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle) || (0,external_wp_i18n_namespaceObject.__)('(Untitled)')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "components-site-home",
+ children: siteHome
+ })]
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(maybe_upload_media_PostFormatPanel, {}), hasPublishAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, {
+ initialOpen: false,
+ title: [(0,external_wp_i18n_namespaceObject.__)('Visibility:'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "editor-post-publish-panel__link",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostVisibilityLabel, {})
+ }, "label")],
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostVisibility, {})
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, {
+ initialOpen: false,
+ title: [(0,external_wp_i18n_namespaceObject.__)('Publish:'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "editor-post-publish-panel__link",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostScheduleLabel, {})
+ }, "label")],
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSchedule, {})
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostFormatPanel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(maybe_tags_panel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(maybe_category_panel, {}), children]
+ });
}
/* harmony default export */ const prepublish = (PostPublishPanelPrepublish);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/postpublish.js
-
/**
* WordPress dependencies
*/
@@ -12243,6 +16344,9 @@ function PostPublishPanelPrepublish({
*/
+
+
+
const POSTNAME = '%postname%';
const PAGENAME = '%pagename%';
@@ -12272,10 +16376,11 @@ function postpublish_CopyButton({
children
}) {
const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text, onCopy);
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
variant: "secondary",
- ref: ref
- }, children);
+ ref: ref,
+ children: children
+ });
}
class PostPublishPanelPostpublish extends external_wp_element_namespaceObject.Component {
constructor() {
@@ -12323,40 +16428,56 @@ class PostPublishPanelPostpublish extends external_wp_element_namespaceObject.Co
const addLink = (0,external_wp_url_namespaceObject.addQueryArgs)('post-new.php', {
post_type: post.type
});
- const postPublishNonLinkHeader = isScheduled ? (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_wp_i18n_namespaceObject.__)('is now scheduled. It will go live on'), ' ', (0,external_React_.createElement)(PostScheduleLabel, null), ".") : (0,external_wp_i18n_namespaceObject.__)('is now live.');
- return (0,external_React_.createElement)("div", {
- className: "post-publish-panel__postpublish"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, {
- className: "post-publish-panel__postpublish-header"
- }, (0,external_React_.createElement)("a", {
- ref: this.postLink,
- href: link
- }, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(post.title) || (0,external_wp_i18n_namespaceObject.__)('(no title)')), ' ', postPublishNonLinkHeader), (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, null, (0,external_React_.createElement)("p", {
- className: "post-publish-panel__postpublish-subheader"
- }, (0,external_React_.createElement)("strong", null, (0,external_wp_i18n_namespaceObject.__)('What’s next?'))), (0,external_React_.createElement)("div", {
- className: "post-publish-panel__postpublish-post-address-container"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, {
- __nextHasNoMarginBottom: true,
- className: "post-publish-panel__postpublish-post-address",
- readOnly: true,
- label: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: post type singular name */
- (0,external_wp_i18n_namespaceObject.__)('%s address'), postLabel),
- value: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(link),
- onFocus: this.onSelectInput
- }), (0,external_React_.createElement)("div", {
- className: "post-publish-panel__postpublish-post-address__copy-button-wrap"
- }, (0,external_React_.createElement)(postpublish_CopyButton, {
- text: link,
- onCopy: this.onCopy
- }, this.state.showCopyConfirmation ? (0,external_wp_i18n_namespaceObject.__)('Copied!') : (0,external_wp_i18n_namespaceObject.__)('Copy')))), (0,external_React_.createElement)("div", {
- className: "post-publish-panel__postpublish-buttons"
- }, !isScheduled && (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "primary",
- href: link
- }, viewPostLabel), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: isScheduled ? 'primary' : 'secondary',
- href: addLink
- }, addNewPostLabel))), children);
+ const postPublishNonLinkHeader = isScheduled ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [(0,external_wp_i18n_namespaceObject.__)('is now scheduled. It will go live on'), ' ', /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostScheduleLabel, {}), "."]
+ }) : (0,external_wp_i18n_namespaceObject.__)('is now live.');
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "post-publish-panel__postpublish",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, {
+ className: "post-publish-panel__postpublish-header",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", {
+ ref: this.postLink,
+ href: link,
+ children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(post.title) || (0,external_wp_i18n_namespaceObject.__)('(no title)')
+ }), ' ', postPublishNonLinkHeader]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ className: "post-publish-panel__postpublish-subheader",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", {
+ children: (0,external_wp_i18n_namespaceObject.__)('What’s next?')
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "post-publish-panel__postpublish-post-address-container",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, {
+ __nextHasNoMarginBottom: true,
+ className: "post-publish-panel__postpublish-post-address",
+ readOnly: true,
+ label: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: post type singular name */
+ (0,external_wp_i18n_namespaceObject.__)('%s address'), postLabel),
+ value: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(link),
+ onFocus: this.onSelectInput
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "post-publish-panel__postpublish-post-address__copy-button-wrap",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(postpublish_CopyButton, {
+ text: link,
+ onCopy: this.onCopy,
+ children: this.state.showCopyConfirmation ? (0,external_wp_i18n_namespaceObject.__)('Copied!') : (0,external_wp_i18n_namespaceObject.__)('Copy')
+ })
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "post-publish-panel__postpublish-buttons",
+ children: [!isScheduled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "primary",
+ href: link,
+ children: viewPostLabel
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: isScheduled ? 'primary' : 'secondary',
+ href: addLink,
+ children: addNewPostLabel
+ })]
+ })]
+ }), children]
+ });
}
}
/* harmony default export */ const postpublish = ((0,external_wp_data_namespaceObject.withSelect)(select => {
@@ -12376,7 +16497,6 @@ class PostPublishPanelPostpublish extends external_wp_element_namespaceObject.Co
})(PostPublishPanelPostpublish));
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/index.js
-
/**
* WordPress dependencies
*/
@@ -12395,6 +16515,9 @@ class PostPublishPanelPostpublish extends external_wp_element_namespaceObject.Co
+
+
+
class PostPublishPanel extends external_wp_element_namespaceObject.Component {
constructor() {
super(...arguments);
@@ -12441,39 +16564,53 @@ class PostPublishPanel extends external_wp_element_namespaceObject.Component {
const isPublishedOrScheduled = isPublished || isScheduled && isBeingScheduled;
const isPrePublish = !isPublishedOrScheduled && !isSaving;
const isPostPublish = isPublishedOrScheduled && !isSaving;
- return (0,external_React_.createElement)("div", {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
className: "editor-post-publish-panel",
- ...propsForPanel
- }, (0,external_React_.createElement)("div", {
- className: "editor-post-publish-panel__header"
- }, isPostPublish ? (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- onClick: onClose,
- icon: close_small,
- label: (0,external_wp_i18n_namespaceObject.__)('Close panel')
- }) : (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("div", {
- className: "editor-post-publish-panel__header-publish-button"
- }, (0,external_React_.createElement)(post_publish_button, {
- focusOnMount: true,
- onSubmit: this.onSubmit,
- forceIsDirty: forceIsDirty
- })), (0,external_React_.createElement)("div", {
- className: "editor-post-publish-panel__header-cancel-button"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- disabled: isSavingNonPostEntityChanges,
- onClick: onClose,
- variant: "secondary"
- }, (0,external_wp_i18n_namespaceObject.__)('Cancel'))))), (0,external_React_.createElement)("div", {
- className: "editor-post-publish-panel__content"
- }, isPrePublish && (0,external_React_.createElement)(prepublish, null, PrePublishExtension && (0,external_React_.createElement)(PrePublishExtension, null)), isPostPublish && (0,external_React_.createElement)(postpublish, {
- focusOnMount: true
- }, PostPublishExtension && (0,external_React_.createElement)(PostPublishExtension, null)), isSaving && (0,external_React_.createElement)(external_wp_components_namespaceObject.Spinner, null)), (0,external_React_.createElement)("div", {
- className: "editor-post-publish-panel__footer"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
- __nextHasNoMarginBottom: true,
- label: (0,external_wp_i18n_namespaceObject.__)('Always show pre-publish checks.'),
- checked: isPublishSidebarEnabled,
- onChange: onTogglePublishSidebar
- })));
+ ...propsForPanel,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "editor-post-publish-panel__header",
+ children: isPostPublish ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ onClick: onClose,
+ icon: close_small,
+ label: (0,external_wp_i18n_namespaceObject.__)('Close panel')
+ }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "editor-post-publish-panel__header-publish-button",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_publish_button, {
+ focusOnMount: true,
+ onSubmit: this.onSubmit,
+ forceIsDirty: forceIsDirty
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "editor-post-publish-panel__header-cancel-button",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ __experimentalIsFocusable: true,
+ disabled: isSavingNonPostEntityChanges,
+ onClick: onClose,
+ variant: "secondary",
+ size: "compact",
+ children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
+ })
+ })]
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "editor-post-publish-panel__content",
+ children: [isPrePublish && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(prepublish, {
+ children: PrePublishExtension && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrePublishExtension, {})
+ }), isPostPublish && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(postpublish, {
+ focusOnMount: true,
+ children: PostPublishExtension && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostPublishExtension, {})
+ }), isSaving && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {})]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "editor-post-publish-panel__footer",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, {
+ __nextHasNoMarginBottom: true,
+ label: (0,external_wp_i18n_namespaceObject.__)('Always show pre-publish checks.'),
+ checked: isPublishSidebarEnabled,
+ onChange: onTogglePublishSidebar
+ })
+ })]
+ });
}
}
/* harmony default export */ const post_publish_panel = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
@@ -12526,17 +16663,18 @@ class PostPublishPanel extends external_wp_element_namespaceObject.Component {
}), external_wp_components_namespaceObject.withFocusReturn, external_wp_components_namespaceObject.withConstrainedTabbing])(PostPublishPanel));
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cloud-upload.js
-
/**
* WordPress dependencies
*/
-const cloudUpload = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+const cloudUpload = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-4v-2.4L14 14l1-1-3-3-3 3 1 1 1.2-1.2v2.4H7.7c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4H9l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8 0 1-.8 1.8-1.7 1.8z"
-}));
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-4v-2.4L14 14l1-1-3-3-3 3 1 1 1.2-1.2v2.4H7.7c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4H9l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8 0 1-.8 1.8-1.7 1.8z"
+ })
+});
/* harmony default export */ const cloud_upload = (cloudUpload);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js
@@ -12572,22 +16710,255 @@ function Icon({
/* harmony default export */ const icon = ((0,external_wp_element_namespaceObject.forwardRef)(Icon));
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cloud.js
-
/**
* WordPress dependencies
*/
-const cloud = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+const cloud = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-9c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4h1.3l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8-.1 1-.9 1.8-1.8 1.8z"
-}));
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-9c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4h1.3l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8-.1 1-.9 1.8-1.8 1.8z"
+ })
+});
/* harmony default export */ const library_cloud = (cloud);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-saved-state/index.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-status/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
/**
+ * Internal dependencies
+ */
+
+
+
+
+
+
+
+const labels = {
+ 'auto-draft': (0,external_wp_i18n_namespaceObject.__)('Draft'),
+ draft: (0,external_wp_i18n_namespaceObject.__)('Draft'),
+ pending: (0,external_wp_i18n_namespaceObject.__)('Pending'),
+ private: (0,external_wp_i18n_namespaceObject.__)('Private'),
+ future: (0,external_wp_i18n_namespaceObject.__)('Scheduled'),
+ publish: (0,external_wp_i18n_namespaceObject.__)('Published')
+};
+const STATUS_OPTIONS = [{
+ label: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [(0,external_wp_i18n_namespaceObject.__)('Draft'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ variant: "muted",
+ size: 12,
+ children: (0,external_wp_i18n_namespaceObject.__)('Not ready to publish.')
+ })]
+ }),
+ value: 'draft'
+}, {
+ label: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [(0,external_wp_i18n_namespaceObject.__)('Pending'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ variant: "muted",
+ size: 12,
+ children: (0,external_wp_i18n_namespaceObject.__)('Waiting for review before publishing.')
+ })]
+ }),
+ value: 'pending'
+}, {
+ label: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [(0,external_wp_i18n_namespaceObject.__)('Private'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ variant: "muted",
+ size: 12,
+ children: (0,external_wp_i18n_namespaceObject.__)('Only visible to site admins and editors.')
+ })]
+ }),
+ value: 'private'
+}, {
+ label: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [(0,external_wp_i18n_namespaceObject.__)('Scheduled'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ variant: "muted",
+ size: 12,
+ children: (0,external_wp_i18n_namespaceObject.__)('Publish automatically on a chosen date.')
+ })]
+ }),
+ value: 'future'
+}, {
+ label: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [(0,external_wp_i18n_namespaceObject.__)('Published'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ variant: "muted",
+ size: 12,
+ children: (0,external_wp_i18n_namespaceObject.__)('Visible to everyone.')
+ })]
+ }),
+ value: 'publish'
+}];
+const DESIGN_POST_TYPES = [TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, PATTERN_POST_TYPE, NAVIGATION_POST_TYPE];
+function PostStatus() {
+ const {
+ status,
+ date,
+ password,
+ postId,
+ postType,
+ canEdit
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ var _getCurrentPost$_link;
+ const {
+ getEditedPostAttribute,
+ getCurrentPostId,
+ getCurrentPostType,
+ getCurrentPost
+ } = select(store_store);
+ return {
+ status: getEditedPostAttribute('status'),
+ date: getEditedPostAttribute('date'),
+ password: getEditedPostAttribute('password'),
+ postId: getCurrentPostId(),
+ postType: getCurrentPostType(),
+ canEdit: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false
+ };
+ }, []);
+ const [showPassword, setShowPassword] = (0,external_wp_element_namespaceObject.useState)(!!password);
+ const passwordInputId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostStatus, 'editor-change-status__password-input');
+ const {
+ editEntityRecord
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
+ const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
+ // Memoize popoverProps to avoid returning a new object every time.
+ const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
+ // Anchor the popover to the middle of the entire row so that it doesn't
+ // move around when the label changes.
+ anchor: popoverAnchor,
+ 'aria-label': (0,external_wp_i18n_namespaceObject.__)('Status & visibility'),
+ headerTitle: (0,external_wp_i18n_namespaceObject.__)('Status & visibility'),
+ placement: 'left-start',
+ offset: 36,
+ shift: true
+ }), [popoverAnchor]);
+ if (DESIGN_POST_TYPES.includes(postType)) {
+ return null;
+ }
+ const updatePost = ({
+ status: newStatus = status,
+ password: newPassword = password,
+ date: newDate = date
+ }) => {
+ editEntityRecord('postType', postType, postId, {
+ status: newStatus,
+ date: newDate,
+ password: newPassword
+ });
+ };
+ const handleTogglePassword = value => {
+ setShowPassword(value);
+ if (!value) {
+ updatePost({
+ password: ''
+ });
+ }
+ };
+ const handleStatus = value => {
+ let newDate = date;
+ let newPassword = password;
+ if (status === 'future' && new Date(date) > new Date()) {
+ newDate = null;
+ }
+ if (value === 'private' && password) {
+ newPassword = '';
+ }
+ updatePost({
+ status: value,
+ date: newDate,
+ password: newPassword
+ });
+ };
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Status'),
+ ref: setPopoverAnchor,
+ children: canEdit ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
+ className: "editor-post-status",
+ contentClassName: "editor-change-status__content",
+ popoverProps: popoverProps,
+ focusOnMount: true,
+ renderToggle: ({
+ onToggle
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "tertiary",
+ size: "compact",
+ onClick: onToggle,
+ "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: Current post status.
+ (0,external_wp_i18n_namespaceObject.__)('Change post status: %s'), labels[status]),
+ children: labels[status]
+ }),
+ renderContent: ({
+ onClose
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Status & visibility'),
+ onClose: onClose
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 4,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RadioControl, {
+ className: "editor-change-status__options",
+ hideLabelFromVision: true,
+ label: (0,external_wp_i18n_namespaceObject.__)('Status'),
+ options: STATUS_OPTIONS,
+ onChange: handleStatus,
+ selected: status === 'auto-draft' ? 'draft' : status
+ }), status === 'future' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "editor-change-status__publish-date-wrapper",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivatePostSchedule, {
+ showPopoverHeaderActions: false,
+ isCompact: true
+ })
+ }), status !== 'private' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ as: "fieldset",
+ spacing: 4,
+ className: "editor-change-status__password-fieldset",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, {
+ __nextHasNoMarginBottom: true,
+ label: (0,external_wp_i18n_namespaceObject.__)('Password protected'),
+ help: (0,external_wp_i18n_namespaceObject.__)('Only visible to those who know the password'),
+ checked: showPassword,
+ onChange: handleTogglePassword
+ }), showPassword && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "editor-change-status__password-input",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Password'),
+ onChange: value => updatePost({
+ password: value
+ }),
+ value: password,
+ placeholder: (0,external_wp_i18n_namespaceObject.__)('Use a secure password'),
+ type: "text",
+ id: passwordInputId,
+ __next40pxDefaultSize: true,
+ __nextHasNoMarginBottom: true
+ })
+ })]
+ })]
+ })
+ })]
+ })
+ }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "editor-post-status is-read-only",
+ children: labels[status]
+ })
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-saved-state/index.js
+/**
* External dependencies
*/
@@ -12609,6 +16980,7 @@ const cloud = (0,external_React_.createElement)(external_wp_primitives_namespace
*/
+
/**
* Component showing whether the post is saved or not and providing save
* buttons.
@@ -12618,6 +16990,8 @@ const cloud = (0,external_React_.createElement)(external_wp_primitives_namespace
* as dirty.
* @return {import('react').ComponentType} The component.
*/
+
+
function PostSavedState({
forceIsDirty
}) {
@@ -12627,13 +17001,14 @@ function PostSavedState({
isAutosaving,
isDirty,
isNew,
- isPending,
isPublished,
isSaveable,
isSaving,
isScheduled,
hasPublishAction,
- showIconLabels
+ showIconLabels,
+ postStatus,
+ postStatusHasChanged
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
var _getCurrentPost$_link;
const {
@@ -12645,7 +17020,8 @@ function PostSavedState({
isEditedPostSaveable,
getCurrentPost,
isAutosavingPost,
- getEditedPostAttribute
+ getEditedPostAttribute,
+ getPostEdits
} = select(store_store);
const {
get
@@ -12654,15 +17030,17 @@ function PostSavedState({
isAutosaving: isAutosavingPost(),
isDirty: forceIsDirty || isEditedPostDirty(),
isNew: isEditedPostNew(),
- isPending: 'pending' === getEditedPostAttribute('status'),
isPublished: isCurrentPostPublished(),
isSaving: isSavingPost(),
isSaveable: isEditedPostSaveable(),
isScheduled: isCurrentPostScheduled(),
hasPublishAction: (_getCurrentPost$_link = getCurrentPost()?._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false,
- showIconLabels: get('core', 'showIconLabels')
+ showIconLabels: get('core', 'showIconLabels'),
+ postStatus: getEditedPostAttribute('status'),
+ postStatusHasChanged: !!getPostEdits()?.status
};
}, [forceIsDirty]);
+ const isPending = postStatus === 'pending';
const {
savePost
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
@@ -12683,7 +17061,16 @@ function PostSavedState({
if (!hasPublishAction && isPending) {
return null;
}
- if (isPublished || isScheduled) {
+
+ // We shouldn't render the button if the post has not one of the following statuses: pending, draft, auto-draft.
+ // The reason for this is that this button handles the `save as pending` and `save draft` actions.
+ // An exception for this is when the post has a custom status and there should be a way to save changes without
+ // having to publish. This should be handled better in the future when custom statuses have better support.
+ // @see https://github.com/WordPress/gutenberg/issues/3144.
+ const isIneligibleStatus = !['pending', 'draft', 'auto-draft'].includes(postStatus) && STATUS_OPTIONS.map(({
+ value
+ }) => value).includes(postStatus);
+ if (isPublished || isScheduled || isIneligibleStatus || postStatusHasChanged && ['pending', 'draft'].includes(postStatus)) {
return null;
}
@@ -12708,8 +17095,8 @@ function PostSavedState({
// Use common Button instance for all saved states so that focus is not
// lost.
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- className: isSaveable || isSaving ? classnames_default()({
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Button, {
+ className: isSaveable || isSaving ? dist_clsx({
'editor-post-save-draft': !isSavedState,
'editor-post-saved-state': isSavedState,
'is-saving': isSaving,
@@ -12729,10 +17116,11 @@ function PostSavedState({
size: "compact",
icon: isLargeViewport ? undefined : cloud_upload,
label: text || label,
- "aria-disabled": isDisabled
- }, isSavedState && (0,external_React_.createElement)(icon, {
- icon: isSaved ? library_check : library_cloud
- }), text);
+ "aria-disabled": isDisabled,
+ children: [isSavedState && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icon, {
+ icon: isSaved ? library_check : library_cloud
+ }), text]
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/check.js
@@ -12745,6 +17133,15 @@ function PostSavedState({
* Internal dependencies
*/
+
+/**
+ * Wrapper component that renders its children only if post has a publish action.
+ *
+ * @param {Object} props Props.
+ * @param {Element} props.children Children to be rendered.
+ *
+ * @return {Component} - The component to be rendered or null if there is no publish action.
+ */
function PostScheduleCheck({
children
}) {
@@ -12759,7 +17156,6 @@ function PostScheduleCheck({
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/panel.js
-
/**
* WordPress dependencies
*/
@@ -12767,6 +17163,7 @@ function PostScheduleCheck({
+
/**
* Internal dependencies
*/
@@ -12774,67 +17171,88 @@ function PostScheduleCheck({
+
+
+
+const panel_DESIGN_POST_TYPES = [TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, PATTERN_POST_TYPE, NAVIGATION_POST_TYPE];
+
+/**
+ * Renders the Post Schedule Panel component.
+ *
+ * @return {Component} The component to be rendered.
+ */
function PostSchedulePanel() {
const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
+ const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentPostType(), []);
// Memoize popoverProps to avoid returning a new object every time.
const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
// Anchor the popover to the middle of the entire row so that it doesn't
// move around when the label changes.
anchor: popoverAnchor,
'aria-label': (0,external_wp_i18n_namespaceObject.__)('Change publish date'),
- placement: 'bottom-end'
+ placement: 'left-start',
+ offset: 36,
+ shift: true
}), [popoverAnchor]);
const label = usePostScheduleLabel();
const fullLabel = usePostScheduleLabel({
full: true
});
- return (0,external_React_.createElement)(PostScheduleCheck, null, (0,external_React_.createElement)(post_panel_row, {
- label: (0,external_wp_i18n_namespaceObject.__)('Publish'),
- ref: setPopoverAnchor
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Dropdown, {
- popoverProps: popoverProps,
- focusOnMount: true,
- className: "editor-post-schedule__panel-dropdown",
- contentClassName: "editor-post-schedule__dialog",
- renderToggle: ({
- onToggle,
- isOpen
- }) => (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- __next40pxDefaultSize: true,
- className: "editor-post-schedule__dialog-toggle",
- variant: "tertiary",
- onClick: onToggle,
- "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %s: Current post date.
- (0,external_wp_i18n_namespaceObject.__)('Change date: %s'), label),
- label: fullLabel,
- showTooltip: label !== fullLabel,
- "aria-expanded": isOpen
- }, label),
- renderContent: ({
- onClose
- }) => (0,external_React_.createElement)(PostSchedule, {
- onClose: onClose
+ if (panel_DESIGN_POST_TYPES.includes(postType)) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostScheduleCheck, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Publish'),
+ ref: setPopoverAnchor,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
+ popoverProps: popoverProps,
+ focusOnMount: true,
+ className: "editor-post-schedule__panel-dropdown",
+ contentClassName: "editor-post-schedule__dialog",
+ renderToggle: ({
+ onToggle,
+ isOpen
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ size: "compact",
+ className: "editor-post-schedule__dialog-toggle",
+ variant: "tertiary",
+ tooltipPosition: "middle left",
+ onClick: onToggle,
+ "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: Current post date.
+ (0,external_wp_i18n_namespaceObject.__)('Change date: %s'), label),
+ label: fullLabel,
+ showTooltip: label !== fullLabel,
+ "aria-expanded": isOpen,
+ children: label
+ }),
+ renderContent: ({
+ onClose
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSchedule, {
+ onClose: onClose
+ })
+ })
})
- })));
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-slug/check.js
-
/**
* Internal dependencies
*/
+
function PostSlugCheck({
children
}) {
- return (0,external_React_.createElement)(post_type_support_check, {
- supportKeys: "slug"
- }, children);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, {
+ supportKeys: "slug",
+ children: children
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-slug/index.js
-
/**
* WordPress dependencies
*/
@@ -12844,81 +17262,60 @@ function PostSlugCheck({
-
/**
* Internal dependencies
*/
-class PostSlug extends external_wp_element_namespaceObject.Component {
- constructor({
- postSlug,
- postTitle,
- postID
- }) {
- super(...arguments);
- this.state = {
- editedSlug: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(postSlug) || (0,external_wp_url_namespaceObject.cleanForSlug)(postTitle) || postID
- };
- this.setSlug = this.setSlug.bind(this);
- }
- setSlug(event) {
- const {
- postSlug,
- onUpdateSlug
- } = this.props;
- const {
- value
- } = event.target;
- const editedSlug = (0,external_wp_url_namespaceObject.cleanForSlug)(value);
- if (editedSlug === postSlug) {
- return;
- }
- onUpdateSlug(editedSlug);
- }
- render() {
- const {
- editedSlug
- } = this.state;
- return (0,external_React_.createElement)(PostSlugCheck, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, {
- __nextHasNoMarginBottom: true,
- label: (0,external_wp_i18n_namespaceObject.__)('Slug'),
- autoComplete: "off",
- spellCheck: "false",
- value: editedSlug,
- onChange: slug => this.setState({
- editedSlug: slug
- }),
- onBlur: this.setSlug,
- className: "editor-post-slug"
- }));
- }
-}
-/* harmony default export */ const post_slug = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
- const {
- getCurrentPost,
- getEditedPostAttribute
- } = select(store_store);
- const {
- id
- } = getCurrentPost();
- return {
- postSlug: getEditedPostAttribute('slug'),
- postTitle: getEditedPostAttribute('title'),
- postID: id
- };
-}), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
+
+function PostSlugControl() {
+ const postSlug = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ return (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(select(store_store).getEditedPostSlug());
+ }, []);
const {
editPost
- } = dispatch(store_store);
- return {
- onUpdateSlug(slug) {
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
+ const [forceEmptyField, setForceEmptyField] = (0,external_wp_element_namespaceObject.useState)(false);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, {
+ __nextHasNoMarginBottom: true,
+ label: (0,external_wp_i18n_namespaceObject.__)('Slug'),
+ autoComplete: "off",
+ spellCheck: "false",
+ value: forceEmptyField ? '' : postSlug,
+ onChange: newValue => {
editPost({
- slug
+ slug: newValue
});
- }
- };
-})])(PostSlug));
+ // When we delete the field the permalink gets
+ // reverted to the original value.
+ // The forceEmptyField logic allows the user to have
+ // the field temporarily empty while typing.
+ if (!newValue) {
+ if (!forceEmptyField) {
+ setForceEmptyField(true);
+ }
+ return;
+ }
+ if (forceEmptyField) {
+ setForceEmptyField(false);
+ }
+ },
+ onBlur: event => {
+ editPost({
+ slug: (0,external_wp_url_namespaceObject.cleanForSlug)(event.target.value)
+ });
+ if (forceEmptyField) {
+ setForceEmptyField(false);
+ }
+ },
+ className: "editor-post-slug"
+ });
+}
+function PostSlug() {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSlugCheck, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSlugControl, {})
+ });
+}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-sticky/check.js
/**
@@ -12951,7 +17348,6 @@ function PostStickyCheck({
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-sticky/index.js
-
/**
* WordPress dependencies
*/
@@ -12964,6 +17360,8 @@ function PostStickyCheck({
*/
+
+
function PostSticky() {
const postSticky = (0,external_wp_data_namespaceObject.useSelect)(select => {
var _select$getEditedPost;
@@ -12972,18 +17370,24 @@ function PostSticky() {
const {
editPost
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- return (0,external_React_.createElement)(PostStickyCheck, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
- __nextHasNoMarginBottom: true,
- label: (0,external_wp_i18n_namespaceObject.__)('Stick to the top of the blog'),
- checked: postSticky,
- onChange: () => editPost({
- sticky: !postSticky
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostStickyCheck, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Sticky'),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, {
+ className: "editor-post-sticky__toggle-control",
+ label: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, {
+ children: (0,external_wp_i18n_namespaceObject.__)('Sticky')
+ }),
+ checked: postSticky,
+ onChange: () => editPost({
+ sticky: !postSticky
+ })
+ })
})
- }));
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-switch-to-draft-button/index.js
-
/**
* WordPress dependencies
*/
@@ -12996,6 +17400,11 @@ function PostSticky() {
* Internal dependencies
*/
+
+// TODO: deprecate..
+
+
+
function PostSwitchToDraftButton() {
const [showConfirmDialog, setShowConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false);
const {
@@ -13020,10 +17429,13 @@ function PostSwitchToDraftButton() {
}, []);
const isDisabled = isSaving || !isPublished && !isScheduled;
let alertMessage;
+ let confirmButtonText;
if (isPublished) {
alertMessage = (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to unpublish this post?');
+ confirmButtonText = (0,external_wp_i18n_namespaceObject.__)('Unpublish');
} else if (isScheduled) {
alertMessage = (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to unschedule this post?');
+ confirmButtonText = (0,external_wp_i18n_namespaceObject.__)('Unschedule');
}
const handleConfirm = () => {
setShowConfirmDialog(false);
@@ -13032,29 +17444,33 @@ function PostSwitchToDraftButton() {
});
savePost();
};
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- __next40pxDefaultSize: true,
- className: "editor-post-switch-to-draft",
- onClick: () => {
- if (!isDisabled) {
- setShowConfirmDialog(true);
- }
- },
- "aria-disabled": isDisabled,
- variant: "secondary",
- style: {
- flexGrow: '1',
- justifyContent: 'center'
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Switch to draft')), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalConfirmDialog, {
- isOpen: showConfirmDialog,
- onConfirm: handleConfirm,
- onCancel: () => setShowConfirmDialog(false)
- }, alertMessage));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ __next40pxDefaultSize: true,
+ className: "editor-post-switch-to-draft",
+ onClick: () => {
+ if (!isDisabled) {
+ setShowConfirmDialog(true);
+ }
+ },
+ "aria-disabled": isDisabled,
+ variant: "secondary",
+ style: {
+ flexGrow: '1',
+ justifyContent: 'center'
+ },
+ children: (0,external_wp_i18n_namespaceObject.__)('Switch to draft')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, {
+ isOpen: showConfirmDialog,
+ onConfirm: handleConfirm,
+ onCancel: () => setShowConfirmDialog(false),
+ confirmButtonText: confirmButtonText,
+ children: alertMessage
+ })]
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-sync-status/index.js
-
/**
* WordPress dependencies
*/
@@ -13066,6 +17482,7 @@ function PostSwitchToDraftButton() {
*/
+
function PostSyncStatus() {
const {
syncStatus,
@@ -13086,15 +17503,16 @@ function PostSyncStatus() {
if (postType !== 'wp_block') {
return null;
}
- return (0,external_React_.createElement)(post_panel_row, {
- label: (0,external_wp_i18n_namespaceObject.__)('Sync status')
- }, (0,external_React_.createElement)("div", {
- className: "editor-post-sync-status__value"
- }, syncStatus === 'unsynced' ? (0,external_wp_i18n_namespaceObject._x)('Not synced', 'Text that indicates that the pattern is not synchronized') : (0,external_wp_i18n_namespaceObject._x)('Synced', 'Text that indicates that the pattern is synchronized')));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Sync status'),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "editor-post-sync-status__value",
+ children: syncStatus === 'unsynced' ? (0,external_wp_i18n_namespaceObject._x)('Not synced', 'pattern (singular)') : (0,external_wp_i18n_namespaceObject._x)('Synced', 'pattern (singular)')
+ })
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/index.js
-
/**
* WordPress dependencies
*/
@@ -13108,6 +17526,7 @@ function PostSyncStatus() {
+
const post_taxonomies_identity = x => x;
function PostTaxonomies({
taxonomyWrapper = post_taxonomies_identity
@@ -13129,11 +17548,11 @@ function PostTaxonomies({
taxonomy.types.includes(postType) && taxonomy.visibility?.show_ui);
return visibleTaxonomies.map(taxonomy => {
const TaxonomyComponent = taxonomy.hierarchical ? hierarchical_term_selector : flat_term_selector;
- return (0,external_React_.createElement)(external_wp_element_namespaceObject.Fragment, {
- key: `taxonomy-${taxonomy.slug}`
- }, taxonomyWrapper((0,external_React_.createElement)(TaxonomyComponent, {
- slug: taxonomy.slug
- }), taxonomy));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.Fragment, {
+ children: taxonomyWrapper( /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TaxonomyComponent, {
+ slug: taxonomy.slug
+ }), taxonomy)
+ }, `taxonomy-${taxonomy.slug}`);
});
}
/* harmony default export */ const post_taxonomies = (PostTaxonomies);
@@ -13166,7 +17585,6 @@ function PostTaxonomiesCheck({
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/panel.js
-
/**
* WordPress dependencies
*/
@@ -13179,6 +17597,7 @@ function PostTaxonomiesCheck({
+
function TaxonomyPanel({
taxonomy,
children
@@ -13208,27 +17627,30 @@ function TaxonomyPanel({
if (!taxonomyMenuName) {
return null;
}
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, {
title: taxonomyMenuName,
opened: isOpened,
- onToggle: () => toggleEditorPanelOpened(panelName)
- }, children);
+ onToggle: () => toggleEditorPanelOpened(panelName),
+ children: children
+ });
}
function panel_PostTaxonomies() {
- return (0,external_React_.createElement)(PostTaxonomiesCheck, null, (0,external_React_.createElement)(post_taxonomies, {
- taxonomyWrapper: (content, taxonomy) => {
- return (0,external_React_.createElement)(TaxonomyPanel, {
- taxonomy: taxonomy
- }, content);
- }
- }));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTaxonomiesCheck, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_taxonomies, {
+ taxonomyWrapper: (content, taxonomy) => {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TaxonomyPanel, {
+ taxonomy: taxonomy,
+ children: content
+ });
+ }
+ })
+ });
}
/* harmony default export */ const post_taxonomies_panel = (panel_PostTaxonomies);
// EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js
var lib = __webpack_require__(4132);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-text-editor/index.js
-
/**
* External dependencies
*/
@@ -13249,6 +17671,15 @@ var lib = __webpack_require__(4132);
* Internal dependencies
*/
+
+/**
+ * Displays the Post Text Editor along with content in Visual and Text mode.
+ *
+ * @return {JSX.Element|null} The rendered PostTextEditor component.
+ */
+
+
+
function PostTextEditor() {
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostTextEditor);
const {
@@ -13291,24 +17722,27 @@ function PostTextEditor() {
}
return content;
}, [content, blocks]);
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
- as: "label",
- htmlFor: `post-content-${instanceId}`
- }, (0,external_wp_i18n_namespaceObject.__)('Type text or HTML')), (0,external_React_.createElement)(lib/* default */.A, {
- autoComplete: "off",
- dir: "auto",
- value: value,
- onChange: event => {
- editEntityRecord('postType', type, id, {
- content: event.target.value,
- blocks: undefined,
- selection: undefined
- });
- },
- className: "editor-post-text-editor",
- id: `post-content-${instanceId}`,
- placeholder: (0,external_wp_i18n_namespaceObject.__)('Start writing with text or HTML')
- }));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, {
+ as: "label",
+ htmlFor: `post-content-${instanceId}`,
+ children: (0,external_wp_i18n_namespaceObject.__)('Type text or HTML')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(lib/* default */.A, {
+ autoComplete: "off",
+ dir: "auto",
+ value: value,
+ onChange: event => {
+ editEntityRecord('postType', type, id, {
+ content: event.target.value,
+ blocks: undefined,
+ selection: undefined
+ });
+ },
+ className: "editor-post-text-editor",
+ id: `post-content-${instanceId}`,
+ placeholder: (0,external_wp_i18n_namespaceObject.__)('Start writing with text or HTML')
+ })]
+ });
}
;// CONCATENATED MODULE: external ["wp","dom"]
@@ -13328,6 +17762,14 @@ const REGEXP_NEWLINES = /[\r\n]+/g;
* Internal dependencies
*/
+
+/**
+ * Custom hook that manages the focus behavior of the post title input field.
+ *
+ * @param {Element} forwardedRef - The forwarded ref for the input field.
+ *
+ * @return {Object} - The ref object.
+ */
function usePostTitleFocus(forwardedRef) {
const ref = (0,external_wp_element_namespaceObject.useRef)();
const {
@@ -13384,6 +17826,12 @@ function usePostTitleFocus(forwardedRef) {
* Internal dependencies
*/
+
+/**
+ * Custom hook for managing the post title in the editor.
+ *
+ * @return {Object} An object containing the current title and a function to update the title.
+ */
function usePostTitle() {
const {
editPost
@@ -13410,12 +17858,10 @@ function usePostTitle() {
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-title/index.js
-
/**
* External dependencies
*/
-
/**
* WordPress dependencies
*/
@@ -13444,9 +17890,6 @@ function PostTitle(_, forwardedRef) {
hasFixedToolbar
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
- getEditedPostAttribute
- } = select(store_store);
- const {
getSettings
} = select(external_wp_blockEditor_namespaceObject.store);
const {
@@ -13454,7 +17897,6 @@ function PostTitle(_, forwardedRef) {
hasFixedToolbar: _hasFixedToolbar
} = getSettings();
return {
- title: getEditedPostAttribute('title'),
placeholder: titlePlaceholder,
hasFixedToolbar: _hasFixedToolbar
};
@@ -13594,33 +18036,44 @@ function PostTitle(_, forwardedRef) {
// The wp-block className is important for editor styles.
// This same block is used in both the visual and the code editor.
- const className = classnames_default()(DEFAULT_CLASSNAMES, {
+ const className = dist_clsx(DEFAULT_CLASSNAMES, {
'is-selected': isSelected,
'has-fixed-toolbar': hasFixedToolbar
});
- return /* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */(
- (0,external_React_.createElement)(post_type_support_check, {
- supportKeys: "title"
- }, (0,external_React_.createElement)("h1", {
- ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([richTextRef, focusRef]),
- contentEditable: true,
- className: className,
- "aria-label": decodedPlaceholder,
- role: "textbox",
- "aria-multiline": "true",
- onFocus: onSelect,
- onBlur: onUnselect,
- onKeyDown: onKeyDown,
- onKeyPress: onUnselect,
- onPaste: onPaste
- }))
+ return (
+ /*#__PURE__*/
+ /* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */
+ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, {
+ supportKeys: "title",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", {
+ ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([richTextRef, focusRef]),
+ contentEditable: true,
+ className: className,
+ "aria-label": decodedPlaceholder,
+ role: "textbox",
+ "aria-multiline": "true",
+ onFocus: onSelect,
+ onBlur: onUnselect,
+ onKeyDown: onKeyDown,
+ onKeyPress: onUnselect,
+ onPaste: onPaste
+ })
+ })
/* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */
);
}
+
+/**
+ * Renders the `PostTitle` component.
+ *
+ * @param {Object} _ Unused parameter.
+ * @param {Element} forwardedRef Forwarded ref for the component.
+ *
+ * @return {Component} The rendered PostTitle component.
+ */
/* harmony default export */ const post_title = ((0,external_wp_element_namespaceObject.forwardRef)(PostTitle));
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-title/post-title-raw.js
-
/**
* External dependencies
*/
@@ -13642,6 +18095,16 @@ function PostTitle(_, forwardedRef) {
+
+/**
+ * Renders a raw post title input field.
+ *
+ * @param {Object} _ Unused parameter.
+ * @param {Element} forwardedRef Reference to the component's DOM node.
+ *
+ * @return {Component} The rendered component.
+ */
+
function PostTitleRaw(_, forwardedRef) {
const {
placeholder,
@@ -13679,13 +18142,13 @@ function PostTitleRaw(_, forwardedRef) {
// The wp-block className is important for editor styles.
// This same block is used in both the visual and the code editor.
- const className = classnames_default()(DEFAULT_CLASSNAMES, {
+ const className = dist_clsx(DEFAULT_CLASSNAMES, {
'is-selected': isSelected,
'has-fixed-toolbar': hasFixedToolbar,
'is-raw-text': true
});
const decodedPlaceholder = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(placeholder) || (0,external_wp_i18n_namespaceObject.__)('Add title');
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.TextareaControl, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextareaControl, {
ref: focusRef,
value: title,
onChange: onChange,
@@ -13704,7 +18167,6 @@ function PostTitleRaw(_, forwardedRef) {
/* harmony default export */ const post_title_raw = ((0,external_wp_element_namespaceObject.forwardRef)(PostTitleRaw));
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-trash/index.js
-
/**
* WordPress dependencies
*/
@@ -13717,6 +18179,9 @@ function PostTitleRaw(_, forwardedRef) {
* Internal dependencies
*/
+
+
+
function PostTrash() {
const {
isNew,
@@ -13741,19 +18206,25 @@ function PostTrash() {
setShowConfirmDialog(false);
trashPost();
};
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- __next40pxDefaultSize: true,
- className: "editor-post-trash",
- isDestructive: true,
- variant: "secondary",
- isBusy: isDeleting,
- "aria-disabled": isDeleting,
- onClick: isDeleting ? undefined : () => setShowConfirmDialog(true)
- }, (0,external_wp_i18n_namespaceObject.__)('Move to trash')), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalConfirmDialog, {
- isOpen: showConfirmDialog,
- onConfirm: handleConfirm,
- onCancel: () => setShowConfirmDialog(false)
- }, (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to move this post to the trash?')));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ __next40pxDefaultSize: true,
+ className: "editor-post-trash",
+ isDestructive: true,
+ variant: "secondary",
+ isBusy: isDeleting,
+ "aria-disabled": isDeleting,
+ onClick: isDeleting ? undefined : () => setShowConfirmDialog(true),
+ children: (0,external_wp_i18n_namespaceObject.__)('Move to trash')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, {
+ isOpen: showConfirmDialog,
+ onConfirm: handleConfirm,
+ onCancel: () => setShowConfirmDialog(false),
+ confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Move to trash'),
+ size: "medium",
+ children: (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to move this post to the trash?')
+ })]
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-trash/check.js
@@ -13768,39 +18239,53 @@ function PostTrash() {
*/
function PostTrashCheck({
- isNew,
- postId,
- canUserDelete,
children
}) {
- if (isNew || !postId || !canUserDelete) {
+ const {
+ canTrashPost
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ isEditedPostNew,
+ getCurrentPostId,
+ getCurrentPostType
+ } = select(store_store);
+ const {
+ getPostType,
+ canUser
+ } = select(external_wp_coreData_namespaceObject.store);
+ const postType = getPostType(getCurrentPostType());
+ const postId = getCurrentPostId();
+ const isNew = isEditedPostNew();
+ const resource = postType?.rest_base || ''; // eslint-disable-line camelcase
+ const canUserDelete = postId && resource ? canUser('delete', resource, postId) : false;
+ return {
+ canTrashPost: (!isNew || postId) && canUserDelete
+ };
+ }, []);
+ if (!canTrashPost) {
return null;
}
return children;
}
-/* harmony default export */ const post_trash_check = ((0,external_wp_data_namespaceObject.withSelect)(select => {
- const {
- isEditedPostNew,
- getCurrentPostId,
- getCurrentPostType
- } = select(store_store);
- const {
- getPostType,
- canUser
- } = select(external_wp_coreData_namespaceObject.store);
- const postId = getCurrentPostId();
- const postType = getPostType(getCurrentPostType());
- const resource = postType?.rest_base || ''; // eslint-disable-line camelcase
- return {
- isNew: isEditedPostNew(),
- postId,
- canUserDelete: postId && resource ? canUser('delete', resource, postId) : false
- };
-})(PostTrashCheck));
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/copy-small.js
+/**
+ * WordPress dependencies
+ */
-;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-url/index.js
+const copySmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ fillRule: "evenodd",
+ clipRule: "evenodd",
+ d: "M5.625 5.5h9.75c.069 0 .125.056.125.125v9.75a.125.125 0 0 1-.125.125h-9.75a.125.125 0 0 1-.125-.125v-9.75c0-.069.056-.125.125-.125ZM4 5.625C4 4.728 4.728 4 5.625 4h9.75C16.273 4 17 4.728 17 5.625v9.75c0 .898-.727 1.625-1.625 1.625h-9.75A1.625 1.625 0 0 1 4 15.375v-9.75Zm14.5 11.656v-9H20v9C20 18.8 18.77 20 17.251 20H6.25v-1.5h11.001c.69 0 1.249-.528 1.249-1.219Z"
+ })
+});
+/* harmony default export */ const copy_small = (copySmall);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-url/index.js
/**
* WordPress dependencies
*/
@@ -13812,20 +18297,38 @@ function PostTrashCheck({
+
+
+
/**
* Internal dependencies
*/
+
+/**
+ * Renders the `PostURL` component.
+ *
+ * @example
+ * ```jsx
+ * <PostURL />
+ * ```
+ *
+ * @param {Function} onClose Callback function to be executed when the popover is closed.
+ *
+ * @return {Component} The rendered PostURL component.
+ */
+
+
function PostURL({
onClose
}) {
const {
isEditable,
postSlug,
- viewPostLabel,
postLink,
permalinkPrefix,
- permalinkSuffix
+ permalinkSuffix,
+ permalink
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
var _post$_links$wpActio;
const post = select(store_store).getCurrentPost();
@@ -13839,66 +18342,103 @@ function PostURL({
viewPostLabel: postType?.labels.view_item,
postLink: post.link,
permalinkPrefix: permalinkParts?.prefix,
- permalinkSuffix: permalinkParts?.suffix
+ permalinkSuffix: permalinkParts?.suffix,
+ permalink: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(select(store_store).getPermalink())
};
}, []);
const {
editPost
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
+ const {
+ createNotice
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
const [forceEmptyField, setForceEmptyField] = (0,external_wp_element_namespaceObject.useState)(false);
- return (0,external_React_.createElement)("div", {
- className: "editor-post-url"
- }, (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
- title: (0,external_wp_i18n_namespaceObject.__)('URL'),
- onClose: onClose
- }), isEditable && (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, {
- __nextHasNoMarginBottom: true,
- label: (0,external_wp_i18n_namespaceObject.__)('Permalink'),
- value: forceEmptyField ? '' : postSlug,
- autoComplete: "off",
- spellCheck: "false",
- help: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_wp_i18n_namespaceObject.__)('The last part of the URL.'), ' ', (0,external_React_.createElement)(external_wp_components_namespaceObject.ExternalLink, {
- href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink')
- }, (0,external_wp_i18n_namespaceObject.__)('Learn more.'))),
- onChange: newValue => {
- editPost({
- slug: newValue
- });
- // When we delete the field the permalink gets
- // reverted to the original value.
- // The forceEmptyField logic allows the user to have
- // the field temporarily empty while typing.
- if (!newValue) {
- if (!forceEmptyField) {
- setForceEmptyField(true);
- }
- return;
- }
- if (forceEmptyField) {
- setForceEmptyField(false);
- }
- },
- onBlur: event => {
- editPost({
- slug: (0,external_wp_url_namespaceObject.cleanForSlug)(event.target.value)
- });
- if (forceEmptyField) {
- setForceEmptyField(false);
- }
- }
- }), isEditable && (0,external_React_.createElement)("h3", {
- className: "editor-post-url__link-label"
- }, viewPostLabel !== null && viewPostLabel !== void 0 ? viewPostLabel : (0,external_wp_i18n_namespaceObject.__)('View post')), (0,external_React_.createElement)("p", null, (0,external_React_.createElement)(external_wp_components_namespaceObject.ExternalLink, {
- className: "editor-post-url__link",
- href: postLink,
- target: "_blank"
- }, isEditable ? (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("span", {
- className: "editor-post-url__link-prefix"
- }, permalinkPrefix), (0,external_React_.createElement)("span", {
- className: "editor-post-url__link-slug"
- }, postSlug), (0,external_React_.createElement)("span", {
- className: "editor-post-url__link-suffix"
- }, permalinkSuffix)) : postLink)));
+ const copyButtonRef = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(permalink, () => {
+ createNotice('info', (0,external_wp_i18n_namespaceObject.__)('Copied URL to clipboard.'), {
+ isDismissible: true,
+ type: 'snackbar'
+ });
+ });
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "editor-post-url",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Link'),
+ onClose: onClose
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 3,
+ children: [isEditable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ children: [(0,external_wp_i18n_namespaceObject.__)('Customize the last part of the URL. '), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, {
+ href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink'),
+ children: (0,external_wp_i18n_namespaceObject.__)('Learn more.')
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ children: [isEditable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, {
+ __next40pxDefaultSize: true,
+ prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, {
+ children: "/"
+ }),
+ suffix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ icon: copy_small,
+ ref: copyButtonRef,
+ label: (0,external_wp_i18n_namespaceObject.__)('Copy')
+ }),
+ label: (0,external_wp_i18n_namespaceObject.__)('Link'),
+ hideLabelFromVision: true,
+ value: forceEmptyField ? '' : postSlug,
+ autoComplete: "off",
+ spellCheck: "false",
+ type: "text",
+ className: "editor-post-url__input",
+ onChange: newValue => {
+ editPost({
+ slug: newValue
+ });
+ // When we delete the field the permalink gets
+ // reverted to the original value.
+ // The forceEmptyField logic allows the user to have
+ // the field temporarily empty while typing.
+ if (!newValue) {
+ if (!forceEmptyField) {
+ setForceEmptyField(true);
+ }
+ return;
+ }
+ if (forceEmptyField) {
+ setForceEmptyField(false);
+ }
+ },
+ onBlur: event => {
+ editPost({
+ slug: (0,external_wp_url_namespaceObject.cleanForSlug)(event.target.value)
+ });
+ if (forceEmptyField) {
+ setForceEmptyField(false);
+ }
+ },
+ help: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ExternalLink, {
+ className: "editor-post-url__link",
+ href: postLink,
+ target: "_blank",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "editor-post-url__link-prefix",
+ children: permalinkPrefix
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "editor-post-url__link-slug",
+ children: postSlug
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "editor-post-url__link-suffix",
+ children: permalinkSuffix
+ })]
+ })
+ }), !isEditable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, {
+ className: "editor-post-url__link",
+ href: postLink,
+ target: "_blank",
+ children: postLink
+ })]
+ })]
+ })]
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-url/check.js
@@ -13912,6 +18452,15 @@ function PostURL({
* Internal dependencies
*/
+
+/**
+ * Check if the post URL is valid and visible.
+ *
+ * @param {Object} props The component props.
+ * @param {Element} props.children The child components.
+ *
+ * @return {Component|null} The child components if the post URL is valid and visible, otherwise null.
+ */
function PostURLCheck({
children
}) {
@@ -13948,16 +18497,27 @@ function PostURLCheck({
* Internal dependencies
*/
+
+/**
+ * Represents a label component for a post URL.
+ *
+ * @return {Component} The PostURLLabel component.
+ */
function PostURLLabel() {
return usePostURLLabel();
}
+
+/**
+ * Custom hook to get the label for the post URL.
+ *
+ * @return {string} The filtered and decoded post URL label.
+ */
function usePostURLLabel() {
const postLink = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getPermalink(), []);
return (0,external_wp_url_namespaceObject.filterURLForDisplay)((0,external_wp_url_namespaceObject.safeDecodeURIComponent)(postLink));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-url/panel.js
-
/**
* WordPress dependencies
*/
@@ -13965,6 +18525,9 @@ function usePostURLLabel() {
+
+
+
/**
* Internal dependencies
*/
@@ -13972,52 +18535,91 @@ function usePostURLLabel() {
+
+/**
+ * Renders the `PostURLPanel` component.
+ *
+ * @return {JSX.Element} The rendered PostURLPanel component.
+ */
+
+
+
function PostURLPanel() {
// Use internal state instead of a ref to make sure that the component
// re-renders when the popover's anchor updates.
const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
// Memoize popoverProps to avoid returning a new object every time.
const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
+ // Anchor the popover to the middle of the entire row so that it doesn't
+ // move around when the label changes.
anchor: popoverAnchor,
- placement: 'bottom-end'
+ placement: 'left-start',
+ offset: 36,
+ shift: true
}), [popoverAnchor]);
- return (0,external_React_.createElement)(PostURLCheck, null, (0,external_React_.createElement)(post_panel_row, {
- label: (0,external_wp_i18n_namespaceObject.__)('URL'),
- ref: setPopoverAnchor
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Dropdown, {
- popoverProps: popoverProps,
- className: "editor-post-url__panel-dropdown",
- contentClassName: "editor-post-url__panel-dialog",
- focusOnMount: true,
- renderToggle: ({
- isOpen,
- onToggle
- }) => (0,external_React_.createElement)(PostURLToggle, {
- isOpen: isOpen,
- onClick: onToggle
- }),
- renderContent: ({
- onClose
- }) => (0,external_React_.createElement)(PostURL, {
- onClose: onClose
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostURLCheck, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Link'),
+ ref: setPopoverAnchor,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
+ popoverProps: popoverProps,
+ className: "editor-post-url__panel-dropdown",
+ contentClassName: "editor-post-url__panel-dialog",
+ focusOnMount: true,
+ renderToggle: ({
+ isOpen,
+ onToggle
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostURLToggle, {
+ isOpen: isOpen,
+ onClick: onToggle
+ }),
+ renderContent: ({
+ onClose
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostURL, {
+ onClose: onClose
+ })
+ })
})
- })));
+ });
}
function PostURLToggle({
isOpen,
onClick
}) {
- const label = usePostURLLabel();
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- __next40pxDefaultSize: true,
+ const {
+ slug,
+ isFrontPage,
+ postLink
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getCurrentPostId,
+ getCurrentPost
+ } = select(store_store);
+ const {
+ getEditedEntityRecord
+ } = select(external_wp_coreData_namespaceObject.store);
+ const siteSettings = getEditedEntityRecord('root', 'site');
+ const _id = getCurrentPostId();
+ return {
+ slug: select(store_store).getEditedPostSlug(),
+ isFrontPage: siteSettings?.page_on_front === _id,
+ postLink: getCurrentPost()?.link
+ };
+ }, []);
+ const decodedSlug = (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(slug);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ size: "compact",
className: "editor-post-url__panel-toggle",
variant: "tertiary",
"aria-expanded": isOpen
- // translators: %s: Current post URL.
+ // translators: %s: Current post link.
,
- "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Change URL: %s'), label),
- onClick: onClick
- }, label);
+ "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Change link: %s'), decodedSlug),
+ onClick: onClick,
+ children: isFrontPage ? postLink : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: ["/", decodedSlug]
+ })
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/check.js
@@ -14030,6 +18632,16 @@ function PostURLToggle({
* Internal dependencies
*/
+
+/**
+ * Determines if the current post can be edited (published)
+ * and passes this information to the provided render function.
+ *
+ * @param {Object} props The component props.
+ * @param {Function} props.render Function to render the component.
+ * Receives an object with a `canEdit` property.
+ * @return {JSX.Element} The rendered component.
+ */
function PostVisibilityCheck({
render
}) {
@@ -14043,23 +18655,23 @@ function PostVisibilityCheck({
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/info.js
-
/**
* WordPress dependencies
*/
-const info = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+const info = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z"
-}));
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z"
+ })
+});
/* harmony default export */ const library_info = (info);
;// CONCATENATED MODULE: external ["wp","wordcount"]
const external_wp_wordcount_namespaceObject = window["wp"]["wordcount"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/word-count/index.js
-
/**
* WordPress dependencies
*/
@@ -14071,6 +18683,7 @@ const external_wp_wordcount_namespaceObject = window["wp"]["wordcount"];
* Internal dependencies
*/
+
function WordCount() {
const content = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('content'), []);
@@ -14080,13 +18693,13 @@ function WordCount() {
* Do not translate into your own language.
*/
const wordCountType = (0,external_wp_i18n_namespaceObject._x)('words', 'Word count type. Do not translate!');
- return (0,external_React_.createElement)("span", {
- className: "word-count"
- }, (0,external_wp_wordcount_namespaceObject.count)(content, wordCountType));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "word-count",
+ children: (0,external_wp_wordcount_namespaceObject.count)(content, wordCountType)
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/time-to-read/index.js
-
/**
* WordPress dependencies
*/
@@ -14107,6 +18720,7 @@ function WordCount() {
*
* @type {number} A rough estimate of the average reading rate across multiple languages.
*/
+
const AVERAGE_READING_RATE = 189;
function TimeToRead() {
const content = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('content'), []);
@@ -14119,14 +18733,15 @@ function TimeToRead() {
const wordCountType = (0,external_wp_i18n_namespaceObject._x)('words', 'Word count type. Do not translate!');
const minutesToRead = Math.round((0,external_wp_wordcount_namespaceObject.count)(content, wordCountType) / AVERAGE_READING_RATE);
const minutesToReadString = minutesToRead === 0 ? (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('<span>< 1</span> minute'), {
- span: (0,external_React_.createElement)("span", null)
+ span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {})
}) : (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s is the number of minutes the post will take to read. */
(0,external_wp_i18n_namespaceObject._n)('<span>%d</span> minute', '<span>%d</span> minutes', minutesToRead), minutesToRead), {
- span: (0,external_React_.createElement)("span", null)
+ span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {})
+ });
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "time-to-read",
+ children: minutesToReadString
});
- return (0,external_React_.createElement)("span", {
- className: "time-to-read"
- }, minutesToReadString);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/character-count/index.js
@@ -14140,13 +18755,18 @@ function TimeToRead() {
* Internal dependencies
*/
+
+/**
+ * Renders the character count of the post content.
+ *
+ * @return {number} The character count.
+ */
function CharacterCount() {
const content = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('content'), []);
return (0,external_wp_wordcount_namespaceObject.count)(content, 'characters_including_spaces');
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/table-of-contents/panel.js
-
/**
* WordPress dependencies
*/
@@ -14161,6 +18781,9 @@ function CharacterCount() {
+
+
+
function TableOfContentsPanel({
hasOutlineItemsDisabled,
onRequestClose
@@ -14180,52 +18803,69 @@ function TableOfContentsPanel({
};
}, []);
return (
+ /*#__PURE__*/
/*
* Disable reason: The `list` ARIA role is redundant but
* Safari+VoiceOver won't announce the list otherwise.
*/
/* eslint-disable jsx-a11y/no-redundant-roles */
- (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("div", {
- className: "table-of-contents__wrapper",
- role: "note",
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('Document Statistics'),
- tabIndex: "0"
- }, (0,external_React_.createElement)("ul", {
- role: "list",
- className: "table-of-contents__counts"
- }, (0,external_React_.createElement)("li", {
- className: "table-of-contents__count"
- }, (0,external_wp_i18n_namespaceObject.__)('Words'), (0,external_React_.createElement)(WordCount, null)), (0,external_React_.createElement)("li", {
- className: "table-of-contents__count"
- }, (0,external_wp_i18n_namespaceObject.__)('Characters'), (0,external_React_.createElement)("span", {
- className: "table-of-contents__number"
- }, (0,external_React_.createElement)(CharacterCount, null))), (0,external_React_.createElement)("li", {
- className: "table-of-contents__count"
- }, (0,external_wp_i18n_namespaceObject.__)('Time to read'), (0,external_React_.createElement)(TimeToRead, null)), (0,external_React_.createElement)("li", {
- className: "table-of-contents__count"
- }, (0,external_wp_i18n_namespaceObject.__)('Headings'), (0,external_React_.createElement)("span", {
- className: "table-of-contents__number"
- }, headingCount)), (0,external_React_.createElement)("li", {
- className: "table-of-contents__count"
- }, (0,external_wp_i18n_namespaceObject.__)('Paragraphs'), (0,external_React_.createElement)("span", {
- className: "table-of-contents__number"
- }, paragraphCount)), (0,external_React_.createElement)("li", {
- className: "table-of-contents__count"
- }, (0,external_wp_i18n_namespaceObject.__)('Blocks'), (0,external_React_.createElement)("span", {
- className: "table-of-contents__number"
- }, numberOfBlocks)))), headingCount > 0 && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("hr", null), (0,external_React_.createElement)("h2", {
- className: "table-of-contents__title"
- }, (0,external_wp_i18n_namespaceObject.__)('Document Outline')), (0,external_React_.createElement)(document_outline, {
- onSelect: onRequestClose,
- hasOutlineItemsDisabled: hasOutlineItemsDisabled
- })))
+ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "table-of-contents__wrapper",
+ role: "note",
+ "aria-label": (0,external_wp_i18n_namespaceObject.__)('Document Statistics'),
+ tabIndex: "0",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("ul", {
+ role: "list",
+ className: "table-of-contents__counts",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", {
+ className: "table-of-contents__count",
+ children: [(0,external_wp_i18n_namespaceObject.__)('Words'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WordCount, {})]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", {
+ className: "table-of-contents__count",
+ children: [(0,external_wp_i18n_namespaceObject.__)('Characters'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "table-of-contents__number",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CharacterCount, {})
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", {
+ className: "table-of-contents__count",
+ children: [(0,external_wp_i18n_namespaceObject.__)('Time to read'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TimeToRead, {})]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", {
+ className: "table-of-contents__count",
+ children: [(0,external_wp_i18n_namespaceObject.__)('Headings'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "table-of-contents__number",
+ children: headingCount
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", {
+ className: "table-of-contents__count",
+ children: [(0,external_wp_i18n_namespaceObject.__)('Paragraphs'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "table-of-contents__number",
+ children: paragraphCount
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", {
+ className: "table-of-contents__count",
+ children: [(0,external_wp_i18n_namespaceObject.__)('Blocks'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "table-of-contents__number",
+ children: numberOfBlocks
+ })]
+ })]
+ })
+ }), headingCount > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("hr", {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", {
+ className: "table-of-contents__title",
+ children: (0,external_wp_i18n_namespaceObject.__)('Document Outline')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DocumentOutline, {
+ onSelect: onRequestClose,
+ hasOutlineItemsDisabled: hasOutlineItemsDisabled
+ })]
+ })]
+ })
/* eslint-enable jsx-a11y/no-redundant-roles */
);
}
/* harmony default export */ const table_of_contents_panel = (TableOfContentsPanel);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/table-of-contents/index.js
-
/**
* WordPress dependencies
*/
@@ -14240,13 +18880,14 @@ function TableOfContentsPanel({
* Internal dependencies
*/
+
function TableOfContents({
hasOutlineItemsDisabled,
repositionDropdown,
...props
}, ref) {
const hasBlocks = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_blockEditor_namespaceObject.store).getBlockCount(), []);
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Dropdown, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
popoverProps: {
placement: repositionDropdown ? 'right' : 'bottom'
},
@@ -14255,7 +18896,7 @@ function TableOfContents({
renderToggle: ({
isOpen,
onToggle
- }) => (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
...props,
ref: ref,
onClick: hasBlocks ? onToggle : undefined,
@@ -14269,7 +18910,7 @@ function TableOfContents({
}),
renderContent: ({
onClose
- }) => (0,external_React_.createElement)(table_of_contents_panel, {
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(table_of_contents_panel, {
onRequestClose: onClose,
hasOutlineItemsDisabled: hasOutlineItemsDisabled
})
@@ -14324,7 +18965,6 @@ function UnsavedChangesWarning() {
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/with-registry-provider.js
-
/**
* WordPress dependencies
*/
@@ -14337,34 +18977,43 @@ function UnsavedChangesWarning() {
* Internal dependencies
*/
-const withRegistryProvider = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => (0,external_wp_data_namespaceObject.withRegistry)(props => {
- const {
- useSubRegistry = true,
- registry,
- ...additionalProps
- } = props;
+
+function getSubRegistry(subRegistries, registry, useSubRegistry) {
if (!useSubRegistry) {
- return (0,external_React_.createElement)(WrappedComponent, {
- ...additionalProps
- });
+ return registry;
}
- const [subRegistry, setSubRegistry] = (0,external_wp_element_namespaceObject.useState)(null);
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- const newRegistry = (0,external_wp_data_namespaceObject.createRegistry)({
+ let subRegistry = subRegistries.get(registry);
+ if (!subRegistry) {
+ subRegistry = (0,external_wp_data_namespaceObject.createRegistry)({
'core/block-editor': external_wp_blockEditor_namespaceObject.storeConfig
}, registry);
- newRegistry.registerStore('core/editor', storeConfig);
- setSubRegistry(newRegistry);
- }, [registry]);
- if (!subRegistry) {
- return null;
+ // Todo: The interface store should also be created per instance.
+ subRegistry.registerStore('core/editor', storeConfig);
+ subRegistries.set(registry, subRegistry);
}
- return (0,external_React_.createElement)(external_wp_data_namespaceObject.RegistryProvider, {
- value: subRegistry
- }, (0,external_React_.createElement)(WrappedComponent, {
- ...additionalProps
- }));
-}), 'withRegistryProvider');
+ return subRegistry;
+}
+const withRegistryProvider = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => ({
+ useSubRegistry = true,
+ ...props
+}) => {
+ const registry = (0,external_wp_data_namespaceObject.useRegistry)();
+ const [subRegistries] = (0,external_wp_element_namespaceObject.useState)(() => new WeakMap());
+ const subRegistry = getSubRegistry(subRegistries, registry, useSubRegistry);
+ if (subRegistry === registry) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, {
+ registry: registry,
+ ...props
+ });
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_data_namespaceObject.RegistryProvider, {
+ value: subRegistry,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, {
+ registry: subRegistry,
+ ...props
+ })
+ });
+}, 'withRegistryProvider');
/* harmony default export */ const with_registry_provider = (withRegistryProvider);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/media-categories/index.js
@@ -14515,7 +19164,7 @@ const inserterMediaCategories = [{
per_page: 'page_size',
search: 'q'
};
- const url = new URL('https://api.openverse.engineering/v1/images/');
+ const url = new URL('https://api.openverse.org/v1/images/');
Object.entries(finalQuery).forEach(([key, value]) => {
const queryKey = mapFromInserterMediaRequest[key] || key;
url.searchParams.set(queryKey, value);
@@ -14545,8 +19194,6 @@ const inserterMediaCategories = [{
}];
/* harmony default export */ const media_categories = (inserterMediaCategories);
-;// CONCATENATED MODULE: external ["wp","mediaUtils"]
-const external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/media-upload/index.js
/**
* WordPress dependencies
@@ -14608,6 +19255,179 @@ function mediaUpload({
});
}
+// EXTERNAL MODULE: ./node_modules/deepmerge/dist/cjs.js
+var cjs = __webpack_require__(66);
+var cjs_default = /*#__PURE__*/__webpack_require__.n(cjs);
+;// CONCATENATED MODULE: ./node_modules/is-plain-object/dist/is-plain-object.mjs
+/*!
+ * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
+ *
+ * Copyright (c) 2014-2017, Jon Schlinkert.
+ * Released under the MIT License.
+ */
+
+function isObject(o) {
+ return Object.prototype.toString.call(o) === '[object Object]';
+}
+
+function isPlainObject(o) {
+ var ctor,prot;
+
+ if (isObject(o) === false) return false;
+
+ // If has modified constructor
+ ctor = o.constructor;
+ if (ctor === undefined) return true;
+
+ // If has modified prototype
+ prot = ctor.prototype;
+ if (isObject(prot) === false) return false;
+
+ // If constructor does not have an Object-specific method
+ if (prot.hasOwnProperty('isPrototypeOf') === false) {
+ return false;
+ }
+
+ // Most likely a plain Object
+ return true;
+}
+
+
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-styles-provider/index.js
+/**
+ * External dependencies
+ */
+
+
+
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+const {
+ GlobalStylesContext: global_styles_provider_GlobalStylesContext,
+ cleanEmptyObject
+} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
+function mergeBaseAndUserConfigs(base, user) {
+ return cjs_default()(base, user, {
+ // We only pass as arrays the presets,
+ // in which case we want the new array of values
+ // to override the old array (no merging).
+ isMergeableObject: isPlainObject
+ });
+}
+function useGlobalStylesUserConfig() {
+ const {
+ globalStylesId,
+ isReady,
+ settings,
+ styles,
+ _links
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getEditedEntityRecord,
+ hasFinishedResolution
+ } = select(external_wp_coreData_namespaceObject.store);
+ const _globalStylesId = select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentGlobalStylesId();
+ const record = _globalStylesId ? getEditedEntityRecord('root', 'globalStyles', _globalStylesId) : undefined;
+ let hasResolved = false;
+ if (hasFinishedResolution('__experimentalGetCurrentGlobalStylesId')) {
+ hasResolved = _globalStylesId ? hasFinishedResolution('getEditedEntityRecord', ['root', 'globalStyles', _globalStylesId]) : true;
+ }
+ return {
+ globalStylesId: _globalStylesId,
+ isReady: hasResolved,
+ settings: record?.settings,
+ styles: record?.styles,
+ _links: record?._links
+ };
+ }, []);
+ const {
+ getEditedEntityRecord
+ } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store);
+ const {
+ editEntityRecord
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
+ const config = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ return {
+ settings: settings !== null && settings !== void 0 ? settings : {},
+ styles: styles !== null && styles !== void 0 ? styles : {},
+ _links: _links !== null && _links !== void 0 ? _links : {}
+ };
+ }, [settings, styles, _links]);
+ const setConfig = (0,external_wp_element_namespaceObject.useCallback)(
+ /**
+ * Set the global styles config.
+ * @param {Function|Object} callbackOrObject If the callbackOrObject is a function, pass the current config to the callback so the consumer can merge values.
+ * Otherwise, overwrite the current config with the incoming object.
+ * @param {Object} options Options for editEntityRecord Core selector.
+ */
+ (callbackOrObject, options = {}) => {
+ var _record$styles, _record$settings, _record$_links;
+ const record = getEditedEntityRecord('root', 'globalStyles', globalStylesId);
+ const currentConfig = {
+ styles: (_record$styles = record?.styles) !== null && _record$styles !== void 0 ? _record$styles : {},
+ settings: (_record$settings = record?.settings) !== null && _record$settings !== void 0 ? _record$settings : {},
+ _links: (_record$_links = record?._links) !== null && _record$_links !== void 0 ? _record$_links : {}
+ };
+ const updatedConfig = typeof callbackOrObject === 'function' ? callbackOrObject(currentConfig) : callbackOrObject;
+ editEntityRecord('root', 'globalStyles', globalStylesId, {
+ styles: cleanEmptyObject(updatedConfig.styles) || {},
+ settings: cleanEmptyObject(updatedConfig.settings) || {},
+ _links: cleanEmptyObject(updatedConfig._links) || {}
+ }, options);
+ }, [globalStylesId, editEntityRecord, getEditedEntityRecord]);
+ return [isReady, config, setConfig];
+}
+function useGlobalStylesBaseConfig() {
+ const baseConfig = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ return select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeBaseGlobalStyles();
+ }, []);
+ return [!!baseConfig, baseConfig];
+}
+function useGlobalStylesContext() {
+ const [isUserConfigReady, userConfig, setUserConfig] = useGlobalStylesUserConfig();
+ const [isBaseConfigReady, baseConfig] = useGlobalStylesBaseConfig();
+ const mergedConfig = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ if (!baseConfig || !userConfig) {
+ return {};
+ }
+ return mergeBaseAndUserConfigs(baseConfig, userConfig);
+ }, [userConfig, baseConfig]);
+ const context = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ return {
+ isReady: isUserConfigReady && isBaseConfigReady,
+ user: userConfig,
+ base: baseConfig,
+ merged: mergedConfig,
+ setUserConfig
+ };
+ }, [mergedConfig, userConfig, baseConfig, setUserConfig, isUserConfigReady, isBaseConfigReady]);
+ return context;
+}
+function GlobalStylesProvider({
+ children
+}) {
+ const context = useGlobalStylesContext();
+ if (!context.isReady) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(global_styles_provider_GlobalStylesContext.Provider, {
+ value: context,
+ children: children
+ });
+}
+
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/use-block-editor-settings.js
/**
* WordPress dependencies
@@ -14628,20 +19448,34 @@ function mediaUpload({
+
const EMPTY_BLOCKS_LIST = [];
-const BLOCK_EDITOR_SETTINGS = ['__experimentalBlockDirectory', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalGlobalStylesBaseStyles', '__experimentalPreferredStyleVariations', '__unstableGalleryWithImageBlocks', 'alignWide', 'blockInspectorTabs', 'allowedMimeTypes', 'bodyPlaceholder', 'canLockBlocks', 'capabilities', 'clearBlockSelection', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomSpacingSizes', 'disableCustomGradients', 'disableLayoutStyles', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'enableOpenverseMediaCategory', 'fontSizes', 'gradients', 'generateAnchors', 'onNavigateToEntityRecord', 'hasInlineToolbar', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'locale', 'maxWidth', 'onUpdateDefaultBlockStyles', 'postContentAttributes', 'postsPerPage', 'readOnly', 'styles', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableHasCustomAppender', '__unstableIsPreviewMode', '__unstableResolvedAssets', '__unstableIsBlockBasedTheme', '__experimentalArchiveTitleTypeLabel', '__experimentalArchiveTitleNameLabel'];
+const DEFAULT_STYLES = {};
+function __experimentalReusableBlocksSelect(select) {
+ var _select$getEntityReco;
+ return (_select$getEntityReco = select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_block', {
+ per_page: -1
+ })) !== null && _select$getEntityReco !== void 0 ? _select$getEntityReco : EMPTY_BLOCKS_LIST;
+}
+const BLOCK_EDITOR_SETTINGS = ['__experimentalBlockDirectory', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalGlobalStylesBaseStyles', '__unstableGalleryWithImageBlocks', 'alignWide', 'blockInspectorTabs', 'allowedMimeTypes', 'bodyPlaceholder', 'canLockBlocks', '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', 'sectionRootClientId', 'styles', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableHasCustomAppender', '__unstableIsPreviewMode', '__unstableResolvedAssets', '__unstableIsBlockBasedTheme', '__experimentalArchiveTitleTypeLabel', '__experimentalArchiveTitleNameLabel'];
+const {
+ globalStylesDataKey,
+ selectBlockPatternsKey,
+ reusableBlocksSelectKey
+} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
/**
* React hook used to compute the block editor settings to use for the post editor.
*
- * @param {Object} settings EditorProvider settings prop.
- * @param {string} postType Editor root level post type.
- * @param {string} postId Editor root level post ID.
+ * @param {Object} settings EditorProvider settings prop.
+ * @param {string} postType Editor root level post type.
+ * @param {string} postId Editor root level post ID.
+ * @param {string} renderingMode Editor rendering mode.
*
* @return {Object} Block Editor Settings.
*/
-function useBlockEditorSettings(settings, postType, postId) {
- var _settings$__experimen, _settings$__experimen2;
+function useBlockEditorSettings(settings, postType, postId, renderingMode) {
+ var _mergedGlobalStyles$s, _settings$__experimen, _settings$__experimen2;
const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
const {
allowRightClickOverrides,
@@ -14650,7 +19484,6 @@ function useBlockEditorSettings(settings, postType, postId) {
hasFixedToolbar,
isDistractionFree,
keepCaretInsideBlock,
- reusableBlocks,
hasUploadPermissions,
hiddenBlockTypes,
canUseUnfilteredHTML,
@@ -14658,16 +19491,15 @@ function useBlockEditorSettings(settings, postType, postId) {
pageOnFront,
pageForPosts,
userPatternCategories,
- restBlockPatternCategories
+ restBlockPatternCategories,
+ sectionRootClientId
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
var _canUser;
- const isWeb = external_wp_element_namespaceObject.Platform.OS === 'web';
const {
canUser,
getRawEntityRecord,
getEntityRecord,
getUserPatternCategories,
- getEntityRecords,
getBlockPatternCategories
} = select(external_wp_coreData_namespaceObject.store);
const {
@@ -14676,7 +19508,19 @@ function useBlockEditorSettings(settings, postType, postId) {
const {
getBlockTypes
} = select(external_wp_blocks_namespaceObject.store);
+ const {
+ getBlocksByName,
+ getBlockAttributes
+ } = select(external_wp_blockEditor_namespaceObject.store);
const siteSettings = canUser('read', 'settings') ? getEntityRecord('root', 'site') : undefined;
+ function getSectionRootBlock() {
+ var _getBlocksByName$find;
+ if (renderingMode === 'template-locked') {
+ var _getBlocksByName$;
+ return (_getBlocksByName$ = getBlocksByName('core/post-content')?.[0]) !== null && _getBlocksByName$ !== void 0 ? _getBlocksByName$ : '';
+ }
+ return (_getBlocksByName$find = getBlocksByName('core/group').find(clientId => getBlockAttributes(clientId)?.tagName === 'main')) !== null && _getBlocksByName$find !== void 0 ? _getBlocksByName$find : '';
+ }
return {
allowRightClickOverrides: get('core', 'allowRightClickOverrides'),
blockTypes: getBlockTypes(),
@@ -14686,18 +19530,19 @@ function useBlockEditorSettings(settings, postType, postId) {
hiddenBlockTypes: get('core', 'hiddenBlockTypes'),
isDistractionFree: get('core', 'distractionFree'),
keepCaretInsideBlock: get('core', 'keepCaretInsideBlock'),
- reusableBlocks: isWeb ? getEntityRecords('postType', 'wp_block', {
- per_page: -1
- }) : EMPTY_BLOCKS_LIST,
- // Reusable blocks are fetched in the native version of this hook.
hasUploadPermissions: (_canUser = canUser('create', 'media')) !== null && _canUser !== void 0 ? _canUser : true,
userCanCreatePages: canUser('create', 'pages'),
pageOnFront: siteSettings?.page_on_front,
pageForPosts: siteSettings?.page_for_posts,
userPatternCategories: getUserPatternCategories(),
- restBlockPatternCategories: getBlockPatternCategories()
+ restBlockPatternCategories: getBlockPatternCategories(),
+ sectionRootClientId: getSectionRootBlock()
};
- }, [postType, postId, isLargeViewport]);
+ }, [postType, postId, isLargeViewport, renderingMode]);
+ const {
+ merged: mergedGlobalStyles
+ } = useGlobalStylesContext();
+ const globalStylesData = (_mergedGlobalStyles$s = mergedGlobalStyles.styles) !== null && _mergedGlobalStyles$s !== void 0 ? _mergedGlobalStyles$s : DEFAULT_STYLES;
const settingsBlockPatterns = (_settings$__experimen = settings.__experimentalAdditionalBlockPatterns) !== null && _settings$__experimen !== void 0 ? _settings$__experimen :
// WP 6.0
settings.__experimentalBlockPatterns; // WP 5.9
@@ -14748,41 +19593,55 @@ function useBlockEditorSettings(settings, postType, postId) {
return settings.allowedBlockTypes;
}, [settings.allowedBlockTypes, hiddenBlockTypes, blockTypes]);
const forceDisableFocusMode = settings.focusMode === false;
- return (0,external_wp_element_namespaceObject.useMemo)(() => ({
- ...Object.fromEntries(Object.entries(settings).filter(([key]) => BLOCK_EDITOR_SETTINGS.includes(key))),
- allowedBlockTypes,
- allowRightClickOverrides,
- focusMode: focusMode && !forceDisableFocusMode,
- hasFixedToolbar,
- isDistractionFree,
- keepCaretInsideBlock,
- mediaUpload: hasUploadPermissions ? mediaUpload : undefined,
- __experimentalBlockPatterns: blockPatterns,
- [unlock(external_wp_blockEditor_namespaceObject.privateApis).selectBlockPatternsKey]: select => unlock(select(external_wp_coreData_namespaceObject.store)).getBlockPatternsForPostType(postType),
- __experimentalReusableBlocks: reusableBlocks,
- __experimentalBlockPatternCategories: blockPatternCategories,
- __experimentalUserPatternCategories: userPatternCategories,
- __experimentalFetchLinkSuggestions: (search, searchOptions) => (0,external_wp_coreData_namespaceObject.__experimentalFetchLinkSuggestions)(search, searchOptions, settings),
- inserterMediaCategories: media_categories,
- __experimentalFetchRichUrlData: external_wp_coreData_namespaceObject.__experimentalFetchUrlData,
- // Todo: This only checks the top level post, not the post within a template or any other entity that can be edited.
- // This might be better as a generic "canUser" selector.
- __experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,
- //Todo: this is only needed for native and should probably be removed.
- __experimentalUndo: undo,
- // Check whether we want all site editor frames to have outlines
- // including the navigation / pattern / parts editors.
- outlineMode: postType === 'wp_template',
- // Check these two properties: they were not present in the site editor.
- __experimentalCreatePageEntity: createPageEntity,
- __experimentalUserCanCreatePages: userCanCreatePages,
- pageOnFront,
- pageForPosts,
- __experimentalPreferPatternsOnRoot: postType === 'wp_template',
- templateLock: postType === 'wp_navigation' ? 'insert' : settings.templateLock,
- template: postType === 'wp_navigation' ? [['core/navigation', {}, []]] : settings.template,
- __experimentalSetIsInserterOpened: setIsInserterOpened
- }), [allowedBlockTypes, allowRightClickOverrides, focusMode, forceDisableFocusMode, hasFixedToolbar, isDistractionFree, keepCaretInsideBlock, settings, hasUploadPermissions, reusableBlocks, userPatternCategories, blockPatterns, blockPatternCategories, canUseUnfilteredHTML, undo, createPageEntity, userCanCreatePages, pageOnFront, pageForPosts, postType, setIsInserterOpened]);
+ return (0,external_wp_element_namespaceObject.useMemo)(() => {
+ const blockEditorSettings = {
+ ...Object.fromEntries(Object.entries(settings).filter(([key]) => BLOCK_EDITOR_SETTINGS.includes(key))),
+ [globalStylesDataKey]: globalStylesData,
+ allowedBlockTypes,
+ allowRightClickOverrides,
+ focusMode: focusMode && !forceDisableFocusMode,
+ hasFixedToolbar,
+ isDistractionFree,
+ keepCaretInsideBlock,
+ mediaUpload: hasUploadPermissions ? mediaUpload : undefined,
+ __experimentalBlockPatterns: blockPatterns,
+ [selectBlockPatternsKey]: select => {
+ const {
+ hasFinishedResolution,
+ getBlockPatternsForPostType
+ } = unlock(select(external_wp_coreData_namespaceObject.store));
+ const patterns = getBlockPatternsForPostType(postType);
+ return hasFinishedResolution('getBlockPatterns') ? patterns : undefined;
+ },
+ [reusableBlocksSelectKey]: __experimentalReusableBlocksSelect,
+ __experimentalBlockPatternCategories: blockPatternCategories,
+ __experimentalUserPatternCategories: userPatternCategories,
+ __experimentalFetchLinkSuggestions: (search, searchOptions) => (0,external_wp_coreData_namespaceObject.__experimentalFetchLinkSuggestions)(search, searchOptions, settings),
+ inserterMediaCategories: media_categories,
+ __experimentalFetchRichUrlData: external_wp_coreData_namespaceObject.__experimentalFetchUrlData,
+ // Todo: This only checks the top level post, not the post within a template or any other entity that can be edited.
+ // This might be better as a generic "canUser" selector.
+ __experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,
+ //Todo: this is only needed for native and should probably be removed.
+ __experimentalUndo: undo,
+ // Check whether we want all site editor frames to have outlines
+ // including the navigation / pattern / parts editors.
+ outlineMode: postType === 'wp_template',
+ // Check these two properties: they were not present in the site editor.
+ __experimentalCreatePageEntity: createPageEntity,
+ __experimentalUserCanCreatePages: userCanCreatePages,
+ pageOnFront,
+ pageForPosts,
+ __experimentalPreferPatternsOnRoot: postType === 'wp_template',
+ templateLock: postType === 'wp_navigation' ? 'insert' : settings.templateLock,
+ template: postType === 'wp_navigation' ? [['core/navigation', {}, []]] : settings.template,
+ __experimentalSetIsInserterOpened: setIsInserterOpened
+ };
+ lock(blockEditorSettings, {
+ sectionRootClientId
+ });
+ return blockEditorSettings;
+ }, [allowedBlockTypes, allowRightClickOverrides, focusMode, forceDisableFocusMode, hasFixedToolbar, isDistractionFree, keepCaretInsideBlock, settings, hasUploadPermissions, userPatternCategories, blockPatterns, blockPatternCategories, canUseUnfilteredHTML, undo, createPageEntity, userCanCreatePages, pageOnFront, pageForPosts, postType, setIsInserterOpened, sectionRootClientId, globalStylesData]);
}
/* harmony default export */ const use_block_editor_settings = (useBlockEditorSettings);
@@ -14793,44 +19652,69 @@ function useBlockEditorSettings(settings, postType, postId) {
-const PAGE_CONTENT_BLOCKS = ['core/post-title', 'core/post-featured-image', 'core/post-content'];
-function useDisableNonPageContentBlocks() {
- const contentIds = (0,external_wp_data_namespaceObject.useSelect)(select => {
+
+const DEFAULT_CONTENT_ONLY_BLOCKS = ['core/post-title', 'core/post-featured-image', 'core/post-content', 'core/template-part'];
+
+/**
+ * Component that when rendered, makes it so that the site editor allows only
+ * page content to be edited.
+ */
+function DisableNonPageContentBlocks() {
+ const contentOnlyBlocks = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.postContentBlockTypes', DEFAULT_CONTENT_ONLY_BLOCKS);
+
+ // Note that there are two separate subscription because the result for each
+ // returns a new array.
+ const contentOnlyIds = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlocksByName,
getBlockParents,
getBlockName
} = select(external_wp_blockEditor_namespaceObject.store);
- return getBlocksByName(PAGE_CONTENT_BLOCKS).filter(clientId => getBlockParents(clientId).every(parentClientId => {
+ return getBlocksByName(contentOnlyBlocks).filter(clientId => getBlockParents(clientId).every(parentClientId => {
const parentBlockName = getBlockName(parentClientId);
- return parentBlockName !== 'core/query' && !PAGE_CONTENT_BLOCKS.includes(parentBlockName);
+ return (
+ // Ignore descendents of the query block.
+ parentBlockName !== 'core/query' &&
+ // Enable only the top-most block.
+ !contentOnlyBlocks.includes(parentBlockName)
+ );
}));
}, []);
- const {
- setBlockEditingMode,
- unsetBlockEditingMode
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
+ const disabledIds = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getBlocksByName,
+ getBlockOrder
+ } = select(external_wp_blockEditor_namespaceObject.store);
+ return getBlocksByName(['core/template-part']).flatMap(clientId => getBlockOrder(clientId));
+ }, []);
+ const registry = (0,external_wp_data_namespaceObject.useRegistry)();
(0,external_wp_element_namespaceObject.useEffect)(() => {
- setBlockEditingMode('', 'disabled'); // Disable editing at the root level.
-
- for (const contentId of contentIds) {
- setBlockEditingMode(contentId, 'contentOnly'); // Re-enable each content block.
- }
- return () => {
- unsetBlockEditingMode('');
- for (const contentId of contentIds) {
- unsetBlockEditingMode(contentId);
+ const {
+ setBlockEditingMode,
+ unsetBlockEditingMode
+ } = registry.dispatch(external_wp_blockEditor_namespaceObject.store);
+ registry.batch(() => {
+ setBlockEditingMode('', 'disabled');
+ for (const clientId of contentOnlyIds) {
+ setBlockEditingMode(clientId, 'contentOnly');
+ }
+ for (const clientId of disabledIds) {
+ setBlockEditingMode(clientId, 'disabled');
}
+ });
+ return () => {
+ registry.batch(() => {
+ unsetBlockEditingMode('');
+ for (const clientId of contentOnlyIds) {
+ unsetBlockEditingMode(clientId);
+ }
+ for (const clientId of disabledIds) {
+ unsetBlockEditingMode(clientId);
+ }
+ });
};
- }, [contentIds, setBlockEditingMode, unsetBlockEditingMode]);
-}
-
-/**
- * Component that when rendered, makes it so that the site editor allows only
- * page content to be edited.
- */
-function DisableNonPageContentBlocks() {
- useDisableNonPageContentBlocks();
+ }, [contentOnlyIds, disabledIds, registry]);
+ return null;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/navigation-block-editing-mode.js
@@ -14868,8 +19752,313 @@ function NavigationBlockEditingMode() {
}, [blockClientId, unsetBlockEditingMode, setBlockEditingMode]);
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/index.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/use-hide-blocks-from-inserter.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+// These post types are "structural" block lists.
+// We should be allowed to use
+// the post content and template parts blocks within them.
+const POST_TYPES_ALLOWING_POST_CONTENT_TEMPLATE_PART = ['wp_block', 'wp_template', 'wp_template_part'];
+
+/**
+ * In some specific contexts,
+ * the template part and post content blocks need to be hidden.
+ *
+ * @param {string} postType Post Type
+ * @param {string} mode Rendering mode
+ */
+function useHideBlocksFromInserter(postType, mode) {
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
+ /*
+ * Prevent adding template part in the editor.
+ */
+ (0,external_wp_hooks_namespaceObject.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removeTemplatePartsFromInserter', (canInsert, blockType) => {
+ if (!POST_TYPES_ALLOWING_POST_CONTENT_TEMPLATE_PART.includes(postType) && blockType.name === 'core/template-part' && mode === 'post-only') {
+ return false;
+ }
+ return canInsert;
+ });
+
+ /*
+ * Prevent adding post content block (except in query block) in the editor.
+ */
+ (0,external_wp_hooks_namespaceObject.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removePostContentFromInserter', (canInsert, blockType, rootClientId, {
+ getBlockParentsByBlockName
+ }) => {
+ if (!POST_TYPES_ALLOWING_POST_CONTENT_TEMPLATE_PART.includes(postType) && blockType.name === 'core/post-content') {
+ return getBlockParentsByBlockName(rootClientId, 'core/query').length > 0;
+ }
+ return canInsert;
+ });
+ return () => {
+ (0,external_wp_hooks_namespaceObject.removeFilter)('blockEditor.__unstableCanInsertBlockType', 'removeTemplatePartsFromInserter');
+ (0,external_wp_hooks_namespaceObject.removeFilter)('blockEditor.__unstableCanInsertBlockType', 'removePostContentFromInserter');
+ };
+ }, [postType, mode]);
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/keyboard.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+const keyboard = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "m16 15.5h-8v-1.5h8zm-7.5-2.5h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm-9-3h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2z"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "m18.5 6.5h-13a.5.5 0 0 0 -.5.5v9.5a.5.5 0 0 0 .5.5h13a.5.5 0 0 0 .5-.5v-9.5a.5.5 0 0 0 -.5-.5zm-13-1.5h13a2 2 0 0 1 2 2v9.5a2 2 0 0 1 -2 2h-13a2 2 0 0 1 -2-2v-9.5a2 2 0 0 1 2-2z"
+ })]
+});
+/* harmony default export */ const library_keyboard = (keyboard);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list-view.js
+/**
+ * WordPress dependencies
+ */
+
+
+const listView = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ viewBox: "0 0 24 24",
+ xmlns: "http://www.w3.org/2000/svg",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z"
+ })
+});
+/* harmony default export */ const list_view = (listView);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/code.js
+/**
+ * WordPress dependencies
+ */
+
+
+const code = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ viewBox: "0 0 24 24",
+ xmlns: "http://www.w3.org/2000/svg",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z"
+ })
+});
+/* harmony default export */ const library_code = (code);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/drawer-left.js
+/**
+ * WordPress dependencies
+ */
+
+
+const drawerLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ width: "24",
+ height: "24",
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ fillRule: "evenodd",
+ clipRule: "evenodd",
+ d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM8.5 18.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h2.5v13zm10-.5c0 .3-.2.5-.5.5h-8v-13h8c.3 0 .5.2.5.5v12z"
+ })
+});
+/* harmony default export */ const drawer_left = (drawerLeft);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/drawer-right.js
+/**
+ * WordPress dependencies
+ */
+
+
+const drawerRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ width: "24",
+ height: "24",
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ fillRule: "evenodd",
+ clipRule: "evenodd",
+ d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4 14.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h8v13zm4.5-.5c0 .3-.2.5-.5.5h-2.5v-13H18c.3 0 .5.2.5.5v12z"
+ })
+});
+/* harmony default export */ const drawer_right = (drawerRight);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-default.js
+/**
+ * WordPress dependencies
+ */
+
+
+const blockDefault = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z"
+ })
+});
+/* harmony default export */ const block_default = (blockDefault);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-list-bullets.js
+/**
+ * WordPress dependencies
+ */
+
+
+const formatListBullets = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
+ })
+});
+/* harmony default export */ const format_list_bullets = (formatListBullets);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js
+/**
+ * WordPress dependencies
+ */
+
+
+const external = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"
+ })
+});
+/* harmony default export */ const library_external = (external);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pencil.js
+/**
+ * WordPress dependencies
+ */
+
+
+const pencil = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z"
+ })
+});
+/* harmony default export */ const library_pencil = (pencil);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/edit.js
+/**
+ * Internal dependencies
+ */
+
+
+/* harmony default export */ const edit = (library_pencil);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/pattern-rename-modal/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+const {
+ RenamePatternModal
+} = unlock(external_wp_patterns_namespaceObject.privateApis);
+const modalName = 'editor/pattern-rename';
+function PatternRenameModal() {
+ const {
+ record,
+ postType
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getCurrentPostType,
+ getCurrentPostId
+ } = select(store_store);
+ const {
+ getEditedEntityRecord
+ } = select(external_wp_coreData_namespaceObject.store);
+ const _postType = getCurrentPostType();
+ return {
+ record: getEditedEntityRecord('postType', _postType, getCurrentPostId()),
+ postType: _postType
+ };
+ }, []);
+ const {
+ closeModal
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
+ const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isModalActive(modalName));
+ if (!isActive || postType !== PATTERN_POST_TYPE) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenamePatternModal, {
+ onClose: closeModal,
+ pattern: record
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/pattern-duplicate-modal/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+const {
+ DuplicatePatternModal
+} = unlock(external_wp_patterns_namespaceObject.privateApis);
+const pattern_duplicate_modal_modalName = 'editor/pattern-duplicate';
+function PatternDuplicateModal() {
+ const {
+ record,
+ postType
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getCurrentPostType,
+ getCurrentPostId
+ } = select(store_store);
+ const {
+ getEditedEntityRecord
+ } = select(external_wp_coreData_namespaceObject.store);
+ const _postType = getCurrentPostType();
+ return {
+ record: getEditedEntityRecord('postType', _postType, getCurrentPostId()),
+ postType: _postType
+ };
+ }, []);
+ const {
+ closeModal
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
+ const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isModalActive(pattern_duplicate_modal_modalName));
+ if (!isActive || postType !== PATTERN_POST_TYPE) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DuplicatePatternModal, {
+ onClose: closeModal,
+ onSuccess: () => closeModal(),
+ pattern: record
+ });
+}
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/commands/index.js
/**
* WordPress dependencies
*/
@@ -14882,6 +20071,7 @@ function NavigationBlockEditingMode() {
+
/**
* Internal dependencies
*/
@@ -14889,6 +20079,1184 @@ function NavigationBlockEditingMode() {
+function useEditorCommandLoader() {
+ const {
+ editorMode,
+ isListViewOpen,
+ showBlockBreadcrumbs,
+ isDistractionFree,
+ isTopToolbar,
+ isFocusMode,
+ isPreviewMode,
+ isViewable,
+ isCodeEditingEnabled,
+ isRichEditingEnabled,
+ isPublishSidebarEnabled
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ var _get, _getPostType$viewable;
+ const {
+ get
+ } = select(external_wp_preferences_namespaceObject.store);
+ const {
+ isListViewOpened,
+ getCurrentPostType,
+ getEditorSettings
+ } = select(store_store);
+ const {
+ getSettings
+ } = select(external_wp_blockEditor_namespaceObject.store);
+ const {
+ getPostType
+ } = select(external_wp_coreData_namespaceObject.store);
+ return {
+ editorMode: (_get = get('core', 'editorMode')) !== null && _get !== void 0 ? _get : 'visual',
+ isListViewOpen: isListViewOpened(),
+ showBlockBreadcrumbs: get('core', 'showBlockBreadcrumbs'),
+ isDistractionFree: get('core', 'distractionFree'),
+ isFocusMode: get('core', 'focusMode'),
+ isTopToolbar: get('core', 'fixedToolbar'),
+ isPreviewMode: getSettings().__unstableIsPreviewMode,
+ isViewable: (_getPostType$viewable = getPostType(getCurrentPostType())?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false,
+ isCodeEditingEnabled: getEditorSettings().codeEditingEnabled,
+ isRichEditingEnabled: getEditorSettings().richEditingEnabled,
+ isPublishSidebarEnabled: select(store_store).isPublishSidebarEnabled()
+ };
+ }, []);
+ const {
+ getActiveComplementaryArea
+ } = (0,external_wp_data_namespaceObject.useSelect)(store);
+ const {
+ toggle
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
+ const {
+ createInfoNotice
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
+ const {
+ __unstableSaveForPreview,
+ setIsListViewOpened,
+ switchEditorMode,
+ toggleDistractionFree
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
+ const {
+ openModal,
+ enableComplementaryArea,
+ disableComplementaryArea
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
+ const {
+ getCurrentPostId
+ } = (0,external_wp_data_namespaceObject.useSelect)(store_store);
+ const allowSwitchEditorMode = isCodeEditingEnabled && isRichEditingEnabled;
+ if (isPreviewMode) {
+ return {
+ commands: [],
+ isLoading: false
+ };
+ }
+ const commands = [];
+ commands.push({
+ name: 'core/open-shortcut-help',
+ label: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'),
+ icon: library_keyboard,
+ callback: () => {
+ openModal('editor/keyboard-shortcut-help');
+ }
+ });
+ commands.push({
+ name: 'core/toggle-distraction-free',
+ label: isDistractionFree ? (0,external_wp_i18n_namespaceObject.__)('Exit Distraction Free') : (0,external_wp_i18n_namespaceObject.__)('Enter Distraction Free'),
+ callback: ({
+ close
+ }) => {
+ toggleDistractionFree();
+ close();
+ }
+ });
+ commands.push({
+ name: 'core/open-preferences',
+ label: (0,external_wp_i18n_namespaceObject.__)('Editor preferences'),
+ callback: () => {
+ openModal('editor/preferences');
+ }
+ });
+ commands.push({
+ name: 'core/toggle-spotlight-mode',
+ label: (0,external_wp_i18n_namespaceObject.__)('Toggle spotlight'),
+ callback: ({
+ close
+ }) => {
+ toggle('core', 'focusMode');
+ close();
+ createInfoNotice(isFocusMode ? (0,external_wp_i18n_namespaceObject.__)('Spotlight off.') : (0,external_wp_i18n_namespaceObject.__)('Spotlight on.'), {
+ id: 'core/editor/toggle-spotlight-mode/notice',
+ type: 'snackbar',
+ actions: [{
+ label: (0,external_wp_i18n_namespaceObject.__)('Undo'),
+ onClick: () => {
+ toggle('core', 'focusMode');
+ }
+ }]
+ });
+ }
+ });
+ commands.push({
+ name: 'core/toggle-list-view',
+ label: isListViewOpen ? (0,external_wp_i18n_namespaceObject.__)('Close List View') : (0,external_wp_i18n_namespaceObject.__)('Open List View'),
+ icon: list_view,
+ callback: ({
+ close
+ }) => {
+ setIsListViewOpened(!isListViewOpen);
+ close();
+ createInfoNotice(isListViewOpen ? (0,external_wp_i18n_namespaceObject.__)('List View off.') : (0,external_wp_i18n_namespaceObject.__)('List View on.'), {
+ id: 'core/editor/toggle-list-view/notice',
+ type: 'snackbar'
+ });
+ }
+ });
+ commands.push({
+ name: 'core/toggle-top-toolbar',
+ label: (0,external_wp_i18n_namespaceObject.__)('Toggle top toolbar'),
+ callback: ({
+ close
+ }) => {
+ toggle('core', 'fixedToolbar');
+ if (isDistractionFree) {
+ toggleDistractionFree();
+ }
+ close();
+ createInfoNotice(isTopToolbar ? (0,external_wp_i18n_namespaceObject.__)('Top toolbar off.') : (0,external_wp_i18n_namespaceObject.__)('Top toolbar on.'), {
+ id: 'core/editor/toggle-top-toolbar/notice',
+ type: 'snackbar',
+ actions: [{
+ label: (0,external_wp_i18n_namespaceObject.__)('Undo'),
+ onClick: () => {
+ toggle('core', 'fixedToolbar');
+ }
+ }]
+ });
+ }
+ });
+ if (allowSwitchEditorMode) {
+ commands.push({
+ name: 'core/toggle-code-editor',
+ label: editorMode === 'visual' ? (0,external_wp_i18n_namespaceObject.__)('Open code editor') : (0,external_wp_i18n_namespaceObject.__)('Exit code editor'),
+ icon: library_code,
+ callback: ({
+ close
+ }) => {
+ switchEditorMode(editorMode === 'visual' ? 'text' : 'visual');
+ close();
+ }
+ });
+ }
+ commands.push({
+ name: 'core/toggle-breadcrumbs',
+ label: showBlockBreadcrumbs ? (0,external_wp_i18n_namespaceObject.__)('Hide block breadcrumbs') : (0,external_wp_i18n_namespaceObject.__)('Show block breadcrumbs'),
+ callback: ({
+ close
+ }) => {
+ toggle('core', 'showBlockBreadcrumbs');
+ close();
+ createInfoNotice(showBlockBreadcrumbs ? (0,external_wp_i18n_namespaceObject.__)('Breadcrumbs hidden.') : (0,external_wp_i18n_namespaceObject.__)('Breadcrumbs visible.'), {
+ id: 'core/editor/toggle-breadcrumbs/notice',
+ type: 'snackbar'
+ });
+ }
+ });
+ commands.push({
+ name: 'core/open-settings-sidebar',
+ label: (0,external_wp_i18n_namespaceObject.__)('Toggle settings sidebar'),
+ icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? drawer_left : drawer_right,
+ callback: ({
+ close
+ }) => {
+ const activeSidebar = getActiveComplementaryArea('core');
+ close();
+ if (activeSidebar === 'edit-post/document') {
+ disableComplementaryArea('core');
+ } else {
+ enableComplementaryArea('core', 'edit-post/document');
+ }
+ }
+ });
+ commands.push({
+ name: 'core/open-block-inspector',
+ label: (0,external_wp_i18n_namespaceObject.__)('Toggle block inspector'),
+ icon: block_default,
+ callback: ({
+ close
+ }) => {
+ const activeSidebar = getActiveComplementaryArea('core');
+ close();
+ if (activeSidebar === 'edit-post/block') {
+ disableComplementaryArea('core');
+ } else {
+ enableComplementaryArea('core', 'edit-post/block');
+ }
+ }
+ });
+ commands.push({
+ name: 'core/toggle-publish-sidebar',
+ label: isPublishSidebarEnabled ? (0,external_wp_i18n_namespaceObject.__)('Disable pre-publish checks') : (0,external_wp_i18n_namespaceObject.__)('Enable pre-publish checks'),
+ icon: format_list_bullets,
+ callback: ({
+ close
+ }) => {
+ close();
+ toggle('core', 'isPublishSidebarEnabled');
+ createInfoNotice(isPublishSidebarEnabled ? (0,external_wp_i18n_namespaceObject.__)('Pre-publish checks disabled.') : (0,external_wp_i18n_namespaceObject.__)('Pre-publish checks enabled.'), {
+ id: 'core/editor/publish-sidebar/notice',
+ type: 'snackbar'
+ });
+ }
+ });
+ if (isViewable) {
+ commands.push({
+ name: 'core/preview-link',
+ label: (0,external_wp_i18n_namespaceObject.__)('Preview in a new tab'),
+ icon: library_external,
+ callback: async ({
+ close
+ }) => {
+ close();
+ const postId = getCurrentPostId();
+ const link = await __unstableSaveForPreview();
+ window.open(link, `wp-preview-${postId}`);
+ }
+ });
+ }
+ return {
+ commands,
+ isLoading: false
+ };
+}
+function useEditedEntityContextualCommands() {
+ const {
+ postType
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getCurrentPostType
+ } = select(store_store);
+ return {
+ postType: getCurrentPostType()
+ };
+ }, []);
+ const {
+ openModal
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
+ const commands = [];
+ if (postType === PATTERN_POST_TYPE) {
+ commands.push({
+ name: 'core/rename-pattern',
+ label: (0,external_wp_i18n_namespaceObject.__)('Rename pattern'),
+ icon: edit,
+ callback: ({
+ close
+ }) => {
+ openModal(modalName);
+ close();
+ }
+ });
+ commands.push({
+ name: 'core/duplicate-pattern',
+ label: (0,external_wp_i18n_namespaceObject.__)('Duplicate pattern'),
+ icon: library_symbol,
+ callback: ({
+ close
+ }) => {
+ openModal(pattern_duplicate_modal_modalName);
+ close();
+ }
+ });
+ }
+ return {
+ isLoading: false,
+ commands
+ };
+}
+function useCommands() {
+ (0,external_wp_commands_namespaceObject.useCommandLoader)({
+ name: 'core/editor/edit-ui',
+ hook: useEditorCommandLoader
+ });
+ (0,external_wp_commands_namespaceObject.useCommandLoader)({
+ name: 'core/editor/contextual-commands',
+ hook: useEditedEntityContextualCommands,
+ context: 'entity-edit'
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-removal-warnings/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+const {
+ BlockRemovalWarningModal
+} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
+
+// Prevent accidental removal of certain blocks, asking the user for confirmation first.
+const TEMPLATE_BLOCKS = ['core/post-content', 'core/post-template', 'core/query'];
+const BLOCK_REMOVAL_RULES = [{
+ // Template blocks.
+ // The warning is only shown when a user manipulates templates or template parts.
+ postTypes: ['wp_template', 'wp_template_part'],
+ callback(removedBlocks) {
+ const removedTemplateBlocks = removedBlocks.filter(({
+ name
+ }) => TEMPLATE_BLOCKS.includes(name));
+ if (removedTemplateBlocks.length) {
+ return (0,external_wp_i18n_namespaceObject._n)('Deleting this block will stop your post or page content from displaying on this template. It is not recommended.', 'Some of the deleted blocks will stop your post or page content from displaying on this template. It is not recommended.', removedBlocks.length);
+ }
+ }
+}, {
+ // Pattern overrides.
+ // The warning is only shown when the user edits a pattern.
+ postTypes: ['wp_block'],
+ callback(removedBlocks) {
+ const removedBlocksWithOverrides = removedBlocks.filter(({
+ attributes
+ }) => attributes?.metadata?.bindings && Object.values(attributes.metadata.bindings).some(binding => binding.source === 'core/pattern-overrides'));
+ if (removedBlocksWithOverrides.length) {
+ return (0,external_wp_i18n_namespaceObject._n)('The deleted block allows instance overrides. Removing it may result in content not displaying where this pattern is used. Are you sure you want to proceed?', 'Some of the deleted blocks allow instance overrides. Removing them may result in content not displaying where this pattern is used. Are you sure you want to proceed?', removedBlocks.length);
+ }
+ }
+}];
+function BlockRemovalWarnings() {
+ const currentPostType = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentPostType(), []);
+ const removalRulesForPostType = (0,external_wp_element_namespaceObject.useMemo)(() => BLOCK_REMOVAL_RULES.filter(rule => rule.postTypes.includes(currentPostType)), [currentPostType]);
+
+ // `BlockRemovalWarnings` is rendered in the editor provider, a shared component
+ // across react native and web. However, `BlockRemovalWarningModal` is web only.
+ // Check it exists before trying to render it.
+ if (!BlockRemovalWarningModal) {
+ return null;
+ }
+ if (!removalRulesForPostType) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockRemovalWarningModal, {
+ rules: removalRulesForPostType
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/start-page-options/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+function useStartPatterns() {
+ // A pattern is a start pattern if it includes 'core/post-content' in its blockTypes,
+ // and it has no postTypes declared and the current post type is page or if
+ // the current post type is part of the postTypes declared.
+ const {
+ blockPatternsWithPostContentBlockType,
+ postType
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getPatternsByBlockTypes,
+ getBlocksByName
+ } = select(external_wp_blockEditor_namespaceObject.store);
+ const {
+ getCurrentPostType,
+ getRenderingMode
+ } = select(store_store);
+ const rootClientId = getRenderingMode() === 'post-only' ? '' : getBlocksByName('core/post-content')?.[0];
+ return {
+ blockPatternsWithPostContentBlockType: getPatternsByBlockTypes('core/post-content', rootClientId),
+ postType: getCurrentPostType()
+ };
+ }, []);
+ return (0,external_wp_element_namespaceObject.useMemo)(() => {
+ // filter patterns without postTypes declared if the current postType is page
+ // or patterns that declare the current postType in its post type array.
+ return blockPatternsWithPostContentBlockType.filter(pattern => {
+ return postType === 'page' && !pattern.postTypes || Array.isArray(pattern.postTypes) && pattern.postTypes.includes(postType);
+ });
+ }, [postType, blockPatternsWithPostContentBlockType]);
+}
+function PatternSelection({
+ blockPatterns,
+ onChoosePattern
+}) {
+ const shownBlockPatterns = (0,external_wp_compose_namespaceObject.useAsyncList)(blockPatterns);
+ const {
+ editEntityRecord
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
+ const {
+ postType,
+ postId
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getCurrentPostType,
+ getCurrentPostId
+ } = select(store_store);
+ return {
+ postType: getCurrentPostType(),
+ postId: getCurrentPostId()
+ };
+ }, []);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, {
+ blockPatterns: blockPatterns,
+ shownPatterns: shownBlockPatterns,
+ onClickPattern: (_pattern, blocks) => {
+ editEntityRecord('postType', postType, postId, {
+ blocks,
+ content: ({
+ blocks: blocksForSerialization = []
+ }) => (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization)
+ });
+ onChoosePattern();
+ }
+ });
+}
+function StartPageOptionsModal({
+ onClose
+}) {
+ const startPatterns = useStartPatterns();
+ const hasStartPattern = startPatterns.length > 0;
+ if (!hasStartPattern) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Choose a pattern'),
+ isFullScreen: true,
+ onRequestClose: onClose,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "editor-start-page-options__modal-content",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternSelection, {
+ blockPatterns: startPatterns,
+ onChoosePattern: onClose
+ })
+ })
+ });
+}
+function StartPageOptions() {
+ const [isClosed, setIsClosed] = (0,external_wp_element_namespaceObject.useState)(false);
+ const {
+ shouldEnableModal,
+ postType,
+ postId
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ isEditedPostDirty,
+ isEditedPostEmpty,
+ getCurrentPostType,
+ getCurrentPostId
+ } = select(store_store);
+ const _postType = getCurrentPostType();
+ return {
+ shouldEnableModal: !isEditedPostDirty() && isEditedPostEmpty() && TEMPLATE_POST_TYPE !== _postType,
+ postType: _postType,
+ postId: getCurrentPostId()
+ };
+ }, []);
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
+ // Should reset the modal state when navigating to a new page/post.
+ setIsClosed(false);
+ }, [postType, postId]);
+ if (!shouldEnableModal || isClosed) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StartPageOptionsModal, {
+ onClose: () => setIsClosed(true)
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/keyboard-shortcut-help-modal/config.js
+/**
+ * WordPress dependencies
+ */
+
+const textFormattingShortcuts = [{
+ keyCombination: {
+ modifier: 'primary',
+ character: 'b'
+ },
+ description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text bold.')
+}, {
+ keyCombination: {
+ modifier: 'primary',
+ character: 'i'
+ },
+ description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text italic.')
+}, {
+ keyCombination: {
+ modifier: 'primary',
+ character: 'k'
+ },
+ description: (0,external_wp_i18n_namespaceObject.__)('Convert the selected text into a link.')
+}, {
+ keyCombination: {
+ modifier: 'primaryShift',
+ character: 'k'
+ },
+ description: (0,external_wp_i18n_namespaceObject.__)('Remove a link.')
+}, {
+ keyCombination: {
+ character: '[['
+ },
+ description: (0,external_wp_i18n_namespaceObject.__)('Insert a link to a post or page.')
+}, {
+ keyCombination: {
+ modifier: 'primary',
+ character: 'u'
+ },
+ description: (0,external_wp_i18n_namespaceObject.__)('Underline the selected text.')
+}, {
+ keyCombination: {
+ modifier: 'access',
+ character: 'd'
+ },
+ description: (0,external_wp_i18n_namespaceObject.__)('Strikethrough the selected text.')
+}, {
+ keyCombination: {
+ modifier: 'access',
+ character: 'x'
+ },
+ description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text inline code.')
+}, {
+ keyCombination: {
+ modifier: 'access',
+ character: '0'
+ },
+ aliases: [{
+ modifier: 'access',
+ character: '7'
+ }],
+ description: (0,external_wp_i18n_namespaceObject.__)('Convert the current heading to a paragraph.')
+}, {
+ keyCombination: {
+ modifier: 'access',
+ character: '1-6'
+ },
+ description: (0,external_wp_i18n_namespaceObject.__)('Convert the current paragraph or heading to a heading of level 1 to 6.')
+}, {
+ keyCombination: {
+ modifier: 'primaryShift',
+ character: 'SPACE'
+ },
+ description: (0,external_wp_i18n_namespaceObject.__)('Add non breaking space.')
+}];
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/keyboard-shortcut-help-modal/shortcut.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+function KeyCombination({
+ keyCombination,
+ forceAriaLabel
+}) {
+ const shortcut = keyCombination.modifier ? external_wp_keycodes_namespaceObject.displayShortcutList[keyCombination.modifier](keyCombination.character) : keyCombination.character;
+ const ariaLabel = keyCombination.modifier ? external_wp_keycodes_namespaceObject.shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character;
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("kbd", {
+ className: "editor-keyboard-shortcut-help-modal__shortcut-key-combination",
+ "aria-label": forceAriaLabel || ariaLabel,
+ children: (Array.isArray(shortcut) ? shortcut : [shortcut]).map((character, index) => {
+ if (character === '+') {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.Fragment, {
+ children: character
+ }, index);
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("kbd", {
+ className: "editor-keyboard-shortcut-help-modal__shortcut-key",
+ children: character
+ }, index);
+ })
+ });
+}
+function Shortcut({
+ description,
+ keyCombination,
+ aliases = [],
+ ariaLabel
+}) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "editor-keyboard-shortcut-help-modal__shortcut-description",
+ children: description
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "editor-keyboard-shortcut-help-modal__shortcut-term",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(KeyCombination, {
+ keyCombination: keyCombination,
+ forceAriaLabel: ariaLabel
+ }), aliases.map((alias, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(KeyCombination, {
+ keyCombination: alias,
+ forceAriaLabel: ariaLabel
+ }, index))]
+ })]
+ });
+}
+/* harmony default export */ const keyboard_shortcut_help_modal_shortcut = (Shortcut);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+function DynamicShortcut({
+ name
+}) {
+ const {
+ keyCombination,
+ description,
+ aliases
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getShortcutKeyCombination,
+ getShortcutDescription,
+ getShortcutAliases
+ } = select(external_wp_keyboardShortcuts_namespaceObject.store);
+ return {
+ keyCombination: getShortcutKeyCombination(name),
+ aliases: getShortcutAliases(name),
+ description: getShortcutDescription(name)
+ };
+ }, [name]);
+ if (!keyCombination) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcut_help_modal_shortcut, {
+ keyCombination: keyCombination,
+ description: description,
+ aliases: aliases
+ });
+}
+/* harmony default export */ const dynamic_shortcut = (DynamicShortcut);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/keyboard-shortcut-help-modal/index.js
+/**
+ * External dependencies
+ */
+
+
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+const KEYBOARD_SHORTCUT_HELP_MODAL_NAME = 'editor/keyboard-shortcut-help';
+const ShortcutList = ({
+ shortcuts
+}) =>
+/*#__PURE__*/
+/*
+ * Disable reason: The `list` ARIA role is redundant but
+ * Safari+VoiceOver won't announce the list otherwise.
+ */
+/* eslint-disable jsx-a11y/no-redundant-roles */
+(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", {
+ className: "editor-keyboard-shortcut-help-modal__shortcut-list",
+ role: "list",
+ children: shortcuts.map((shortcut, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", {
+ className: "editor-keyboard-shortcut-help-modal__shortcut",
+ children: typeof shortcut === 'string' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dynamic_shortcut, {
+ name: shortcut
+ }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcut_help_modal_shortcut, {
+ ...shortcut
+ })
+ }, index))
+})
+/* eslint-enable jsx-a11y/no-redundant-roles */;
+const ShortcutSection = ({
+ title,
+ shortcuts,
+ className
+}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("section", {
+ className: dist_clsx('editor-keyboard-shortcut-help-modal__section', className),
+ children: [!!title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", {
+ className: "editor-keyboard-shortcut-help-modal__section-title",
+ children: title
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutList, {
+ shortcuts: shortcuts
+ })]
+});
+const ShortcutCategorySection = ({
+ title,
+ categoryName,
+ additionalShortcuts = []
+}) => {
+ const categoryShortcuts = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ return select(external_wp_keyboardShortcuts_namespaceObject.store).getCategoryShortcuts(categoryName);
+ }, [categoryName]);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutSection, {
+ title: title,
+ shortcuts: categoryShortcuts.concat(additionalShortcuts)
+ });
+};
+function KeyboardShortcutHelpModal() {
+ const isModalActive = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isModalActive(KEYBOARD_SHORTCUT_HELP_MODAL_NAME), []);
+ const {
+ openModal,
+ closeModal
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
+ const toggleModal = () => {
+ if (isModalActive) {
+ closeModal();
+ } else {
+ openModal(KEYBOARD_SHORTCUT_HELP_MODAL_NAME);
+ }
+ };
+ (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/keyboard-shortcuts', toggleModal);
+ if (!isModalActive) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Modal, {
+ className: "editor-keyboard-shortcut-help-modal",
+ title: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'),
+ closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)('Close'),
+ onRequestClose: toggleModal,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutSection, {
+ className: "editor-keyboard-shortcut-help-modal__main-shortcuts",
+ shortcuts: ['core/editor/keyboard-shortcuts']
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutCategorySection, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Global shortcuts'),
+ categoryName: "global"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutCategorySection, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Selection shortcuts'),
+ categoryName: "selection"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutCategorySection, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Block shortcuts'),
+ categoryName: "block",
+ additionalShortcuts: [{
+ keyCombination: {
+ character: '/'
+ },
+ description: (0,external_wp_i18n_namespaceObject.__)('Change the block type after adding a new paragraph.'),
+ /* translators: The forward-slash character. e.g. '/'. */
+ ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Forward-slash')
+ }]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutSection, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Text formatting'),
+ shortcuts: textFormattingShortcuts
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutCategorySection, {
+ title: (0,external_wp_i18n_namespaceObject.__)('List View shortcuts'),
+ categoryName: "list-view"
+ })]
+ });
+}
+/* harmony default export */ const keyboard_shortcut_help_modal = (KeyboardShortcutHelpModal);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-settings-menu/content-only-settings-menu.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+function ContentOnlySettingsMenuItems({
+ clientId,
+ onClose
+}) {
+ const {
+ entity,
+ onNavigateToEntityRecord,
+ canEditTemplates
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getBlockEditingMode,
+ getBlockParentsByBlockName,
+ getSettings,
+ getBlockAttributes
+ } = select(external_wp_blockEditor_namespaceObject.store);
+ const contentOnly = getBlockEditingMode(clientId) === 'contentOnly';
+ if (!contentOnly) {
+ return {};
+ }
+ const patternParent = getBlockParentsByBlockName(clientId, 'core/block', true)[0];
+ let record;
+ if (patternParent) {
+ record = select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', 'wp_block', getBlockAttributes(patternParent).ref);
+ } else {
+ const {
+ getCurrentTemplateId
+ } = select(store_store);
+ const templateId = getCurrentTemplateId();
+ const {
+ getContentLockingParent
+ } = unlock(select(external_wp_blockEditor_namespaceObject.store));
+ if (!getContentLockingParent(clientId) && templateId) {
+ record = select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', 'wp_template', templateId);
+ }
+ }
+ const _canEditTemplates = select(external_wp_coreData_namespaceObject.store).canUser('create', 'templates');
+ return {
+ canEditTemplates: _canEditTemplates,
+ entity: record,
+ onNavigateToEntityRecord: getSettings().onNavigateToEntityRecord
+ };
+ }, [clientId]);
+ if (!entity) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateLockContentOnlyMenuItems, {
+ clientId: clientId,
+ onClose: onClose
+ });
+ }
+ const isPattern = entity.type === 'wp_block';
+ let helpText = isPattern ? (0,external_wp_i18n_namespaceObject.__)('Edit the pattern to move, delete, or make further changes to this block.') : (0,external_wp_i18n_namespaceObject.__)('Edit the template to move, delete, or make further changes to this block.');
+ if (!canEditTemplates) {
+ helpText = (0,external_wp_i18n_namespaceObject.__)('Only users with permissions to edit the template can move or delete this block');
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableBlockSettingsMenuFirstItem, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ onClick: () => {
+ onNavigateToEntityRecord({
+ postId: entity.id,
+ postType: entity.type
+ });
+ },
+ disabled: !canEditTemplates,
+ children: isPattern ? (0,external_wp_i18n_namespaceObject.__)('Edit pattern') : (0,external_wp_i18n_namespaceObject.__)('Edit template')
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ variant: "muted",
+ as: "p",
+ className: "editor-content-only-settings-menu__description",
+ children: helpText
+ })]
+ });
+}
+function TemplateLockContentOnlyMenuItems({
+ clientId,
+ onClose
+}) {
+ const {
+ contentLockingParent
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getContentLockingParent
+ } = unlock(select(external_wp_blockEditor_namespaceObject.store));
+ return {
+ contentLockingParent: getContentLockingParent(clientId)
+ };
+ }, [clientId]);
+ const blockDisplayInformation = (0,external_wp_blockEditor_namespaceObject.useBlockDisplayInformation)(contentLockingParent);
+ // Disable reason: We're using a hook here so it has to be on top-level.
+ // eslint-disable-next-line @wordpress/no-unused-vars-before-return
+ const {
+ modifyContentLockBlock,
+ selectBlock
+ } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store));
+ if (!blockDisplayInformation?.title) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableBlockSettingsMenuFirstItem, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ onClick: () => {
+ selectBlock(contentLockingParent);
+ modifyContentLockBlock(contentLockingParent);
+ onClose();
+ },
+ children: (0,external_wp_i18n_namespaceObject.__)('Unlock')
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ variant: "muted",
+ as: "p",
+ className: "editor-content-only-settings-menu__description",
+ children: (0,external_wp_i18n_namespaceObject.__)('Temporarily unlock the parent block to edit, delete or make further changes to this block.')
+ })]
+ });
+}
+function ContentOnlySettingsMenu() {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, {
+ children: ({
+ selectedClientIds,
+ onClose
+ }) => selectedClientIds.length === 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ContentOnlySettingsMenuItems, {
+ clientId: selectedClientIds[0],
+ onClose: onClose
+ })
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/start-template-options/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+function useFallbackTemplateContent(slug, isCustom = false) {
+ return (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getEntityRecord,
+ getDefaultTemplateId
+ } = select(external_wp_coreData_namespaceObject.store);
+ const templateId = getDefaultTemplateId({
+ slug,
+ is_custom: isCustom,
+ ignore_empty: true
+ });
+ return templateId ? getEntityRecord('postType', TEMPLATE_POST_TYPE, templateId)?.content?.raw : undefined;
+ }, [slug, isCustom]);
+}
+function start_template_options_useStartPatterns(fallbackContent) {
+ const {
+ slug,
+ patterns
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getCurrentPostType,
+ getCurrentPostId
+ } = select(store_store);
+ const {
+ getEntityRecord,
+ getBlockPatterns
+ } = select(external_wp_coreData_namespaceObject.store);
+ const postId = getCurrentPostId();
+ const postType = getCurrentPostType();
+ const record = getEntityRecord('postType', postType, postId);
+ return {
+ slug: record.slug,
+ patterns: getBlockPatterns()
+ };
+ }, []);
+ const currentThemeStylesheet = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme().stylesheet);
+
+ // Duplicated from packages/block-library/src/pattern/edit.js.
+ function injectThemeAttributeInBlockTemplateContent(block) {
+ if (block.innerBlocks.find(innerBlock => innerBlock.name === 'core/template-part')) {
+ block.innerBlocks = block.innerBlocks.map(innerBlock => {
+ if (innerBlock.name === 'core/template-part' && innerBlock.attributes.theme === undefined) {
+ innerBlock.attributes.theme = currentThemeStylesheet;
+ }
+ return innerBlock;
+ });
+ }
+ if (block.name === 'core/template-part' && block.attributes.theme === undefined) {
+ block.attributes.theme = currentThemeStylesheet;
+ }
+ return block;
+ }
+ return (0,external_wp_element_namespaceObject.useMemo)(() => {
+ // filter patterns that are supposed to be used in the current template being edited.
+ return [{
+ name: 'fallback',
+ blocks: (0,external_wp_blocks_namespaceObject.parse)(fallbackContent),
+ title: (0,external_wp_i18n_namespaceObject.__)('Fallback content')
+ }, ...patterns.filter(pattern => {
+ return Array.isArray(pattern.templateTypes) && pattern.templateTypes.some(templateType => slug.startsWith(templateType));
+ }).map(pattern => {
+ return {
+ ...pattern,
+ blocks: (0,external_wp_blocks_namespaceObject.parse)(pattern.content).map(block => injectThemeAttributeInBlockTemplateContent(block))
+ };
+ })];
+ }, [fallbackContent, slug, patterns]);
+}
+function start_template_options_PatternSelection({
+ fallbackContent,
+ onChoosePattern,
+ postType
+}) {
+ const [,, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', postType);
+ const blockPatterns = start_template_options_useStartPatterns(fallbackContent);
+ const shownBlockPatterns = (0,external_wp_compose_namespaceObject.useAsyncList)(blockPatterns);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, {
+ blockPatterns: blockPatterns,
+ shownPatterns: shownBlockPatterns,
+ onClickPattern: (pattern, blocks) => {
+ onChange(blocks, {
+ selection: undefined
+ });
+ onChoosePattern();
+ }
+ });
+}
+function StartModal({
+ slug,
+ isCustom,
+ onClose,
+ postType
+}) {
+ const fallbackContent = useFallbackTemplateContent(slug, isCustom);
+ if (!fallbackContent) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Modal, {
+ className: "editor-start-template-options__modal",
+ title: (0,external_wp_i18n_namespaceObject.__)('Choose a pattern'),
+ closeLabel: (0,external_wp_i18n_namespaceObject.__)('Cancel'),
+ focusOnMount: "firstElement",
+ onRequestClose: onClose,
+ isFullScreen: true,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "editor-start-template-options__modal-content",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(start_template_options_PatternSelection, {
+ fallbackContent: fallbackContent,
+ slug: slug,
+ isCustom: isCustom,
+ postType: postType,
+ onChoosePattern: () => {
+ onClose();
+ }
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, {
+ className: "editor-start-template-options__modal__actions",
+ justify: "flex-end",
+ expanded: false,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "tertiary",
+ onClick: onClose,
+ children: (0,external_wp_i18n_namespaceObject.__)('Skip')
+ })
+ })
+ })]
+ });
+}
+function StartTemplateOptions() {
+ const [isClosed, setIsClosed] = (0,external_wp_element_namespaceObject.useState)(false);
+ const {
+ shouldOpenModal,
+ slug,
+ isCustom,
+ postType,
+ postId
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getCurrentPostType,
+ getCurrentPostId
+ } = select(store_store);
+ const _postType = getCurrentPostType();
+ const _postId = getCurrentPostId();
+ const {
+ getEditedEntityRecord,
+ hasEditsForEntityRecord
+ } = select(external_wp_coreData_namespaceObject.store);
+ const templateRecord = getEditedEntityRecord('postType', _postType, _postId);
+ const hasEdits = hasEditsForEntityRecord('postType', _postType, _postId);
+ return {
+ shouldOpenModal: !hasEdits && '' === templateRecord.content && TEMPLATE_POST_TYPE === _postType,
+ slug: templateRecord.slug,
+ isCustom: templateRecord.is_custom,
+ postType: _postType,
+ postId: _postId
+ };
+ }, []);
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
+ // Should reset the modal state when navigating to a new page/post.
+ setIsClosed(false);
+ }, [postType, postId]);
+ if (!shouldOpenModal || isClosed) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StartModal, {
+ slug: slug,
+ isCustom: isCustom,
+ postType: postType,
+ onClose: () => setIsClosed(true)
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
const {
@@ -14914,6 +21282,12 @@ const NON_CONTEXTUAL_POST_TYPES = ['wp_block', 'wp_template', 'wp_navigation', '
* @param {Array} post Block list.
* @param {boolean} template Whether the page content has focus (and the surrounding template is inert). If `true` return page content blocks. Default `false`.
* @param {string} mode Rendering mode.
+ *
+ * @example
+ * ```jsx
+ * const [ blocks, onInput, onChange ] = useBlockEditorProps( post, template, mode );
+ * ```
+ *
* @return {Array} Block editor props.
*/
function useBlockEditorProps(post, template, mode) {
@@ -14957,6 +21331,33 @@ function useBlockEditorProps(post, template, mode) {
}
return [blocks, rootLevelPost === 'post' ? onInput : onInputTemplate, rootLevelPost === 'post' ? onChange : onChangeTemplate];
}
+
+/**
+ * This component provides the editor context and manages the state of the block editor.
+ *
+ * @param {Object} props The component props.
+ * @param {Object} props.post The post object.
+ * @param {Object} props.settings The editor settings.
+ * @param {boolean} props.recovery Indicates if the editor is in recovery mode.
+ * @param {Array} props.initialEdits The initial edits for the editor.
+ * @param {Object} props.children The child components.
+ * @param {Object} [props.BlockEditorProviderComponent] The block editor provider component to use. Defaults to ExperimentalBlockEditorProvider.
+ * @param {Object} [props.__unstableTemplate] The template object.
+ *
+ * @example
+ * ```jsx
+ * <ExperimentalEditorProvider
+ * post={ post }
+ * settings={ settings }
+ * recovery={ recovery }
+ * initialEdits={ initialEdits }
+ * __unstableTemplate={ template }
+ * >
+ * { children }
+ * </ExperimentalEditorProvider>
+ *
+ * @return {Object} The rendered ExperimentalEditorProvider component.
+ */
const ExperimentalEditorProvider = with_registry_provider(({
post,
settings,
@@ -14999,7 +21400,7 @@ const ExperimentalEditorProvider = with_registry_provider(({
id,
type
} = rootLevelPost;
- const blockEditorSettings = use_block_editor_settings(editorSettings, type, id);
+ const blockEditorSettings = use_block_editor_settings(editorSettings, type, id, mode);
const [blocks, onInput, onChange] = useBlockEditorProps(post, template, mode);
const {
updatePostLock,
@@ -15052,32 +21453,74 @@ const ExperimentalEditorProvider = with_registry_provider(({
var _settings$defaultRend;
setRenderingMode((_settings$defaultRend = settings.defaultRenderingMode) !== null && _settings$defaultRend !== void 0 ? _settings$defaultRend : 'post-only');
}, [settings.defaultRenderingMode, setRenderingMode]);
+ useHideBlocksFromInserter(post.type, mode);
+
+ // Register the editor commands.
+ useCommands();
if (!isReady) {
return null;
}
- return (0,external_React_.createElement)(external_wp_coreData_namespaceObject.EntityProvider, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_coreData_namespaceObject.EntityProvider, {
kind: "root",
- type: "site"
- }, (0,external_React_.createElement)(external_wp_coreData_namespaceObject.EntityProvider, {
- kind: "postType",
- type: post.type,
- id: post.id
- }, (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.BlockContextProvider, {
- value: defaultBlockContext
- }, (0,external_React_.createElement)(BlockEditorProviderComponent, {
- value: blocks,
- onChange: onChange,
- onInput: onInput,
- selection: selection,
- settings: blockEditorSettings,
- useSubRegistry: false
- }, children, (0,external_React_.createElement)(PatternsMenuItems, null), mode === 'template-locked' && (0,external_React_.createElement)(DisableNonPageContentBlocks, null), type === 'wp_navigation' && (0,external_React_.createElement)(NavigationBlockEditingMode, null)))));
+ type: "site",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_coreData_namespaceObject.EntityProvider, {
+ kind: "postType",
+ type: post.type,
+ id: post.id,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockContextProvider, {
+ value: defaultBlockContext,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(BlockEditorProviderComponent, {
+ value: blocks,
+ onChange: onChange,
+ onInput: onInput,
+ selection: selection,
+ settings: blockEditorSettings,
+ useSubRegistry: false,
+ children: [children, !settings.__unstableIsPreviewMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternsMenuItems, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ContentOnlySettingsMenu, {}), mode === 'template-locked' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DisableNonPageContentBlocks, {}), type === 'wp_navigation' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationBlockEditingMode, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditorKeyboardShortcuts, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcut_help_modal, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockRemovalWarnings, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StartPageOptions, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StartTemplateOptions, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternRenameModal, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternDuplicateModal, {})]
+ })]
+ })
+ })
+ })
+ });
});
+
+/**
+ * This component establishes a new post editing context, and serves as the entry point for a new post editor (or post with template editor).
+ *
+ * It supports a large number of post types, including post, page, templates,
+ * custom post types, patterns, template parts.
+ *
+ * All modification and changes are performed to the `@wordpress/core-data` store.
+ *
+ * @param {Object} props The component props.
+ * @param {Object} [props.post] The post object to edit. This is required.
+ * @param {Object} [props.__unstableTemplate] The template object wrapper the edited post.
+ * This is optional and can only be used when the post type supports templates (like posts and pages).
+ * @param {Object} [props.settings] The settings object to use for the editor.
+ * This is optional and can be used to override the default settings.
+ * @param {Element} [props.children] Children elements for which the BlockEditorProvider context should apply.
+ * This is optional.
+ *
+ * @example
+ * ```jsx
+ * <EditorProvider
+ * post={ post }
+ * settings={ settings }
+ * __unstableTemplate={ template }
+ * >
+ * { children }
+ * </EditorProvider>
+ * ```
+ *
+ * @return {JSX.Element} The rendered EditorProvider component.
+ */
function EditorProvider(props) {
- return (0,external_React_.createElement)(ExperimentalEditorProvider, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ExperimentalEditorProvider, {
...props,
- BlockEditorProviderComponent: external_wp_blockEditor_namespaceObject.BlockEditorProvider
- }, props.children);
+ BlockEditorProviderComponent: external_wp_blockEditor_namespaceObject.BlockEditorProvider,
+ children: props.children
+ });
}
/* harmony default export */ const provider = (EditorProvider);
@@ -15085,7 +21528,6 @@ function EditorProvider(props) {
const external_wp_serverSideRender_namespaceObject = window["wp"]["serverSideRender"];
var external_wp_serverSideRender_default = /*#__PURE__*/__webpack_require__.n(external_wp_serverSideRender_namespaceObject);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/deprecated.js
-
// Block Creation Components.
/**
* WordPress dependencies
@@ -15094,6 +21536,7 @@ var external_wp_serverSideRender_default = /*#__PURE__*/__webpack_require__.n(ex
+
function deprecateComponent(name, Wrapped, staticsToHoist = []) {
const Component = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => {
external_wp_deprecated_default()('wp.editor.' + name, {
@@ -15101,7 +21544,7 @@ function deprecateComponent(name, Wrapped, staticsToHoist = []) {
alternative: 'wp.blockEditor.' + name,
version: '6.2'
});
- return (0,external_React_.createElement)(Wrapped, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Wrapped, {
ref: ref,
...props
});
@@ -15121,59 +21564,218 @@ function deprecateFunction(name, func) {
return func(...args);
};
}
+
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.RichText` instead.
+ */
const RichText = deprecateComponent('RichText', external_wp_blockEditor_namespaceObject.RichText, ['Content']);
RichText.isEmpty = deprecateFunction('RichText.isEmpty', external_wp_blockEditor_namespaceObject.RichText.isEmpty);
+
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.Autocomplete` instead.
+ */
const Autocomplete = deprecateComponent('Autocomplete', external_wp_blockEditor_namespaceObject.Autocomplete);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.AlignmentToolbar` instead.
+ */
const AlignmentToolbar = deprecateComponent('AlignmentToolbar', external_wp_blockEditor_namespaceObject.AlignmentToolbar);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.BlockAlignmentToolbar` instead.
+ */
const BlockAlignmentToolbar = deprecateComponent('BlockAlignmentToolbar', external_wp_blockEditor_namespaceObject.BlockAlignmentToolbar);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.BlockControls` instead.
+ */
const BlockControls = deprecateComponent('BlockControls', external_wp_blockEditor_namespaceObject.BlockControls, ['Slot']);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.BlockEdit` instead.
+ */
const BlockEdit = deprecateComponent('BlockEdit', external_wp_blockEditor_namespaceObject.BlockEdit);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.BlockEditorKeyboardShortcuts` instead.
+ */
const BlockEditorKeyboardShortcuts = deprecateComponent('BlockEditorKeyboardShortcuts', external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.BlockFormatControls` instead.
+ */
const BlockFormatControls = deprecateComponent('BlockFormatControls', external_wp_blockEditor_namespaceObject.BlockFormatControls, ['Slot']);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.BlockIcon` instead.
+ */
const BlockIcon = deprecateComponent('BlockIcon', external_wp_blockEditor_namespaceObject.BlockIcon);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.BlockInspector` instead.
+ */
const BlockInspector = deprecateComponent('BlockInspector', external_wp_blockEditor_namespaceObject.BlockInspector);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.BlockList` instead.
+ */
const BlockList = deprecateComponent('BlockList', external_wp_blockEditor_namespaceObject.BlockList);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.BlockMover` instead.
+ */
const BlockMover = deprecateComponent('BlockMover', external_wp_blockEditor_namespaceObject.BlockMover);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.BlockNavigationDropdown` instead.
+ */
const BlockNavigationDropdown = deprecateComponent('BlockNavigationDropdown', external_wp_blockEditor_namespaceObject.BlockNavigationDropdown);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.BlockSelectionClearer` instead.
+ */
const BlockSelectionClearer = deprecateComponent('BlockSelectionClearer', external_wp_blockEditor_namespaceObject.BlockSelectionClearer);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.BlockSettingsMenu` instead.
+ */
const BlockSettingsMenu = deprecateComponent('BlockSettingsMenu', external_wp_blockEditor_namespaceObject.BlockSettingsMenu);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.BlockTitle` instead.
+ */
const BlockTitle = deprecateComponent('BlockTitle', external_wp_blockEditor_namespaceObject.BlockTitle);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.BlockToolbar` instead.
+ */
const BlockToolbar = deprecateComponent('BlockToolbar', external_wp_blockEditor_namespaceObject.BlockToolbar);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.ColorPalette` instead.
+ */
const ColorPalette = deprecateComponent('ColorPalette', external_wp_blockEditor_namespaceObject.ColorPalette);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.ContrastChecker` instead.
+ */
const ContrastChecker = deprecateComponent('ContrastChecker', external_wp_blockEditor_namespaceObject.ContrastChecker);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.CopyHandler` instead.
+ */
const CopyHandler = deprecateComponent('CopyHandler', external_wp_blockEditor_namespaceObject.CopyHandler);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.DefaultBlockAppender` instead.
+ */
const DefaultBlockAppender = deprecateComponent('DefaultBlockAppender', external_wp_blockEditor_namespaceObject.DefaultBlockAppender);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.FontSizePicker` instead.
+ */
const FontSizePicker = deprecateComponent('FontSizePicker', external_wp_blockEditor_namespaceObject.FontSizePicker);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.Inserter` instead.
+ */
const Inserter = deprecateComponent('Inserter', external_wp_blockEditor_namespaceObject.Inserter);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.InnerBlocks` instead.
+ */
const InnerBlocks = deprecateComponent('InnerBlocks', external_wp_blockEditor_namespaceObject.InnerBlocks, ['ButtonBlockAppender', 'DefaultBlockAppender', 'Content']);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.InspectorAdvancedControls` instead.
+ */
const InspectorAdvancedControls = deprecateComponent('InspectorAdvancedControls', external_wp_blockEditor_namespaceObject.InspectorAdvancedControls, ['Slot']);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.InspectorControls` instead.
+ */
const InspectorControls = deprecateComponent('InspectorControls', external_wp_blockEditor_namespaceObject.InspectorControls, ['Slot']);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.PanelColorSettings` instead.
+ */
const PanelColorSettings = deprecateComponent('PanelColorSettings', external_wp_blockEditor_namespaceObject.PanelColorSettings);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.PlainText` instead.
+ */
const PlainText = deprecateComponent('PlainText', external_wp_blockEditor_namespaceObject.PlainText);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.RichTextShortcut` instead.
+ */
const RichTextShortcut = deprecateComponent('RichTextShortcut', external_wp_blockEditor_namespaceObject.RichTextShortcut);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.RichTextToolbarButton` instead.
+ */
const RichTextToolbarButton = deprecateComponent('RichTextToolbarButton', external_wp_blockEditor_namespaceObject.RichTextToolbarButton);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.__unstableRichTextInputEvent` instead.
+ */
const __unstableRichTextInputEvent = deprecateComponent('__unstableRichTextInputEvent', external_wp_blockEditor_namespaceObject.__unstableRichTextInputEvent);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.MediaPlaceholder` instead.
+ */
const MediaPlaceholder = deprecateComponent('MediaPlaceholder', external_wp_blockEditor_namespaceObject.MediaPlaceholder);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.MediaUpload` instead.
+ */
const MediaUpload = deprecateComponent('MediaUpload', external_wp_blockEditor_namespaceObject.MediaUpload);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.MediaUploadCheck` instead.
+ */
const MediaUploadCheck = deprecateComponent('MediaUploadCheck', external_wp_blockEditor_namespaceObject.MediaUploadCheck);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.MultiSelectScrollIntoView` instead.
+ */
const MultiSelectScrollIntoView = deprecateComponent('MultiSelectScrollIntoView', external_wp_blockEditor_namespaceObject.MultiSelectScrollIntoView);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.NavigableToolbar` instead.
+ */
const NavigableToolbar = deprecateComponent('NavigableToolbar', external_wp_blockEditor_namespaceObject.NavigableToolbar);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.ObserveTyping` instead.
+ */
const ObserveTyping = deprecateComponent('ObserveTyping', external_wp_blockEditor_namespaceObject.ObserveTyping);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.SkipToSelectedBlock` instead.
+ */
const SkipToSelectedBlock = deprecateComponent('SkipToSelectedBlock', external_wp_blockEditor_namespaceObject.SkipToSelectedBlock);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.URLInput` instead.
+ */
const URLInput = deprecateComponent('URLInput', external_wp_blockEditor_namespaceObject.URLInput);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.URLInputButton` instead.
+ */
const URLInputButton = deprecateComponent('URLInputButton', external_wp_blockEditor_namespaceObject.URLInputButton);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.URLPopover` instead.
+ */
const URLPopover = deprecateComponent('URLPopover', external_wp_blockEditor_namespaceObject.URLPopover);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.Warning` instead.
+ */
const Warning = deprecateComponent('Warning', external_wp_blockEditor_namespaceObject.Warning);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.WritingFlow` instead.
+ */
const WritingFlow = deprecateComponent('WritingFlow', external_wp_blockEditor_namespaceObject.WritingFlow);
+
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.createCustomColorsHOC` instead.
+ */
const createCustomColorsHOC = deprecateFunction('createCustomColorsHOC', external_wp_blockEditor_namespaceObject.createCustomColorsHOC);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.getColorClassName` instead.
+ */
const getColorClassName = deprecateFunction('getColorClassName', external_wp_blockEditor_namespaceObject.getColorClassName);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.getColorObjectByAttributeValues` instead.
+ */
const getColorObjectByAttributeValues = deprecateFunction('getColorObjectByAttributeValues', external_wp_blockEditor_namespaceObject.getColorObjectByAttributeValues);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.getColorObjectByColorValue` instead.
+ */
const getColorObjectByColorValue = deprecateFunction('getColorObjectByColorValue', external_wp_blockEditor_namespaceObject.getColorObjectByColorValue);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.getFontSize` instead.
+ */
const getFontSize = deprecateFunction('getFontSize', external_wp_blockEditor_namespaceObject.getFontSize);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.getFontSizeClass` instead.
+ */
const getFontSizeClass = deprecateFunction('getFontSizeClass', external_wp_blockEditor_namespaceObject.getFontSizeClass);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.createCustomColorsHOC` instead.
+ */
const withColorContext = deprecateFunction('withColorContext', external_wp_blockEditor_namespaceObject.withColorContext);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.withColors` instead.
+ */
const withColors = deprecateFunction('withColors', external_wp_blockEditor_namespaceObject.withColors);
+/**
+ * @deprecated since 5.3, use `wp.blockEditor.withFontSizes` instead.
+ */
const withFontSizes = deprecateFunction('withFontSizes', external_wp_blockEditor_namespaceObject.withFontSizes);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/index.js
@@ -15266,6 +21868,14 @@ const withFontSizes = deprecateFunction('withFontSizes', external_wp_blockEditor
+
+
+
+
+
+
+
+
// State Related Components.
@@ -15313,8 +21923,2322 @@ function cleanForSlug(string) {
-;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-canvas/edit-template-blocks-notification.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-interface/content-slot-fill.js
+/**
+ * WordPress dependencies
+ */
+
+
+/**
+ * Internal dependencies
+ */
+
+const {
+ createPrivateSlotFill
+} = unlock(external_wp_components_namespaceObject.privateApis);
+const SLOT_FILL_NAME = 'EditCanvasContainerSlot';
+const EditorContentSlotFill = createPrivateSlotFill(SLOT_FILL_NAME);
+/* harmony default export */ const content_slot_fill = (EditorContentSlotFill);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/header/back-button.js
+/**
+ * WordPress dependencies
+ */
+
+
+// Keeping an old name for backward compatibility.
+
+const slotName = '__experimentalMainDashboardButton';
+const {
+ Fill: back_button_Fill,
+ Slot: back_button_Slot
+} = (0,external_wp_components_namespaceObject.createSlotFill)(slotName);
+const BackButton = back_button_Fill;
+const BackButtonSlot = ({
+ children
+}) => {
+ const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(slotName);
+ const hasFills = Boolean(fills && fills.length);
+ if (!hasFills) {
+ return children;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(back_button_Slot, {
+ bubblesVirtually: true,
+ fillProps: {
+ length: !fills ? 0 : fills.length
+ }
+ });
+};
+BackButton.Slot = BackButtonSlot;
+/* harmony default export */ const back_button = (BackButton);
+
+;// CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.mjs
+/******************************************************************************
+Copyright (c) Microsoft Corporation.
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+***************************************************************************** */
+/* global Reflect, Promise, SuppressedError, Symbol */
+
+var extendStatics = function(d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+};
+
+function __extends(d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+}
+
+var __assign = function() {
+ __assign = Object.assign || function __assign(t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
+ }
+ return t;
+ }
+ return __assign.apply(this, arguments);
+}
+
+function __rest(s, e) {
+ var t = {};
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
+ t[p] = s[p];
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
+ t[p[i]] = s[p[i]];
+ }
+ return t;
+}
+
+function __decorate(decorators, target, key, desc) {
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
+}
+
+function __param(paramIndex, decorator) {
+ return function (target, key) { decorator(target, key, paramIndex); }
+}
+
+function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
+ var _, done = false;
+ for (var i = decorators.length - 1; i >= 0; i--) {
+ var context = {};
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
+ if (kind === "accessor") {
+ if (result === void 0) continue;
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
+ if (_ = accept(result.get)) descriptor.get = _;
+ if (_ = accept(result.set)) descriptor.set = _;
+ if (_ = accept(result.init)) initializers.unshift(_);
+ }
+ else if (_ = accept(result)) {
+ if (kind === "field") initializers.unshift(_);
+ else descriptor[key] = _;
+ }
+ }
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
+ done = true;
+};
+
+function __runInitializers(thisArg, initializers, value) {
+ var useValue = arguments.length > 2;
+ for (var i = 0; i < initializers.length; i++) {
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
+ }
+ return useValue ? value : void 0;
+};
+
+function __propKey(x) {
+ return typeof x === "symbol" ? x : "".concat(x);
+};
+
+function __setFunctionName(f, name, prefix) {
+ if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
+};
+
+function __metadata(metadataKey, metadataValue) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
+}
+
+function __awaiter(thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+}
+
+function __generator(thisArg, body) {
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
+ function verb(n) { return function (v) { return step([n, v]); }; }
+ function step(op) {
+ if (f) throw new TypeError("Generator is already executing.");
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
+ if (y = 0, t) op = [op[0] & 2, t.value];
+ switch (op[0]) {
+ case 0: case 1: t = op; break;
+ case 4: _.label++; return { value: op[1], done: false };
+ case 5: _.label++; y = op[1]; op = [0]; continue;
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
+ default:
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
+ if (t[2]) _.ops.pop();
+ _.trys.pop(); continue;
+ }
+ op = body.call(thisArg, _);
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
+ }
+}
+
+var __createBinding = Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() { return m[k]; } };
+ }
+ Object.defineProperty(o, k2, desc);
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+});
+
+function __exportStar(m, o) {
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
+}
+
+function __values(o) {
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
+ if (m) return m.call(o);
+ if (o && typeof o.length === "number") return {
+ next: function () {
+ if (o && i >= o.length) o = void 0;
+ return { value: o && o[i++], done: !o };
+ }
+ };
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
+}
+
+function __read(o, n) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
+ if (!m) return o;
+ var i = m.call(o), r, ar = [], e;
+ try {
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
+ }
+ catch (error) { e = { error: error }; }
+ finally {
+ try {
+ if (r && !r.done && (m = i["return"])) m.call(i);
+ }
+ finally { if (e) throw e.error; }
+ }
+ return ar;
+}
+
+/** @deprecated */
+function __spread() {
+ for (var ar = [], i = 0; i < arguments.length; i++)
+ ar = ar.concat(__read(arguments[i]));
+ return ar;
+}
+
+/** @deprecated */
+function __spreadArrays() {
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
+ r[k] = a[j];
+ return r;
+}
+
+function __spreadArray(to, from, pack) {
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
+ if (ar || !(i in from)) {
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
+ ar[i] = from[i];
+ }
+ }
+ return to.concat(ar || Array.prototype.slice.call(from));
+}
+
+function __await(v) {
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
+}
+
+function __asyncGenerator(thisArg, _arguments, generator) {
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
+ function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
+ function fulfill(value) { resume("next", value); }
+ function reject(value) { resume("throw", value); }
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
+}
+
+function __asyncDelegator(o) {
+ var i, p;
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
+}
+
+function __asyncValues(o) {
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
+ var m = o[Symbol.asyncIterator], i;
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
+}
+
+function __makeTemplateObject(cooked, raw) {
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
+ return cooked;
+};
+
+var __setModuleDefault = Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+};
+
+function __importStar(mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ __setModuleDefault(result, mod);
+ return result;
+}
+
+function __importDefault(mod) {
+ return (mod && mod.__esModule) ? mod : { default: mod };
+}
+
+function __classPrivateFieldGet(receiver, state, kind, f) {
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
+}
+
+function __classPrivateFieldSet(receiver, state, value, kind, f) {
+ if (kind === "m") throw new TypeError("Private method is not writable");
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
+}
+
+function __classPrivateFieldIn(state, receiver) {
+ if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
+ return typeof state === "function" ? receiver === state : state.has(receiver);
+}
+
+function __addDisposableResource(env, value, async) {
+ if (value !== null && value !== void 0) {
+ if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
+ var dispose;
+ if (async) {
+ if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
+ dispose = value[Symbol.asyncDispose];
+ }
+ if (dispose === void 0) {
+ if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
+ dispose = value[Symbol.dispose];
+ }
+ if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
+ env.stack.push({ value: value, dispose: dispose, async: async });
+ }
+ else if (async) {
+ env.stack.push({ async: true });
+ }
+ return value;
+}
+
+var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
+ var e = new Error(message);
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
+};
+
+function __disposeResources(env) {
+ function fail(e) {
+ env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
+ env.hasError = true;
+ }
+ function next() {
+ while (env.stack.length) {
+ var rec = env.stack.pop();
+ try {
+ var result = rec.dispose && rec.dispose.call(rec.value);
+ if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
+ }
+ catch (e) {
+ fail(e);
+ }
+ }
+ if (env.hasError) throw env.error;
+ }
+ return next();
+}
+
+/* harmony default export */ const tslib_es6 = ({
+ __extends,
+ __assign,
+ __rest,
+ __decorate,
+ __param,
+ __metadata,
+ __awaiter,
+ __generator,
+ __createBinding,
+ __exportStar,
+ __values,
+ __read,
+ __spread,
+ __spreadArrays,
+ __spreadArray,
+ __await,
+ __asyncGenerator,
+ __asyncDelegator,
+ __asyncValues,
+ __makeTemplateObject,
+ __importStar,
+ __importDefault,
+ __classPrivateFieldGet,
+ __classPrivateFieldSet,
+ __classPrivateFieldIn,
+ __addDisposableResource,
+ __disposeResources,
+});
+
+;// CONCATENATED MODULE: ./node_modules/lower-case/dist.es2015/index.js
+/**
+ * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
+ */
+var SUPPORTED_LOCALE = {
+ tr: {
+ regexp: /\u0130|\u0049|\u0049\u0307/g,
+ map: {
+ İ: "\u0069",
+ I: "\u0131",
+ İ: "\u0069",
+ },
+ },
+ az: {
+ regexp: /\u0130/g,
+ map: {
+ İ: "\u0069",
+ I: "\u0131",
+ İ: "\u0069",
+ },
+ },
+ lt: {
+ regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g,
+ map: {
+ I: "\u0069\u0307",
+ J: "\u006A\u0307",
+ Į: "\u012F\u0307",
+ Ì: "\u0069\u0307\u0300",
+ Í: "\u0069\u0307\u0301",
+ Ĩ: "\u0069\u0307\u0303",
+ },
+ },
+};
+/**
+ * Localized lower case.
+ */
+function localeLowerCase(str, locale) {
+ var lang = SUPPORTED_LOCALE[locale.toLowerCase()];
+ if (lang)
+ return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; }));
+ return lowerCase(str);
+}
+/**
+ * Lower case as a function.
+ */
+function lowerCase(str) {
+ return str.toLowerCase();
+}
+
+;// CONCATENATED MODULE: ./node_modules/no-case/dist.es2015/index.js
+
+// Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case").
+var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
+// Remove all non-word characters.
+var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
+/**
+ * Normalize the string into something other libraries can manipulate easier.
+ */
+function noCase(input, options) {
+ if (options === void 0) { options = {}; }
+ var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d;
+ var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
+ var start = 0;
+ var end = result.length;
+ // Trim the delimiter from around the output string.
+ while (result.charAt(start) === "\0")
+ start++;
+ while (result.charAt(end - 1) === "\0")
+ end--;
+ // Transform each token independently.
+ return result.slice(start, end).split("\0").map(transform).join(delimiter);
+}
+/**
+ * Replace `re` in the input string with the replacement value.
+ */
+function replace(input, re, value) {
+ if (re instanceof RegExp)
+ return input.replace(re, value);
+ return re.reduce(function (input, re) { return input.replace(re, value); }, input);
+}
+
+;// CONCATENATED MODULE: ./node_modules/dot-case/dist.es2015/index.js
+
+
+function dotCase(input, options) {
+ if (options === void 0) { options = {}; }
+ return noCase(input, __assign({ delimiter: "." }, options));
+}
+
+;// CONCATENATED MODULE: ./node_modules/param-case/dist.es2015/index.js
+
+
+function paramCase(input, options) {
+ if (options === void 0) { options = {}; }
+ return dotCase(input, __assign({ delimiter: "-" }, options));
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/create-template-part-modal/utils.js
+/**
+ * External dependencies
+ */
+
+
+/**
+ * WordPress dependencies
+ */
+
+
+
+/**
+ * Internal dependencies
+ */
+
+const useExistingTemplateParts = () => {
+ return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', TEMPLATE_PART_POST_TYPE, {
+ per_page: -1
+ }), []);
+};
+
+/**
+ * Return a unique template part title based on
+ * the given title and existing template parts.
+ *
+ * @param {string} title The original template part title.
+ * @param {Object} templateParts The array of template part entities.
+ * @return {string} A unique template part title.
+ */
+const getUniqueTemplatePartTitle = (title, templateParts) => {
+ const lowercaseTitle = title.toLowerCase();
+ const existingTitles = templateParts.map(templatePart => templatePart.title.rendered.toLowerCase());
+ if (!existingTitles.includes(lowercaseTitle)) {
+ return title;
+ }
+ let suffix = 2;
+ while (existingTitles.includes(`${lowercaseTitle} ${suffix}`)) {
+ suffix++;
+ }
+ return `${title} ${suffix}`;
+};
+
+/**
+ * Get a valid slug for a template part.
+ * Currently template parts only allow latin chars.
+ * The fallback slug will receive suffix by default.
+ *
+ * @param {string} title The template part title.
+ * @return {string} A valid template part slug.
+ */
+const getCleanTemplatePartSlug = title => {
+ return paramCase(title).replace(/[^\w-]+/g, '') || 'wp-custom-part';
+};
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/create-template-part-modal/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+function CreateTemplatePartModal({
+ modalTitle,
+ ...restProps
+}) {
+ const defaultModalTitle = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostType(TEMPLATE_PART_POST_TYPE)?.labels?.add_new_item, []);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, {
+ title: modalTitle || defaultModalTitle,
+ onRequestClose: restProps.closeModal,
+ overlayClassName: "editor-create-template-part-modal",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateTemplatePartModalContents, {
+ ...restProps
+ })
+ });
+}
+function CreateTemplatePartModalContents({
+ defaultArea = TEMPLATE_PART_AREA_DEFAULT_CATEGORY,
+ blocks = [],
+ confirmLabel = (0,external_wp_i18n_namespaceObject.__)('Add'),
+ closeModal,
+ onCreate,
+ onError,
+ defaultTitle = ''
+}) {
+ const {
+ createErrorNotice
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
+ const {
+ saveEntityRecord
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
+ const existingTemplateParts = useExistingTemplateParts();
+ const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(defaultTitle);
+ const [area, setArea] = (0,external_wp_element_namespaceObject.useState)(defaultArea);
+ const [isSubmitting, setIsSubmitting] = (0,external_wp_element_namespaceObject.useState)(false);
+ const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(CreateTemplatePartModal);
+ const templatePartAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).__experimentalGetDefaultTemplatePartAreas(), []);
+ async function createTemplatePart() {
+ if (!title || isSubmitting) {
+ return;
+ }
+ try {
+ setIsSubmitting(true);
+ const uniqueTitle = getUniqueTemplatePartTitle(title, existingTemplateParts);
+ const cleanSlug = getCleanTemplatePartSlug(uniqueTitle);
+ const templatePart = await saveEntityRecord('postType', TEMPLATE_PART_POST_TYPE, {
+ slug: cleanSlug,
+ title: uniqueTitle,
+ content: (0,external_wp_blocks_namespaceObject.serialize)(blocks),
+ area
+ }, {
+ throwOnError: true
+ });
+ await onCreate(templatePart);
+
+ // TODO: Add a success notice?
+ } catch (error) {
+ const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the template part.');
+ createErrorNotice(errorMessage, {
+ type: 'snackbar'
+ });
+ onError?.();
+ } finally {
+ setIsSubmitting(false);
+ }
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", {
+ onSubmit: async event => {
+ event.preventDefault();
+ await createTemplatePart();
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: "4",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, {
+ __next40pxDefaultSize: true,
+ __nextHasNoMarginBottom: true,
+ label: (0,external_wp_i18n_namespaceObject.__)('Name'),
+ value: title,
+ onChange: setTitle,
+ required: true
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Area'),
+ id: `editor-create-template-part-modal__area-selection-${instanceId}`,
+ className: "editor-create-template-part-modal__area-base-control",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalRadioGroup, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Area'),
+ className: "editor-create-template-part-modal__area-radio-group",
+ id: `editor-create-template-part-modal__area-selection-${instanceId}`,
+ onChange: setArea,
+ checked: area,
+ children: templatePartAreas.map(({
+ icon,
+ label,
+ area: value,
+ description
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalRadio, {
+ value: value,
+ className: "editor-create-template-part-modal__area-radio",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, {
+ align: "start",
+ justify: "start",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, {
+ icon: icon
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexBlock, {
+ className: "editor-create-template-part-modal__option-label",
+ children: [label, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ children: description
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ className: "editor-create-template-part-modal__checkbox",
+ children: area === value && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, {
+ icon: library_check
+ })
+ })]
+ })
+ }, label))
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "right",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ __next40pxDefaultSize: true,
+ variant: "tertiary",
+ onClick: () => {
+ closeModal();
+ },
+ children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ __next40pxDefaultSize: true,
+ variant: "primary",
+ type: "submit",
+ "aria-disabled": !title || isSubmitting,
+ isBusy: isSubmitting,
+ children: confirmLabel
+ })]
+ })]
+ })
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/next.js
+/**
+ * WordPress dependencies
+ */
+
+
+const next = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z"
+ })
+});
+/* harmony default export */ const library_next = (next);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/previous.js
+/**
+ * WordPress dependencies
+ */
+
+
+const previous = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M11.6 7l-1.1-1L5 12l5.5 6 1.1-1L7 12l4.6-5zm6 0l-1.1-1-5.5 6 5.5 6 1.1-1-4.6-5 4.6-5z"
+ })
+});
+/* harmony default export */ const library_previous = (previous);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/collapsible-block-toolbar/index.js
+/**
+ * External dependencies
+ */
+
+
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+const {
+ useHasBlockToolbar
+} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
+function CollapsableBlockToolbar({
+ isCollapsed,
+ onToggle
+}) {
+ const {
+ blockSelectionStart
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ return {
+ blockSelectionStart: select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart()
+ };
+ }, []);
+ const hasBlockToolbar = useHasBlockToolbar();
+ const hasBlockSelection = !!blockSelectionStart;
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
+ // If we have a new block selection, show the block tools
+ if (blockSelectionStart) {
+ onToggle(false);
+ }
+ }, [blockSelectionStart, onToggle]);
+ if (!hasBlockToolbar) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: dist_clsx('editor-collapsible-block-toolbar', {
+ 'is-collapsed': isCollapsed || !hasBlockSelection
+ }),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockToolbar, {
+ hideDragHandle: true
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover.Slot, {
+ name: "block-toolbar"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ className: "editor-collapsible-block-toolbar__toggle",
+ icon: isCollapsed ? library_next : library_previous,
+ onClick: () => {
+ onToggle(!isCollapsed);
+ },
+ label: isCollapsed ? (0,external_wp_i18n_namespaceObject.__)('Show block tools') : (0,external_wp_i18n_namespaceObject.__)('Hide block tools'),
+ size: "compact"
+ })]
+ });
+}
+/* harmony default export */ const collapsible_block_toolbar = (CollapsableBlockToolbar);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js
+/**
+ * WordPress dependencies
+ */
+
+
+const plus = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"
+ })
+});
+/* harmony default export */ const library_plus = (plus);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-tools/index.js
+/**
+ * External dependencies
+ */
+
+
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+
+
+function DocumentTools({
+ className,
+ disableBlockTools = false
+}) {
+ const {
+ setIsInserterOpened,
+ setIsListViewOpened
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
+ const {
+ isDistractionFree,
+ isInserterOpened,
+ isListViewOpen,
+ listViewShortcut,
+ inserterSidebarToggleRef,
+ listViewToggleRef,
+ hasFixedToolbar,
+ showIconLabels
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getSettings
+ } = select(external_wp_blockEditor_namespaceObject.store);
+ const {
+ get
+ } = select(external_wp_preferences_namespaceObject.store);
+ const {
+ isListViewOpened,
+ getEditorMode,
+ getInserterSidebarToggleRef,
+ getListViewToggleRef
+ } = unlock(select(store_store));
+ const {
+ getShortcutRepresentation
+ } = select(external_wp_keyboardShortcuts_namespaceObject.store);
+ const {
+ __unstableGetEditorMode
+ } = select(external_wp_blockEditor_namespaceObject.store);
+ return {
+ isInserterOpened: select(store_store).isInserterOpened(),
+ isListViewOpen: isListViewOpened(),
+ listViewShortcut: getShortcutRepresentation('core/editor/toggle-list-view'),
+ inserterSidebarToggleRef: getInserterSidebarToggleRef(),
+ listViewToggleRef: getListViewToggleRef(),
+ hasFixedToolbar: getSettings().hasFixedToolbar,
+ showIconLabels: get('core', 'showIconLabels'),
+ isDistractionFree: get('core', 'distractionFree'),
+ isVisualMode: getEditorMode() === 'visual',
+ isZoomedOutView: __unstableGetEditorMode() === 'zoom-out'
+ };
+ }, []);
+ const preventDefault = event => {
+ // Because the inserter behaves like a dialog,
+ // if the inserter is opened already then when we click on the toggle button
+ // then the initial click event will close the inserter and then be propagated
+ // to the inserter toggle and it will open it again.
+ // To prevent this we need to stop the propagation of the event.
+ // This won't be necessary when the inserter no longer behaves like a dialog.
+
+ if (isInserterOpened) {
+ event.preventDefault();
+ }
+ };
+ const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
+ const isWideViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('wide');
+
+ /* translators: accessibility text for the editor toolbar */
+ const toolbarAriaLabel = (0,external_wp_i18n_namespaceObject.__)('Document tools');
+ const toggleListView = (0,external_wp_element_namespaceObject.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]);
+ const toggleInserter = (0,external_wp_element_namespaceObject.useCallback)(() => setIsInserterOpened(!isInserterOpened), [isInserterOpened, setIsInserterOpened]);
+
+ /* translators: button label text should, if possible, be under 16 characters. */
+ const longLabel = (0,external_wp_i18n_namespaceObject._x)('Toggle block inserter', 'Generic label for block inserter button');
+ const shortLabel = !isInserterOpened ? (0,external_wp_i18n_namespaceObject.__)('Add') : (0,external_wp_i18n_namespaceObject.__)('Close');
+ return (
+ /*#__PURE__*/
+ // Some plugins expect and use the `edit-post-header-toolbar` CSS class to
+ // find the toolbar and inject UI elements into it. This is not officially
+ // supported, but we're keeping it in the list of class names for backwards
+ // compatibility.
+ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.NavigableToolbar, {
+ className: dist_clsx('editor-document-tools', 'edit-post-header-toolbar', className),
+ "aria-label": toolbarAriaLabel,
+ variant: "unstyled",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "editor-document-tools__left",
+ children: [!isDistractionFree && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, {
+ ref: inserterSidebarToggleRef,
+ as: external_wp_components_namespaceObject.Button,
+ className: "editor-document-tools__inserter-toggle",
+ variant: "primary",
+ isPressed: isInserterOpened,
+ onMouseDown: preventDefault,
+ onClick: toggleInserter,
+ disabled: disableBlockTools,
+ icon: library_plus,
+ label: showIconLabels ? shortLabel : longLabel,
+ showTooltip: !showIconLabels,
+ "aria-expanded": isInserterOpened
+ }), (isWideViewport || !showIconLabels) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [isLargeViewport && !hasFixedToolbar && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, {
+ as: external_wp_blockEditor_namespaceObject.ToolSelector,
+ showTooltip: !showIconLabels,
+ variant: showIconLabels ? 'tertiary' : undefined,
+ disabled: disableBlockTools,
+ size: "compact"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, {
+ as: editor_history_undo,
+ showTooltip: !showIconLabels,
+ variant: showIconLabels ? 'tertiary' : undefined,
+ size: "compact"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, {
+ as: editor_history_redo,
+ showTooltip: !showIconLabels,
+ variant: showIconLabels ? 'tertiary' : undefined,
+ size: "compact"
+ }), !isDistractionFree && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, {
+ as: external_wp_components_namespaceObject.Button,
+ className: "editor-document-tools__document-overview-toggle",
+ icon: list_view,
+ disabled: disableBlockTools,
+ isPressed: isListViewOpen
+ /* translators: button label text should, if possible, be under 16 characters. */,
+ label: (0,external_wp_i18n_namespaceObject.__)('Document Overview'),
+ onClick: toggleListView,
+ shortcut: listViewShortcut,
+ showTooltip: !showIconLabels,
+ variant: showIconLabels ? 'tertiary' : undefined,
+ "aria-expanded": isListViewOpen,
+ ref: listViewToggleRef,
+ size: "compact"
+ })]
+ })]
+ })
+ })
+ );
+}
+/* harmony default export */ const document_tools = (DocumentTools);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js
+/**
+ * WordPress dependencies
+ */
+
+
+const moreVertical = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"
+ })
+});
+/* harmony default export */ const more_vertical = (moreVertical);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/more-menu/copy-content-menu-item.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+function CopyContentMenuItem() {
+ const {
+ createNotice
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
+ const {
+ getCurrentPostId,
+ getCurrentPostType
+ } = (0,external_wp_data_namespaceObject.useSelect)(store_store);
+ const {
+ getEditedEntityRecord
+ } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store);
+ function getText() {
+ const record = getEditedEntityRecord('postType', getCurrentPostType(), getCurrentPostId());
+ if (!record) {
+ return '';
+ }
+ if (typeof record.content === 'function') {
+ return record.content(record);
+ } else if (record.blocks) {
+ return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(record.blocks);
+ } else if (record.content) {
+ return record.content;
+ }
+ }
+ function onSuccess() {
+ createNotice('info', (0,external_wp_i18n_namespaceObject.__)('All content copied.'), {
+ isDismissible: true,
+ type: 'snackbar'
+ });
+ }
+ const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(getText, onSuccess);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ ref: ref,
+ children: (0,external_wp_i18n_namespaceObject.__)('Copy all blocks')
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/mode-switcher/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+/**
+ * Set of available mode options.
+ *
+ * @type {Array}
+ */
+
+const MODES = [{
+ value: 'visual',
+ label: (0,external_wp_i18n_namespaceObject.__)('Visual editor')
+}, {
+ value: 'text',
+ label: (0,external_wp_i18n_namespaceObject.__)('Code editor')
+}];
+function ModeSwitcher() {
+ const {
+ shortcut,
+ isRichEditingEnabled,
+ isCodeEditingEnabled,
+ mode
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
+ shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/editor/toggle-mode'),
+ isRichEditingEnabled: select(store_store).getEditorSettings().richEditingEnabled,
+ isCodeEditingEnabled: select(store_store).getEditorSettings().codeEditingEnabled,
+ mode: select(store_store).getEditorMode()
+ }), []);
+ const {
+ switchEditorMode
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
+ let selectedMode = mode;
+ if (!isRichEditingEnabled && mode === 'visual') {
+ selectedMode = 'text';
+ }
+ if (!isCodeEditingEnabled && mode === 'text') {
+ selectedMode = 'visual';
+ }
+ const choices = MODES.map(choice => {
+ if (!isCodeEditingEnabled && choice.value === 'text') {
+ choice = {
+ ...choice,
+ disabled: true
+ };
+ }
+ if (!isRichEditingEnabled && choice.value === 'visual') {
+ choice = {
+ ...choice,
+ disabled: true,
+ info: (0,external_wp_i18n_namespaceObject.__)('You can enable the visual editor in your profile settings.')
+ };
+ }
+ if (choice.value !== selectedMode && !choice.disabled) {
+ return {
+ ...choice,
+ shortcut
+ };
+ }
+ return choice;
+ });
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Editor'),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItemsChoice, {
+ choices: choices,
+ value: selectedMode,
+ onSelect: switchEditorMode
+ })
+ });
+}
+/* harmony default export */ const mode_switcher = (ModeSwitcher);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/more-menu/tools-more-menu-group.js
+/**
+ * WordPress dependencies
+ */
+
+
+const {
+ Fill: ToolsMoreMenuGroup,
+ Slot: tools_more_menu_group_Slot
+} = (0,external_wp_components_namespaceObject.createSlotFill)('ToolsMoreMenuGroup');
+ToolsMoreMenuGroup.Slot = ({
+ fillProps
+}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tools_more_menu_group_Slot, {
+ fillProps: fillProps
+});
+/* harmony default export */ const tools_more_menu_group = (ToolsMoreMenuGroup);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/more-menu/view-more-menu-group.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+const {
+ Fill: ViewMoreMenuGroup,
+ Slot: view_more_menu_group_Slot
+} = (0,external_wp_components_namespaceObject.createSlotFill)(external_wp_element_namespaceObject.Platform.OS === 'web' ? Symbol('ViewMoreMenuGroup') : 'ViewMoreMenuGroup');
+ViewMoreMenuGroup.Slot = ({
+ fillProps
+}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_more_menu_group_Slot, {
+ fillProps: fillProps
+});
+/* harmony default export */ const view_more_menu_group = (ViewMoreMenuGroup);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/more-menu/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+
+
+
+function MoreMenu() {
+ const {
+ openModal
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
+ const {
+ set: setPreference
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
+ const {
+ toggleDistractionFree
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
+ const showIconLabels = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_preferences_namespaceObject.store).get('core', 'showIconLabels'), []);
+ const turnOffDistractionFree = () => {
+ setPreference('core', 'distractionFree', false);
+ };
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, {
+ icon: more_vertical,
+ label: (0,external_wp_i18n_namespaceObject.__)('Options'),
+ popoverProps: {
+ placement: 'bottom-end',
+ className: 'more-menu-dropdown__content'
+ },
+ toggleProps: {
+ showTooltip: !showIconLabels,
+ ...(showIconLabels && {
+ variant: 'tertiary'
+ }),
+ tooltipPosition: 'bottom',
+ size: 'compact'
+ },
+ children: ({
+ onClose
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, {
+ label: (0,external_wp_i18n_namespaceObject._x)('View', 'noun'),
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
+ scope: "core",
+ name: "fixedToolbar",
+ onToggle: turnOffDistractionFree,
+ label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar'),
+ info: (0,external_wp_i18n_namespaceObject.__)('Access all block and document tools in a single place'),
+ messageActivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar activated'),
+ messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar deactivated')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
+ scope: "core",
+ name: "distractionFree",
+ label: (0,external_wp_i18n_namespaceObject.__)('Distraction free'),
+ info: (0,external_wp_i18n_namespaceObject.__)('Write with calmness'),
+ handleToggling: false,
+ onToggle: toggleDistractionFree,
+ messageActivated: (0,external_wp_i18n_namespaceObject.__)('Distraction free mode activated'),
+ messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Distraction free mode deactivated'),
+ shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('\\')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
+ scope: "core",
+ name: "focusMode",
+ label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode'),
+ info: (0,external_wp_i18n_namespaceObject.__)('Focus on one block at a time'),
+ messageActivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode activated'),
+ messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode deactivated')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_more_menu_group.Slot, {
+ fillProps: {
+ onClose
+ }
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(mode_switcher, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(action_item.Slot, {
+ name: "core/plugin-more-menu",
+ label: (0,external_wp_i18n_namespaceObject.__)('Plugins'),
+ as: external_wp_components_namespaceObject.MenuGroup,
+ fillProps: {
+ onClick: onClose
+ }
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Tools'),
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ onClick: () => openModal('editor/keyboard-shortcut-help'),
+ shortcut: external_wp_keycodes_namespaceObject.displayShortcut.access('h'),
+ children: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyContentMenuItem, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuItem, {
+ icon: library_external,
+ href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/wordpress-block-editor/'),
+ target: "_blank",
+ rel: "noopener noreferrer",
+ children: [(0,external_wp_i18n_namespaceObject.__)('Help'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, {
+ as: "span",
+ children: /* translators: accessibility text */
+ (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)')
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tools_more_menu_group.Slot, {
+ fillProps: {
+ onClose
+ }
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ onClick: () => openModal('editor/preferences'),
+ children: (0,external_wp_i18n_namespaceObject.__)('Preferences')
+ })
+ })]
+ })
+ })
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-button/post-publish-button-or-toggle.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+function PostPublishButtonOrToggle({
+ forceIsDirty,
+ hasPublishAction,
+ isBeingScheduled,
+ isPending,
+ isPublished,
+ isPublishSidebarEnabled,
+ isPublishSidebarOpened,
+ isScheduled,
+ togglePublishSidebar,
+ setEntitiesSavedStatesCallback,
+ postStatusHasChanged,
+ postStatus
+}) {
+ const IS_TOGGLE = 'toggle';
+ const IS_BUTTON = 'button';
+ const isSmallerThanMediumViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
+ let component;
+
+ /**
+ * Conditions to show a BUTTON (publish directly) or a TOGGLE (open publish sidebar):
+ *
+ * 1) We want to show a BUTTON when the post status is at the _final stage_
+ * for a particular role (see https://wordpress.org/documentation/article/post-status/):
+ *
+ * - is published
+ * - post status has changed explicitely to something different than 'future' or 'publish'
+ * - is scheduled to be published
+ * - is pending and can't be published (but only for viewports >= medium).
+ * Originally, we considered showing a button for pending posts that couldn't be published
+ * (for example, for an author with the contributor role). Some languages can have
+ * long translations for "Submit for review", so given the lack of UI real estate available
+ * we decided to take into account the viewport in that case.
+ * See: https://github.com/WordPress/gutenberg/issues/10475
+ *
+ * 2) Then, in small viewports, we'll show a TOGGLE.
+ *
+ * 3) Finally, we'll use the publish sidebar status to decide:
+ *
+ * - if it is enabled, we show a TOGGLE
+ * - if it is disabled, we show a BUTTON
+ */
+ if (isPublished || postStatusHasChanged && !['future', 'publish'].includes(postStatus) || isScheduled && isBeingScheduled || isPending && !hasPublishAction && !isSmallerThanMediumViewport) {
+ component = IS_BUTTON;
+ } else if (isSmallerThanMediumViewport || isPublishSidebarEnabled) {
+ component = IS_TOGGLE;
+ } else {
+ component = IS_BUTTON;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_publish_button, {
+ forceIsDirty: forceIsDirty,
+ isOpen: isPublishSidebarOpened,
+ isToggle: component === IS_TOGGLE,
+ onToggle: togglePublishSidebar,
+ setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
+ });
+}
+/* harmony default export */ const post_publish_button_or_toggle = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => {
+ var _select$getCurrentPos;
+ return {
+ hasPublishAction: (_select$getCurrentPos = select(store_store).getCurrentPost()?._links?.['wp:action-publish']) !== null && _select$getCurrentPos !== void 0 ? _select$getCurrentPos : false,
+ isBeingScheduled: select(store_store).isEditedPostBeingScheduled(),
+ isPending: select(store_store).isCurrentPostPending(),
+ isPublished: select(store_store).isCurrentPostPublished(),
+ isPublishSidebarEnabled: select(store_store).isPublishSidebarEnabled(),
+ isPublishSidebarOpened: select(store_store).isPublishSidebarOpened(),
+ isScheduled: select(store_store).isCurrentPostScheduled(),
+ postStatus: select(store_store).getEditedPostAttribute('status'),
+ postStatusHasChanged: select(store_store).getPostEdits()?.status
+ };
+}), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
+ const {
+ togglePublishSidebar
+ } = dispatch(store_store);
+ return {
+ togglePublishSidebar
+ };
+}))(PostPublishButtonOrToggle));
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-view-link/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+function PostViewLink() {
+ const {
+ hasLoaded,
+ permalink,
+ isPublished,
+ label,
+ showIconLabels
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ // Grab post type to retrieve the view_item label.
+ const postTypeSlug = select(store_store).getCurrentPostType();
+ const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug);
+ const {
+ get
+ } = select(external_wp_preferences_namespaceObject.store);
+ return {
+ permalink: select(store_store).getPermalink(),
+ isPublished: select(store_store).isCurrentPostPublished(),
+ label: postType?.labels.view_item,
+ hasLoaded: !!postType,
+ showIconLabels: get('core', 'showIconLabels')
+ };
+ }, []);
+
+ // Only render the view button if the post is published and has a permalink.
+ if (!isPublished || !permalink || !hasLoaded) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ icon: library_external,
+ label: label || (0,external_wp_i18n_namespaceObject.__)('View post'),
+ href: permalink,
+ target: "_blank",
+ showTooltip: !showIconLabels,
+ size: "compact"
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/mobile.js
+/**
+ * WordPress dependencies
+ */
+
+
+const mobile = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M15 4H9c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h6c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H9c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h6c.3 0 .5.2.5.5v12zm-4.5-.5h2V16h-2v1.5z"
+ })
+});
+/* harmony default export */ const library_mobile = (mobile);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/tablet.js
+/**
+ * WordPress dependencies
+ */
+
+
+const tablet = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M17 4H7c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H7c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h10c.3 0 .5.2.5.5v12zm-7.5-.5h4V16h-4v1.5z"
+ })
+});
+/* harmony default export */ const library_tablet = (tablet);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/desktop.js
+/**
+ * WordPress dependencies
+ */
+
+
+const desktop = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M20.5 16h-.7V8c0-1.1-.9-2-2-2H6.2c-1.1 0-2 .9-2 2v8h-.7c-.8 0-1.5.7-1.5 1.5h20c0-.8-.7-1.5-1.5-1.5zM5.7 8c0-.3.2-.5.5-.5h11.6c.3 0 .5.2.5.5v7.6H5.7V8z"
+ })
+});
+/* harmony default export */ const library_desktop = (desktop);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/preview-dropdown/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+function PreviewDropdown({
+ forceIsAutosaveable,
+ disabled
+}) {
+ const {
+ deviceType,
+ homeUrl,
+ isTemplate,
+ isViewable,
+ showIconLabels
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ var _getPostType$viewable;
+ const {
+ getDeviceType,
+ getCurrentPostType
+ } = select(store_store);
+ const {
+ getUnstableBase,
+ getPostType
+ } = select(external_wp_coreData_namespaceObject.store);
+ const {
+ get
+ } = select(external_wp_preferences_namespaceObject.store);
+ const _currentPostType = getCurrentPostType();
+ return {
+ deviceType: getDeviceType(),
+ homeUrl: getUnstableBase()?.home,
+ isTemplate: _currentPostType === 'wp_template',
+ isViewable: (_getPostType$viewable = getPostType(_currentPostType)?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false,
+ showIconLabels: get('core', 'showIconLabels')
+ };
+ }, []);
+ const {
+ setDeviceType
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
+ const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
+ if (isMobile) {
+ return null;
+ }
+ const popoverProps = {
+ placement: 'bottom-end'
+ };
+ const toggleProps = {
+ className: 'editor-preview-dropdown__toggle',
+ size: 'compact',
+ showTooltip: !showIconLabels,
+ disabled,
+ __experimentalIsFocusable: disabled
+ };
+ const menuProps = {
+ 'aria-label': (0,external_wp_i18n_namespaceObject.__)('View options')
+ };
+ const deviceIcons = {
+ mobile: library_mobile,
+ tablet: library_tablet,
+ desktop: library_desktop
+ };
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, {
+ className: "editor-preview-dropdown",
+ popoverProps: popoverProps,
+ toggleProps: toggleProps,
+ menuProps: menuProps,
+ icon: deviceIcons[deviceType.toLowerCase()],
+ label: (0,external_wp_i18n_namespaceObject.__)('View'),
+ disableOpenOnArrowDown: disabled,
+ children: ({
+ onClose
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ onClick: () => setDeviceType('Desktop'),
+ icon: deviceType === 'Desktop' && library_check,
+ children: (0,external_wp_i18n_namespaceObject.__)('Desktop')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ onClick: () => setDeviceType('Tablet'),
+ icon: deviceType === 'Tablet' && library_check,
+ children: (0,external_wp_i18n_namespaceObject.__)('Tablet')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ onClick: () => setDeviceType('Mobile'),
+ icon: deviceType === 'Mobile' && library_check,
+ children: (0,external_wp_i18n_namespaceObject.__)('Mobile')
+ })]
+ }), isTemplate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuItem, {
+ href: homeUrl,
+ target: "_blank",
+ icon: library_external,
+ onClick: onClose,
+ children: [(0,external_wp_i18n_namespaceObject.__)('View site'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, {
+ as: "span",
+ children: /* translators: accessibility text */
+ (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)')
+ })]
+ })
+ }), isViewable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostPreviewButton, {
+ className: "editor-preview-dropdown__button-external",
+ role: "menuitem",
+ forceIsAutosaveable: forceIsAutosaveable,
+ textContent: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [(0,external_wp_i18n_namespaceObject.__)('Preview in new tab'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, {
+ icon: library_external
+ })]
+ }),
+ onPreview: onClose
+ })
+ })]
+ })
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/header/index.js
+/**
+ * External dependencies
+ */
+
+
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+
+
+
+
+
+
+
+
+const toolbarVariations = {
+ distractionFreeDisabled: {
+ y: '-50px'
+ },
+ distractionFreeHover: {
+ y: 0
+ },
+ distractionFreeHidden: {
+ y: '-50px'
+ },
+ visible: {
+ y: 0
+ },
+ hidden: {
+ y: 0
+ }
+};
+const backButtonVariations = {
+ distractionFreeDisabled: {
+ x: '-100%'
+ },
+ distractionFreeHover: {
+ x: 0
+ },
+ distractionFreeHidden: {
+ x: '-100%'
+ },
+ visible: {
+ x: 0
+ },
+ hidden: {
+ x: 0
+ }
+};
+function Header({
+ customSaveButton,
+ forceIsDirty,
+ forceDisableBlockTools,
+ setEntitiesSavedStatesCallback,
+ title
+}) {
+ const isWideViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('large');
+ const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
+ const {
+ isTextEditor,
+ isPublishSidebarOpened,
+ showIconLabels,
+ hasFixedToolbar,
+ isNestedEntity,
+ isZoomedOutView
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ get: getPreference
+ } = select(external_wp_preferences_namespaceObject.store);
+ const {
+ getEditorMode,
+ getEditorSettings,
+ isPublishSidebarOpened: _isPublishSidebarOpened
+ } = select(store_store);
+ const {
+ __unstableGetEditorMode
+ } = select(external_wp_blockEditor_namespaceObject.store);
+ return {
+ isTextEditor: getEditorMode() === 'text',
+ isPublishSidebarOpened: _isPublishSidebarOpened(),
+ showIconLabels: getPreference('core', 'showIconLabels'),
+ hasFixedToolbar: getPreference('core', 'fixedToolbar'),
+ isNestedEntity: !!getEditorSettings().onNavigateToPreviousEntityRecord,
+ isZoomedOutView: __unstableGetEditorMode() === 'zoom-out'
+ };
+ }, []);
+ const hasTopToolbar = isLargeViewport && hasFixedToolbar;
+ const [isBlockToolsCollapsed, setIsBlockToolsCollapsed] = (0,external_wp_element_namespaceObject.useState)(true);
+
+ // The edit-post-header classname is only kept for backward compatibilty
+ // as some plugins might be relying on its presence.
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "editor-header edit-post-header",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, {
+ variants: backButtonVariations,
+ transition: {
+ type: 'tween'
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(back_button.Slot, {})
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, {
+ variants: toolbarVariations,
+ className: "editor-header__toolbar",
+ transition: {
+ type: 'tween'
+ },
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(document_tools, {
+ disableBlockTools: forceDisableBlockTools || isTextEditor
+ }), hasTopToolbar && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(collapsible_block_toolbar, {
+ isCollapsed: isBlockToolsCollapsed,
+ onToggle: setIsBlockToolsCollapsed
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: dist_clsx('editor-header__center', {
+ 'is-collapsed': !isBlockToolsCollapsed && hasTopToolbar
+ }),
+ children: !title ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DocumentBar, {}) : title
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, {
+ variants: toolbarVariations,
+ transition: {
+ type: 'tween'
+ },
+ className: "editor-header__settings",
+ children: [!customSaveButton && !isPublishSidebarOpened &&
+ /*#__PURE__*/
+ // This button isn't completely hidden by the publish sidebar.
+ // We can't hide the whole toolbar when the publish sidebar is open because
+ // we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.
+ // We track that DOM node to return focus to the PostPublishButtonOrToggle
+ // when the publish sidebar has been closed.
+ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSavedState, {
+ forceIsDirty: forceIsDirty
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewDropdown, {
+ forceIsAutosaveable: forceIsDirty,
+ disabled: isNestedEntity || isZoomedOutView
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostPreviewButton, {
+ className: "editor-header__post-preview-button",
+ forceIsAutosaveable: forceIsDirty
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostViewLink, {}), !customSaveButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_publish_button_or_toggle, {
+ forceIsDirty: forceIsDirty,
+ setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
+ }), customSaveButton, (isWideViewport || !showIconLabels) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(pinned_items.Slot, {
+ scope: "core"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MoreMenu, {})]
+ })]
+ });
+}
+/* harmony default export */ const components_header = (Header);
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/inserter-sidebar/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+const {
+ PrivateInserterLibrary
+} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
+function InserterSidebar() {
+ const {
+ blockSectionRootClientId,
+ inserterSidebarToggleRef,
+ insertionPoint,
+ showMostUsedBlocks,
+ sidebarIsOpened
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getInserterSidebarToggleRef,
+ getInsertionPoint,
+ isPublishSidebarOpened
+ } = unlock(select(store_store));
+ const {
+ getBlockRootClientId,
+ __unstableGetEditorMode,
+ getSettings
+ } = select(external_wp_blockEditor_namespaceObject.store);
+ const {
+ get
+ } = select(external_wp_preferences_namespaceObject.store);
+ const {
+ getActiveComplementaryArea
+ } = select(store);
+ const getBlockSectionRootClientId = () => {
+ if (__unstableGetEditorMode() === 'zoom-out') {
+ const {
+ sectionRootClientId
+ } = unlock(getSettings());
+ if (sectionRootClientId) {
+ return sectionRootClientId;
+ }
+ }
+ return getBlockRootClientId();
+ };
+ return {
+ inserterSidebarToggleRef: getInserterSidebarToggleRef(),
+ insertionPoint: getInsertionPoint(),
+ showMostUsedBlocks: get('core', 'mostUsedBlocks'),
+ blockSectionRootClientId: getBlockSectionRootClientId(),
+ sidebarIsOpened: !!(getActiveComplementaryArea('core') || isPublishSidebarOpened())
+ };
+ }, []);
+ const {
+ setIsInserterOpened
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
+ const {
+ disableComplementaryArea
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
+ const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
+ const [inserterDialogRef, inserterDialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({
+ onClose: () => setIsInserterOpened(false),
+ focusOnMount: true
+ });
+ const libraryRef = (0,external_wp_element_namespaceObject.useRef)();
+
+ // When closing the inserter, focus should return to the toggle button.
+ const closeInserterSidebar = (0,external_wp_element_namespaceObject.useCallback)(() => {
+ setIsInserterOpened(false);
+ inserterSidebarToggleRef.current?.focus();
+ }, [inserterSidebarToggleRef, setIsInserterOpened]);
+ const closeOnEscape = (0,external_wp_element_namespaceObject.useCallback)(event => {
+ if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) {
+ event.preventDefault();
+ closeInserterSidebar();
+ }
+ }, [closeInserterSidebar]);
+ const inserterContents = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "editor-inserter-sidebar__content",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateInserterLibrary, {
+ showMostUsedBlocks: showMostUsedBlocks,
+ showInserterHelpPanel: true,
+ shouldFocusBlock: isMobileViewport,
+ rootClientId: blockSectionRootClientId !== null && blockSectionRootClientId !== void 0 ? blockSectionRootClientId : insertionPoint.rootClientId,
+ __experimentalInsertionIndex: insertionPoint.insertionIndex,
+ __experimentalInitialTab: insertionPoint.tab,
+ __experimentalInitialCategory: insertionPoint.category,
+ __experimentalFilterValue: insertionPoint.filterValue,
+ onPatternCategorySelection: sidebarIsOpened ? () => disableComplementaryArea('core') : undefined,
+ ref: libraryRef,
+ onClose: closeInserterSidebar
+ })
+ });
+ if (window.__experimentalEnableZoomedOutPatternsTab) {
+ return (
+ /*#__PURE__*/
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions
+ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ onKeyDown: closeOnEscape,
+ className: "editor-inserter-sidebar",
+ children: inserterContents
+ })
+ );
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ ref: inserterDialogRef,
+ ...inserterDialogProps,
+ className: "editor-inserter-sidebar",
+ children: inserterContents
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/list-view-sidebar/list-view-outline.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+
+
+function ListViewOutline() {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "editor-list-view-sidebar__outline",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ children: (0,external_wp_i18n_namespaceObject.__)('Characters:')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CharacterCount, {})
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ children: (0,external_wp_i18n_namespaceObject.__)('Words:')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WordCount, {})]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ children: (0,external_wp_i18n_namespaceObject.__)('Time to read:')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TimeToRead, {})]
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DocumentOutline, {})]
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/list-view-sidebar/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+const {
+ Tabs
+} = unlock(external_wp_components_namespaceObject.privateApis);
+function ListViewSidebar() {
+ const {
+ setIsListViewOpened
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
+ const {
+ getListViewToggleRef
+ } = unlock((0,external_wp_data_namespaceObject.useSelect)(store_store));
+
+ // This hook handles focus when the sidebar first renders.
+ const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)('firstElement');
+
+ // When closing the list view, focus should return to the toggle button.
+ const closeListView = (0,external_wp_element_namespaceObject.useCallback)(() => {
+ setIsListViewOpened(false);
+ getListViewToggleRef().current?.focus();
+ }, [getListViewToggleRef, setIsListViewOpened]);
+ const closeOnEscape = (0,external_wp_element_namespaceObject.useCallback)(event => {
+ if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) {
+ event.preventDefault();
+ closeListView();
+ }
+ }, [closeListView]);
+
+ // Use internal state instead of a ref to make sure that the component
+ // re-renders when the dropZoneElement updates.
+ const [dropZoneElement, setDropZoneElement] = (0,external_wp_element_namespaceObject.useState)(null);
+ // Tracks our current tab.
+ const [tab, setTab] = (0,external_wp_element_namespaceObject.useState)('list-view');
+
+ // This ref refers to the sidebar as a whole.
+ const sidebarRef = (0,external_wp_element_namespaceObject.useRef)();
+ // This ref refers to the tab panel.
+ const tabsRef = (0,external_wp_element_namespaceObject.useRef)();
+ // This ref refers to the list view application area.
+ const listViewRef = (0,external_wp_element_namespaceObject.useRef)();
+
+ // Must merge the refs together so focus can be handled properly in the next function.
+ const listViewContainerRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([focusOnMountRef, listViewRef, setDropZoneElement]);
+
+ /*
+ * Callback function to handle list view or outline focus.
+ *
+ * @param {string} currentTab The current tab. Either list view or outline.
+ *
+ * @return void
+ */
+ function handleSidebarFocus(currentTab) {
+ // Tab panel focus.
+ const tabPanelFocus = external_wp_dom_namespaceObject.focus.tabbable.find(tabsRef.current)[0];
+ // List view tab is selected.
+ if (currentTab === 'list-view') {
+ // Either focus the list view or the tab panel. Must have a fallback because the list view does not render when there are no blocks.
+ const listViewApplicationFocus = external_wp_dom_namespaceObject.focus.tabbable.find(listViewRef.current)[0];
+ const listViewFocusArea = sidebarRef.current.contains(listViewApplicationFocus) ? listViewApplicationFocus : tabPanelFocus;
+ listViewFocusArea.focus();
+ // Outline tab is selected.
+ } else {
+ tabPanelFocus.focus();
+ }
+ }
+ const handleToggleListViewShortcut = (0,external_wp_element_namespaceObject.useCallback)(() => {
+ // If the sidebar has focus, it is safe to close.
+ if (sidebarRef.current.contains(sidebarRef.current.ownerDocument.activeElement)) {
+ closeListView();
+ } else {
+ // If the list view or outline does not have focus, focus should be moved to it.
+ handleSidebarFocus(tab);
+ }
+ }, [closeListView, tab]);
+
+ // This only fires when the sidebar is open because of the conditional rendering.
+ // It is the same shortcut to open but that is defined as a global shortcut and only fires when the sidebar is closed.
+ (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/toggle-list-view', handleToggleListViewShortcut);
+ return (
+ /*#__PURE__*/
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions
+ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "editor-list-view-sidebar",
+ onKeyDown: closeOnEscape,
+ ref: sidebarRef,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tabs, {
+ onSelect: tabName => setTab(tabName),
+ selectOnMove: false
+ // The initial tab value is set explicitly to avoid an initial
+ // render where no tab is selected. This ensures that the
+ // tabpanel height is correct so the relevant scroll container
+ // can be rendered internally.
+ ,
+ defaultTabId: "list-view",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "editor-list-view-sidebar__header",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ className: "editor-list-view-sidebar__close-button",
+ icon: close_small,
+ label: (0,external_wp_i18n_namespaceObject.__)('Close'),
+ onClick: closeListView,
+ size: "small"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tabs.TabList, {
+ className: "editor-list-view-sidebar__tabs-tablist",
+ ref: tabsRef,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, {
+ className: "editor-list-view-sidebar__tabs-tab",
+ tabId: "list-view",
+ children: (0,external_wp_i18n_namespaceObject._x)('List View', 'Post overview')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, {
+ className: "editor-list-view-sidebar__tabs-tab",
+ tabId: "outline",
+ children: (0,external_wp_i18n_namespaceObject._x)('Outline', 'Post overview')
+ })]
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.TabPanel, {
+ ref: listViewContainerRef,
+ className: "editor-list-view-sidebar__tabs-tabpanel",
+ tabId: "list-view",
+ focusable: false,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "editor-list-view-sidebar__list-view-container",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "editor-list-view-sidebar__list-view-panel-content",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalListView, {
+ dropZoneElement: dropZoneElement
+ })
+ })
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.TabPanel, {
+ className: "editor-list-view-sidebar__tabs-tabpanel",
+ tabId: "outline",
+ focusable: false,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "editor-list-view-sidebar__list-view-container",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewOutline, {})
+ })
+ })]
+ })
+ })
+ );
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/save-publish-panels/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+
+
+
+const {
+ Fill: save_publish_panels_Fill,
+ Slot: save_publish_panels_Slot
+} = (0,external_wp_components_namespaceObject.createSlotFill)('ActionsPanel');
+const ActionsPanelFill = (/* unused pure expression or super */ null && (save_publish_panels_Fill));
+function SavePublishPanels({
+ setEntitiesSavedStatesCallback,
+ closeEntitiesSavedStates,
+ isEntitiesSavedStatesOpen,
+ forceIsDirtyPublishPanel
+}) {
+ const {
+ closePublishSidebar,
+ togglePublishSidebar
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
+ const {
+ publishSidebarOpened,
+ isPublishable,
+ isDirty,
+ hasOtherEntitiesChanges
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ isPublishSidebarOpened,
+ isEditedPostPublishable,
+ isCurrentPostPublished,
+ isEditedPostDirty,
+ hasNonPostEntityChanges
+ } = select(store_store);
+ const _hasOtherEntitiesChanges = hasNonPostEntityChanges();
+ return {
+ publishSidebarOpened: isPublishSidebarOpened(),
+ isPublishable: !isCurrentPostPublished() && isEditedPostPublishable(),
+ isDirty: _hasOtherEntitiesChanges || isEditedPostDirty(),
+ hasOtherEntitiesChanges: _hasOtherEntitiesChanges
+ };
+ }, []);
+ const openEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(() => setEntitiesSavedStatesCallback(true), []);
+
+ // It is ok for these components to be unmounted when not in visual use.
+ // We don't want more than one present at a time, decide which to render.
+ let unmountableContent;
+ if (publishSidebarOpened) {
+ unmountableContent = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_publish_panel, {
+ onClose: closePublishSidebar,
+ forceIsDirty: forceIsDirtyPublishPanel,
+ PrePublishExtension: plugin_pre_publish_panel.Slot,
+ PostPublishExtension: plugin_post_publish_panel.Slot
+ });
+ } else if (isPublishable && !hasOtherEntitiesChanges) {
+ unmountableContent = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "editor-layout__toggle-publish-panel",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "secondary",
+ className: "editor-layout__toggle-publish-panel-button",
+ onClick: togglePublishSidebar,
+ "aria-expanded": false,
+ children: (0,external_wp_i18n_namespaceObject.__)('Open publish panel')
+ })
+ });
+ } else {
+ unmountableContent = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "editor-layout__toggle-entities-saved-states-panel",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "secondary",
+ className: "editor-layout__toggle-entities-saved-states-panel-button",
+ onClick: openEntitiesSavedStates,
+ "aria-expanded": false,
+ disabled: !isDirty,
+ __experimentalIsFocusable: true,
+ children: (0,external_wp_i18n_namespaceObject.__)('Open save panel')
+ })
+ });
+ }
+
+ // Since EntitiesSavedStates controls its own panel, we can keep it
+ // always mounted to retain its own component state (such as checkboxes).
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [isEntitiesSavedStatesOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntitiesSavedStates, {
+ close: closeEntitiesSavedStates
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(save_publish_panels_Slot, {
+ bubblesVirtually: true
+ }), !isEntitiesSavedStatesOpen && unmountableContent]
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/text-editor/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+function TextEditor({
+ autoFocus = false
+}) {
+ const {
+ switchEditorMode
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
+ const {
+ shortcut,
+ isRichEditingEnabled
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getEditorSettings
+ } = select(store_store);
+ const {
+ getShortcutRepresentation
+ } = select(external_wp_keyboardShortcuts_namespaceObject.store);
+ return {
+ shortcut: getShortcutRepresentation('core/editor/toggle-mode'),
+ isRichEditingEnabled: getEditorSettings().richEditingEnabled
+ };
+ }, []);
+ const titleRef = (0,external_wp_element_namespaceObject.useRef)();
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
+ if (autoFocus) {
+ return;
+ }
+ titleRef?.current?.focus();
+ }, [autoFocus]);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "editor-text-editor",
+ children: [isRichEditingEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "editor-text-editor__toolbar",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", {
+ children: (0,external_wp_i18n_namespaceObject.__)('Editing code')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "tertiary",
+ onClick: () => switchEditorMode('visual'),
+ shortcut: shortcut,
+ children: (0,external_wp_i18n_namespaceObject.__)('Exit code editor')
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "editor-text-editor__body",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_title_raw, {
+ ref: titleRef
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTextEditor, {})]
+ })]
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/visual-editor/edit-template-blocks-notification.js
/**
* WordPress dependencies
*/
@@ -15343,6 +24267,7 @@ function cleanForSlug(string) {
* @param {import('react').RefObject<HTMLElement>} props.contentRef Ref to the block
* editor iframe canvas.
*/
+
function EditTemplateBlocksNotification({
contentRef
}) {
@@ -15359,57 +24284,31 @@ function EditTemplateBlocksNotification({
templateId: getCurrentTemplateId()
};
}, []);
- const {
- getNotices
- } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_notices_namespaceObject.store);
- const {
- createInfoNotice,
- removeNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
+ const canEditTemplate = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ var _select$canUser;
+ return (_select$canUser = select(external_wp_coreData_namespaceObject.store).canUser('create', 'templates')) !== null && _select$canUser !== void 0 ? _select$canUser : false;
+ });
const [isDialogOpen, setIsDialogOpen] = (0,external_wp_element_namespaceObject.useState)(false);
- const lastNoticeId = (0,external_wp_element_namespaceObject.useRef)(0);
(0,external_wp_element_namespaceObject.useEffect)(() => {
- const handleClick = async event => {
- if (!event.target.classList.contains('is-root-container')) {
- return;
- }
- const isNoticeAlreadyShowing = getNotices().some(notice => notice.id === lastNoticeId.current);
- if (isNoticeAlreadyShowing) {
+ const handleDblClick = event => {
+ if (!canEditTemplate) {
return;
}
- const {
- notice
- } = await createInfoNotice((0,external_wp_i18n_namespaceObject.__)('Edit your template to edit this block.'), {
- isDismissible: true,
- type: 'snackbar',
- actions: [{
- label: (0,external_wp_i18n_namespaceObject.__)('Edit template'),
- onClick: () => onNavigateToEntityRecord({
- postId: templateId,
- postType: 'wp_template'
- })
- }]
- });
- lastNoticeId.current = notice.id;
- };
- const handleDblClick = event => {
if (!event.target.classList.contains('is-root-container')) {
return;
}
- if (lastNoticeId.current) {
- removeNotice(lastNoticeId.current);
- }
setIsDialogOpen(true);
};
const canvas = contentRef.current;
- canvas?.addEventListener('click', handleClick);
canvas?.addEventListener('dblclick', handleDblClick);
return () => {
- canvas?.removeEventListener('click', handleClick);
canvas?.removeEventListener('dblclick', handleDblClick);
};
- }, [lastNoticeId, contentRef, getNotices, createInfoNotice, onNavigateToEntityRecord, templateId, removeNotice]);
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalConfirmDialog, {
+ }, [contentRef, canEditTemplate]);
+ if (!canEditTemplate) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, {
isOpen: isDialogOpen,
confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Edit template'),
onConfirm: () => {
@@ -15419,12 +24318,239 @@ function EditTemplateBlocksNotification({
postType: 'wp_template'
});
},
- onCancel: () => setIsDialogOpen(false)
- }, (0,external_wp_i18n_namespaceObject.__)('Edit your template to edit this block.'));
+ onCancel: () => setIsDialogOpen(false),
+ size: "medium",
+ children: (0,external_wp_i18n_namespaceObject.__)('You’ve tried to select a block that is part of a template, which may be used on other posts and pages. Would you like to edit the template?')
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/resizable-editor/resize-handle.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+const DELTA_DISTANCE = 20; // The distance to resize per keydown in pixels.
+
+function ResizeHandle({
+ direction,
+ resizeWidthBy
+}) {
+ function handleKeyDown(event) {
+ const {
+ keyCode
+ } = event;
+ if (direction === 'left' && keyCode === external_wp_keycodes_namespaceObject.LEFT || direction === 'right' && keyCode === external_wp_keycodes_namespaceObject.RIGHT) {
+ resizeWidthBy(DELTA_DISTANCE);
+ } else if (direction === 'left' && keyCode === external_wp_keycodes_namespaceObject.RIGHT || direction === 'right' && keyCode === external_wp_keycodes_namespaceObject.LEFT) {
+ resizeWidthBy(-DELTA_DISTANCE);
+ }
+ }
+ const resizeHandleVariants = {
+ active: {
+ opacity: 1,
+ scaleY: 1.3
+ }
+ };
+ const resizableHandleHelpId = `resizable-editor__resize-help-${direction}`;
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, {
+ text: (0,external_wp_i18n_namespaceObject.__)('Drag to resize'),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.button, {
+ className: `editor-resizable-editor__resize-handle is-${direction}`,
+ "aria-label": (0,external_wp_i18n_namespaceObject.__)('Drag to resize'),
+ "aria-describedby": resizableHandleHelpId,
+ onKeyDown: handleKeyDown,
+ variants: resizeHandleVariants,
+ whileFocus: "active",
+ whileHover: "active",
+ whileTap: "active",
+ role: "separator",
+ "aria-orientation": "vertical"
+ }, "handle")
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, {
+ id: resizableHandleHelpId,
+ children: (0,external_wp_i18n_namespaceObject.__)('Use left and right arrow keys to resize the canvas.')
+ })]
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/resizable-editor/index.js
+/**
+ * External dependencies
+ */
+
+
+/**
+ * WordPress dependencies
+ */
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+// Removes the inline styles in the drag handles.
+
+const HANDLE_STYLES_OVERRIDE = {
+ position: undefined,
+ userSelect: undefined,
+ cursor: undefined,
+ width: undefined,
+ height: undefined,
+ top: undefined,
+ right: undefined,
+ bottom: undefined,
+ left: undefined
+};
+function ResizableEditor({
+ className,
+ enableResizing,
+ height,
+ children
+}) {
+ const [width, setWidth] = (0,external_wp_element_namespaceObject.useState)('100%');
+ const resizableRef = (0,external_wp_element_namespaceObject.useRef)();
+ const resizeWidthBy = (0,external_wp_element_namespaceObject.useCallback)(deltaPixels => {
+ if (resizableRef.current) {
+ setWidth(resizableRef.current.offsetWidth + deltaPixels);
+ }
+ }, []);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ResizableBox, {
+ className: dist_clsx('editor-resizable-editor', className, {
+ 'is-resizable': enableResizing
+ }),
+ ref: api => {
+ resizableRef.current = api?.resizable;
+ },
+ size: {
+ width: enableResizing ? width : '100%',
+ height: enableResizing && height ? height : '100%'
+ },
+ onResizeStop: (event, direction, element) => {
+ setWidth(element.style.width);
+ },
+ minWidth: 300,
+ maxWidth: "100%",
+ maxHeight: "100%",
+ enable: {
+ left: enableResizing,
+ right: enableResizing
+ },
+ showHandle: enableResizing
+ // The editor is centered horizontally, resizing it only
+ // moves half the distance. Hence double the ratio to correctly
+ // align the cursor to the resizer handle.
+ ,
+ resizeRatio: 2,
+ handleComponent: {
+ left: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResizeHandle, {
+ direction: "left",
+ resizeWidthBy: resizeWidthBy
+ }),
+ right: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResizeHandle, {
+ direction: "right",
+ resizeWidthBy: resizeWidthBy
+ })
+ },
+ handleClasses: undefined,
+ handleStyles: {
+ left: HANDLE_STYLES_OVERRIDE,
+ right: HANDLE_STYLES_OVERRIDE
+ },
+ children: children
+ });
}
+/* harmony default export */ const resizable_editor = (ResizableEditor);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/use-select-nearest-editable-block.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+/**
+ * Internal dependencies
+ */
-;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-canvas/index.js
+const DISTANCE_THRESHOLD = 500;
+function clamp(value, min, max) {
+ return Math.min(Math.max(value, min), max);
+}
+function distanceFromRect(x, y, rect) {
+ const dx = x - clamp(x, rect.left, rect.right);
+ const dy = y - clamp(y, rect.top, rect.bottom);
+ return Math.sqrt(dx * dx + dy * dy);
+}
+function useSelectNearestEditableBlock({
+ isEnabled = true
+} = {}) {
+ const {
+ getEnabledClientIdsTree,
+ getBlockName,
+ getBlockOrder
+ } = unlock((0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store));
+ const {
+ selectBlock
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
+ return (0,external_wp_compose_namespaceObject.useRefEffect)(element => {
+ if (!isEnabled) {
+ return;
+ }
+ const selectNearestEditableBlock = (x, y) => {
+ const editableBlockClientIds = getEnabledClientIdsTree().flatMap(({
+ clientId
+ }) => {
+ const blockName = getBlockName(clientId);
+ if (blockName === 'core/template-part') {
+ return [];
+ }
+ if (blockName === 'core/post-content') {
+ const innerBlocks = getBlockOrder(clientId);
+ if (innerBlocks.length) {
+ return innerBlocks;
+ }
+ }
+ return [clientId];
+ });
+ let nearestDistance = Infinity,
+ nearestClientId = null;
+ for (const clientId of editableBlockClientIds) {
+ const block = element.querySelector(`[data-block="${clientId}"]`);
+ if (!block) {
+ continue;
+ }
+ const rect = block.getBoundingClientRect();
+ const distance = distanceFromRect(x, y, rect);
+ if (distance < nearestDistance && distance < DISTANCE_THRESHOLD) {
+ nearestDistance = distance;
+ nearestClientId = clientId;
+ }
+ }
+ if (nearestClientId) {
+ selectBlock(nearestClientId);
+ }
+ };
+ const handleClick = event => {
+ const shouldSelect = event.target === element || event.target.classList.contains('is-root-container');
+ if (shouldSelect) {
+ selectNearestEditableBlock(event.clientX, event.clientY);
+ }
+ };
+ element.addEventListener('click', handleClick);
+ return () => element.removeEventListener('click', handleClick);
+ }, [isEnabled]);
+}
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/visual-editor/index.js
/**
* External dependencies
*/
@@ -15447,6 +24573,12 @@ function EditTemplateBlocksNotification({
+
+
+
+
+
+
const {
LayoutStyle,
useLayoutClasses,
@@ -15454,13 +24586,12 @@ const {
ExperimentalBlockCanvas: BlockCanvas,
useFlashEditableBlocks
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
-const editor_canvas_noop = () => {};
/**
* These post types have a special editor where they don't allow you to fill the title
* and they don't apply the layout styles.
*/
-const DESIGN_POST_TYPES = ['wp_block', 'wp_template', 'wp_navigation', 'wp_template_part'];
+const visual_editor_DESIGN_POST_TYPES = [PATTERN_POST_TYPE, TEMPLATE_POST_TYPE, NAVIGATION_POST_TYPE, TEMPLATE_PART_POST_TYPE];
/**
* Given an array of nested blocks, find the first Post Content
@@ -15492,16 +24623,17 @@ function checkForPostContentAtRootLevel(blocks) {
}
return false;
}
-function EditorCanvas({
+function VisualEditor({
// Ideally as we unify post and site editors, we won't need these props.
autoFocus,
- className,
- renderAppender,
styles,
disableIframe = false,
iframeProps,
- children
+ contentRef,
+ className
}) {
+ const [resizeObserver, sizes] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
+ const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small', '<');
const {
renderingMode,
postContentAttributes,
@@ -15509,8 +24641,10 @@ function EditorCanvas({
wrapperBlockName,
wrapperUniqueId,
deviceType,
- showEditorPadding,
- isDesignPostType
+ isFocusedEntity,
+ isDesignPostType,
+ postType,
+ isPreview
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getCurrentPostId,
@@ -15528,28 +24662,30 @@ function EditorCanvas({
const postTypeSlug = getCurrentPostType();
const _renderingMode = getRenderingMode();
let _wrapperBlockName;
- if (postTypeSlug === 'wp_block') {
+ if (postTypeSlug === PATTERN_POST_TYPE) {
_wrapperBlockName = 'core/block';
} else if (_renderingMode === 'post-only') {
_wrapperBlockName = 'core/post-content';
}
const editorSettings = getEditorSettings();
const supportsTemplateMode = editorSettings.supportsTemplateMode;
- const postType = getPostType(postTypeSlug);
+ const postTypeObject = getPostType(postTypeSlug);
const canEditTemplate = canUser('create', 'templates');
const currentTemplateId = getCurrentTemplateId();
- const template = currentTemplateId ? getEditedEntityRecord('postType', 'wp_template', currentTemplateId) : undefined;
+ const template = currentTemplateId ? getEditedEntityRecord('postType', TEMPLATE_POST_TYPE, currentTemplateId) : undefined;
return {
renderingMode: _renderingMode,
postContentAttributes: editorSettings.postContentAttributes,
- isDesignPostType: DESIGN_POST_TYPES.includes(postTypeSlug),
+ isDesignPostType: visual_editor_DESIGN_POST_TYPES.includes(postTypeSlug),
// Post template fetch returns a 404 on classic themes, which
// messes with e2e tests, so check it's a block theme first.
- editedPostTemplate: postType?.viewable && supportsTemplateMode && canEditTemplate ? template : undefined,
+ editedPostTemplate: postTypeObject?.viewable && supportsTemplateMode && canEditTemplate ? template : undefined,
wrapperBlockName: _wrapperBlockName,
wrapperUniqueId: getCurrentPostId(),
deviceType: getDeviceType(),
- showEditorPadding: !!editorSettings.onNavigateToPreviousEntityRecord
+ isFocusedEntity: !!editorSettings.onNavigateToPreviousEntityRecord,
+ postType: postTypeSlug,
+ isPreview: editorSettings.__unstableIsPreviewMode
};
}, []);
const {
@@ -15558,13 +24694,19 @@ function EditorCanvas({
const {
hasRootPaddingAwareAlignments,
themeHasDisabledLayoutStyles,
- themeSupportsLayout
+ themeSupportsLayout,
+ isZoomOutMode
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const _settings = select(external_wp_blockEditor_namespaceObject.store).getSettings();
+ const {
+ getSettings,
+ __unstableGetEditorMode
+ } = select(external_wp_blockEditor_namespaceObject.store);
+ const _settings = getSettings();
return {
themeHasDisabledLayoutStyles: _settings.disableLayoutStyles,
themeSupportsLayout: _settings.supportsLayout,
- hasRootPaddingAwareAlignments: _settings.__experimentalFeatures?.useRootPaddingAwareAlignments
+ hasRootPaddingAwareAlignments: _settings.__experimentalFeatures?.useRootPaddingAwareAlignments,
+ isZoomOutMode: __unstableGetEditorMode() === 'zoom-out'
};
}, []);
const deviceStyles = (0,external_wp_blockEditor_namespaceObject.__experimentalUseResizeCanvas)(deviceType);
@@ -15622,7 +24764,7 @@ function EditorCanvas({
align = ''
} = newestPostContentAttributes || {};
const postContentLayoutClasses = useLayoutClasses(newestPostContentAttributes, 'core/post-content');
- const blockListLayoutClass = classnames_default()({
+ const blockListLayoutClass = dist_clsx({
'is-layout-flow': !themeSupportsLayout
}, themeSupportsLayout && postContentLayoutClasses, align && `align${align}`);
const postContentLayoutStyles = useLayoutStyles(newestPostContentAttributes, 'core/post-content', '.block-editor-block-list__layout.is-root-container');
@@ -15660,73 +24802,120 @@ function EditorCanvas({
.is-root-container.alignfull:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: none;}`;
const localRef = (0,external_wp_element_namespaceObject.useRef)();
const typewriterRef = (0,external_wp_blockEditor_namespaceObject.__unstableUseTypewriter)();
- const contentRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([localRef, renderingMode === 'post-only' ? typewriterRef : editor_canvas_noop, useFlashEditableBlocks({
+ contentRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([localRef, contentRef, renderingMode === 'post-only' ? typewriterRef : null, useFlashEditableBlocks({
+ isEnabled: renderingMode === 'template-locked'
+ }), useSelectNearestEditableBlock({
isEnabled: renderingMode === 'template-locked'
})]);
- return (0,external_React_.createElement)(BlockCanvas, {
- shouldIframe: !disableIframe || ['Tablet', 'Mobile'].includes(deviceType),
- contentRef: contentRef,
- styles: styles,
- height: "100%",
- iframeProps: {
- className: classnames_default()('editor-canvas__iframe', {
- 'has-editor-padding': showEditorPadding
- }),
- ...iframeProps,
- style: {
- ...iframeProps?.style,
- ...deviceStyles
- }
- }
- }, themeSupportsLayout && !themeHasDisabledLayoutStyles && renderingMode === 'post-only' && !isDesignPostType && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(LayoutStyle, {
- selector: ".editor-editor-canvas__post-title-wrapper",
- layout: fallbackLayout
- }), (0,external_React_.createElement)(LayoutStyle, {
- selector: ".block-editor-block-list__layout.is-root-container",
- layout: postEditorLayout
- }), align && (0,external_React_.createElement)(LayoutStyle, {
- css: alignCSS
- }), postContentLayoutStyles && (0,external_React_.createElement)(LayoutStyle, {
- layout: postContentLayout,
- css: postContentLayoutStyles
- })), renderingMode === 'post-only' && !isDesignPostType && (0,external_React_.createElement)("div", {
- className: classnames_default()('editor-editor-canvas__post-title-wrapper',
- // The following class is only here for backward comapatibility
- // some themes might be using it to style the post title.
- 'edit-post-visual-editor__post-title-wrapper', {
- 'has-global-padding': hasRootPaddingAwareAlignments
+ const zoomOutProps = isZoomOutMode ? {
+ scale: 'default',
+ frameSize: '20px'
+ } : {};
+ const forceFullHeight = postType === NAVIGATION_POST_TYPE;
+ const enableResizing = [NAVIGATION_POST_TYPE, TEMPLATE_PART_POST_TYPE, PATTERN_POST_TYPE].includes(postType) &&
+ // Disable in previews / view mode.
+ !isPreview &&
+ // Disable resizing in mobile viewport.
+ !isMobileViewport &&
+ // Dsiable resizing in zoomed-out mode.
+ !isZoomOutMode;
+ const shouldIframe = !disableIframe || ['Tablet', 'Mobile'].includes(deviceType);
+ const iframeStyles = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ return [...(styles !== null && styles !== void 0 ? styles : []), {
+ css: `.is-root-container{display:flow-root;${
+ // Some themes will have `min-height: 100vh` for the root container,
+ // which isn't a requirement in auto resize mode.
+ enableResizing ? 'min-height:0!important;' : ''}}`
+ }];
+ }, [styles, enableResizing]);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: dist_clsx('editor-visual-editor',
+ // this class is here for backward compatibility reasons.
+ 'edit-post-visual-editor', className, {
+ 'has-padding': isFocusedEntity || enableResizing,
+ 'is-resizable': enableResizing,
+ 'is-iframed': shouldIframe
}),
- contentEditable: false,
- ref: observeTypingRef,
- style: {
- // This is using inline styles
- // so it's applied for both iframed and non iframed editors.
- marginTop: '4rem'
- }
- }, (0,external_React_.createElement)(post_title, {
- ref: titleRef
- })), (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.RecursionProvider, {
- blockName: wrapperBlockName,
- uniqueId: wrapperUniqueId
- }, (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.BlockList, {
- className: classnames_default()(className, 'is-' + deviceType.toLowerCase() + '-preview', renderingMode !== 'post-only' || isDesignPostType ? 'wp-site-blocks' : `${blockListLayoutClass} wp-block-post-content` // Ensure root level blocks receive default/flow blockGap styling rules.
- ),
- layout: blockListLayout,
- dropZoneElement:
- // When iframed, pass in the html element of the iframe to
- // ensure the drop zone extends to the edges of the iframe.
- disableIframe ? localRef.current : localRef.current?.parentNode,
- renderAppender: renderAppender,
- __unstableDisableDropZone:
- // In template preview mode, disable drop zones at the root of the template.
- renderingMode === 'template-locked' ? true : false
- }), renderingMode === 'template-locked' && (0,external_React_.createElement)(EditTemplateBlocksNotification, {
- contentRef: localRef
- })), children);
-}
-/* harmony default export */ const editor_canvas = (EditorCanvas);
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(resizable_editor, {
+ enableResizing: enableResizing,
+ height: sizes.height && !forceFullHeight ? sizes.height : '100%',
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(BlockCanvas, {
+ shouldIframe: shouldIframe,
+ contentRef: contentRef,
+ styles: iframeStyles,
+ height: "100%",
+ iframeProps: {
+ ...iframeProps,
+ ...zoomOutProps,
+ style: {
+ ...iframeProps?.style,
+ ...deviceStyles
+ }
+ },
+ children: [themeSupportsLayout && !themeHasDisabledLayoutStyles && renderingMode === 'post-only' && !isDesignPostType && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutStyle, {
+ selector: ".editor-visual-editor__post-title-wrapper",
+ layout: fallbackLayout
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutStyle, {
+ selector: ".block-editor-block-list__layout.is-root-container",
+ layout: postEditorLayout
+ }), align && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutStyle, {
+ css: alignCSS
+ }), postContentLayoutStyles && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutStyle, {
+ layout: postContentLayout,
+ css: postContentLayoutStyles
+ })]
+ }), renderingMode === 'post-only' && !isDesignPostType && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: dist_clsx('editor-visual-editor__post-title-wrapper',
+ // The following class is only here for backward comapatibility
+ // some themes might be using it to style the post title.
+ 'edit-post-visual-editor__post-title-wrapper', {
+ 'has-global-padding': hasRootPaddingAwareAlignments
+ }),
+ contentEditable: false,
+ ref: observeTypingRef,
+ style: {
+ // This is using inline styles
+ // so it's applied for both iframed and non iframed editors.
+ marginTop: '4rem'
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_title, {
+ ref: titleRef
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.RecursionProvider, {
+ blockName: wrapperBlockName,
+ uniqueId: wrapperUniqueId,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, {
+ className: dist_clsx('is-' + deviceType.toLowerCase() + '-preview', renderingMode !== 'post-only' || isDesignPostType ? 'wp-site-blocks' : `${blockListLayoutClass} wp-block-post-content` // Ensure root level blocks receive default/flow blockGap styling rules.
+ ),
+ layout: blockListLayout,
+ dropZoneElement:
+ // When iframed, pass in the html element of the iframe to
+ // ensure the drop zone extends to the edges of the iframe.
+ disableIframe ? localRef.current : localRef.current?.parentNode,
+ __unstableDisableDropZone:
+ // In template preview mode, disable drop zones at the root of the template.
+ renderingMode === 'template-locked' ? true : false
+ }), renderingMode === 'template-locked' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditTemplateBlocksNotification, {
+ contentRef: localRef
+ })]
+ }),
+ // Avoid resize listeners when not needed,
+ // these will trigger unnecessary re-renders
+ // when animating the iframe width.
+ enableResizing && resizeObserver]
+ })
+ })
+ });
+}
+/* harmony default export */ const visual_editor = (VisualEditor);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-interface/index.js
+/**
+ * External dependencies
+ */
+
-;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/preferences-modal/enable-panel.js
/**
* WordPress dependencies
*/
@@ -15734,93 +24923,268 @@ function EditorCanvas({
+
+
+
+
+
/**
* Internal dependencies
*/
-const {
- PreferenceBaseOption
-} = unlock(external_wp_preferences_namespaceObject.privateApis);
-/* harmony default export */ const enable_panel = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, {
- panelName
-}) => {
- const {
- isEditorPanelEnabled,
- isEditorPanelRemoved
- } = select(store_store);
- return {
- isRemoved: isEditorPanelRemoved(panelName),
- isChecked: isEditorPanelEnabled(panelName)
- };
-}), (0,external_wp_compose_namespaceObject.ifCondition)(({
- isRemoved
-}) => !isRemoved), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, {
- panelName
-}) => ({
- onChange: () => dispatch(store_store).toggleEditorPanelEnabled(panelName)
-})))(PreferenceBaseOption));
-;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/preferences-modal/enable-plugin-document-setting-panel.js
+
+
+
+
+
+
+
+
+const interfaceLabels = {
+ /* translators: accessibility text for the editor top bar landmark region. */
+ header: (0,external_wp_i18n_namespaceObject.__)('Editor top bar'),
+ /* translators: accessibility text for the editor content landmark region. */
+ body: (0,external_wp_i18n_namespaceObject.__)('Editor content'),
+ /* translators: accessibility text for the editor settings landmark region. */
+ sidebar: (0,external_wp_i18n_namespaceObject.__)('Editor settings'),
+ /* translators: accessibility text for the editor publish landmark region. */
+ actions: (0,external_wp_i18n_namespaceObject.__)('Editor publish'),
+ /* translators: accessibility text for the editor footer landmark region. */
+ footer: (0,external_wp_i18n_namespaceObject.__)('Editor footer')
+};
+function EditorInterface({
+ className,
+ enableRegionNavigation,
+ styles,
+ children,
+ forceIsDirty,
+ contentRef,
+ disableIframe,
+ autoFocus,
+ customSaveButton,
+ customSavePanel,
+ forceDisableBlockTools,
+ title,
+ iframeProps
+}) {
+ const {
+ mode,
+ isRichEditingEnabled,
+ isInserterOpened,
+ isListViewOpened,
+ isDistractionFree,
+ isPreviewMode,
+ previousShortcut,
+ nextShortcut,
+ showBlockBreadcrumbs,
+ documentLabel,
+ blockEditorMode
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ get
+ } = select(external_wp_preferences_namespaceObject.store);
+ const {
+ getEditorSettings,
+ getPostTypeLabel
+ } = select(store_store);
+ const editorSettings = getEditorSettings();
+ const postTypeLabel = getPostTypeLabel();
+ return {
+ mode: select(store_store).getEditorMode(),
+ isRichEditingEnabled: editorSettings.richEditingEnabled,
+ isInserterOpened: select(store_store).isInserterOpened(),
+ isListViewOpened: select(store_store).isListViewOpened(),
+ isDistractionFree: get('core', 'distractionFree'),
+ isPreviewMode: editorSettings.__unstableIsPreviewMode,
+ previousShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/editor/previous-region'),
+ nextShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/editor/next-region'),
+ showBlockBreadcrumbs: get('core', 'showBlockBreadcrumbs'),
+ // translators: Default label for the Document in the Block Breadcrumb.
+ documentLabel: postTypeLabel || (0,external_wp_i18n_namespaceObject._x)('Document', 'noun'),
+ blockEditorMode: select(external_wp_blockEditor_namespaceObject.store).__unstableGetEditorMode()
+ };
+ }, []);
+ const isWideViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('large');
+ const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
+ const secondarySidebarLabel = isListViewOpened ? (0,external_wp_i18n_namespaceObject.__)('Document Overview') : (0,external_wp_i18n_namespaceObject.__)('Block Library');
+
+ // Local state for save panel.
+ // Note 'truthy' callback implies an open panel.
+ const [entitiesSavedStatesCallback, setEntitiesSavedStatesCallback] = (0,external_wp_element_namespaceObject.useState)(false);
+ const closeEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(arg => {
+ if (typeof entitiesSavedStatesCallback === 'function') {
+ entitiesSavedStatesCallback(arg);
+ }
+ setEntitiesSavedStatesCallback(false);
+ }, [entitiesSavedStatesCallback]);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(interface_skeleton, {
+ enableRegionNavigation: enableRegionNavigation,
+ isDistractionFree: isDistractionFree && isWideViewport,
+ className: dist_clsx('editor-editor-interface', className, {
+ 'is-entity-save-view-open': !!entitiesSavedStatesCallback,
+ 'is-distraction-free': isDistractionFree && isWideViewport && !isPreviewMode
+ }),
+ labels: {
+ ...interfaceLabels,
+ secondarySidebar: secondarySidebarLabel
+ },
+ header: !isPreviewMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(components_header, {
+ forceIsDirty: forceIsDirty,
+ setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback,
+ customSaveButton: customSaveButton,
+ forceDisableBlockTools: forceDisableBlockTools,
+ title: title
+ }),
+ editorNotices: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_notices, {}),
+ secondarySidebar: !isPreviewMode && mode === 'visual' && (isInserterOpened && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InserterSidebar, {}) || isListViewOpened && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewSidebar, {})),
+ sidebar: !isPreviewMode && !isDistractionFree && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area.Slot, {
+ scope: "core"
+ }),
+ content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [!isDistractionFree && !isPreviewMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_notices, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(content_slot_fill.Slot, {
+ children: ([editorCanvasView]) => editorCanvasView ? editorCanvasView : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [!isPreviewMode && (mode === 'text' || !isRichEditingEnabled) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TextEditor
+ // We should auto-focus the canvas (title) on load.
+ // eslint-disable-next-line jsx-a11y/no-autofocus
+ , {
+ autoFocus: autoFocus
+ }), !isPreviewMode && !isLargeViewport && mode === 'visual' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockToolbar, {
+ hideDragHandle: true
+ }), (isPreviewMode || isRichEditingEnabled && mode === 'visual') && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(visual_editor, {
+ styles: styles,
+ contentRef: contentRef,
+ disableIframe: disableIframe
+ // We should auto-focus the canvas (title) on load.
+ // eslint-disable-next-line jsx-a11y/no-autofocus
+ ,
+ autoFocus: autoFocus,
+ iframeProps: iframeProps
+ }), children]
+ })
+ })]
+ }),
+ footer: !isPreviewMode && !isDistractionFree && isLargeViewport && showBlockBreadcrumbs && isRichEditingEnabled && blockEditorMode !== 'zoom-out' && mode === 'visual' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockBreadcrumb, {
+ rootLabelText: documentLabel
+ }),
+ actions: !isPreviewMode ? customSavePanel || /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SavePublishPanels, {
+ closeEntitiesSavedStates: closeEntitiesSavedStates,
+ isEntitiesSavedStatesOpen: entitiesSavedStatesCallback,
+ setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback,
+ forceIsDirtyPublishPanel: forceIsDirty
+ }) : undefined,
+ shortcuts: {
+ previous: previousShortcut,
+ next: nextShortcut
+ }
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/pattern-overrides-panel/index.js
/**
* WordPress dependencies
*/
+
/**
* Internal dependencies
*/
-const {
- Fill: enable_plugin_document_setting_panel_Fill,
- Slot: enable_plugin_document_setting_panel_Slot
-} = (0,external_wp_components_namespaceObject.createSlotFill)('EnablePluginDocumentSettingPanelOption');
-const EnablePluginDocumentSettingPanelOption = ({
- label,
- panelName
-}) => (0,external_React_.createElement)(enable_plugin_document_setting_panel_Fill, null, (0,external_React_.createElement)(enable_panel, {
- label: label,
- panelName: panelName
-}));
-EnablePluginDocumentSettingPanelOption.Slot = enable_plugin_document_setting_panel_Slot;
-/* harmony default export */ const enable_plugin_document_setting_panel = (EnablePluginDocumentSettingPanelOption);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js
+const {
+ OverridesPanel
+} = unlock(external_wp_patterns_namespaceObject.privateApis);
+function PatternOverridesPanel() {
+ const supportsPatternOverridesPanel = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentPostType() === 'wp_block', []);
+ if (!supportsPatternOverridesPanel) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OverridesPanel, {});
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/trash.js
/**
* WordPress dependencies
*/
-const plus = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+const trash = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"
-}));
-/* harmony default export */ const library_plus = (plus);
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ fillRule: "evenodd",
+ clipRule: "evenodd",
+ d: "M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"
+ })
+});
+/* harmony default export */ const library_trash = (trash);
+
+;// CONCATENATED MODULE: ./node_modules/client-zip/index.js
+"stream"in Blob.prototype||Object.defineProperty(Blob.prototype,"stream",{value(){return new Response(this).body}}),"setBigUint64"in DataView.prototype||Object.defineProperty(DataView.prototype,"setBigUint64",{value(e,n,t){const i=Number(0xffffffffn&n),r=Number(n>>32n);this.setUint32(e+(t?0:4),i,t),this.setUint32(e+(t?4:0),r,t)}});var e=e=>new DataView(new ArrayBuffer(e)),n=e=>new Uint8Array(e.buffer||e),t=e=>(new TextEncoder).encode(String(e)),i=e=>Math.min(4294967295,Number(e)),client_zip_r=e=>Math.min(65535,Number(e));function f(e,i){if(void 0===i||i instanceof Date||(i=new Date(i)),e instanceof File)return{isFile:1,t:i||new Date(e.lastModified),i:e.stream()};if(e instanceof Response)return{isFile:1,t:i||new Date(e.headers.get("Last-Modified")||Date.now()),i:e.body};if(void 0===i)i=new Date;else if(isNaN(i))throw new Error("Invalid modification date.");if(void 0===e)return{isFile:0,t:i};if("string"==typeof e)return{isFile:1,t:i,i:t(e)};if(e instanceof Blob)return{isFile:1,t:i,i:e.stream()};if(e instanceof Uint8Array||e instanceof ReadableStream)return{isFile:1,t:i,i:e};if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return{isFile:1,t:i,i:n(e)};if(Symbol.asyncIterator in e)return{isFile:1,t:i,i:o(e[Symbol.asyncIterator]())};throw new TypeError("Unsupported input format.")}function o(e,n=e){return new ReadableStream({async pull(n){let t=0;for(;n.desiredSize>t;){const i=await e.next();if(!i.value){n.close();break}{const e=a(i.value);n.enqueue(e),t+=e.byteLength}}},cancel(e){n.throw?.(e)}})}function a(e){return"string"==typeof e?t(e):e instanceof Uint8Array?e:n(e)}function s(e,i,r){let[f,o]=function(e){return e?e instanceof Uint8Array?[e,1]:ArrayBuffer.isView(e)||e instanceof ArrayBuffer?[n(e),1]:[t(e),0]:[void 0,0]}(i);if(e instanceof File)return{o:d(f||t(e.name)),u:BigInt(e.size),l:o};if(e instanceof Response){const n=e.headers.get("content-disposition"),i=n&&n.match(/;\s*filename\*?=["']?(.*?)["']?$/i),a=i&&i[1]||e.url&&new URL(e.url).pathname.split("/").findLast(Boolean),s=a&&decodeURIComponent(a),u=r||+e.headers.get("content-length");return{o:d(f||t(s)),u:BigInt(u),l:o}}return f=d(f,void 0!==e||void 0!==r),"string"==typeof e?{o:f,u:BigInt(t(e).length),l:o}:e instanceof Blob?{o:f,u:BigInt(e.size),l:o}:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?{o:f,u:BigInt(e.byteLength),l:o}:{o:f,u:u(e,r),l:o}}function u(e,n){return n>-1?BigInt(n):e?void 0:0n}function d(e,n=1){if(!e||e.every((c=>47===c)))throw new Error("The file must have a name.");if(n)for(;47===e[e.length-1];)e=e.subarray(0,-1);else 47!==e[e.length-1]&&(e=new Uint8Array([...e,47]));return e}var l=new Uint32Array(256);for(let e=0;e<256;++e){let n=e;for(let e=0;e<8;++e)n=n>>>1^(1&n&&3988292384);l[e]=n}function y(e,n=0){n^=-1;for(var t=0,i=e.length;t<i;t++)n=n>>>8^l[255&n^e[t]];return(-1^n)>>>0}function w(e,n,t=0){const i=e.getSeconds()>>1|e.getMinutes()<<5|e.getHours()<<11,r=e.getDate()|e.getMonth()+1<<5|e.getFullYear()-1980<<9;n.setUint16(t,i,1),n.setUint16(t+2,r,1)}function B({o:e,l:n},t){return 8*(!n||(t??function(e){try{b.decode(e)}catch{return 0}return 1}(e)))}var b=new TextDecoder("utf8",{fatal:1});function p(t,i=0){const r=e(30);return r.setUint32(0,1347093252),r.setUint32(4,754976768|i),w(t.t,r,10),r.setUint16(26,t.o.length,1),n(r)}async function*g(e){let{i:n}=e;if("then"in n&&(n=await n),n instanceof Uint8Array)yield n,e.m=y(n,0),e.u=BigInt(n.length);else{e.u=0n;const t=n.getReader();for(;;){const{value:n,done:i}=await t.read();if(i)break;e.m=y(n,e.m),e.u+=BigInt(n.length),yield n}}}function I(t,r){const f=e(16+(r?8:0));return f.setUint32(0,1347094280),f.setUint32(4,t.isFile?t.m:0,1),r?(f.setBigUint64(8,t.u,1),f.setBigUint64(16,t.u,1)):(f.setUint32(8,i(t.u),1),f.setUint32(12,i(t.u),1)),n(f)}function v(t,r,f=0,o=0){const a=e(46);return a.setUint32(0,1347092738),a.setUint32(4,755182848),a.setUint16(8,2048|f),w(t.t,a,12),a.setUint32(16,t.isFile?t.m:0,1),a.setUint32(20,i(t.u),1),a.setUint32(24,i(t.u),1),a.setUint16(28,t.o.length,1),a.setUint16(30,o,1),a.setUint16(40,t.isFile?33204:16893,1),a.setUint32(42,i(r),1),n(a)}function h(t,i,r){const f=e(r);return f.setUint16(0,1,1),f.setUint16(2,r-4,1),16&r&&(f.setBigUint64(4,t.u,1),f.setBigUint64(12,t.u,1)),f.setBigUint64(r-8,i,1),n(f)}function D(e){return e instanceof File||e instanceof Response?[[e],[e]]:[[e.input,e.name,e.size],[e.input,e.lastModified]]}var S=e=>function(e){let n=BigInt(22),t=0n,i=0;for(const r of e){if(!r.o)throw new Error("Every file must have a non-empty name.");if(void 0===r.u)throw new Error(`Missing size for file "${(new TextDecoder).decode(r.o)}".`);const e=r.u>=0xffffffffn,f=t>=0xffffffffn;t+=BigInt(46+r.o.length+(e&&8))+r.u,n+=BigInt(r.o.length+46+(12*f|28*e)),i||(i=e)}return(i||t>=0xffffffffn)&&(n+=BigInt(76)),n+t}(function*(e){for(const n of e)yield s(...D(n)[0])}(e));function A(e,n={}){const t={"Content-Type":"application/zip","Content-Disposition":"attachment"};return("bigint"==typeof n.length||Number.isInteger(n.length))&&n.length>0&&(t["Content-Length"]=String(n.length)),n.metadata&&(t["Content-Length"]=String(S(n.metadata))),new Response(N(e,n),{headers:t})}function N(t,a={}){const u=function(e){const n=e[Symbol.iterator in e?Symbol.iterator:Symbol.asyncIterator]();return{async next(){const e=await n.next();if(e.done)return e;const[t,i]=D(e.value);return{done:0,value:Object.assign(f(...i),s(...t))}},throw:n.throw?.bind(n),[Symbol.asyncIterator](){return this}}}(t);return o(async function*(t,f){const o=[];let a=0n,s=0n,u=0;for await(const e of t){const n=B(e,f.buffersAreUTF8);yield p(e,n),yield new Uint8Array(e.o),e.isFile&&(yield*g(e));const t=e.u>=0xffffffffn,i=12*(a>=0xffffffffn)|28*t;yield I(e,t),o.push(v(e,a,n,i)),o.push(e.o),i&&o.push(h(e,a,i)),t&&(a+=8n),s++,a+=BigInt(46+e.o.length)+e.u,u||(u=t)}let d=0n;for(const e of o)yield e,d+=BigInt(e.length);if(u||a>=0xffffffffn){const t=e(76);t.setUint32(0,1347094022),t.setBigUint64(4,BigInt(44),1),t.setUint32(12,755182848),t.setBigUint64(24,s,1),t.setBigUint64(32,s,1),t.setBigUint64(40,d,1),t.setBigUint64(48,a,1),t.setUint32(56,1347094023),t.setBigUint64(64,a+d,1),t.setUint32(72,1,1),yield n(t)}const l=e(22);l.setUint32(0,1347093766),l.setUint16(8,client_zip_r(s),1),l.setUint16(10,client_zip_r(s),1),l.setUint32(12,i(d),1),l.setUint32(16,i(a),1),yield n(l)}(u,a),u)}
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-actions/export-pattern-action.js
+/**
+ * External dependencies
+ */
+
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list-view.js
/**
* WordPress dependencies
*/
-const listView = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/svg"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z"
-}));
-/* harmony default export */ const list_view = (listView);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-tools/index.js
+
/**
- * External dependencies
+ * Internal dependencies
*/
+// Patterns.
+const {
+ PATTERN_TYPES: export_pattern_action_PATTERN_TYPES
+} = unlock(external_wp_patterns_namespaceObject.privateApis);
+function getJsonFromItem(item) {
+ return JSON.stringify({
+ __file: item.type,
+ title: item.title || item.name,
+ content: item?.patternPost?.content?.raw || item.content,
+ syncStatus: item?.patternPost?.wp_pattern_sync_status || item.wp_pattern_sync_status
+ }, null, 2);
+}
+const exportPatternAsJSONAction = {
+ id: 'export-pattern',
+ label: (0,external_wp_i18n_namespaceObject.__)('Export as JSON'),
+ supportsBulk: true,
+ isEligible: item => {
+ if (!item.type) {
+ return false;
+ }
+ return item.type === export_pattern_action_PATTERN_TYPES.user;
+ },
+ callback: async items => {
+ if (items.length === 1) {
+ return (0,external_wp_blob_namespaceObject.downloadBlob)(`${paramCase(items[0].title || items[0].name)}.json`, getJsonFromItem(items[0]), 'application/json');
+ }
+ const nameCount = {};
+ const filesToZip = items.map(item => {
+ const name = paramCase(item.title || item.name);
+ nameCount[name] = (nameCount[name] || 0) + 1;
+ return {
+ name: `${name + (nameCount[name] > 1 ? '-' + (nameCount[name] - 1) : '')}.json`,
+ lastModified: new Date(),
+ input: getJsonFromItem(item)
+ };
+ });
+ return (0,external_wp_blob_namespaceObject.downloadBlob)((0,external_wp_i18n_namespaceObject.__)('patterns-export') + '.zip', await A(filesToZip).blob(), 'application/zip');
+ }
+};
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-actions/actions.js
/**
* WordPress dependencies
*/
@@ -15834,6 +25198,7 @@ const listView = (0,external_React_.createElement)(external_wp_primitives_namesp
+
/**
* Internal dependencies
*/
@@ -15841,163 +25206,1155 @@ const listView = (0,external_React_.createElement)(external_wp_primitives_namesp
+
+
+
+// Patterns.
+
+
const {
- useCanBlockToolbarBeFocused
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
-const preventDefault = event => {
- event.preventDefault();
+ PATTERN_TYPES: actions_PATTERN_TYPES,
+ CreatePatternModalContents,
+ useDuplicatePatternProps
+} = unlock(external_wp_patterns_namespaceObject.privateApis);
+
+/**
+ * Check if a template is removable.
+ *
+ * @param {Object} template The template entity to check.
+ * @return {boolean} Whether the template is removable.
+ */
+function isTemplateRemovable(template) {
+ if (!template) {
+ return false;
+ }
+ // In patterns list page we map the templates parts to a different object
+ // than the one returned from the endpoint. This is why we need to check for
+ // two props whether is custom or has a theme file.
+ return [template.source, template.templatePart?.source].includes(TEMPLATE_ORIGINS.custom) && !template.has_theme_file && !template.templatePart?.has_theme_file;
+}
+function getItemTitle(item) {
+ if (typeof item.title === 'string') {
+ return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title);
+ }
+ return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title?.rendered || '');
+}
+
+// This action is used for templates, patterns and template parts.
+// Every other post type uses the similar `trashPostAction` which
+// moves the post to trash.
+const deletePostAction = {
+ id: 'delete-post',
+ label: (0,external_wp_i18n_namespaceObject.__)('Delete'),
+ isPrimary: true,
+ icon: library_trash,
+ isEligible(post) {
+ if ([TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE].includes(post.type)) {
+ return isTemplateRemovable(post);
+ }
+ // We can only remove user patterns.
+ return post.type === actions_PATTERN_TYPES.user;
+ },
+ supportsBulk: true,
+ hideModalHeader: true,
+ RenderModal: ({
+ items,
+ closeModal,
+ onActionStart,
+ onActionPerformed
+ }) => {
+ const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false);
+ const {
+ removeTemplates
+ } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: "5",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ children: items.length > 1 ? (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %d: number of items to delete.
+ (0,external_wp_i18n_namespaceObject._n)('Delete %d item?', 'Delete %d items?', items.length), items.length) : (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: The template or template part's titles
+ (0,external_wp_i18n_namespaceObject.__)('Delete "%s"?'), getItemTitle(items[0]))
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "right",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "tertiary",
+ onClick: closeModal,
+ disabled: isBusy,
+ __experimentalIsFocusable: true,
+ children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "primary",
+ onClick: async () => {
+ setIsBusy(true);
+ if (onActionStart) {
+ onActionStart(items);
+ }
+ await removeTemplates(items, {
+ allowUndo: false
+ });
+ onActionPerformed?.(items);
+ setIsBusy(false);
+ closeModal();
+ },
+ isBusy: isBusy,
+ disabled: isBusy,
+ __experimentalIsFocusable: true,
+ children: (0,external_wp_i18n_namespaceObject.__)('Delete')
+ })]
+ })]
+ });
+ }
};
-function DocumentTools({
- className,
- disableBlockTools = false,
- children,
- // This is a temporary prop until the list view is fully unified between post and site editors.
- listViewLabel = (0,external_wp_i18n_namespaceObject.__)('Document Overview')
-}) {
- const inserterButton = (0,external_wp_element_namespaceObject.useRef)();
+function useCanUserEligibilityCheckPostType(capability, resource, action) {
+ const registry = (0,external_wp_data_namespaceObject.useRegistry)();
+ return (0,external_wp_element_namespaceObject.useMemo)(() => ({
+ ...action,
+ isEligible(item) {
+ return action.isEligible(item) && registry.select(external_wp_coreData_namespaceObject.store).canUser(capability, resource, item.id);
+ }
+ }), [action, registry, capability, resource]);
+}
+const trashPostAction = {
+ id: 'move-to-trash',
+ label: (0,external_wp_i18n_namespaceObject.__)('Move to Trash'),
+ isPrimary: true,
+ icon: library_trash,
+ isEligible(item) {
+ return !['auto-draft', 'trash'].includes(item.status);
+ },
+ supportsBulk: true,
+ hideModalHeader: true,
+ RenderModal: ({
+ items,
+ closeModal,
+ onActionStart,
+ onActionPerformed
+ }) => {
+ const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false);
+ const {
+ createSuccessNotice,
+ createErrorNotice
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
+ const {
+ deleteEntityRecord
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: "5",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ children: items.length === 1 ? (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: The item's title.
+ (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to move to trash "%s"?'), getItemTitle(items[0])) : (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %d: The number of items (2 or more).
+ (0,external_wp_i18n_namespaceObject._n)('Are you sure you want to move to trash %d item?', 'Are you sure you want to move to trash %d items?', items.length), items.length)
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "right",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "tertiary",
+ onClick: closeModal,
+ disabled: isBusy,
+ __experimentalIsFocusable: true,
+ children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "primary",
+ onClick: async () => {
+ setIsBusy(true);
+ if (onActionStart) {
+ onActionStart(items);
+ }
+ const promiseResult = await Promise.allSettled(items.map(item => deleteEntityRecord('postType', item.type, item.id, {}, {
+ throwOnError: true
+ })));
+ // If all the promises were fulfilled with success.
+ if (promiseResult.every(({
+ status
+ }) => status === 'fulfilled')) {
+ let successMessage;
+ if (promiseResult.length === 1) {
+ successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The item's title. */
+ (0,external_wp_i18n_namespaceObject.__)('"%s" moved to trash.'), getItemTitle(items[0]));
+ } else {
+ successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The number of items. */
+ (0,external_wp_i18n_namespaceObject._n)('%s item moved to trash.', '%s items moved to trash.', items.length), items.length);
+ }
+ createSuccessNotice(successMessage, {
+ type: 'snackbar',
+ id: 'move-to-trash-action'
+ });
+ } else {
+ // If there was at least one failure.
+ let errorMessage;
+ // If we were trying to delete a single item.
+ if (promiseResult.length === 1) {
+ if (promiseResult[0].reason?.message) {
+ errorMessage = promiseResult[0].reason.message;
+ } else {
+ errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while moving to trash the item.');
+ }
+ // If we were trying to delete multiple items.
+ } else {
+ const errorMessages = new Set();
+ const failedPromises = promiseResult.filter(({
+ status
+ }) => status === 'rejected');
+ for (const failedPromise of failedPromises) {
+ if (failedPromise.reason?.message) {
+ errorMessages.add(failedPromise.reason.message);
+ }
+ }
+ if (errorMessages.size === 0) {
+ errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while moving to trash the items.');
+ } else if (errorMessages.size === 1) {
+ errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: an error message */
+ (0,external_wp_i18n_namespaceObject.__)('An error occurred while moving to trash the item: %s'), [...errorMessages][0]);
+ } else {
+ errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: a list of comma separated error messages */
+ (0,external_wp_i18n_namespaceObject.__)('Some errors occurred while moving to trash the items: %s'), [...errorMessages].join(','));
+ }
+ }
+ createErrorNotice(errorMessage, {
+ type: 'snackbar'
+ });
+ }
+ if (onActionPerformed) {
+ onActionPerformed(items);
+ }
+ setIsBusy(false);
+ closeModal();
+ },
+ isBusy: isBusy,
+ disabled: isBusy,
+ __experimentalIsFocusable: true,
+ children: (0,external_wp_i18n_namespaceObject.__)('Trash')
+ })]
+ })]
+ });
+ }
+};
+function useTrashPostAction(resource) {
+ return useCanUserEligibilityCheckPostType('delete', resource, trashPostAction);
+}
+function usePermanentlyDeletePostAction(resource) {
const {
- setIsInserterOpened,
- setIsListViewOpened
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
+ createSuccessNotice,
+ createErrorNotice
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
const {
- isDistractionFree,
- isInserterOpened,
- isListViewOpen,
- listViewShortcut,
- listViewToggleRef,
- hasFixedToolbar,
- showIconLabels
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ deleteEntityRecord
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
+ const permanentlyDeletePostAction = (0,external_wp_element_namespaceObject.useMemo)(() => ({
+ id: 'permanently-delete',
+ label: (0,external_wp_i18n_namespaceObject.__)('Permanently delete'),
+ supportsBulk: true,
+ isEligible({
+ status
+ }) {
+ return status === 'trash';
+ },
+ async callback(posts, onActionPerformed) {
+ const promiseResult = await Promise.allSettled(posts.map(post => {
+ return deleteEntityRecord('postType', post.type, post.id, {
+ force: true
+ }, {
+ throwOnError: true
+ });
+ }));
+ // If all the promises were fulfilled with success.
+ if (promiseResult.every(({
+ status
+ }) => status === 'fulfilled')) {
+ let successMessage;
+ if (promiseResult.length === 1) {
+ successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The posts's title. */
+ (0,external_wp_i18n_namespaceObject.__)('"%s" permanently deleted.'), getItemTitle(posts[0]));
+ } else {
+ successMessage = (0,external_wp_i18n_namespaceObject.__)('The posts were permanently deleted.');
+ }
+ createSuccessNotice(successMessage, {
+ type: 'snackbar',
+ id: 'permanently-delete-post-action'
+ });
+ if (onActionPerformed) {
+ onActionPerformed(posts);
+ }
+ } else {
+ // If there was at lease one failure.
+ let errorMessage;
+ // If we were trying to permanently delete a single post.
+ if (promiseResult.length === 1) {
+ if (promiseResult[0].reason?.message) {
+ errorMessage = promiseResult[0].reason.message;
+ } else {
+ errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while permanently deleting the post.');
+ }
+ // If we were trying to permanently delete multiple posts
+ } else {
+ const errorMessages = new Set();
+ const failedPromises = promiseResult.filter(({
+ status
+ }) => status === 'rejected');
+ for (const failedPromise of failedPromises) {
+ if (failedPromise.reason?.message) {
+ errorMessages.add(failedPromise.reason.message);
+ }
+ }
+ if (errorMessages.size === 0) {
+ errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while permanently deleting the posts.');
+ } else if (errorMessages.size === 1) {
+ errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: an error message */
+ (0,external_wp_i18n_namespaceObject.__)('An error occurred while permanently deleting the posts: %s'), [...errorMessages][0]);
+ } else {
+ errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: a list of comma separated error messages */
+ (0,external_wp_i18n_namespaceObject.__)('Some errors occurred while permanently deleting the posts: %s'), [...errorMessages].join(','));
+ }
+ }
+ createErrorNotice(errorMessage, {
+ type: 'snackbar'
+ });
+ }
+ }
+ }), [createSuccessNotice, createErrorNotice, deleteEntityRecord]);
+ return useCanUserEligibilityCheckPostType('delete', resource, permanentlyDeletePostAction);
+}
+function useRestorePostAction(resource) {
+ const {
+ createSuccessNotice,
+ createErrorNotice
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
+ const {
+ editEntityRecord,
+ saveEditedEntityRecord
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
+ const restorePostAction = (0,external_wp_element_namespaceObject.useMemo)(() => ({
+ id: 'restore',
+ label: (0,external_wp_i18n_namespaceObject.__)('Restore'),
+ isPrimary: true,
+ icon: library_backup,
+ supportsBulk: true,
+ isEligible({
+ status
+ }) {
+ return status === 'trash';
+ },
+ async callback(posts, onActionPerformed) {
+ await Promise.allSettled(posts.map(post => {
+ return editEntityRecord('postType', post.type, post.id, {
+ status: 'draft'
+ });
+ }));
+ const promiseResult = await Promise.allSettled(posts.map(post => {
+ return saveEditedEntityRecord('postType', post.type, post.id, {
+ throwOnError: true
+ });
+ }));
+ if (promiseResult.every(({
+ status
+ }) => status === 'fulfilled')) {
+ let successMessage;
+ if (posts.length === 1) {
+ successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The number of posts. */
+ (0,external_wp_i18n_namespaceObject.__)('"%s" has been restored.'), getItemTitle(posts[0]));
+ } else if (posts[0].type === 'page') {
+ successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The number of posts. */
+ (0,external_wp_i18n_namespaceObject.__)('%d pages have been restored.'), posts.length);
+ } else {
+ successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The number of posts. */
+ (0,external_wp_i18n_namespaceObject.__)('%d posts have been restored.'), posts.length);
+ }
+ createSuccessNotice(successMessage, {
+ type: 'snackbar',
+ id: 'restore-post-action'
+ });
+ if (onActionPerformed) {
+ onActionPerformed(posts);
+ }
+ } else {
+ // If there was at lease one failure.
+ let errorMessage;
+ // If we were trying to move a single post to the trash.
+ if (promiseResult.length === 1) {
+ if (promiseResult[0].reason?.message) {
+ errorMessage = promiseResult[0].reason.message;
+ } else {
+ errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while restoring the post.');
+ }
+ // If we were trying to move multiple posts to the trash
+ } else {
+ const errorMessages = new Set();
+ const failedPromises = promiseResult.filter(({
+ status
+ }) => status === 'rejected');
+ for (const failedPromise of failedPromises) {
+ if (failedPromise.reason?.message) {
+ errorMessages.add(failedPromise.reason.message);
+ }
+ }
+ if (errorMessages.size === 0) {
+ errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while restoring the posts.');
+ } else if (errorMessages.size === 1) {
+ errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: an error message */
+ (0,external_wp_i18n_namespaceObject.__)('An error occurred while restoring the posts: %s'), [...errorMessages][0]);
+ } else {
+ errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: a list of comma separated error messages */
+ (0,external_wp_i18n_namespaceObject.__)('Some errors occurred while restoring the posts: %s'), [...errorMessages].join(','));
+ }
+ }
+ createErrorNotice(errorMessage, {
+ type: 'snackbar'
+ });
+ }
+ }
+ }), [createSuccessNotice, createErrorNotice, editEntityRecord, saveEditedEntityRecord]);
+ return useCanUserEligibilityCheckPostType('update', resource, restorePostAction);
+}
+const viewPostAction = {
+ id: 'view-post',
+ label: (0,external_wp_i18n_namespaceObject.__)('View'),
+ isPrimary: true,
+ icon: library_external,
+ isEligible(post) {
+ return post.status !== 'trash';
+ },
+ callback(posts, onActionPerformed) {
+ const post = posts[0];
+ window.open(post.link, '_blank');
+ if (onActionPerformed) {
+ onActionPerformed(posts);
+ }
+ }
+};
+const postRevisionsAction = {
+ id: 'view-post-revisions',
+ context: 'list',
+ label(items) {
+ var _items$0$_links$versi;
+ const revisionsCount = (_items$0$_links$versi = items[0]._links?.['version-history']?.[0]?.count) !== null && _items$0$_links$versi !== void 0 ? _items$0$_links$versi : 0;
+ return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: number of revisions */
+ (0,external_wp_i18n_namespaceObject.__)('View revisions (%s)'), revisionsCount);
+ },
+ isEligible: post => {
+ var _post$_links$predeces, _post$_links$version;
+ if (post.status === 'trash') {
+ return false;
+ }
+ const lastRevisionId = (_post$_links$predeces = post?._links?.['predecessor-version']?.[0]?.id) !== null && _post$_links$predeces !== void 0 ? _post$_links$predeces : null;
+ const revisionsCount = (_post$_links$version = post?._links?.['version-history']?.[0]?.count) !== null && _post$_links$version !== void 0 ? _post$_links$version : 0;
+ return lastRevisionId && revisionsCount > 1;
+ },
+ callback(posts, onActionPerformed) {
+ const post = posts[0];
+ const href = (0,external_wp_url_namespaceObject.addQueryArgs)('revision.php', {
+ revision: post?._links?.['predecessor-version']?.[0]?.id
+ });
+ document.location.href = href;
+ if (onActionPerformed) {
+ onActionPerformed(posts);
+ }
+ }
+};
+const renamePostAction = {
+ id: 'rename-post',
+ label: (0,external_wp_i18n_namespaceObject.__)('Rename'),
+ isEligible(post) {
+ if (post.status === 'trash') {
+ return false;
+ }
+ // Templates, template parts and patterns have special checks for renaming.
+ if (![TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, ...Object.values(actions_PATTERN_TYPES)].includes(post.type)) {
+ return true;
+ }
+ // In the case of templates, we can only rename custom templates.
+ if (post.type === TEMPLATE_POST_TYPE) {
+ return isTemplateRemovable(post) && post.is_custom;
+ }
+ // Make necessary checks for template parts and patterns.
+ const isTemplatePart = post.type === TEMPLATE_PART_POST_TYPE;
+ const isUserPattern = post.type === actions_PATTERN_TYPES.user;
+ // In patterns list page we map the templates parts to a different object
+ // than the one returned from the endpoint. This is why we need to check for
+ // two props whether is custom or has a theme file.
+ const isCustomPattern = isUserPattern || isTemplatePart && (post.isCustom || post.source === TEMPLATE_ORIGINS.custom);
+ const hasThemeFile = isTemplatePart && (post.templatePart?.has_theme_file || post.has_theme_file);
+ return isCustomPattern && !hasThemeFile;
+ },
+ RenderModal: ({
+ items,
+ closeModal,
+ onActionPerformed
+ }) => {
+ const [item] = items;
+ const originalTitle = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(typeof item.title === 'string' ? item.title : item.title.rendered);
+ const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(() => originalTitle);
const {
- getSettings
- } = select(external_wp_blockEditor_namespaceObject.store);
+ editEntityRecord,
+ saveEditedEntityRecord
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
const {
- get
- } = select(external_wp_preferences_namespaceObject.store);
+ createSuccessNotice,
+ createErrorNotice
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
+ async function onRename(event) {
+ event.preventDefault();
+ try {
+ await editEntityRecord('postType', item.type, item.id, {
+ title
+ });
+ // Update state before saving rerenders the list.
+ setTitle('');
+ closeModal();
+ // Persist edited entity.
+ await saveEditedEntityRecord('postType', item.type, item.id, {
+ throwOnError: true
+ });
+ createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Name updated'), {
+ type: 'snackbar'
+ });
+ onActionPerformed?.(items);
+ } catch (error) {
+ const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while updating the name');
+ createErrorNotice(errorMessage, {
+ type: 'snackbar'
+ });
+ }
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", {
+ onSubmit: onRename,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: "5",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, {
+ __nextHasNoMarginBottom: true,
+ __next40pxDefaultSize: true,
+ label: (0,external_wp_i18n_namespaceObject.__)('Name'),
+ value: title,
+ onChange: setTitle,
+ required: true
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "right",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ __next40pxDefaultSize: true,
+ variant: "tertiary",
+ onClick: () => {
+ closeModal();
+ },
+ children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ __next40pxDefaultSize: true,
+ variant: "primary",
+ type: "submit",
+ children: (0,external_wp_i18n_namespaceObject.__)('Save')
+ })]
+ })]
+ })
+ });
+ }
+};
+function useRenamePostAction(resource) {
+ return useCanUserEligibilityCheckPostType('update', resource, renamePostAction);
+}
+const duplicatePostAction = {
+ id: 'duplicate-post',
+ label: (0,external_wp_i18n_namespaceObject._x)('Duplicate', 'action label'),
+ isEligible({
+ status
+ }) {
+ return status !== 'trash';
+ },
+ RenderModal: ({
+ items,
+ closeModal,
+ onActionPerformed
+ }) => {
+ const [item] = items;
+ const [isCreatingPage, setIsCreatingPage] = (0,external_wp_element_namespaceObject.useState)(false);
+ const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Existing item title */
+ (0,external_wp_i18n_namespaceObject.__)('%s (Copy)'), getItemTitle(item)));
const {
- isListViewOpened,
- getListViewToggleRef
- } = unlock(select(store_store));
+ saveEntityRecord
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
const {
- getShortcutRepresentation
- } = select(external_wp_keyboardShortcuts_namespaceObject.store);
+ createSuccessNotice,
+ createErrorNotice
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
+ async function createPage(event) {
+ event.preventDefault();
+ if (isCreatingPage) {
+ return;
+ }
+ setIsCreatingPage(true);
+ try {
+ const newItem = await saveEntityRecord('postType', item.type, {
+ status: 'draft',
+ title,
+ slug: title || (0,external_wp_i18n_namespaceObject.__)('No title'),
+ author: item.author,
+ comment_status: item.comment_status,
+ content: typeof item.content === 'string' ? item.content : item.content.raw,
+ excerpt: item.excerpt.raw,
+ meta: item.meta,
+ parent: item.parent,
+ password: item.password,
+ template: item.template,
+ format: item.format,
+ featured_media: item.featured_media,
+ menu_order: item.menu_order,
+ ping_status: item.ping_status,
+ categories: item.categories,
+ tags: item.tags
+ }, {
+ throwOnError: true
+ });
+ createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: Title of the created template e.g: "Category".
+ (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(newItem.title?.rendered || title)), {
+ id: 'duplicate-post-action',
+ type: 'snackbar'
+ });
+ if (onActionPerformed) {
+ onActionPerformed([newItem]);
+ }
+ } catch (error) {
+ const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while duplicating the page.');
+ createErrorNotice(errorMessage, {
+ type: 'snackbar'
+ });
+ } finally {
+ setIsCreatingPage(false);
+ closeModal();
+ }
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", {
+ onSubmit: createPage,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 3,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Title'),
+ onChange: setTitle,
+ placeholder: (0,external_wp_i18n_namespaceObject.__)('No title'),
+ value: title
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ spacing: 2,
+ justify: "end",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "tertiary",
+ onClick: closeModal,
+ children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "primary",
+ type: "submit",
+ isBusy: isCreatingPage,
+ "aria-disabled": isCreatingPage,
+ children: (0,external_wp_i18n_namespaceObject._x)('Duplicate', 'action label')
+ })]
+ })]
+ })
+ });
+ }
+};
+const resetTemplateAction = {
+ id: 'reset-template',
+ label: (0,external_wp_i18n_namespaceObject.__)('Reset'),
+ isEligible: item => {
+ return isTemplateRevertable(item);
+ },
+ icon: library_backup,
+ supportsBulk: true,
+ hideModalHeader: true,
+ RenderModal: ({
+ items,
+ closeModal,
+ onActionStart,
+ onActionPerformed
+ }) => {
+ const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false);
+ const {
+ revertTemplate
+ } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
+ const {
+ saveEditedEntityRecord
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
+ const {
+ createSuccessNotice,
+ createErrorNotice
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
+ const onConfirm = async () => {
+ try {
+ for (const template of items) {
+ await revertTemplate(template, {
+ allowUndo: false
+ });
+ await saveEditedEntityRecord('postType', template.type, template.id);
+ }
+ createSuccessNotice(items.length > 1 ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The number of items. */
+ (0,external_wp_i18n_namespaceObject.__)('%s items reset.'), items.length) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The template/part's name. */
+ (0,external_wp_i18n_namespaceObject.__)('"%s" reset.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(getItemTitle(items[0]))), {
+ type: 'snackbar',
+ id: 'revert-template-action'
+ });
+ } catch (error) {
+ let fallbackErrorMessage;
+ if (items[0].type === TEMPLATE_POST_TYPE) {
+ fallbackErrorMessage = items.length === 1 ? (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the template.') : (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the templates.');
+ } else {
+ fallbackErrorMessage = items.length === 1 ? (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the template part.') : (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the template parts.');
+ }
+ const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : fallbackErrorMessage;
+ createErrorNotice(errorMessage, {
+ type: 'snackbar'
+ });
+ }
+ };
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: "5",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ children: (0,external_wp_i18n_namespaceObject.__)('Reset to default and clear all customizations?')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "right",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "tertiary",
+ onClick: closeModal,
+ disabled: isBusy,
+ __experimentalIsFocusable: true,
+ children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "primary",
+ onClick: async () => {
+ setIsBusy(true);
+ if (onActionStart) {
+ onActionStart(items);
+ }
+ await onConfirm(items);
+ onActionPerformed?.(items);
+ setIsBusy(false);
+ closeModal();
+ },
+ isBusy: isBusy,
+ disabled: isBusy,
+ __experimentalIsFocusable: true,
+ children: (0,external_wp_i18n_namespaceObject.__)('Reset')
+ })]
+ })]
+ });
+ }
+};
+const duplicatePatternAction = {
+ id: 'duplicate-pattern',
+ label: (0,external_wp_i18n_namespaceObject._x)('Duplicate', 'action label'),
+ isEligible: item => item.type !== TEMPLATE_PART_POST_TYPE,
+ modalHeader: (0,external_wp_i18n_namespaceObject._x)('Duplicate pattern', 'action label'),
+ RenderModal: ({
+ items,
+ closeModal
+ }) => {
+ const [item] = items;
+ const isThemePattern = item.type === actions_PATTERN_TYPES.theme;
+ const duplicatedProps = useDuplicatePatternProps({
+ pattern: isThemePattern || !item.patternPost ? item : item.patternPost,
+ onSuccess: () => closeModal()
+ });
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreatePatternModalContents, {
+ onClose: closeModal,
+ confirmLabel: (0,external_wp_i18n_namespaceObject._x)('Duplicate', 'action label'),
+ ...duplicatedProps
+ });
+ }
+};
+const duplicateTemplatePartAction = {
+ id: 'duplicate-template-part',
+ label: (0,external_wp_i18n_namespaceObject._x)('Duplicate', 'action label'),
+ isEligible: item => item.type === TEMPLATE_PART_POST_TYPE,
+ modalHeader: (0,external_wp_i18n_namespaceObject._x)('Duplicate template part', 'action label'),
+ RenderModal: ({
+ items,
+ closeModal
+ }) => {
+ const [item] = items;
+ const {
+ createSuccessNotice
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
+ function onTemplatePartSuccess() {
+ createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: The new template part's title e.g. 'Call to action (copy)'.
+ (0,external_wp_i18n_namespaceObject.__)('"%s" duplicated.'), item.title), {
+ type: 'snackbar',
+ id: 'edit-site-patterns-success'
+ });
+ closeModal();
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateTemplatePartModalContents, {
+ blocks: item.blocks,
+ defaultArea: item.templatePart?.area || item.area,
+ defaultTitle: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Existing template part title */
+ (0,external_wp_i18n_namespaceObject.__)('%s (Copy)'), item.title),
+ onCreate: onTemplatePartSuccess,
+ onError: closeModal,
+ confirmLabel: (0,external_wp_i18n_namespaceObject._x)('Duplicate', 'action label')
+ });
+ }
+};
+function usePostActions({
+ postType,
+ onActionPerformed,
+ context
+}) {
+ const {
+ postTypeObject,
+ resource,
+ cachedCanUserResolvers,
+ userCanCreatePostType
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getPostType,
+ getCachedResolvers,
+ canUser
+ } = select(external_wp_coreData_namespaceObject.store);
+ const _postTypeObject = getPostType(postType);
+ const _resource = _postTypeObject?.rest_base || '';
return {
- isInserterOpened: select(store_store).isInserterOpened(),
- isListViewOpen: isListViewOpened(),
- listViewShortcut: getShortcutRepresentation('core/editor/toggle-list-view'),
- listViewToggleRef: getListViewToggleRef(),
- hasFixedToolbar: getSettings().hasFixedToolbar,
- showIconLabels: get('core', 'showIconLabels'),
- isDistractionFree: get('core', 'distractionFree')
+ postTypeObject: _postTypeObject,
+ resource: _resource,
+ cachedCanUserResolvers: getCachedResolvers()?.canUser,
+ userCanCreatePostType: canUser('create', _resource)
+ };
+ }, [postType]);
+ const trashPostActionForPostType = useTrashPostAction(resource);
+ const permanentlyDeletePostActionForPostType = usePermanentlyDeletePostAction(resource);
+ const renamePostActionForPostType = useRenamePostAction(resource);
+ const restorePostActionForPostType = useRestorePostAction(resource);
+ const isTemplateOrTemplatePart = [TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE].includes(postType);
+ const isPattern = postType === PATTERN_POST_TYPE;
+ const isLoaded = !!postTypeObject;
+ const supportsRevisions = !!postTypeObject?.supports?.revisions;
+ const supportsTitle = !!postTypeObject?.supports?.title;
+ return (0,external_wp_element_namespaceObject.useMemo)(() => {
+ if (!isLoaded) {
+ return [];
+ }
+ let actions = [postTypeObject?.viewable && viewPostAction, supportsRevisions && postRevisionsAction, false ? 0 : false, isTemplateOrTemplatePart && userCanCreatePostType && duplicateTemplatePartAction, isPattern && userCanCreatePostType && duplicatePatternAction, supportsTitle && renamePostActionForPostType, isPattern && exportPatternAsJSONAction, isTemplateOrTemplatePart ? resetTemplateAction : restorePostActionForPostType, isTemplateOrTemplatePart || isPattern ? deletePostAction : trashPostActionForPostType, !isTemplateOrTemplatePart && permanentlyDeletePostActionForPostType].filter(Boolean);
+ // Filter actions based on provided context. If not provided
+ // all actions are returned. We'll have a single entry for getting the actions
+ // and the consumer should provide the context to filter the actions, if needed.
+ // Actions should also provide the `context` they support, if it's specific, to
+ // compare with the provided context to get all the actions.
+ // Right now the only supported context is `list`.
+ actions = actions.filter(action => {
+ if (!action.context) {
+ return true;
+ }
+ return action.context === context;
+ });
+ if (onActionPerformed) {
+ for (let i = 0; i < actions.length; ++i) {
+ if (actions[i].callback) {
+ const existingCallback = actions[i].callback;
+ actions[i] = {
+ ...actions[i],
+ callback: (items, _onActionPerformed) => {
+ existingCallback(items, _items => {
+ if (_onActionPerformed) {
+ _onActionPerformed(_items);
+ }
+ onActionPerformed(actions[i].id, _items);
+ });
+ }
+ };
+ }
+ if (actions[i].RenderModal) {
+ const ExistingRenderModal = actions[i].RenderModal;
+ actions[i] = {
+ ...actions[i],
+ RenderModal: props => {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ExistingRenderModal, {
+ ...props,
+ onActionPerformed: _items => {
+ if (props.onActionPerformed) {
+ props.onActionPerformed(_items);
+ }
+ onActionPerformed(actions[i].id, _items);
+ }
+ });
+ }
+ };
+ }
+ }
+ }
+ return actions;
+ // We are making this use memo depend on cachedCanUserResolvers as a way to make the component using this hook re-render
+ // when user capabilities are resolved. This makes sure the isEligible functions of actions dependent on capabilities are re-evaluated.
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [isTemplateOrTemplatePart, isPattern, postTypeObject?.viewable, permanentlyDeletePostActionForPostType, restorePostActionForPostType, renamePostActionForPostType, trashPostActionForPostType, onActionPerformed, isLoaded, supportsRevisions, supportsTitle, context, userCanCreatePostType, cachedCanUserResolvers]);
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-actions/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+
+const {
+ DropdownMenuV2: DropdownMenu,
+ DropdownMenuGroupV2: DropdownMenuGroup,
+ DropdownMenuItemV2: DropdownMenuItem,
+ DropdownMenuItemLabelV2: DropdownMenuItemLabel,
+ kebabCase
+} = unlock(external_wp_components_namespaceObject.privateApis);
+function PostActions({
+ onActionPerformed,
+ buttonProps
+}) {
+ const [isActionsMenuOpen, setIsActionsMenuOpen] = (0,external_wp_element_namespaceObject.useState)(false);
+ const {
+ item,
+ postType
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getCurrentPostType,
+ getCurrentPostId
+ } = select(store_store);
+ const {
+ getEditedEntityRecord
+ } = select(external_wp_coreData_namespaceObject.store);
+ const _postType = getCurrentPostType();
+ return {
+ item: getEditedEntityRecord('postType', _postType, getCurrentPostId()),
+ postType: _postType
};
}, []);
- const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
- const isWideViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('wide');
- const blockToolbarCanBeFocused = useCanBlockToolbarBeFocused();
+ const allActions = usePostActions({
+ postType,
+ onActionPerformed
+ });
+ const actions = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ return allActions.filter(action => {
+ return !action.isEligible || action.isEligible(item);
+ });
+ }, [allActions, item]);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownMenu, {
+ open: isActionsMenuOpen,
+ trigger: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ size: "small",
+ icon: more_vertical,
+ label: (0,external_wp_i18n_namespaceObject.__)('Actions'),
+ disabled: !actions.length,
+ __experimentalIsFocusable: true,
+ className: "editor-all-actions-button",
+ onClick: () => setIsActionsMenuOpen(!isActionsMenuOpen),
+ ...buttonProps
+ }),
+ onOpenChange: setIsActionsMenuOpen,
+ placement: "bottom-end",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionsDropdownMenuGroup, {
+ actions: actions,
+ item: item,
+ onClose: () => {
+ setIsActionsMenuOpen(false);
+ }
+ })
+ });
+}
- /* translators: accessibility text for the editor toolbar */
- const toolbarAriaLabel = (0,external_wp_i18n_namespaceObject.__)('Document tools');
- const toggleListView = (0,external_wp_element_namespaceObject.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]);
- const toggleInserter = (0,external_wp_element_namespaceObject.useCallback)(() => {
- if (isInserterOpened) {
- // Focusing the inserter button should close the inserter popover.
- // However, there are some cases it won't close when the focus is lost.
- // See https://github.com/WordPress/gutenberg/issues/43090 for more details.
- inserterButton.current.focus();
- setIsInserterOpened(false);
- } else {
- setIsInserterOpened(true);
- }
- }, [isInserterOpened, setIsInserterOpened]);
+// From now on all the functions on this file are copied as from the dataviews packages,
+// The editor packages should not be using the dataviews packages directly,
+// and the dataviews package should not be using the editor packages directly,
+// so duplicating the code here seems like the least bad option.
- /* translators: button label text should, if possible, be under 16 characters. */
- const longLabel = (0,external_wp_i18n_namespaceObject._x)('Toggle block inserter', 'Generic label for block inserter button');
- const shortLabel = !isInserterOpened ? (0,external_wp_i18n_namespaceObject.__)('Add') : (0,external_wp_i18n_namespaceObject.__)('Close');
- return (
- // Some plugins expect and use the `edit-post-header-toolbar` CSS class to
- // find the toolbar and inject UI elements into it. This is not officially
- // supported, but we're keeping it in the list of class names for backwards
- // compatibility.
- (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.NavigableToolbar, {
- className: classnames_default()('editor-document-tools', 'edit-post-header-toolbar', className),
- "aria-label": toolbarAriaLabel,
- shouldUseKeyboardFocusShortcut: !blockToolbarCanBeFocused,
- variant: "unstyled"
- }, (0,external_React_.createElement)("div", {
- className: "editor-document-tools__left"
- }, !isDistractionFree && (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
- ref: inserterButton,
- as: external_wp_components_namespaceObject.Button,
- className: "editor-document-tools__inserter-toggle",
- variant: "primary",
- isPressed: isInserterOpened,
- onMouseDown: preventDefault,
- onClick: toggleInserter,
- disabled: disableBlockTools,
- icon: library_plus,
- label: showIconLabels ? shortLabel : longLabel,
- showTooltip: !showIconLabels,
- "aria-expanded": isInserterOpened
- }), (isWideViewport || !showIconLabels) && (0,external_React_.createElement)(external_React_.Fragment, null, isLargeViewport && !hasFixedToolbar && (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
- as: external_wp_blockEditor_namespaceObject.ToolSelector,
- showTooltip: !showIconLabels,
- variant: showIconLabels ? 'tertiary' : undefined,
- disabled: disableBlockTools,
- size: "compact"
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
- as: editor_history_undo,
- showTooltip: !showIconLabels,
- variant: showIconLabels ? 'tertiary' : undefined,
- size: "compact"
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
- as: editor_history_redo,
- showTooltip: !showIconLabels,
- variant: showIconLabels ? 'tertiary' : undefined,
- size: "compact"
- }), !isDistractionFree && (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
- as: external_wp_components_namespaceObject.Button,
- className: "editor-document-tools__document-overview-toggle",
- icon: list_view,
- disabled: disableBlockTools,
- isPressed: isListViewOpen
- /* translators: button label text should, if possible, be under 16 characters. */,
- label: listViewLabel,
- onClick: toggleListView,
- shortcut: listViewShortcut,
- showTooltip: !showIconLabels,
- variant: showIconLabels ? 'tertiary' : undefined,
- "aria-expanded": isListViewOpen,
- ref: listViewToggleRef,
- size: "compact"
- })), children))
- );
+// Copied as is from packages/dataviews/src/item-actions.js
+function DropdownMenuItemTrigger({
+ action,
+ onClick,
+ items
+}) {
+ const label = typeof action.label === 'string' ? action.label : action.label(items);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownMenuItem, {
+ onClick: onClick,
+ hideOnClick: !action.RenderModal,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownMenuItemLabel, {
+ children: label
+ })
+ });
}
-/* harmony default export */ const document_tools = (DocumentTools);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js
+// Copied as is from packages/dataviews/src/item-actions.js
+// With an added onClose prop.
+function ActionWithModal({
+ action,
+ item,
+ ActionTrigger,
+ onClose
+}) {
+ const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
+ const actionTriggerProps = {
+ action,
+ onClick: () => setIsModalOpen(true),
+ items: [item]
+ };
+ const {
+ RenderModal,
+ hideModalHeader
+ } = action;
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionTrigger, {
+ ...actionTriggerProps
+ }), isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, {
+ title: action.modalHeader || action.label,
+ __experimentalHideHeader: !!hideModalHeader,
+ onRequestClose: () => {
+ setIsModalOpen(false);
+ },
+ overlayClassName: `editor-action-modal editor-action-modal__${kebabCase(action.id)}`,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderModal, {
+ items: [item],
+ closeModal: () => {
+ setIsModalOpen(false);
+ onClose();
+ }
+ })
+ })]
+ });
+}
+
+// Copied as is from packages/dataviews/src/item-actions.js
+// With an added onClose prop.
+function ActionsDropdownMenuGroup({
+ actions,
+ item,
+ onClose
+}) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownMenuGroup, {
+ children: actions.map(action => {
+ if (action.RenderModal) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionWithModal, {
+ action: action,
+ item: item,
+ ActionTrigger: DropdownMenuItemTrigger,
+ onClose: onClose
+ }, action.id);
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownMenuItemTrigger, {
+ action: action,
+ onClick: () => action.callback([item]),
+ items: [item]
+ }, action.id);
+ })
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-card-panel/index.js
+/**
+ * External dependencies
+ */
/**
* WordPress dependencies
*/
-const close_close = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"
-}));
-/* harmony default export */ const library_close = (close_close);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/inserter-sidebar/index.js
+
+
+
/**
- * WordPress dependencies
+ * Internal dependencies
*/
+function PostCardPanel({
+ actions
+}) {
+ const {
+ isFrontPage,
+ isPostsPage,
+ title,
+ icon,
+ isSync
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getEditedPostAttribute,
+ getCurrentPostType,
+ getCurrentPostId,
+ __experimentalGetTemplateInfo
+ } = select(store_store);
+ const {
+ getEditedEntityRecord
+ } = select(external_wp_coreData_namespaceObject.store);
+ const siteSettings = getEditedEntityRecord('root', 'site');
+ const _type = getCurrentPostType();
+ const _id = getCurrentPostId();
+ const _record = getEditedEntityRecord('postType', _type, _id);
+ const _templateInfo = [TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE].includes(_type) && __experimentalGetTemplateInfo(_record);
+ let _isSync = false;
+ if (GLOBAL_POST_TYPES.includes(_type)) {
+ if (PATTERN_POST_TYPE === _type) {
+ // When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.
+ const currentSyncStatus = getEditedPostAttribute('meta')?.wp_pattern_sync_status === 'unsynced' ? 'unsynced' : getEditedPostAttribute('wp_pattern_sync_status');
+ _isSync = currentSyncStatus !== 'unsynced';
+ } else {
+ _isSync = true;
+ }
+ }
+ return {
+ title: _templateInfo?.title || getEditedPostAttribute('title'),
+ icon: unlock(select(store_store)).getPostIcon(_type, {
+ area: _record?.area
+ }),
+ isSync: _isSync,
+ isFrontPage: siteSettings?.page_on_front === _id,
+ isPostsPage: siteSettings?.page_for_posts === _id
+ };
+ }, []);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "editor-post-card-panel",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ spacing: 2,
+ className: "editor-post-card-panel__header",
+ align: "flex-start",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, {
+ className: dist_clsx('editor-post-card-panel__icon', {
+ 'is-sync': isSync
+ }),
+ icon: icon
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalText, {
+ numberOfLines: 2,
+ truncate: true,
+ className: "editor-post-card-panel__title",
+ weight: 500,
+ as: "h2",
+ lineHeight: "20px",
+ children: [title ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title) : (0,external_wp_i18n_namespaceObject.__)('No Title'), isFrontPage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "editor-post-card-panel__title-badge",
+ children: (0,external_wp_i18n_namespaceObject.__)('Front Page')
+ }), isPostsPage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "editor-post-card-panel__title-badge",
+ children: (0,external_wp_i18n_namespaceObject.__)('Posts Page')
+ })]
+ }), actions]
+ })
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-content-information/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
@@ -16007,66 +26364,70 @@ const close_close = (0,external_React_.createElement)(external_wp_primitives_nam
*/
-function InserterSidebar() {
+
+// Taken from packages/editor/src/components/time-to-read/index.js.
+
+const post_content_information_AVERAGE_READING_RATE = 189;
+
+// This component renders the wordcount and reading time for the post.
+function PostContentInformation() {
const {
- insertionPoint,
- showMostUsedBlocks
+ postContent
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
- getInsertionPoint
- } = unlock(select(store_store));
+ getEditedPostAttribute,
+ getCurrentPostType,
+ getCurrentPostId
+ } = select(store_store);
const {
- get
- } = select(external_wp_preferences_namespaceObject.store);
+ getEntityRecord
+ } = select(external_wp_coreData_namespaceObject.store);
+ const siteSettings = getEntityRecord('root', 'site');
+ const postType = getCurrentPostType();
+ const _id = getCurrentPostId();
+ const isPostsPage = +_id === siteSettings?.page_for_posts;
+ const showPostContentInfo = !isPostsPage && ![TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE].includes(postType);
return {
- insertionPoint: getInsertionPoint(),
- showMostUsedBlocks: get('core', 'mostUsedBlocks')
+ postContent: showPostContentInfo && getEditedPostAttribute('content')
};
}, []);
- const {
- setIsInserterOpened
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
- const TagName = !isMobileViewport ? external_wp_components_namespaceObject.VisuallyHidden : 'div';
- const [inserterDialogRef, inserterDialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({
- onClose: () => setIsInserterOpened(false),
- focusOnMount: null
+
+ /*
+ * translators: If your word count is based on single characters (e.g. East Asian characters),
+ * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
+ * Do not translate into your own language.
+ */
+ const wordCountType = (0,external_wp_i18n_namespaceObject._x)('words', 'Word count type. Do not translate!');
+ const wordsCounted = (0,external_wp_element_namespaceObject.useMemo)(() => postContent ? (0,external_wp_wordcount_namespaceObject.count)(postContent, wordCountType) : 0, [postContent, wordCountType]);
+ if (!wordsCounted) {
+ return null;
+ }
+ const readingTime = Math.round(wordsCounted / post_content_information_AVERAGE_READING_RATE);
+ const wordsCountText = (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: the number of words in the post.
+ (0,external_wp_i18n_namespaceObject._n)('%s word', '%s words', wordsCounted), wordsCounted.toLocaleString());
+ const minutesText = readingTime <= 1 ? (0,external_wp_i18n_namespaceObject.__)('1 minute') : (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: the number of minutes to read the post.
+ (0,external_wp_i18n_namespaceObject._n)('%s minute', '%s minutes', readingTime), readingTime.toLocaleString());
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "editor-post-content-information",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ children: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: How many words a post has. 2: the number of minutes to read the post (e.g. 130 words, 2 minutes read time.) */
+ (0,external_wp_i18n_namespaceObject.__)('%1$s, %2$s read time.'), wordsCountText, minutesText)
+ })
});
- const libraryRef = (0,external_wp_element_namespaceObject.useRef)();
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- libraryRef.current.focusSearch();
- }, []);
- return (0,external_React_.createElement)("div", {
- ref: inserterDialogRef,
- ...inserterDialogProps,
- className: "editor-inserter-sidebar"
- }, (0,external_React_.createElement)(TagName, {
- className: "editor-inserter-sidebar__header"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- icon: library_close,
- label: (0,external_wp_i18n_namespaceObject.__)('Close block inserter'),
- onClick: () => setIsInserterOpened(false)
- })), (0,external_React_.createElement)("div", {
- className: "editor-inserter-sidebar__content"
- }, (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLibrary, {
- showMostUsedBlocks: showMostUsedBlocks,
- showInserterHelpPanel: true,
- shouldFocusBlock: isMobileViewport,
- rootClientId: insertionPoint.rootClientId,
- __experimentalInsertionIndex: insertionPoint.insertionIndex,
- __experimentalFilterValue: insertionPoint.filterValue,
- ref: libraryRef
- })));
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/list-view-sidebar/list-view-outline.js
-
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-format/panel.js
/**
* WordPress dependencies
*/
+
+
+
/**
* Internal dependencies
*/
@@ -16074,19 +26435,132 @@ function InserterSidebar() {
-function ListViewOutline() {
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("div", {
- className: "editor-list-view-sidebar__outline"
- }, (0,external_React_.createElement)("div", null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, null, (0,external_wp_i18n_namespaceObject.__)('Characters:')), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, null, (0,external_React_.createElement)(CharacterCount, null))), (0,external_React_.createElement)("div", null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, null, (0,external_wp_i18n_namespaceObject.__)('Words:')), (0,external_React_.createElement)(WordCount, null)), (0,external_React_.createElement)("div", null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, null, (0,external_wp_i18n_namespaceObject.__)('Time to read:')), (0,external_React_.createElement)(TimeToRead, null))), (0,external_React_.createElement)(document_outline, null));
+
+/**
+ * Renders the Post Author Panel component.
+ *
+ * @return {Component} The component to be rendered.
+ */
+
+
+function panel_PostFormat() {
+ const {
+ postFormat
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getEditedPostAttribute
+ } = select(store_store);
+ const _postFormat = getEditedPostAttribute('format');
+ return {
+ postFormat: _postFormat !== null && _postFormat !== void 0 ? _postFormat : 'standard'
+ };
+ }, []);
+ const activeFormat = POST_FORMATS.find(format => format.id === postFormat);
+
+ // Use internal state instead of a ref to make sure that the component
+ // re-renders when the popover's anchor updates.
+ const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
+ // Memoize popoverProps to avoid returning a new object every time.
+ const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
+ // Anchor the popover to the middle of the entire row so that it doesn't
+ // move around when the label changes.
+ anchor: popoverAnchor,
+ placement: 'left-start',
+ offset: 36,
+ shift: true
+ }), [popoverAnchor]);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_format_check, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Format'),
+ ref: setPopoverAnchor,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
+ popoverProps: popoverProps,
+ contentClassName: "editor-post-format__dialog",
+ focusOnMount: true,
+ renderToggle: ({
+ isOpen,
+ onToggle
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ size: "compact",
+ variant: "tertiary",
+ "aria-expanded": isOpen,
+ "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: Current post format.
+ (0,external_wp_i18n_namespaceObject.__)('Change format: %s'), activeFormat?.caption),
+ onClick: onToggle,
+ children: activeFormat?.caption
+ }),
+ renderContent: ({
+ onClose
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "editor-post-format__dialog-content",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Format'),
+ onClose: onClose
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostFormat, {})]
+ })
+ })
+ })
+ });
}
+/* harmony default export */ const post_format_panel = (panel_PostFormat);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-edited-panel/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+function PostLastEditedPanel() {
+ const modified = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('modified'), []);
+ const lastEditedText = modified && (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: Human-readable time difference, e.g. "2 days ago".
+ (0,external_wp_i18n_namespaceObject.__)('Last edited %s.'), (0,external_wp_date_namespaceObject.humanTimeDiff)(modified));
+ if (!lastEditedText) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "editor-post-last-edited-panel",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ children: lastEditedText
+ })
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-panel-section/index.js
+/**
+ * External dependencies
+ */
-;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/list-view-sidebar/index.js
/**
* WordPress dependencies
*/
+function PostPanelSection({
+ className,
+ children
+}) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, {
+ className: dist_clsx('editor-post-panel__section', className),
+ children: children
+ });
+}
+/* harmony default export */ const post_panel_section = (PostPanelSection);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/blog-title/index.js
+/**
+ * WordPress dependencies
+ */
@@ -16102,151 +26576,582 @@ function ListViewOutline() {
-const {
- Tabs
-} = unlock(external_wp_components_namespaceObject.privateApis);
-function ListViewSidebar() {
+
+
+
+const blog_title_EMPTY_OBJECT = {};
+function BlogTitle() {
const {
- setIsListViewOpened
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
+ editEntityRecord
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
const {
- getListViewToggleRef
- } = unlock((0,external_wp_data_namespaceObject.useSelect)(store_store));
+ postsPageTitle,
+ postsPageId,
+ isTemplate,
+ postSlug
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getEntityRecord,
+ getEditedEntityRecord
+ } = select(external_wp_coreData_namespaceObject.store);
+ const siteSettings = getEntityRecord('root', 'site');
+ const _postsPageRecord = siteSettings?.page_for_posts ? getEditedEntityRecord('postType', 'page', siteSettings?.page_for_posts) : blog_title_EMPTY_OBJECT;
+ const {
+ getEditedPostAttribute,
+ getCurrentPostType
+ } = select(store_store);
+ return {
+ postsPageId: _postsPageRecord?.id,
+ postsPageTitle: _postsPageRecord?.title,
+ isTemplate: getCurrentPostType() === TEMPLATE_POST_TYPE,
+ postSlug: getEditedPostAttribute('slug')
+ };
+ }, []);
+ // Use internal state instead of a ref to make sure that the component
+ // re-renders when the popover's anchor updates.
+ const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
+ // Memoize popoverProps to avoid returning a new object every time.
+ const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
+ // Anchor the popover to the middle of the entire row so that it doesn't
+ // move around when the label changes.
+ anchor: popoverAnchor,
+ placement: 'left-start',
+ offset: 36,
+ shift: true
+ }), [popoverAnchor]);
+ if (!isTemplate || !['home', 'index'].includes(postSlug) || !postsPageId) {
+ return null;
+ }
+ const setPostsPageTitle = newValue => {
+ editEntityRecord('postType', 'page', postsPageId, {
+ title: newValue
+ });
+ };
+ const decodedTitle = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(postsPageTitle);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Blog title'),
+ ref: setPopoverAnchor,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
+ popoverProps: popoverProps,
+ contentClassName: "editor-blog-title-dropdown__content",
+ focusOnMount: true,
+ renderToggle: ({
+ isOpen,
+ onToggle
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ size: "compact",
+ variant: "tertiary",
+ "aria-expanded": isOpen,
+ "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: Current post link.
+ (0,external_wp_i18n_namespaceObject.__)('Change blog title: %s'), decodedTitle),
+ onClick: onToggle,
+ children: decodedTitle
+ }),
+ renderContent: ({
+ onClose
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Blog title'),
+ onClose: onClose
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, {
+ placeholder: (0,external_wp_i18n_namespaceObject.__)('No Title'),
+ size: "__unstable-large",
+ value: postsPageTitle,
+ onChange: (0,external_wp_compose_namespaceObject.debounce)(setPostsPageTitle, 300),
+ label: (0,external_wp_i18n_namespaceObject.__)('Blog title'),
+ help: (0,external_wp_i18n_namespaceObject.__)('Set the Posts Page title. Appears in search results, and when the page is shared on social media.'),
+ hideLabelFromVision: true
+ })]
+ })
+ })
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/posts-per-page/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
- // This hook handles focus when the sidebar first renders.
- const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)('firstElement');
- // When closing the list view, focus should return to the toggle button.
- const closeListView = (0,external_wp_element_namespaceObject.useCallback)(() => {
- setIsListViewOpened(false);
- getListViewToggleRef().current?.focus();
- }, [getListViewToggleRef, setIsListViewOpened]);
- const closeOnEscape = (0,external_wp_element_namespaceObject.useCallback)(event => {
- if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) {
- event.preventDefault();
- closeListView();
- }
- }, [closeListView]);
+
+function PostsPerPage() {
+ const {
+ editEntityRecord
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
+ const {
+ postsPerPage,
+ isTemplate,
+ postSlug
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getEditedPostAttribute,
+ getCurrentPostType
+ } = select(store_store);
+ const {
+ getEditedEntityRecord
+ } = select(external_wp_coreData_namespaceObject.store);
+ const siteSettings = getEditedEntityRecord('root', 'site');
+ return {
+ isTemplate: getCurrentPostType() === TEMPLATE_POST_TYPE,
+ postSlug: getEditedPostAttribute('slug'),
+ postsPerPage: siteSettings?.posts_per_page || 1
+ };
+ }, []);
// Use internal state instead of a ref to make sure that the component
- // re-renders when the dropZoneElement updates.
- const [dropZoneElement, setDropZoneElement] = (0,external_wp_element_namespaceObject.useState)(null);
- // Tracks our current tab.
- const [tab, setTab] = (0,external_wp_element_namespaceObject.useState)('list-view');
+ // re-renders when the popover's anchor updates.
+ const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
+ // Memoize popoverProps to avoid returning a new object every time.
+ const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
+ // Anchor the popover to the middle of the entire row so that it doesn't
+ // move around when the label changes.
+ anchor: popoverAnchor,
+ placement: 'left-start',
+ offset: 36,
+ shift: true
+ }), [popoverAnchor]);
+ if (!isTemplate || !['home', 'index'].includes(postSlug)) {
+ return null;
+ }
+ const setPostsPerPage = newValue => {
+ editEntityRecord('root', 'site', undefined, {
+ posts_per_page: newValue
+ });
+ };
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Posts per page'),
+ ref: setPopoverAnchor,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
+ popoverProps: popoverProps,
+ contentClassName: "editor-posts-per-page-dropdown__content",
+ focusOnMount: true,
+ renderToggle: ({
+ isOpen,
+ onToggle
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ size: "compact",
+ variant: "tertiary",
+ "aria-expanded": isOpen,
+ "aria-label": (0,external_wp_i18n_namespaceObject.__)('Change posts per page'),
+ onClick: onToggle,
+ children: postsPerPage
+ }),
+ renderContent: ({
+ onClose
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Posts per page'),
+ onClose: onClose
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, {
+ placeholder: 0,
+ value: postsPerPage,
+ size: "__unstable-large",
+ spinControls: "custom",
+ step: "1",
+ min: "1",
+ onChange: setPostsPerPage,
+ label: (0,external_wp_i18n_namespaceObject.__)('Posts per page'),
+ help: (0,external_wp_i18n_namespaceObject.__)('Set the default number of posts to display on blog pages, including categories and tags. Some templates may override this setting.'),
+ hideLabelFromVision: true
+ })]
+ })
+ })
+ });
+}
- // This ref refers to the sidebar as a whole.
- const sidebarRef = (0,external_wp_element_namespaceObject.useRef)();
- // This ref refers to the tab panel.
- const tabsRef = (0,external_wp_element_namespaceObject.useRef)();
- // This ref refers to the list view application area.
- const listViewRef = (0,external_wp_element_namespaceObject.useRef)();
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/site-discussion/index.js
+/**
+ * WordPress dependencies
+ */
- // Must merge the refs together so focus can be handled properly in the next function.
- const listViewContainerRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([focusOnMountRef, listViewRef, setDropZoneElement]);
- /*
- * Callback function to handle list view or outline focus.
- *
- * @param {string} currentTab The current tab. Either list view or outline.
- *
- * @return void
- */
- function handleSidebarFocus(currentTab) {
- // Tab panel focus.
- const tabPanelFocus = external_wp_dom_namespaceObject.focus.tabbable.find(tabsRef.current)[0];
- // List view tab is selected.
- if (currentTab === 'list-view') {
- // Either focus the list view or the tab panel. Must have a fallback because the list view does not render when there are no blocks.
- const listViewApplicationFocus = external_wp_dom_namespaceObject.focus.tabbable.find(listViewRef.current)[0];
- const listViewFocusArea = sidebarRef.current.contains(listViewApplicationFocus) ? listViewApplicationFocus : tabPanelFocus;
- listViewFocusArea.focus();
- // Outline tab is selected.
- } else {
- tabPanelFocus.focus();
- }
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+
+const site_discussion_COMMENT_OPTIONS = [{
+ label: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [(0,external_wp_i18n_namespaceObject.__)('Open'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ variant: "muted",
+ size: 12,
+ children: (0,external_wp_i18n_namespaceObject.__)('Visitors can add new comments and replies.')
+ })]
+ }),
+ value: 'open'
+}, {
+ label: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [(0,external_wp_i18n_namespaceObject.__)('Closed'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ variant: "muted",
+ size: 12,
+ children: (0,external_wp_i18n_namespaceObject.__)('Visitors cannot add new comments or replies.')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ variant: "muted",
+ size: 12,
+ children: (0,external_wp_i18n_namespaceObject.__)('Existing comments remain visible.')
+ })]
+ }),
+ value: ''
+}];
+function SiteDiscussion() {
+ const {
+ editEntityRecord
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
+ const {
+ allowCommentsOnNewPosts,
+ isTemplate,
+ postSlug
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getEditedPostAttribute,
+ getCurrentPostType
+ } = select(store_store);
+ const {
+ getEditedEntityRecord
+ } = select(external_wp_coreData_namespaceObject.store);
+ const siteSettings = getEditedEntityRecord('root', 'site');
+ return {
+ isTemplate: getCurrentPostType() === TEMPLATE_POST_TYPE,
+ postSlug: getEditedPostAttribute('slug'),
+ allowCommentsOnNewPosts: siteSettings?.default_comment_status || ''
+ };
+ }, []);
+ // Use internal state instead of a ref to make sure that the component
+ // re-renders when the popover's anchor updates.
+ const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
+ // Memoize popoverProps to avoid returning a new object every time.
+ const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
+ // Anchor the popover to the middle of the entire row so that it doesn't
+ // move around when the label changes.
+ anchor: popoverAnchor,
+ placement: 'left-start',
+ offset: 36,
+ shift: true
+ }), [popoverAnchor]);
+ if (!isTemplate || !['home', 'index'].includes(postSlug)) {
+ return null;
}
- const handleToggleListViewShortcut = (0,external_wp_element_namespaceObject.useCallback)(() => {
- // If the sidebar has focus, it is safe to close.
- if (sidebarRef.current.contains(sidebarRef.current.ownerDocument.activeElement)) {
- closeListView();
- } else {
- // If the list view or outline does not have focus, focus should be moved to it.
- handleSidebarFocus(tab);
- }
- }, [closeListView, tab]);
+ const setAllowCommentsOnNewPosts = newValue => {
+ editEntityRecord('root', 'site', undefined, {
+ default_comment_status: newValue ? 'open' : null
+ });
+ };
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Discussion'),
+ ref: setPopoverAnchor,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
+ popoverProps: popoverProps,
+ contentClassName: "editor-site-discussion-dropdown__content",
+ focusOnMount: true,
+ renderToggle: ({
+ isOpen,
+ onToggle
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ size: "compact",
+ variant: "tertiary",
+ "aria-expanded": isOpen,
+ "aria-label": (0,external_wp_i18n_namespaceObject.__)('Change discussion settings'),
+ onClick: onToggle,
+ children: allowCommentsOnNewPosts ? (0,external_wp_i18n_namespaceObject.__)('Comments open') : (0,external_wp_i18n_namespaceObject.__)('Comments closed')
+ }),
+ renderContent: ({
+ onClose
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Discussion'),
+ onClose: onClose
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 3,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ children: (0,external_wp_i18n_namespaceObject.__)('Changes will apply to new posts only. Individual posts may override these settings.')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RadioControl, {
+ className: "editor-site-discussion__options",
+ hideLabelFromVision: true,
+ label: (0,external_wp_i18n_namespaceObject.__)('Comment status'),
+ options: site_discussion_COMMENT_OPTIONS,
+ onChange: setAllowCommentsOnNewPosts,
+ selected: allowCommentsOnNewPosts
+ })]
+ })]
+ })
+ })
+ });
+}
- // This only fires when the sidebar is open because of the conditional rendering.
- // It is the same shortcut to open but that is defined as a global shortcut and only fires when the sidebar is closed.
- (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/toggle-list-view', handleToggleListViewShortcut);
- return (
- // eslint-disable-next-line jsx-a11y/no-static-element-interactions
- (0,external_React_.createElement)("div", {
- className: "editor-list-view-sidebar",
- onKeyDown: closeOnEscape,
- ref: sidebarRef
- }, (0,external_React_.createElement)(Tabs, {
- onSelect: tabName => setTab(tabName),
- selectOnMove: false
- // The initial tab value is set explicitly to avoid an initial
- // render where no tab is selected. This ensures that the
- // tabpanel height is correct so the relevant scroll container
- // can be rendered internally.
- ,
- initialTabId: "list-view"
- }, (0,external_React_.createElement)("div", {
- className: "edit-post-editor__document-overview-panel__header"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- className: "editor-list-view-sidebar__close-button",
- icon: close_small,
- label: (0,external_wp_i18n_namespaceObject.__)('Close'),
- onClick: closeListView
- }), (0,external_React_.createElement)(Tabs.TabList, {
- className: "editor-list-view-sidebar__tabs-tablist",
- ref: tabsRef
- }, (0,external_React_.createElement)(Tabs.Tab, {
- className: "editor-list-view-sidebar__tabs-tab",
- tabId: "list-view"
- }, (0,external_wp_i18n_namespaceObject._x)('List View', 'Post overview')), (0,external_React_.createElement)(Tabs.Tab, {
- className: "editor-list-view-sidebar__tabs-tab",
- tabId: "outline"
- }, (0,external_wp_i18n_namespaceObject._x)('Outline', 'Post overview')))), (0,external_React_.createElement)(Tabs.TabPanel, {
- ref: listViewContainerRef,
- className: "editor-list-view-sidebar__tabs-tabpanel",
- tabId: "list-view",
- focusable: false
- }, (0,external_React_.createElement)("div", {
- className: "editor-list-view-sidebar__list-view-container"
- }, (0,external_React_.createElement)("div", {
- className: "editor-list-view-sidebar__list-view-panel-content"
- }, (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.__experimentalListView, {
- dropZoneElement: dropZoneElement
- })))), (0,external_React_.createElement)(Tabs.TabPanel, {
- className: "editor-list-view-sidebar__tabs-tabpanel",
- tabId: "outline",
- focusable: false
- }, (0,external_React_.createElement)("div", {
- className: "editor-list-view-sidebar__list-view-container"
- }, (0,external_React_.createElement)(ListViewOutline, null)))))
- );
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/template-areas/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+function TemplateAreaItem({
+ area,
+ clientId
+}) {
+ const {
+ selectBlock,
+ toggleBlockHighlight
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
+ const templatePartArea = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const defaultAreas = select(store_store).__experimentalGetDefaultTemplatePartAreas();
+ return defaultAreas.find(defaultArea => defaultArea.area === area);
+ }, [area]);
+ const highlightBlock = () => toggleBlockHighlight(clientId, true);
+ const cancelHighlightBlock = () => toggleBlockHighlight(clientId, false);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ className: "editor-template-areas__item",
+ icon: templatePartArea?.icon,
+ onMouseOver: highlightBlock,
+ onMouseLeave: cancelHighlightBlock,
+ onFocus: highlightBlock,
+ onBlur: cancelHighlightBlock,
+ onClick: () => {
+ selectBlock(clientId);
+ },
+ children: templatePartArea?.label
+ });
+}
+function TemplateAreas() {
+ const {
+ isTemplate,
+ templateParts
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const _isTemplate = select(store_store).getCurrentPostType() === TEMPLATE_POST_TYPE;
+ return {
+ isTemplate: _isTemplate,
+ templateParts: _isTemplate && unlock(select(store_store)).getCurrentTemplateTemplateParts()
+ };
+ }, []);
+ if (!isTemplate || !templateParts.length) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("section", {
+ className: "editor-template-areas",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, {
+ level: 3,
+ className: "editor-template-areas__title",
+ children: (0,external_wp_i18n_namespaceObject.__)('Areas')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", {
+ className: "editor-template-areas__list",
+ children: templateParts.map(({
+ templatePart,
+ block
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateAreaItem, {
+ area: templatePart.area,
+ clientId: block.clientId
+ })
+ }, block.clientId))
+ })]
+ });
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/sidebar/post-summary.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/**
+ * Module Constants
+ */
+
+
+
+const post_summary_PANEL_NAME = 'post-status';
+function PostSummary({
+ onActionPerformed
+}) {
+ const {
+ isRemovedPostStatusPanel
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ // We use isEditorPanelRemoved to hide the panel if it was programatically removed. We do
+ // not use isEditorPanelEnabled since this panel should not be disabled through the UI.
+ const {
+ isEditorPanelRemoved,
+ getCurrentPostType
+ } = select(store_store);
+ return {
+ isRemovedPostStatusPanel: isEditorPanelRemoved(post_summary_PANEL_NAME),
+ postType: getCurrentPostType()
+ };
+ }, []);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_section, {
+ className: "editor-post-summary",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_post_status_info.Slot, {
+ children: fills => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 4,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostCardPanel, {
+ actions: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostActions, {
+ onActionPerformed: onActionPerformed
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostFeaturedImagePanel, {
+ withPanelBody: false
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivatePostExcerptPanel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 1,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostContentInformation, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostLastEditedPanel, {})]
+ }), !isRemovedPostStatusPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 2,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 1,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostStatus, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSchedulePanel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostURLPanel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(panel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTemplatePanel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostDiscussionPanel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivatePostLastRevision, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageAttributesPanel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSyncStatus, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlogTitle, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostsPerPage, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SiteDiscussion, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_format_panel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSticky, {})]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateAreas, {}), fills]
+ })]
+ })
+ })
+ })
+ });
+}
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-transform-panel/hooks.js
/**
* WordPress dependencies
*/
-const external = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"
-}));
-/* harmony default export */ const library_external = (external);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-view-link/index.js
+
+
+
/**
+ * Internal dependencies
+ */
+
+
+const {
+ EXCLUDED_PATTERN_SOURCES,
+ PATTERN_TYPES: hooks_PATTERN_TYPES
+} = unlock(external_wp_patterns_namespaceObject.privateApis);
+function injectThemeAttributeInBlockTemplateContent(block, currentThemeStylesheet) {
+ block.innerBlocks = block.innerBlocks.map(innerBlock => {
+ return injectThemeAttributeInBlockTemplateContent(innerBlock, currentThemeStylesheet);
+ });
+ if (block.name === 'core/template-part' && block.attributes.theme === undefined) {
+ block.attributes.theme = currentThemeStylesheet;
+ }
+ return block;
+}
+
+/**
+ * Filter all patterns and return only the ones that are compatible with the current template.
+ *
+ * @param {Array} patterns An array of patterns.
+ * @param {Object} template The current template.
+ * @return {Array} Array of patterns that are compatible with the current template.
+ */
+function filterPatterns(patterns, template) {
+ // Filter out duplicates.
+ const filterOutDuplicatesByName = (currentItem, index, items) => index === items.findIndex(item => currentItem.name === item.name);
+
+ // Filter out core/directory patterns not included in theme.json.
+ const filterOutExcludedPatternSources = pattern => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source);
+
+ // Looks for patterns that have the same template type as the current template,
+ // or have a block type that matches the current template area.
+ const filterCompatiblePatterns = pattern => pattern.templateTypes?.includes(template.slug) || pattern.blockTypes?.includes('core/template-part/' + template.area);
+ return patterns.filter((pattern, index, items) => {
+ return filterOutDuplicatesByName(pattern, index, items) && filterOutExcludedPatternSources(pattern) && filterCompatiblePatterns(pattern);
+ });
+}
+function preparePatterns(patterns, currentThemeStylesheet) {
+ return patterns.map(pattern => ({
+ ...pattern,
+ keywords: pattern.keywords || [],
+ type: hooks_PATTERN_TYPES.theme,
+ blocks: (0,external_wp_blocks_namespaceObject.parse)(pattern.content, {
+ __unstableSkipMigrationLogs: true
+ }).map(block => injectThemeAttributeInBlockTemplateContent(block, currentThemeStylesheet))
+ }));
+}
+function useAvailablePatterns(template) {
+ const {
+ blockPatterns,
+ restBlockPatterns,
+ currentThemeStylesheet
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ var _settings$__experimen;
+ const {
+ getEditorSettings
+ } = select(store_store);
+ const settings = getEditorSettings();
+ return {
+ blockPatterns: (_settings$__experimen = settings.__experimentalAdditionalBlockPatterns) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : settings.__experimentalBlockPatterns,
+ restBlockPatterns: select(external_wp_coreData_namespaceObject.store).getBlockPatterns(),
+ currentThemeStylesheet: select(external_wp_coreData_namespaceObject.store).getCurrentTheme().stylesheet
+ };
+ }, []);
+ return (0,external_wp_element_namespaceObject.useMemo)(() => {
+ const mergedPatterns = [...(blockPatterns || []), ...(restBlockPatterns || [])];
+ const filteredPatterns = filterPatterns(mergedPatterns, template);
+ return preparePatterns(filteredPatterns, template, currentThemeStylesheet);
+ }, [blockPatterns, restBlockPatterns, template, currentThemeStylesheet]);
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-transform-panel/index.js
+/**
* WordPress dependencies
*/
@@ -16256,91 +27161,229 @@ const external = (0,external_React_.createElement)(external_wp_primitives_namesp
+
/**
* Internal dependencies
*/
-function PostViewLink() {
+
+
+
+function post_transform_panel_TemplatesList({
+ availableTemplates,
+ onSelect
+}) {
+ const shownTemplates = (0,external_wp_compose_namespaceObject.useAsyncList)(availableTemplates);
+ if (!availableTemplates || availableTemplates?.length === 0) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Templates'),
+ blockPatterns: availableTemplates,
+ shownPatterns: shownTemplates,
+ onClickPattern: onSelect,
+ showTitlesAsTooltip: true
+ });
+}
+function PostTransform() {
const {
- hasLoaded,
- permalink,
- isPublished,
- label,
- showIconLabels
+ record,
+ postType,
+ postId
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
- // Grab post type to retrieve the view_item label.
- const postTypeSlug = select(store_store).getCurrentPostType();
- const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug);
const {
- get
- } = select(external_wp_preferences_namespaceObject.store);
+ getCurrentPostType,
+ getCurrentPostId
+ } = select(store_store);
+ const {
+ getEditedEntityRecord
+ } = select(external_wp_coreData_namespaceObject.store);
+ const type = getCurrentPostType();
+ const id = getCurrentPostId();
return {
- permalink: select(store_store).getPermalink(),
- isPublished: select(store_store).isCurrentPostPublished(),
- label: postType?.labels.view_item,
- hasLoaded: !!postType,
- showIconLabels: get('core', 'showIconLabels')
+ postType: type,
+ postId: id,
+ record: getEditedEntityRecord('postType', type, id)
};
}, []);
-
- // Only render the view button if the post is published and has a permalink.
- if (!isPublished || !permalink || !hasLoaded) {
+ const {
+ editEntityRecord
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
+ const availablePatterns = useAvailablePatterns(record);
+ const onTemplateSelect = async selectedTemplate => {
+ await editEntityRecord('postType', postType, postId, {
+ blocks: selectedTemplate.blocks,
+ content: (0,external_wp_blocks_namespaceObject.serialize)(selectedTemplate.blocks)
+ });
+ };
+ if (!availablePatterns?.length) {
return null;
}
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- icon: library_external,
- label: label || (0,external_wp_i18n_namespaceObject.__)('View post'),
- href: permalink,
- target: "_blank",
- showTooltip: !showIconLabels
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Design'),
+ initialOpen: record.type === TEMPLATE_PART_POST_TYPE,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_transform_panel_TemplatesList, {
+ availableTemplates: availablePatterns,
+ onSelect: onTemplateSelect
+ })
});
}
+function PostTransformPanel() {
+ const {
+ postType
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getCurrentPostType
+ } = select(store_store);
+ return {
+ postType: getCurrentPostType()
+ };
+ }, []);
+ if (![TEMPLATE_PART_POST_TYPE, TEMPLATE_POST_TYPE].includes(postType)) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTransform, {});
+}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/mobile.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/sidebar/constants.js
+const sidebars = {
+ document: 'edit-post/document',
+ block: 'edit-post/block'
+};
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/sidebar/header.js
/**
* WordPress dependencies
*/
-const mobile = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M15 4H9c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h6c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H9c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h6c.3 0 .5.2.5.5v12zm-4.5-.5h2V16h-2v1.5z"
-}));
-/* harmony default export */ const library_mobile = (mobile);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/tablet.js
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+const {
+ Tabs: header_Tabs
+} = unlock(external_wp_components_namespaceObject.privateApis);
+const SidebarHeader = (_, ref) => {
+ const {
+ documentLabel
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getPostTypeLabel
+ } = select(store_store);
+ return {
+ // translators: Default label for the Document sidebar tab, not selected.
+ documentLabel: getPostTypeLabel() || (0,external_wp_i18n_namespaceObject._x)('Document', 'noun')
+ };
+ }, []);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(header_Tabs.TabList, {
+ ref: ref,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header_Tabs.Tab, {
+ tabId: sidebars.document
+ // Used for focus management in the SettingsSidebar component.
+ ,
+ "data-tab-id": sidebars.document,
+ children: documentLabel
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header_Tabs.Tab, {
+ tabId: sidebars.block
+ // Used for focus management in the SettingsSidebar component.
+ ,
+ "data-tab-id": sidebars.block,
+ children: (0,external_wp_i18n_namespaceObject.__)('Block')
+ })]
+ });
+};
+/* harmony default export */ const sidebar_header = ((0,external_wp_element_namespaceObject.forwardRef)(SidebarHeader));
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/template-content-panel/index.js
/**
* WordPress dependencies
*/
-const tablet = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M17 4H7c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H7c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h10c.3 0 .5.2.5.5v12zm-7.5-.5h4V16h-4v1.5z"
-}));
-/* harmony default export */ const library_tablet = (tablet);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/desktop.js
+
+
+/**
+ * Internal dependencies
+ */
+
+
+const {
+ BlockQuickNavigation
+} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
+const PAGE_CONTENT_BLOCKS = ['core/post-content', 'core/post-featured-image', 'core/post-title'];
+function TemplateContentPanel() {
+ const clientIds = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getBlocksByName
+ } = select(external_wp_blockEditor_namespaceObject.store);
+ return getBlocksByName(PAGE_CONTENT_BLOCKS);
+ }, []);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Content'),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockQuickNavigation, {
+ clientIds: clientIds
+ })
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/use-auto-switch-editor-sidebars.js
/**
* WordPress dependencies
*/
-const desktop = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M20.5 16h-.7V8c0-1.1-.9-2-2-2H6.2c-1.1 0-2 .9-2 2v8h-.7c-.8 0-1.5.7-1.5 1.5h20c0-.8-.7-1.5-1.5-1.5zM5.7 8c0-.3.2-.5.5-.5h11.6c.3 0 .5.2.5.5v7.6H5.7V8z"
-}));
-/* harmony default export */ const library_desktop = (desktop);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/preview-dropdown/index.js
+
+
+
/**
+ * This listener hook monitors for block selection and triggers the appropriate
+ * sidebar state.
+ */
+function useAutoSwitchEditorSidebars() {
+ const {
+ hasBlockSelection
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ return {
+ hasBlockSelection: !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart()
+ };
+ }, []);
+ const {
+ getActiveComplementaryArea
+ } = (0,external_wp_data_namespaceObject.useSelect)(store);
+ const {
+ enableComplementaryArea
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
+ const {
+ get: getPreference
+ } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_preferences_namespaceObject.store);
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
+ const activeGeneralSidebar = getActiveComplementaryArea('core');
+ const isEditorSidebarOpened = ['edit-post/document', 'edit-post/block'].includes(activeGeneralSidebar);
+ const isDistractionFree = getPreference('core', 'distractionFree');
+ if (!isEditorSidebarOpened || isDistractionFree) {
+ return;
+ }
+ if (hasBlockSelection) {
+ enableComplementaryArea('core', 'edit-post/block');
+ } else {
+ enableComplementaryArea('core', 'edit-post/document');
+ }
+ }, [hasBlockSelection, getActiveComplementaryArea, enableComplementaryArea, getPreference]);
+}
+/* harmony default export */ const use_auto_switch_editor_sidebars = (useAutoSwitchEditorSidebars);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/sidebar/index.js
+/**
* WordPress dependencies
*/
@@ -16351,134 +27394,290 @@ const desktop = (0,external_React_.createElement)(external_wp_primitives_namespa
+
/**
* Internal dependencies
*/
-function PreviewDropdown({
- forceIsAutosaveable,
- disabled
+
+
+
+
+
+
+
+
+
+
+
+
+
+const {
+ Tabs: sidebar_Tabs
+} = unlock(external_wp_components_namespaceObject.privateApis);
+const SIDEBAR_ACTIVE_BY_DEFAULT = external_wp_element_namespaceObject.Platform.select({
+ web: true,
+ native: false
+});
+const SidebarContent = ({
+ tabName,
+ keyboardShortcut,
+ renderingMode,
+ onActionPerformed,
+ extraPanels
+}) => {
+ const tabListRef = (0,external_wp_element_namespaceObject.useRef)(null);
+ // Because `PluginSidebar` renders a `ComplementaryArea`, we
+ // need to forward the `Tabs` context so it can be passed through the
+ // underlying slot/fill.
+ const tabsContextValue = (0,external_wp_element_namespaceObject.useContext)(sidebar_Tabs.Context);
+
+ // This effect addresses a race condition caused by tabbing from the last
+ // block in the editor into the settings sidebar. Without this effect, the
+ // selected tab and browser focus can become separated in an unexpected way
+ // (e.g the "block" tab is focused, but the "post" tab is selected).
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
+ const tabsElements = Array.from(tabListRef.current?.querySelectorAll('[role="tab"]') || []);
+ const selectedTabElement = tabsElements.find(
+ // We are purposefully using a custom `data-tab-id` attribute here
+ // because we don't want rely on any assumptions about `Tabs`
+ // component internals.
+ element => element.getAttribute('data-tab-id') === tabName);
+ const activeElement = selectedTabElement?.ownerDocument.activeElement;
+ const tabsHasFocus = tabsElements.some(element => {
+ return activeElement && activeElement.id === element.id;
+ });
+ if (tabsHasFocus && selectedTabElement && selectedTabElement.id !== activeElement?.id) {
+ selectedTabElement?.focus();
+ }
+ }, [tabName]);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PluginSidebar, {
+ identifier: tabName,
+ header: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(sidebar_Tabs.Context.Provider, {
+ value: tabsContextValue,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(sidebar_header, {
+ ref: tabListRef
+ })
+ }),
+ closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close Settings')
+ // This classname is added so we can apply a corrective negative
+ // margin to the panel.
+ // see https://github.com/WordPress/gutenberg/pull/55360#pullrequestreview-1737671049
+ ,
+ className: "editor-sidebar__panel",
+ headerClassName: "editor-sidebar__panel-tabs"
+ /* translators: button label text should, if possible, be under 16 characters. */,
+ title: (0,external_wp_i18n_namespaceObject.__)('Settings'),
+ toggleShortcut: keyboardShortcut,
+ icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? drawer_left : drawer_right,
+ isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(sidebar_Tabs.Context.Provider, {
+ value: tabsContextValue,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(sidebar_Tabs.TabPanel, {
+ tabId: sidebars.document,
+ focusable: false,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSummary, {
+ onActionPerformed: onActionPerformed
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_document_setting_panel.Slot, {}), renderingMode !== 'post-only' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateContentPanel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTransformPanel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_taxonomies_panel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternOverridesPanel, {}), extraPanels]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(sidebar_Tabs.TabPanel, {
+ tabId: sidebars.block,
+ focusable: false,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockInspector, {})
+ })]
+ })
+ });
+};
+const Sidebar = ({
+ extraPanels,
+ onActionPerformed
+}) => {
+ use_auto_switch_editor_sidebars();
+ const {
+ tabName,
+ keyboardShortcut,
+ showSummary,
+ renderingMode
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const shortcut = select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/editor/toggle-sidebar');
+ const sidebar = select(store).getActiveComplementaryArea('core');
+ const _isEditorSidebarOpened = [sidebars.block, sidebars.document].includes(sidebar);
+ let _tabName = sidebar;
+ if (!_isEditorSidebarOpened) {
+ _tabName = !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart() ? sidebars.block : sidebars.document;
+ }
+ return {
+ tabName: _tabName,
+ keyboardShortcut: shortcut,
+ showSummary: ![TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE].includes(select(store_store).getCurrentPostType()),
+ renderingMode: select(store_store).getRenderingMode()
+ };
+ }, []);
+ const {
+ enableComplementaryArea
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
+ const onTabSelect = (0,external_wp_element_namespaceObject.useCallback)(newSelectedTabId => {
+ if (!!newSelectedTabId) {
+ enableComplementaryArea('core', newSelectedTabId);
+ }
+ }, [enableComplementaryArea]);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(sidebar_Tabs, {
+ selectedTabId: tabName,
+ onSelect: onTabSelect,
+ selectOnMove: false,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarContent, {
+ tabName: tabName,
+ keyboardShortcut: keyboardShortcut,
+ showSummary: showSummary,
+ renderingMode: renderingMode,
+ onActionPerformed: onActionPerformed,
+ extraPanels: extraPanels
+ })
+ });
+};
+/* harmony default export */ const components_sidebar = (Sidebar);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+
+function Editor({
+ postType,
+ postId,
+ templateId,
+ settings,
+ children,
+ // This could be part of the settings.
+ onActionPerformed,
+ // The following abstractions are not ideal but necessary
+ // to account for site editor and post editor differences for now.
+ className,
+ styles,
+ customSaveButton,
+ customSavePanel,
+ forceDisableBlockTools,
+ title,
+ iframeProps,
+ extraSidebarPanels,
+ enableRegionNavigation = true
}) {
const {
- deviceType,
- homeUrl,
- isTemplate,
- isViewable,
- showIconLabels
+ post,
+ template,
+ hasLoadedPost
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
- var _getPostType$viewable;
const {
- getDeviceType,
- getCurrentPostType
- } = select(store_store);
- const {
- getUnstableBase,
- getPostType
+ getEntityRecord,
+ hasFinishedResolution
} = select(external_wp_coreData_namespaceObject.store);
- const {
- get
- } = select(external_wp_preferences_namespaceObject.store);
- const _currentPostType = getCurrentPostType();
return {
- deviceType: getDeviceType(),
- homeUrl: getUnstableBase()?.home,
- isTemplate: _currentPostType === 'wp_template',
- isViewable: (_getPostType$viewable = getPostType(_currentPostType)?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false,
- showIconLabels: get('core', 'showIconLabels')
+ post: getEntityRecord('postType', postType, postId),
+ template: templateId ? getEntityRecord('postType', TEMPLATE_POST_TYPE, templateId) : undefined,
+ hasLoadedPost: hasFinishedResolution('getEntityRecord', ['postType', postType, postId])
};
- }, []);
+ }, [postType, postId, templateId]);
+ if (!post) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ExperimentalEditorProvider, {
+ post: post,
+ __unstableTemplate: template,
+ settings: settings,
+ useSubRegistry: false,
+ children: [hasLoadedPost && !post && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, {
+ status: "warning",
+ isDismissible: false,
+ children: (0,external_wp_i18n_namespaceObject.__)("You attempted to edit an item that doesn't exist. Perhaps it was deleted?")
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditorInterface, {
+ className: className,
+ styles: styles,
+ enableRegionNavigation: enableRegionNavigation,
+ customSaveButton: customSaveButton,
+ customSavePanel: customSavePanel,
+ forceDisableBlockTools: forceDisableBlockTools,
+ title: title,
+ iframeProps: iframeProps
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(components_sidebar, {
+ onActionPerformed: onActionPerformed,
+ extraPanels: extraSidebarPanels
+ }), children]
+ });
+}
+/* harmony default export */ const editor = (Editor);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/preferences-modal/enable-publish-sidebar.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+const {
+ PreferenceBaseOption: enable_publish_sidebar_PreferenceBaseOption
+} = unlock(external_wp_preferences_namespaceObject.privateApis);
+/* harmony default export */ const enable_publish_sidebar = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => ({
+ isChecked: select(store_store).isPublishSidebarEnabled()
+})), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
const {
- setDeviceType
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
- if (isMobile) return null;
- const popoverProps = {
- placement: 'bottom-end'
- };
- const toggleProps = {
- className: 'editor-preview-dropdown__toggle',
- size: 'compact',
- showTooltip: !showIconLabels,
- disabled,
- __experimentalIsFocusable: disabled
- };
- const menuProps = {
- 'aria-label': (0,external_wp_i18n_namespaceObject.__)('View options')
- };
- const deviceIcons = {
- mobile: library_mobile,
- tablet: library_tablet,
- desktop: library_desktop
+ enablePublishSidebar,
+ disablePublishSidebar
+ } = dispatch(store_store);
+ return {
+ onChange: isEnabled => isEnabled ? enablePublishSidebar() : disablePublishSidebar()
};
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
- className: "editor-preview-dropdown",
- popoverProps: popoverProps,
- toggleProps: toggleProps,
- menuProps: menuProps,
- icon: deviceIcons[deviceType.toLowerCase()],
- label: (0,external_wp_i18n_namespaceObject.__)('View'),
- disableOpenOnArrowDown: disabled
- }, ({
- onClose
- }) => (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- onClick: () => setDeviceType('Desktop'),
- icon: deviceType === 'Desktop' && library_check
- }, (0,external_wp_i18n_namespaceObject.__)('Desktop')), (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- onClick: () => setDeviceType('Tablet'),
- icon: deviceType === 'Tablet' && library_check
- }, (0,external_wp_i18n_namespaceObject.__)('Tablet')), (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- onClick: () => setDeviceType('Mobile'),
- icon: deviceType === 'Mobile' && library_check
- }, (0,external_wp_i18n_namespaceObject.__)('Mobile'))), isTemplate && (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- href: homeUrl,
- target: "_blank",
- icon: library_external,
- onClick: onClose
- }, (0,external_wp_i18n_namespaceObject.__)('View site'), (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
- as: "span"
- }, /* translators: accessibility text */
- (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)')))), isViewable && (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_React_.createElement)(PostPreviewButton, {
- className: "editor-preview-dropdown__button-external",
- role: "menuitem",
- forceIsAutosaveable: forceIsAutosaveable,
- textContent: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_wp_i18n_namespaceObject.__)('Preview in new tab'), (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, {
- icon: library_external
- })),
- onPreview: onClose
- }))));
-}
+}))(enable_publish_sidebar_PreferenceBaseOption));
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-manager/checklist.js
-
/**
* WordPress dependencies
*/
+
+
function BlockTypesChecklist({
blockTypes,
value,
onItemChange
}) {
- return (0,external_React_.createElement)("ul", {
- className: "editor-block-manager__checklist"
- }, blockTypes.map(blockType => (0,external_React_.createElement)("li", {
- key: blockType.name,
- className: "editor-block-manager__checklist-item"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
- __nextHasNoMarginBottom: true,
- label: blockType.title,
- checked: value.includes(blockType.name),
- onChange: (...args) => onItemChange(blockType.name, ...args)
- }), (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, {
- icon: blockType.icon
- }))));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", {
+ className: "editor-block-manager__checklist",
+ children: blockTypes.map(blockType => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", {
+ className: "editor-block-manager__checklist-item",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, {
+ __nextHasNoMarginBottom: true,
+ label: blockType.title,
+ checked: value.includes(blockType.name),
+ onChange: (...args) => onItemChange(blockType.name, ...args)
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, {
+ icon: blockType.icon
+ })]
+ }, blockType.name))
+ });
}
/* harmony default export */ const checklist = (BlockTypesChecklist);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-manager/category.js
-
/**
* WordPress dependencies
*/
@@ -16494,6 +27693,8 @@ function BlockTypesChecklist({
+
+
function BlockManagerCategory({
title,
blockTypes
@@ -16554,29 +27755,30 @@ function BlockManagerCategory({
const titleId = 'editor-block-manager__category-title-' + instanceId;
const isAllChecked = checkedBlockNames.length === filteredBlockTypes.length;
const isIndeterminate = !isAllChecked && checkedBlockNames.length > 0;
- return (0,external_React_.createElement)("div", {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
role: "group",
"aria-labelledby": titleId,
- className: "editor-block-manager__category"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
- __nextHasNoMarginBottom: true,
- checked: isAllChecked,
- onChange: toggleAllVisible,
- className: "editor-block-manager__category-title",
- indeterminate: isIndeterminate,
- label: (0,external_React_.createElement)("span", {
- id: titleId
- }, title)
- }), (0,external_React_.createElement)(checklist, {
- blockTypes: filteredBlockTypes,
- value: checkedBlockNames,
- onItemChange: toggleVisible
- }));
+ className: "editor-block-manager__category",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, {
+ __nextHasNoMarginBottom: true,
+ checked: isAllChecked,
+ onChange: toggleAllVisible,
+ className: "editor-block-manager__category-title",
+ indeterminate: isIndeterminate,
+ label: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ id: titleId,
+ children: title
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(checklist, {
+ blockTypes: filteredBlockTypes,
+ value: checkedBlockNames,
+ onItemChange: toggleVisible
+ })]
+ });
}
/* harmony default export */ const block_manager_category = (BlockManagerCategory);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-manager/index.js
-
/**
* WordPress dependencies
*/
@@ -16595,6 +27797,8 @@ function BlockManagerCategory({
+
+
function BlockManager({
blockTypes,
categories,
@@ -16621,38 +27825,42 @@ function BlockManager({
(0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', count), count);
debouncedSpeak(resultsFoundMessage);
}, [blockTypes.length, search, debouncedSpeak]);
- return (0,external_React_.createElement)("div", {
- className: "editor-block-manager__content"
- }, !!numberOfHiddenBlocks && (0,external_React_.createElement)("div", {
- className: "editor-block-manager__disabled-blocks-count"
- }, (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of blocks. */
- (0,external_wp_i18n_namespaceObject._n)('%d block is hidden.', '%d blocks are hidden.', numberOfHiddenBlocks), numberOfHiddenBlocks), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "link",
- onClick: () => enableAllBlockTypes(blockTypes)
- }, (0,external_wp_i18n_namespaceObject.__)('Reset'))), (0,external_React_.createElement)(external_wp_components_namespaceObject.SearchControl, {
- __nextHasNoMarginBottom: true,
- label: (0,external_wp_i18n_namespaceObject.__)('Search for a block'),
- placeholder: (0,external_wp_i18n_namespaceObject.__)('Search for a block'),
- value: search,
- onChange: nextSearch => setSearch(nextSearch),
- className: "editor-block-manager__search"
- }), (0,external_React_.createElement)("div", {
- tabIndex: "0",
- role: "region",
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('Available block types'),
- className: "editor-block-manager__results"
- }, blockTypes.length === 0 && (0,external_React_.createElement)("p", {
- className: "editor-block-manager__no-results"
- }, (0,external_wp_i18n_namespaceObject.__)('No blocks found.')), categories.map(category => (0,external_React_.createElement)(block_manager_category, {
- key: category.slug,
- title: category.title,
- blockTypes: blockTypes.filter(blockType => blockType.category === category.slug)
- })), (0,external_React_.createElement)(block_manager_category, {
- title: (0,external_wp_i18n_namespaceObject.__)('Uncategorized'),
- blockTypes: blockTypes.filter(({
- category
- }) => !category)
- })));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "editor-block-manager__content",
+ children: [!!numberOfHiddenBlocks && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "editor-block-manager__disabled-blocks-count",
+ children: [(0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of blocks. */
+ (0,external_wp_i18n_namespaceObject._n)('%d block is hidden.', '%d blocks are hidden.', numberOfHiddenBlocks), numberOfHiddenBlocks), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "link",
+ onClick: () => enableAllBlockTypes(blockTypes),
+ children: (0,external_wp_i18n_namespaceObject.__)('Reset')
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, {
+ __nextHasNoMarginBottom: true,
+ label: (0,external_wp_i18n_namespaceObject.__)('Search for a block'),
+ placeholder: (0,external_wp_i18n_namespaceObject.__)('Search for a block'),
+ value: search,
+ onChange: nextSearch => setSearch(nextSearch),
+ className: "editor-block-manager__search"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ tabIndex: "0",
+ role: "region",
+ "aria-label": (0,external_wp_i18n_namespaceObject.__)('Available block types'),
+ className: "editor-block-manager__results",
+ children: [blockTypes.length === 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ className: "editor-block-manager__no-results",
+ children: (0,external_wp_i18n_namespaceObject.__)('No blocks found.')
+ }), categories.map(category => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_manager_category, {
+ title: category.title,
+ blockTypes: blockTypes.filter(blockType => blockType.category === category.slug)
+ }, category.slug)), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_manager_category, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Uncategorized'),
+ blockTypes: blockTypes.filter(({
+ category
+ }) => !category)
+ })]
+ })]
+ });
}
/* harmony default export */ const block_manager = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
var _get;
@@ -16698,7 +27906,6 @@ function BlockManager({
})])(BlockManager));
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/preferences-modal/index.js
-
/**
* WordPress dependencies
*/
@@ -16709,6 +27916,7 @@ function BlockManager({
+
/**
* Internal dependencies
*/
@@ -16722,6 +27930,10 @@ function BlockManager({
+
+
+
+
const {
PreferencesModal,
PreferencesModalTabs,
@@ -16729,12 +27941,11 @@ const {
PreferenceToggleControl
} = unlock(external_wp_preferences_namespaceObject.privateApis);
function EditorPreferencesModal({
- extraSections = {},
- isActive,
- onClose
+ extraSections = {}
}) {
const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
const {
+ isActive,
showBlockBreadcrumbsOption
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
@@ -16743,141 +27954,175 @@ function EditorPreferencesModal({
const {
get
} = select(external_wp_preferences_namespaceObject.store);
+ const {
+ isModalActive
+ } = select(store);
const isRichEditingEnabled = getEditorSettings().richEditingEnabled;
const isDistractionFreeEnabled = get('core', 'distractionFree');
return {
- showBlockBreadcrumbsOption: !isDistractionFreeEnabled && isLargeViewport && isRichEditingEnabled
+ showBlockBreadcrumbsOption: !isDistractionFreeEnabled && isLargeViewport && isRichEditingEnabled,
+ isActive: isModalActive('editor/preferences')
};
}, [isLargeViewport]);
const {
+ closeModal
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
+ const {
setIsListViewOpened,
setIsInserterOpened
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
const {
set: setPreference
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
- const toggleDistractionFree = () => {
- setPreference('core', 'fixedToolbar', true);
- setIsInserterOpened(false);
- setIsListViewOpened(false);
- // Todo: Check sidebar when closing/opening distraction free.
- };
- const turnOffDistractionFree = () => {
- setPreference('core', 'distractionFree', false);
- };
const sections = (0,external_wp_element_namespaceObject.useMemo)(() => [{
name: 'general',
tabLabel: (0,external_wp_i18n_namespaceObject.__)('General'),
- content: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(PreferencesModalSection, {
- title: (0,external_wp_i18n_namespaceObject.__)('Interface')
- }, (0,external_React_.createElement)(PreferenceToggleControl, {
- scope: "core",
- featureName: "showListViewByDefault",
- help: (0,external_wp_i18n_namespaceObject.__)('Opens the block list view sidebar by default.'),
- label: (0,external_wp_i18n_namespaceObject.__)('Always open list view')
- }), showBlockBreadcrumbsOption && (0,external_React_.createElement)(PreferenceToggleControl, {
- scope: "core",
- featureName: "showBlockBreadcrumbs",
- help: (0,external_wp_i18n_namespaceObject.__)('Display the block hierarchy trail at the bottom of the editor.'),
- label: (0,external_wp_i18n_namespaceObject.__)('Show block breadcrumbs')
- }), (0,external_React_.createElement)(PreferenceToggleControl, {
- scope: "core",
- featureName: "allowRightClickOverrides",
- help: (0,external_wp_i18n_namespaceObject.__)('Allows contextual list view menus via right-click, overriding browser defaults.'),
- label: (0,external_wp_i18n_namespaceObject.__)('Allow right-click contextual menus')
- })), (0,external_React_.createElement)(PreferencesModalSection, {
- title: (0,external_wp_i18n_namespaceObject.__)('Document settings'),
- description: (0,external_wp_i18n_namespaceObject.__)('Select what settings are shown in the document panel.')
- }, (0,external_React_.createElement)(enable_plugin_document_setting_panel.Slot, null), (0,external_React_.createElement)(post_taxonomies, {
- taxonomyWrapper: (content, taxonomy) => (0,external_React_.createElement)(enable_panel, {
- label: taxonomy.labels.menu_name,
- panelName: `taxonomy-panel-${taxonomy.slug}`
- })
- }), (0,external_React_.createElement)(post_featured_image_check, null, (0,external_React_.createElement)(enable_panel, {
- label: (0,external_wp_i18n_namespaceObject.__)('Featured image'),
- panelName: "featured-image"
- })), (0,external_React_.createElement)(post_excerpt_check, null, (0,external_React_.createElement)(enable_panel, {
- label: (0,external_wp_i18n_namespaceObject.__)('Excerpt'),
- panelName: "post-excerpt"
- })), (0,external_React_.createElement)(post_type_support_check, {
- supportKeys: ['comments', 'trackbacks']
- }, (0,external_React_.createElement)(enable_panel, {
- label: (0,external_wp_i18n_namespaceObject.__)('Discussion'),
- panelName: "discussion-panel"
- })), (0,external_React_.createElement)(page_attributes_check, null, (0,external_React_.createElement)(enable_panel, {
- label: (0,external_wp_i18n_namespaceObject.__)('Page attributes'),
- panelName: "page-attributes"
- }))), extraSections?.general)
+ content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PreferencesModalSection, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Interface'),
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, {
+ scope: "core",
+ featureName: "showListViewByDefault",
+ help: (0,external_wp_i18n_namespaceObject.__)('Opens the List View sidebar by default.'),
+ label: (0,external_wp_i18n_namespaceObject.__)('Always open List View')
+ }), showBlockBreadcrumbsOption && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, {
+ scope: "core",
+ featureName: "showBlockBreadcrumbs",
+ help: (0,external_wp_i18n_namespaceObject.__)('Display the block hierarchy trail at the bottom of the editor.'),
+ label: (0,external_wp_i18n_namespaceObject.__)('Show block breadcrumbs')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, {
+ scope: "core",
+ featureName: "allowRightClickOverrides",
+ help: (0,external_wp_i18n_namespaceObject.__)('Allows contextual List View menus via right-click, overriding browser defaults.'),
+ label: (0,external_wp_i18n_namespaceObject.__)('Allow right-click contextual menus')
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PreferencesModalSection, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Document settings'),
+ description: (0,external_wp_i18n_namespaceObject.__)('Select what settings are shown in the document panel.'),
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_plugin_document_setting_panel.Slot, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_taxonomies, {
+ taxonomyWrapper: (content, taxonomy) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_panel, {
+ label: taxonomy.labels.menu_name,
+ panelName: `taxonomy-panel-${taxonomy.slug}`
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image_check, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_panel, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Featured image'),
+ panelName: "featured-image"
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_check, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_panel, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Excerpt'),
+ panelName: "post-excerpt"
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, {
+ supportKeys: ['comments', 'trackbacks'],
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_panel, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Discussion'),
+ panelName: "discussion-panel"
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(page_attributes_check, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_panel, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Page attributes'),
+ panelName: "page-attributes"
+ })
+ })]
+ }), isLargeViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalSection, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Publishing'),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_publish_sidebar, {
+ help: (0,external_wp_i18n_namespaceObject.__)('Review settings, such as visibility and tags.'),
+ label: (0,external_wp_i18n_namespaceObject.__)('Enable pre-publish checks')
+ })
+ }), extraSections?.general]
+ })
}, {
name: 'appearance',
tabLabel: (0,external_wp_i18n_namespaceObject.__)('Appearance'),
- content: (0,external_React_.createElement)(PreferencesModalSection, {
+ content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PreferencesModalSection, {
title: (0,external_wp_i18n_namespaceObject.__)('Appearance'),
- description: (0,external_wp_i18n_namespaceObject.__)('Customize the editor interface to suit your needs.')
- }, (0,external_React_.createElement)(PreferenceToggleControl, {
- scope: "core",
- featureName: "fixedToolbar",
- onToggle: turnOffDistractionFree,
- help: (0,external_wp_i18n_namespaceObject.__)('Access all block and document tools in a single place.'),
- label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar')
- }), (0,external_React_.createElement)(PreferenceToggleControl, {
- scope: "core",
- featureName: "distractionFree",
- onToggle: toggleDistractionFree,
- help: (0,external_wp_i18n_namespaceObject.__)('Reduce visual distractions by hiding the toolbar and other elements to focus on writing.'),
- label: (0,external_wp_i18n_namespaceObject.__)('Distraction free')
- }), (0,external_React_.createElement)(PreferenceToggleControl, {
- scope: "core",
- featureName: "focusMode",
- help: (0,external_wp_i18n_namespaceObject.__)('Highlights the current block and fades other content.'),
- label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode')
- }), extraSections?.appearance)
+ description: (0,external_wp_i18n_namespaceObject.__)('Customize the editor interface to suit your needs.'),
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, {
+ scope: "core",
+ featureName: "fixedToolbar",
+ onToggle: () => setPreference('core', 'distractionFree', false),
+ help: (0,external_wp_i18n_namespaceObject.__)('Access all block and document tools in a single place.'),
+ label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, {
+ scope: "core",
+ featureName: "distractionFree",
+ onToggle: () => {
+ setPreference('core', 'fixedToolbar', true);
+ setIsInserterOpened(false);
+ setIsListViewOpened(false);
+ },
+ help: (0,external_wp_i18n_namespaceObject.__)('Reduce visual distractions by hiding the toolbar and other elements to focus on writing.'),
+ label: (0,external_wp_i18n_namespaceObject.__)('Distraction free')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, {
+ scope: "core",
+ featureName: "focusMode",
+ help: (0,external_wp_i18n_namespaceObject.__)('Highlights the current block and fades other content.'),
+ label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode')
+ }), extraSections?.appearance]
+ })
}, {
name: 'accessibility',
tabLabel: (0,external_wp_i18n_namespaceObject.__)('Accessibility'),
- content: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(PreferencesModalSection, {
- title: (0,external_wp_i18n_namespaceObject.__)('Navigation'),
- description: (0,external_wp_i18n_namespaceObject.__)('Optimize the editing experience for enhanced control.')
- }, (0,external_React_.createElement)(PreferenceToggleControl, {
- scope: "core",
- featureName: "keepCaretInsideBlock",
- help: (0,external_wp_i18n_namespaceObject.__)('Keeps the text cursor within the block boundaries, aiding users with screen readers by preventing unintentional cursor movement outside the block.'),
- label: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block')
- })), (0,external_React_.createElement)(PreferencesModalSection, {
- title: (0,external_wp_i18n_namespaceObject.__)('Interface')
- }, (0,external_React_.createElement)(PreferenceToggleControl, {
- scope: "core",
- featureName: "showIconLabels",
- label: (0,external_wp_i18n_namespaceObject.__)('Show button text labels'),
- help: (0,external_wp_i18n_namespaceObject.__)('Show text instead of icons on buttons across the interface.')
- })))
+ content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalSection, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Navigation'),
+ description: (0,external_wp_i18n_namespaceObject.__)('Optimize the editing experience for enhanced control.'),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, {
+ scope: "core",
+ featureName: "keepCaretInsideBlock",
+ help: (0,external_wp_i18n_namespaceObject.__)('Keeps the text cursor within the block boundaries, aiding users with screen readers by preventing unintentional cursor movement outside the block.'),
+ label: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block')
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalSection, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Interface'),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, {
+ scope: "core",
+ featureName: "showIconLabels",
+ label: (0,external_wp_i18n_namespaceObject.__)('Show button text labels'),
+ help: (0,external_wp_i18n_namespaceObject.__)('Show text instead of icons on buttons across the interface.')
+ })
+ })]
+ })
}, {
name: 'blocks',
tabLabel: (0,external_wp_i18n_namespaceObject.__)('Blocks'),
- content: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(PreferencesModalSection, {
- title: (0,external_wp_i18n_namespaceObject.__)('Inserter')
- }, (0,external_React_.createElement)(PreferenceToggleControl, {
- scope: "core",
- featureName: "mostUsedBlocks",
- help: (0,external_wp_i18n_namespaceObject.__)('Adds a category with the most frequently used blocks in the inserter.'),
- label: (0,external_wp_i18n_namespaceObject.__)('Show most used blocks')
- })), (0,external_React_.createElement)(PreferencesModalSection, {
- title: (0,external_wp_i18n_namespaceObject.__)('Manage block visibility'),
- description: (0,external_wp_i18n_namespaceObject.__)("Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later.")
- }, (0,external_React_.createElement)(block_manager, null)))
- }], [isLargeViewport, showBlockBreadcrumbsOption, extraSections]);
+ content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalSection, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Inserter'),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, {
+ scope: "core",
+ featureName: "mostUsedBlocks",
+ help: (0,external_wp_i18n_namespaceObject.__)('Adds a category with the most frequently used blocks in the inserter.'),
+ label: (0,external_wp_i18n_namespaceObject.__)('Show most used blocks')
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalSection, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Manage block visibility'),
+ description: (0,external_wp_i18n_namespaceObject.__)("Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later."),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_manager, {})
+ })]
+ })
+ }], [showBlockBreadcrumbsOption, extraSections, setIsInserterOpened, setIsListViewOpened, setPreference, isLargeViewport]);
if (!isActive) {
return null;
}
- return (0,external_React_.createElement)(PreferencesModal, {
- closeModal: onClose
- }, (0,external_React_.createElement)(PreferencesModalTabs, {
- sections: sections
- }));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModal, {
+ closeModal: closeModal,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalTabs, {
+ sections: sections
+ })
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/private-apis.js
/**
+ * WordPress dependencies
+ */
+
+
+/**
* Internal dependencies
*/
@@ -16894,22 +28139,35 @@ function EditorPreferencesModal({
+
+
+
+const {
+ store: interfaceStore,
+ ...remainingInterfaceApis
+} = build_module_namespaceObject;
const privateApis = {};
lock(privateApis, {
- DocumentTools: document_tools,
- EditorCanvas: editor_canvas,
+ CreateTemplatePartModal: CreateTemplatePartModal,
+ BackButton: back_button,
ExperimentalEditorProvider: ExperimentalEditorProvider,
- EnablePluginDocumentSettingPanelOption: enable_plugin_document_setting_panel,
EntitiesSavedStatesExtensible: EntitiesSavedStatesExtensible,
- InserterSidebar: InserterSidebar,
- ListViewSidebar: ListViewSidebar,
+ Editor: editor,
+ EditorInterface: EditorInterface,
+ EditorContentSlotFill: content_slot_fill,
+ GlobalStylesProvider: GlobalStylesProvider,
+ mergeBaseAndUserConfigs: mergeBaseAndUserConfigs,
PluginPostExcerpt: post_excerpt_plugin,
- PostPanelRow: post_panel_row,
- PostViewLink: PostViewLink,
- PreviewDropdown: PreviewDropdown,
PreferencesModal: EditorPreferencesModal,
+ usePostActions: usePostActions,
+ ToolsMoreMenuGroup: tools_more_menu_group,
+ ViewMoreMenuGroup: view_more_menu_group,
+ ResizableEditor: resizable_editor,
+ Sidebar: components_sidebar,
// This is a temporary private API while we're updating the site editor to use EditorProvider.
- useBlockEditorSettings: use_block_editor_settings
+ useBlockEditorSettings: use_block_editor_settings,
+ interfaceStore,
+ ...remainingInterfaceApis
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/index.js