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

Fix link button and add custom sidebar component #227

Merged
merged 3 commits into from
Jun 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.25.0] - 2023-06-13

### Added
- `settings.iso.sidebar.customComponent` added to allow a custom settings sidebar to be supplied
- Fix buttons in link popup (see #226)

## [2.24.0] - 2023-04-24

### Update
Expand Down
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,13 @@ The following function is also provided:
- _iso.blocks.disallowBlocks_ `[string[]]` - list of block names to disallow, defaults to none
- _iso.disallowEmbed_ `[string[]]` - List of embed names to remove, defaults to none.
- _iso.toolbar_ `[Object]` - Toolbar settings
- _iso.toolbar.inserter_ `[boolean]` - Enable or disable the toolbar block inserter, defaults to `true`
- _iso.toolbar.inspector_ `[boolean]` - Enable or disable the toolbar block inspector, defaults to `false`
- _iso.toolbar.navigation_ `[boolean]` - Enable or disable the toolbar navigation button, defaults to `false`
- _iso.toolbar.undo_ `[boolean]` - Enable or disable the toolbar undo/redo buttons, defaults to `true`
- _iso.toolbar.documentInspector_ `[string|null]` - Set to a string to show as a new tab in the inspector and filled with `DocumentSection`, otherwise defaults to no new tab
- _iso.sidebar_ `[Object]` - Sidebar settings
- _iso.sidebar.inserter_ `[boolean]` - Enable or disable the sidebar block inserter, defaults to `true`
- _iso.sidebar.inspector_ `[boolean]` - Enable or disable the sidebar block inspector, defaults to `false`
- _iso.sidebar.customComponent_ `[function]` - A function returning a custom sidebar component, or null to uses the default sidebar
- _iso.moreMenu_ `[Object]` - More menu settings
- _iso.moreMenu.editor_ `[boolean]` - Enable or disable the editor sub menu (visual/code editing), defaults to `false`
- _iso.moreMenu.fullscreen_ `[boolean]` - Enable or disable the fullscreen option, defaults to `false`
Expand Down Expand Up @@ -321,6 +323,22 @@ settings.editor.mediaUpload = mediaUpload;

In versions earlier than 2.21.0 this was automatically done, but this meant that you were unable to modify or disable it.

### Custom settings sidebar

By default the editor will use the Gutenberg settings sidebar. This provides the block and document inspector tabs, along with associated content.

If you wish to customise this sidebar then you can use the `iso.sidebar.customComponent` setting and pass a function that returns a React component.

You will need to manage the display of the sidebar yourself, including whether it should appear or not. It may help to look at the [existing sidebar code](src/components/block-editor/sidebar.js) for reference.

For example:

```js
sidebar: {
customComponent: () => <div>My custom sidebar</div>
},
```

### Extending

Custom behaviour can be added through child components. These components will have access to the `isolated/editor` store, as well as to the editor instance versions of `core/block-editor`.
Expand Down
2 changes: 1 addition & 1 deletion build-browser/isolated-block-editor.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build-browser/isolated-block-editor.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions build-module/components/block-editor-container/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@
background-color: transparent;
background-image: none;
}

&.is-primary:hover {
background-color: var(--wp-components-color-accent-darker-10,var(--wp-admin-theme-color-darker-10,#006BA1));;
}
}

// Ugly fix for an issue with the outline view in an empty document showing no content.
Expand Down
7 changes: 4 additions & 3 deletions build-module/components/block-editor/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.