Skip to content

Commit

Permalink
Fix confrict
Browse files Browse the repository at this point in the history
  • Loading branch information
t-hamano committed Aug 28, 2022
2 parents 427277b + 3b6a399 commit fa67bd5
Show file tree
Hide file tree
Showing 406 changed files with 4,887 additions and 4,211 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/stale-issue-flaky-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: 'Mark old flaky tests issues as stale'
on:
schedule:
- cron: '20 1 * * *'

jobs:
stale:
runs-on: ubuntu-latest
if: ${{ github.repository == 'WordPress/gutenberg' }}

steps:
- uses: actions/stale@996798eb71ef485dc4c7b4d3285842d714040c4a # v3.0.17
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue has gone 30 days without any activity.'
days-before-stale: 30
days-before-close: 1
only-labels: '[Type] Flaky Test'
stale-issue-label: '[Status] Stale'
415 changes: 415 additions & 0 deletions changelog.txt

Large diffs are not rendered by default.

44 changes: 41 additions & 3 deletions docs/how-to-guides/format-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ registerFormatType( 'my-custom-format/sample-output', {
} );
```

Let's check that everything is working as expected. Build and reload and then select a text block. Confirm the new button was added to the format toolbar.
Let's check that everything is working as expected. Build and reload and then select any block containing text like for example the paragraph block. Confirm the new button was added to the format toolbar.

![Toolbar with custom button](https://developer.wordpress.org/files/2021/12/format-api-toolbar.png)

Expand Down Expand Up @@ -125,13 +125,13 @@ registerFormatType( 'my-custom-format/sample-output', {

Confirm it is working: first build and reload, then make a text selection and click the button. Your browser will likely display that selection differently than the surrounding text.

You can also confirm by switching to HTML view (Code editor Ctrl+Shift+Alt+M) and see the text selection wrapped with `<samp>` HTML tags.
You can also confirm by switching to HTML view (Code editor `Ctrl+Shift+Alt+M`) and see the text selection wrapped with `<samp>` HTML tags.

Use the `className` option when registering to add your own custom class to the tag. You can use that class and custom CSS to target that element and style as you wish.

### Step 4: Show the button only for specific blocks (Optional)

By default, the button is rendered on every rich text toolbar (image captions, buttons, paragraphs, etc). You can render the button only on blocks of a certain type by using `wp.data.withSelect` together with `wp.compose.ifCondition`.
By default, the button is rendered on every rich text toolbar (image captions, buttons, paragraphs, etc). You can render the button only on blocks of a certain type by using [the data API](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-data).

Here is an example that only shows the button for Paragraph blocks:

Expand Down Expand Up @@ -173,6 +173,44 @@ registerFormatType( 'my-custom-format/sample-output', {
} );
```

### Step5: Add a button outside of the dropdown (Optional)

Using the `RichTextToolbarButton` component, the button is added to the default dropdown menu. You can add the button directly to the toolbar by using the `BlockControls` component.

```js
import { registerFormatType, toggleFormat } from '@wordpress/rich-text';
import { BlockControls } from '@wordpress/block-editor';
import { ToolbarGroup, ToolbarButton } from '@wordpress/components';

const MyCustomButton = ( { isActive, onChange, value } ) => {
return (
<BlockControls>
<ToolbarGroup>
<ToolbarButton
icon="editor-code"
title="Sample output"
onClick={ () => {
onChange(
toggleFormat( value, {
type: 'my-custom-format/sample-output',
} )
);
} }
isActive={ isActive }
/>
</ToolbarGroup>
</BlockControls>
);
};

registerFormatType( 'my-custom-format/sample-output', {
title: 'Sample output',
tagName: 'samp',
className: null,
edit: MyCustomButton,
} );
```

## Troubleshooting

If you run into errors:
Expand Down
6 changes: 3 additions & 3 deletions docs/reference-guides/core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ Create a link that always points to the homepage of the site. Usually not necess

- **Name:** core/home-link
- **Category:** design
- **Supports:** ~~html~~, ~~reusable~~
- **Supports:** typography (fontSize, lineHeight), ~~html~~, ~~reusable~~
- **Attributes:** label

## Custom HTML
Expand Down Expand Up @@ -329,7 +329,7 @@ Display a list of your most recent posts. ([Source](https://github.com/WordPress

- **Name:** core/latest-posts
- **Category:** widgets
- **Supports:** align, ~~html~~
- **Supports:** align, typography (fontSize, lineHeight), ~~html~~
- **Attributes:** addLinkToFeaturedImage, categories, columns, displayAuthor, displayFeaturedImage, displayPostContent, displayPostContentRadio, displayPostDate, excerptLength, featuredImageAlign, featuredImageSizeHeight, featuredImageSizeSlug, featuredImageSizeWidth, order, orderBy, postLayout, postsToShow, selectedAuthor

## List
Expand Down Expand Up @@ -617,7 +617,7 @@ Contains the block elements used to render content when no query results are fou

- **Name:** core/query-no-results
- **Category:** theme
- **Supports:** align, color (background, gradients, link, text), ~~html~~, ~~reusable~~
- **Supports:** align, color (background, gradients, link, text), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~
- **Attributes:**

## Pagination
Expand Down
Loading

0 comments on commit fa67bd5

Please sign in to comment.