Skip to content

Commit

Permalink
Merge pull request #3837 from yf-yang/decoratetype
Browse files Browse the repository at this point in the history
feat: add DecoratedRange/TDecoratedRange types
  • Loading branch information
zbeyens authored Dec 9, 2024
2 parents d649052 + 7eab6df commit 06f6cac
Show file tree
Hide file tree
Showing 73 changed files with 155 additions and 189 deletions.
6 changes: 6 additions & 0 deletions .changeset/twenty-mayflies-fry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@udecode/slate': patch
'@udecode/plate-core': patch
---

feat: Change Decorate's return type to DecoratedRange/TDecoratedRange
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ body:
attributes:
label: "Slate React version"
description: Please give the version of slate-react
placeholder: ex. 0.103.0
placeholder: ex. 0.112.0
validations:
required: true
- type: textarea
Expand Down
2 changes: 1 addition & 1 deletion apps/www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
"react-wrap-balancer": "^1.1.1",
"remark-emoji": "5.0.1",
"sass": "^1.78.0",
"slate": "0.110.2",
"slate": "0.112.0",
"slate-dom": "0.111.0",
"slate-history": "0.110.3",
"slate-hyperscript": "0.100.0",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
"react-test-renderer": "18.3.1",
"rimraf": "^6.0.1",
"shadcx": "workspace:^",
"slate": "0.110.2",
"slate": "0.112.0",
"slate-dom": "0.111.0",
"slate-history": "0.110.3",
"slate-hyperscript": "0.100.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/ai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"@udecode/plate-common": ">=40.0.0",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/alignment/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/autoformat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/basic-elements/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/basic-marks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/block-quote/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/break/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/callout/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/caption/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/cloud/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/code-block/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/combobox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/comments/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"peerDependencies": {
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"peerDependencies": {
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/lib/plugin/SlatePlugin.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { TDescendant, TNodeEntry, Value } from '@udecode/slate';
import type { AnyObject } from '@udecode/utils';
import type { Range } from 'slate';
import type { DecoratedRange } from 'slate';

import type { SlateEditor } from '../editor';
import type { Nullable } from '../types/misc';
Expand Down Expand Up @@ -393,7 +393,7 @@ export type HtmlSerializer<C extends AnyPluginConfig = PluginConfig> =
*/
export type Decorate<C extends AnyPluginConfig = PluginConfig> = (
ctx: SlatePluginContext<C> & { entry: TNodeEntry }
) => Range[] | undefined;
) => DecoratedRange[] | undefined;

export type InjectNodeProps<C extends AnyPluginConfig = PluginConfig> =
BaseInjectProps & {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/react/plugin/PlatePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import type {
Keys,
} from '@udecode/react-hotkeys';
import type {
TDecoratedRange,
TDescendant,
TElement,
TNodeEntry,
TRange,
TText,
Value,
} from '@udecode/slate';
Expand Down Expand Up @@ -657,7 +657,7 @@ export type HtmlReactSerializer<C extends AnyPluginConfig = PluginConfig> = {
*/
export type Decorate<C extends AnyPluginConfig = PluginConfig> = (
ctx: PlatePluginContext<C> & { entry: TNodeEntry }
) => TRange[] | undefined;
) => TDecoratedRange[] | undefined;

/** Properties used by Plate to inject props into any {@link NodeComponent}. */
export type InjectNodeProps<C extends AnyPluginConfig = PluginConfig> =
Expand Down
2 changes: 1 addition & 1 deletion packages/csv/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/cursor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/diff/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/dnd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"react-dnd": ">=14.0.0",
"react-dnd-html5-backend": ">=14.0.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/docx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/emoji/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/excalidraw/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/find-replace/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/floating/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/font/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/heading/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/highlight/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/horizontal-rule/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/html/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/indent-list/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/indent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/juice/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/layout/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/line-height/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/link/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"@udecode/plate-common": ">=40.2.8",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.103.0",
"slate": ">=0.112.0",
"slate-dom": ">=0.111.0",
"slate-history": ">=0.93.0",
"slate-hyperscript": ">=0.66.0",
Expand Down
Loading

0 comments on commit 06f6cac

Please sign in to comment.