Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfeng33 committed Nov 8, 2024
1 parent 8216bb3 commit eadf073
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions apps/www/content/docs/block-selection.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,29 @@ export function BlockSelection() {

This component should be rendered inside each block element for consistent selection feedback. Plate UI is doing it in `plate-element.tsx`.

## Selectable and resetable

### full page selectable

Like the [potion](https://potion.platejs.org/) template, you can enable block selection outside of the `<Editor />` component.

Simply add the `data-plate-selectable` attribute to any component outside the editor that you want to make selectable. You can even make the entire page selectable if desired.

For example:

```tsx
<Cover data-plate-selectable />
```

### full page resetable

To reset the selection, you need call the `api.blockSelection.unselect();` method.

If you want to make the full page resetable by click, this means you need to be able to access the editor outside of `<Editor />`.

Or you can implement a click outside handler to reset the selection.


## Prevent unselect

To prevent unselecting blocks when clicking on certain elements, add the `data-plate-prevent-unselect` attribute to those components
Expand Down

0 comments on commit eadf073

Please sign in to comment.