Skip to content

Commit

Permalink
🐛
Browse files Browse the repository at this point in the history
  • Loading branch information
zbeyens committed Sep 18, 2023
1 parent d376b1b commit 0137b33
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/two-avocados-hear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@udecode/plate-core': patch
---

- Fix: set Plate `id` prop type to `string` to satisfy [HTML specs](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id).
2 changes: 1 addition & 1 deletion apps/www/content/docs/api/core/plate.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ description: API reference for Plate component.
## Plate Props

<APIParameters>
<APIItem name="id" type="symbol | string | number" optional>
<APIItem name="id" type="string" optional>
A unique ID to store the editor state by ID. This is mandatory when nesting **`Plate`** instances but optional otherwise.

- **Default:** `'plate'`.
Expand Down
3 changes: 1 addition & 2 deletions apps/www/src/lib/plate/demo/plugins/emojiPlugin.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { RenderAfterEditable } from '@udecode/plate-common';
import { EmojiPlugin } from '@udecode/plate-emoji';

import { MyPlatePlugin } from '@/types/plate-types';
import { EmojiCombobox } from '@/registry/default/plate-ui/emoji-combobox';

export const emojiPlugin: Partial<MyPlatePlugin<EmojiPlugin>> = {
renderAfterEditable: EmojiCombobox as RenderAfterEditable,
renderAfterEditable: EmojiCombobox,
};
4 changes: 2 additions & 2 deletions packages/core/src/stores/plate/createPlateStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
SetRecord,
UseRecord,
} from '../../atoms/index';
import { Scope, useAtom } from '../../libs/index';
import { useAtom } from '../../libs/index';
import { PlateEditor } from '../../types/PlateEditor';
import { PlateStoreState } from '../../types/PlateStore';

Expand All @@ -17,7 +17,7 @@ import { PlateStoreState } from '../../types/PlateStore';
* Use it if you have multiple `Plate` in the same React tree.
* @default PLATE_SCOPE
*/
export type PlateId = Scope;
export type PlateId = string;

export const PLATE_SCOPE = 'plate';
export const GLOBAL_PLATE_SCOPE = Symbol('global-plate');
Expand Down
4 changes: 1 addition & 3 deletions packages/core/src/types/slate-react/TEditableProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@ import { RenderLeafFn, TNodeEntry } from '@udecode/slate';
import { Range } from 'slate';
import { EditableProps } from 'slate-react/dist/components/editable';

import { PlateId } from '../../stores/index';
import { RenderElementFn } from './TRenderElementProps';

/**
* `EditableProps` are passed to the <Editable> component.
*/
export type TEditableProps = Omit<
EditableProps,
'id' | 'decorate' | 'renderElement' | 'renderLeaf'
'decorate' | 'renderElement' | 'renderLeaf'
> & {
id?: PlateId;
decorate?: (entry: TNodeEntry) => Range[];
renderElement?: RenderElementFn;
renderLeaf?: RenderLeafFn;
Expand Down

0 comments on commit 0137b33

Please sign in to comment.