Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zbeyens committed Dec 21, 2024
1 parent 08159e9 commit e57256d
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/cuddly-swans-doubt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@udecode/slate-react': patch
---

Type
Empty file.
Empty file.
10 changes: 10 additions & 0 deletions packages/common/src/type.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { createSlateEditor } from '@udecode/plate-core';
import { isType } from '@udecode/plate-utils';

it('should not throw', () => {
const editor = createSlateEditor();

expect(
isType(createSlateEditor({ editor }), editor.children[0], 'p')
).toEqual(true);
});
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/** @jsx jsxt */
import { type SlateEditor, createSlateEditor } from '@udecode/plate-core';
import { jsxt } from '@udecode/plate-test-utils';
import { isType } from '@udecode/plate-utils';

import { isType } from './isType';

jsxt;

Expand Down
24 changes: 21 additions & 3 deletions packages/slate-react/src/types/TEditableProps.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
import type { TNodeEntry } from '@udecode/slate';
import type { TEditor, TNodeEntry } from '@udecode/slate';
import type { Range } from 'slate';
import type { EditableProps } from 'slate-react/dist/components/editable';
import type { DOMRange } from 'slate-dom';

import type { RenderElementFn } from './TRenderElementProps';
import type { RenderLeafFn } from './TRenderLeafProps';

/** `EditableProps` are passed to the <Editable> component. */
export type TEditableProps = {
renderPlaceholder?: (props: {
attributes: {
contentEditable: boolean;
'data-slate-placeholder': boolean;
ref: React.RefCallback<any>;
style: React.CSSProperties;
dir?: 'rtl';
};
children: any;
}) => JSX.Element;
as?: React.ElementType;
decorate?: (entry: TNodeEntry) => Range[];
disableDefaultStyles?: boolean;
placeholder?: string;
readOnly?: boolean;
renderElement?: RenderElementFn;
renderLeaf?: RenderLeafFn;
} & Omit<EditableProps, 'decorate' | 'renderElement' | 'renderLeaf'>;
role?: string;
scrollSelectionIntoView?: (editor: TEditor, domRange: DOMRange) => void;
style?: React.CSSProperties;
onDOMBeforeInput?: (event: InputEvent) => void;
} & React.TextareaHTMLAttributes<HTMLDivElement>;

0 comments on commit e57256d

Please sign in to comment.