-
-
Notifications
You must be signed in to change notification settings - Fork 755
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
38 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@udecode/slate-react': patch | ||
--- | ||
|
||
Type |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); |
3 changes: 2 additions & 1 deletion
3
...rc/queries/__tests__/isType/type.spec.tsx → packages/plate-utils/src/lib/isType.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>; |