Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] trunk from WordPress:trunk #85

Merged
merged 16 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
7050a44
Fix: Fix link to minimal-block example plugin code. (#67888)
jorgefilipecosta Dec 13, 2024
7e85993
Plugin: Fix eligibility check for post types' default rendering mode …
Mamaduka Dec 13, 2024
25e9753
[Docs] Fix: Two broken links to the packages reference API and to blo…
jorgefilipecosta Dec 13, 2024
20f4174
Create a catalog list of private APIs (#66558)
jsnajdr Dec 13, 2024
d988d28
Refactor "Settings" panel of Columns block to use ToolsPanel instead …
prasadkarmalkar Dec 13, 2024
d90fbad
Refactor "Settings" panel of Column block to use ToolsPanel instead o…
prasadkarmalkar Dec 13, 2024
662455d
Make sure the sidebar navigation item focus style is fully visible. (…
afercia Dec 13, 2024
673f80d
Fix dataviews commonjs export (#67962)
manzoorwanijk Dec 13, 2024
750c8e4
Editor: Remove the 'content-only' check from 'TemplatePartConverterMe…
Mamaduka Dec 13, 2024
0b1a6b6
Improve logic to show entities saved panel description. (#67971)
afercia Dec 13, 2024
6291232
Customizer Widgets: Fix inserter button size and animation (#67880)
t-hamano Dec 13, 2024
67557ed
Storybook: Add stories for the TextAlignmentControl component (#67371)
himanshupathak95 Dec 13, 2024
3d17c61
TreeSelect: Deprecate 36px default size (#67855)
mirka Dec 13, 2024
c8cdff3
Refactor "Settings" panel of Site Title block to use ToolsPanel inste…
Sukhendu2002 Dec 13, 2024
0d7f1e3
Refactor "Settings" panel of Excerpt block to use ToolsPanel instead …
Sukhendu2002 Dec 13, 2024
d0d1045
Button: Replace ButtonGroup usage with ToggleGroupControl (#65346)
Mamaduka Dec 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backport-changelog/6.8/7129.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
https://github.com/WordPress/wordpress-develop/pull/7129

* https://github.com/WordPress/gutenberg/pull/62304
* https://github.com/WordPress/gutenberg/pull/67879
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ The `wp-scripts` package also facilitates the use of JavaScript modules, allowin

Integrating JavaScript into your WordPress projects without a build process can be the most straightforward approach in specific scenarios. This is particularly true for projects that don't leverage JSX or other advanced JavaScript features requiring compilation.

When you opt out of a build process, you interact directly with WordPress's [JavaScript APIs](/docs/reference-guides/packages/) through the global `wp` object. This means that all the methods and packages provided by WordPress are readily available, but with one caveat: you must manually manage script dependencies. This is done by adding [the handle](/docs/contributors/code/scripts.md) of each corresponding package to the dependency array of your enqueued JavaScript file.
When you opt out of a build process, you interact directly with WordPress's [JavaScript APIs](/docs/reference-guides/packages.md) through the global `wp` object. This means that all the methods and packages provided by WordPress are readily available, but with one caveat: you must manually manage script dependencies. This is done by adding [the handle](/docs/contributors/code/scripts.md) of each corresponding package to the dependency array of your enqueued JavaScript file.

For example, suppose you're creating a script that registers a new block [variation](/docs/reference-guides/block-api/block-variations.md) using the `registerBlockVariation` function from the [`blocks`](/docs/reference-guides/packages/packages-blocks.md) package. You must include `wp-blocks` in your script's dependency array. This guarantees that the `wp.blocks.registerBlockVariation` method is available and defined by the time your script executes.
For example, suppose you're creating a script that registers a new block [variation](/docs/reference-guides/block-api/block-variations.md) using the `registerBlockVariation` function from the [`blocks`](/packages/blocks/README.md) package. You must include `wp-blocks` in your script's dependency array. This guarantees that the `wp.blocks.registerBlockVariation` method is available and defined by the time your script executes.

In the following example, the `wp-blocks` dependency is defined when enqueuing the `variations.js` file.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function minimal_block_ca6eda___register_block() {
add_action( 'init', 'minimal_block_ca6eda___register_block' );
```

_See the [full block example](https://github.com/WordPress/block-development-examples/tree/trunk/plugins/minimal-block-ca6eda) of the [code above](https://github.com/WordPress/block-development-examples/blob/trunk/plugins/minimal-block-ca6eda/index.php)_
_See the [full block example](https://github.com/WordPress/block-development-examples/tree/trunk/plugins/minimal-block-ca6eda) of the [code above](https://github.com/WordPress/block-development-examples/blob/trunk/plugins/minimal-block-ca6eda/plugin.php)_

## Registering a block with JavaScript (client-side)

Expand Down
340 changes: 340 additions & 0 deletions docs/private-apis.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,340 @@
# Gutenberg Private APIs

This is an overview of private APIs exposed by Gutenberg packages. These APIs are used to implement parts of the Gutenberg editor (Post Editor, Site Editor, Core blocks and others) but are not exposed publicly to plugin and theme authors or authors of custom Gutenberg integrations.

The purpose of this document is to present a picture of how many private APIs we have and how they are used to build the Gutenberg editor apps with the libraries and frameworks provided by the family of `@wordpress/*` packages.

## data

The registry has two private methods:
- `privateActionsOf`
- `privateSelectorsOf`

Every store has a private API for registering private selectors/actions:
- `privateActions`
- `registerPrivateActions`
- `privateSelectors`
- `registerPrivateSelectors`

## blocks

### `core/blocks` store

Private actions:
- `addBlockBindingsSource`
- `removeBlockBindingsSource`
- `addBootstrappedBlockType`
- `addUnprocessedBlockType`

Private selectors:
- `getAllBlockBindingsSources`
- `getBlockBindingsSource`
- `getBootstrappedBlockType`
- `getSupportedStyles`
- `getUnprocessedBlockTypes`
- `hasContentRoleAttribute`

## components

Private exports:
- `__experimentalPopoverLegacyPositionToPlacement`
- `ComponentsContext`
- `Tabs`
- `Theme`
- `Menu`
- `kebabCase`

## commands

Private exports:
- `useCommandContext` (added May 2023 in #50543)

### `core/commands` store

Private actions:
- `setContext` (added together with `useCommandContext`)

## preferences

Private exports: (added in Jan 2024 in #57639)
- `PreferenceBaseOption`
- `PreferenceToggleControl`
- `PreferencesModal`
- `PreferencesModalSection`
- `PreferencesModalTabs`

There is only one publicly exported component!
- `PreferenceToggleMenuItem`

## block-editor

Private exports:
- `AdvancedPanel`
- `BackgroundPanel`
- `BorderPanel`
- `ColorPanel`
- `DimensionsPanel`
- `FiltersPanel`
- `GlobalStylesContext`
- `ImageSettingsPanel`
- `TypographyPanel`
- `areGlobalStyleConfigsEqual`
- `getBlockCSSSelector`
- `getBlockSelectors`
- `getGlobalStylesChanges`
- `getLayoutStyles`
- `toStyles`
- `useGlobalSetting`
- `useGlobalStyle`
- `useGlobalStylesOutput`
- `useGlobalStylesOutputWithConfig`
- `useGlobalStylesReset`
- `useHasBackgroundPanel`
- `useHasBorderPanel`
- `useHasBorderPanelControls`
- `useHasColorPanel`
- `useHasDimensionsPanel`
- `useHasFiltersPanel`
- `useHasImageSettingsPanel`
- `useHasTypographyPanel`
- `useSettingsForBlockElement`
- `ExperimentalBlockCanvas`: version of public `BlockCanvas` that has several extra props: `contentRef`, `shouldIframe`, `iframeProps`.
- `ExperimentalBlockEditorProvider`: version of public `BlockEditorProvider` that filters out several private/experimental settings. See also `__experimentalUpdateSettings`.
- `getDuotoneFilter`
- `getRichTextValues`
- `PrivateQuickInserter`
- `extractWords`
- `getNormalizedSearchTerms`
- `normalizeString`
- `PrivateListView`
- `ResizableBoxPopover`
- `BlockInfo`
- `useHasBlockToolbar`
- `cleanEmptyObject`
- `BlockQuickNavigation`
- `LayoutStyle`
- `BlockRemovalWarningModal`
- `useLayoutClasses`
- `useLayoutStyles`
- `DimensionsTool`
- `ResolutionTool`
- `TabbedSidebar`
- `TextAlignmentControl`
- `usesContextKey`
- `useFlashEditableBlocks`
- `useZoomOut`
- `globalStylesDataKey`
- `globalStylesLinksDataKey`
- `selectBlockPatternsKey`
- `requiresWrapperOnCopy`
- `PrivateRichText`: has an extra prop `readOnly` added in #58916 and #60327 (Feb and Mar 2024).
- `PrivateInserterLibrary`: has an extra prop `onPatternCategorySelection` added in #62130 (May 2024).
- `reusableBlocksSelectKey`
- `PrivateBlockPopover`: has two extra props, `__unstableContentRef` and `__unstablePopoverSlot`.
- `PrivatePublishDateTimePicker`: version of public `PublishDateTimePicker` that has two extra props: `isCompact` and `showPopoverHeaderActions`.
- `useSpacingSizes`
- `useBlockDisplayTitle`
- `__unstableBlockStyleVariationOverridesWithConfig`
- `setBackgroundStyleDefaults`
- `sectionRootClientIdKey`
- `__unstableCommentIconFill`
- `__unstableCommentIconToolbarFill`

### `core/block-editor` store

Private actions:
- `__experimentalUpdateSettings`: version of public `updateSettings` action that filters out some private/experimental settings.
- `clearBlockRemovalPrompt`
- `deleteStyleOverride`
- `ensureDefaultBlock`
- `expandBlock`
- `hideBlockInterface`
- `modifyContentLockBlock`
- `privateRemoveBlocks`
- `resetZoomLevel`
- `setBlockRemovalRules`
- `setInsertionPoint`
- `setLastFocus`
- `setOpenedBlockSettingsMenu`
- `setStyleOverride`
- `setZoomLevel`
- `showBlockInterface`
- `startDragging`
- `stopDragging`
- `stopEditingAsBlocks`

Private selectors:
- `getAllPatterns`
- `getBlockRemovalRules`
- `getBlockSettings`
- `getBlockStyles`
- `getBlockWithoutAttributes`
- `getClosestAllowedInsertionPoint`
- `getClosestAllowedInsertionPointForPattern`
- `getContentLockingParent`
- `getEnabledBlockParents`
- `getEnabledClientIdsTree`
- `getExpandedBlock`
- `getInserterMediaCategories`
- `getInsertionPoint`
- `getLastFocus`
- `getLastInsertedBlocksClientIds`
- `getOpenedBlockSettingsMenu`
- `getParentSectionBlock`
- `getPatternBySlug`
- `getRegisteredInserterMediaCategories`
- `getRemovalPromptData`
- `getReusableBlocks`
- `getSectionRootClientId`
- `getStyleOverrides`
- `getTemporarilyEditingAsBlocks`
- `getTemporarilyEditingFocusModeToRevert`
- `getZoomLevel`
- `hasAllowedPatterns`
- `isBlockInterfaceHidden`
- `isBlockSubtreeDisabled`
- `isDragging`
- `isResolvingPatterns`
- `isSectionBlock`
- `isZoomOut`

## core-data

Private exports:
- `useEntityRecordsWithPermissions`

### `core` store

Private actions:
- `receiveRegisteredPostMeta`

Private selectors:
- `getBlockPatternsForPostType`
- `getEntityRecordPermissions`
- `getEntityRecordsPermissions`
- `getNavigationFallbackId`
- `getRegisteredPostMeta`
- `getUndoManager`

## patterns (package created in Aug 2023 and has no public exports, everything is private)

Private exports:
- `OverridesPanel`
- `CreatePatternModal`
- `CreatePatternModalContents`
- `DuplicatePatternModal`
- `isOverridableBlock`
- `hasOverridableBlocks`
- `useDuplicatePatternProps`
- `RenamePatternModal`
- `PatternsMenuItems`
- `RenamePatternCategoryModal`
- `PatternOverridesControls`
- `ResetOverridesControl`
- `PatternOverridesBlockControls`
- `useAddPatternCategory`
- `PATTERN_TYPES`
- `PATTERN_DEFAULT_CATEGORY`
- `PATTERN_USER_CATEGORY`
- `EXCLUDED_PATTERN_SOURCES`
- `PATTERN_SYNC_TYPES`
- `PARTIAL_SYNCING_SUPPORTED_BLOCKS`

### `core/patterns` store

Private actions:
- `convertSyncedPatternToStatic`
- `createPattern`
- `createPatternFromFile`
- `setEditingPattern`

Private selectors:
- `isEditingPattern`

## block-library

Private exports:
- `BlockKeyboardShortcuts`

## router (private exports only)

Private exports:
- `useHistory`
- `useLocation`
- `RouterProvider`

## core-commands (private exports only)

Private exports:
- `useCommands`

## editor

Private exports:
- `CreateTemplatePartModal`
- `BackButton`
- `EntitiesSavedStatesExtensible`
- `Editor`
- `EditorContentSlotFill`
- `GlobalStylesProvider`
- `mergeBaseAndUserConfigs`
- `PluginPostExcerpt`
- `PostCardPanel`
- `PreferencesModal`
- `usePostActions`
- `ToolsMoreMenuGroup`
- `ViewMoreMenuGroup`
- `ResizableEditor`
- `registerCoreBlockBindingsSources`
- `interfaceStore`
- `ActionItem`
- `ComplementaryArea`
- `ComplementaryAreaMoreMenuItem`
- `FullscreenMode`
- `InterfaceSkeleton`
- `NavigableRegion`
- `PinnedItems`

### `core/editor` store

Private actions:
- `createTemplate`
- `hideBlockTypes`
- `registerEntityAction`
- `registerPostTypeActions`
- `removeTemplates`
- `revertTemplate`
- `saveDirtyEntities`
- `setCurrentTemplateId`
- `setIsReady`
- `showBlockTypes`
- `unregisterEntityAction`

Private selectors:
- `getEntityActions`
- `getInserter`
- `getInserterSidebarToggleRef`
- `getListViewToggleRef`
- `getPostBlocksByName`
- `getPostIcon`
- `hasPostMetaChanges`
- `isEntityReady`

## edit-post

### `core/edit-post` store

Private selectors:
- `getEditedPostTemplateId`

## edit-site

### `core/edit-site` store

Private actions:
- `registerRoute`
- `setEditorCanvasContainerView`

Private selectors:
- `getRoutes`
- `getEditorCanvasContainerView`
9 changes: 6 additions & 3 deletions lib/compat/wordpress-6.8/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,18 @@ function gutenberg_post_type_rendering_modes() {
* @return array Updated array of post type arguments.
*/
function gutenberg_post_type_default_rendering_mode( $args, $post_type ) {
$rendering_mode = 'page' === $post_type ? 'template-locked' : 'post-only';
$rendering_modes = gutenberg_post_type_rendering_modes();
if ( ! wp_is_block_theme() || ! current_theme_supports( 'block-templates' ) ) {
return $args;
}

// Make sure the post type supports the block editor.
if (
wp_is_block_theme() &&
( isset( $args['show_in_rest'] ) && $args['show_in_rest'] ) &&
( ! empty( $args['supports'] ) && in_array( 'editor', $args['supports'], true ) )
) {
$rendering_mode = 'page' === $post_type ? 'template-locked' : 'post-only';
$rendering_modes = gutenberg_post_type_rendering_modes();

// Validate the supplied rendering mode.
if (
isset( $args['default_rendering_mode'] ) &&
Expand Down
Loading
Loading