Skip to content

Commit

Permalink
Rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
jameskoster committed Jul 22, 2024
2 parents f27d3e9 + 47bde1a commit fe40895
Show file tree
Hide file tree
Showing 106 changed files with 11,982 additions and 1,528 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/sync-backport-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ jobs:
with:
fetch-depth: 2 # Fetch the last two commits to compare changes
- name: Check for changes in backport-changelog
id: check-for-changes
run: |
git diff --quiet HEAD^ HEAD -- backport-changelog || echo "changes=true" >> $GITHUB_OUTPUT
git diff --quiet HEAD^ HEAD -- backport-changelog || echo "HAS_CHANGES=1" >> "$GITHUB_OUTPUT"
- name: Sync Issue
if: env.changes == 'true'
if: steps.check-for-changes.outputs.HAS_CHANGES
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
Expand Down Expand Up @@ -52,18 +53,20 @@ jobs:
const endDelimiter = '<!-- END TRUNK BACKPORT CHANGELOG -->';
const autoGeneratedContent = `${startDelimiter}\n${processedChangelog}\n${endDelimiter}`;
const regex = new RegExp(`${startDelimiter}[\\s\\S]*${endDelimiter}`);
const existingBody = latestIssue.body ?? '';
let newBody;
if (regex.test(latestIssue.body)) {
const regex = new RegExp(`${startDelimiter}[\\s\\S]*${endDelimiter}`);
if (regex.test(existingBody)) {
// If delimiters exist, replace the content between them
newBody = latestIssue.body.replace(regex, autoGeneratedContent);
newBody = existingBody.replace(regex, autoGeneratedContent);
} else {
// If delimiters don't exist, append the new content at the end
newBody = `${latestIssue.body}\n\n${autoGeneratedContent}`;
newBody = `${existingBody}\n\n${autoGeneratedContent}`;
}
if (newBody.trim() !== latestIssue.body.trim()) {
if (newBody.trim() !== existingBody.trim()) {
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
Expand Down
3 changes: 3 additions & 0 deletions backport-changelog/6.7/7020.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/7020

* https://github.com/WordPress/gutenberg/pull/63470
24 changes: 24 additions & 0 deletions docs/reference-guides/data/data-core-block-editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,18 @@ _Returns_

- `number`: Number of blocks in the post, or number of blocks with name equal to blockName.

### getHoveredBlockClientId

Returns the currently hovered block.

_Parameters_

- _state_ `Object`: Global application state.

_Returns_

- `Object`: Client Id of the hovered block.

### getInserterItems

Determines the items that appear in the inserter. Includes both static items (e.g. a regular block type) and dynamic items (e.g. a reusable block).
Expand Down Expand Up @@ -1257,6 +1269,18 @@ _Parameters_

Action that hides the insertion point.

### hoverBlock

Returns an action object used in signalling that the block with the specified client ID has been hovered.

_Parameters_

- _clientId_ `string`: Block client ID.

_Returns_

- `Object`: Action object.

### insertAfterBlock

Action that inserts a default block after a given block.
Expand Down
2 changes: 1 addition & 1 deletion docs/reference-guides/interactivity-api/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ const { state } = store("myPlugin", {
});
```

As mentioned above with [`wp-on`](#wp-on), [`wp-on-window`](#wp-on-window), and [`wp-on-document`](#wp-on-document), an async action should be used whenever the `async` versions of the aforementioned directives cannot be used due to the action requiring synchronous access to the `event` object. Synchronous access is reqired whenever the action needs to call `event.preventDefault()`, `event.stopPropagation()`, or `event.stopImmediatePropagation()`. To ensure that the action code does not contribute to a long task, you may manually yield to the main thread after calling the synchronous event API. For example:
As mentioned above with [`wp-on`](#wp-on), [`wp-on-window`](#wp-on-window), and [`wp-on-document`](#wp-on-document), an async action should be used whenever the `async` versions of the aforementioned directives cannot be used due to the action requiring synchronous access to the `event` object. Synchronous access is required whenever the action needs to call `event.preventDefault()`, `event.stopPropagation()`, or `event.stopImmediatePropagation()`. To ensure that the action code does not contribute to a long task, you may manually yield to the main thread after calling the synchronous event API. For example:

```js
// Note: In WordPress 6.6 this splitTask function is exported by @wordpress/interactivity.
Expand Down
40 changes: 40 additions & 0 deletions lib/compat/wordpress-6.7/block-bindings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php
/**
* Temporary compatibility code for new functionalitites/changes related to block bindings APIs present in Gutenberg.
*
* @package gutenberg
*/

/**
* Adds the block bindings sources registered in the server to the editor settings.
*
* This allows them to be bootstrapped in the editor.
*
* @param array $settings The block editor settings from the `block_editor_settings_all` filter.
* @return array The editor settings including the block bindings sources.
*/
function gutenberg_add_server_block_bindings_sources_to_editor_settings( $editor_settings ) {
// Check if the sources are already exposed in the editor settings.
if ( isset( $editor_settings['blockBindingsSources'] ) ) {
return $editor_settings;
}

$registered_block_bindings_sources = get_all_registered_block_bindings_sources();
if ( ! empty( $registered_block_bindings_sources ) ) {
// Initialize array.
$editor_settings['blockBindingsSources'] = array();
foreach ( $registered_block_bindings_sources as $source_name => $source_properties ) {
// Add source with the label to editor settings.
$editor_settings['blockBindingsSources'][ $source_name ] = array(
'label' => $source_properties->label,
);
// Add `usesContext` property if exists.
if ( ! empty( $source_properties->uses_context ) ) {
$editor_settings['blockBindingsSources'][ $source_name ]['usesContext'] = $source_properties->uses_context;
}
}
}
return $editor_settings;
}

add_filter( 'block_editor_settings_all', 'gutenberg_add_server_block_bindings_sources_to_editor_settings', 10 );
Loading

0 comments on commit fe40895

Please sign in to comment.