slate-react
Advanced tools
Comparing version 0.110.3 to 0.111.0-20241031142807
@@ -5,3 +5,3 @@ import React from 'react'; | ||
import { ReactEditor } from '../plugin/react-editor'; | ||
import { DOMRange } from '../utils/dom'; | ||
import { DOMRange } from 'slate-dom'; | ||
/** | ||
@@ -8,0 +8,0 @@ * `RenderElementProps` are passed to the `renderElement` handler. |
@@ -16,3 +16,3 @@ export { Editable, RenderElementProps, RenderLeafProps, RenderPlaceholderProps, DefaultPlaceholder, } from './components/editable'; | ||
export { withReact } from './plugin/with-react'; | ||
export { NODE_TO_INDEX, NODE_TO_PARENT } from './utils/weak-maps'; | ||
export { NODE_TO_INDEX, NODE_TO_PARENT } from 'slate-dom'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,158 +0,10 @@ | ||
import { BaseEditor, Editor, Node, Path, Point, Range } from 'slate'; | ||
import { TextDiff } from '../utils/diff-text'; | ||
import { DOMNode, DOMPoint, DOMRange, DOMSelection, DOMStaticRange } from '../utils/dom'; | ||
import { Key } from '../utils/key'; | ||
import { DOMEditor, type DOMEditorInterface } from 'slate-dom'; | ||
/** | ||
* A React and DOM-specific version of the `Editor` interface. | ||
*/ | ||
export interface ReactEditor extends BaseEditor { | ||
hasEditableTarget: (editor: ReactEditor, target: EventTarget | null) => target is DOMNode; | ||
hasRange: (editor: ReactEditor, range: Range) => boolean; | ||
hasSelectableTarget: (editor: ReactEditor, target: EventTarget | null) => boolean; | ||
hasTarget: (editor: ReactEditor, target: EventTarget | null) => target is DOMNode; | ||
insertData: (data: DataTransfer) => void; | ||
insertFragmentData: (data: DataTransfer) => boolean; | ||
insertTextData: (data: DataTransfer) => boolean; | ||
isTargetInsideNonReadonlyVoid: (editor: ReactEditor, target: EventTarget | null) => boolean; | ||
setFragmentData: (data: DataTransfer, originEvent?: 'drag' | 'copy' | 'cut') => void; | ||
export interface ReactEditor extends DOMEditor { | ||
} | ||
export interface ReactEditorInterface { | ||
/** | ||
* Experimental and android specific: Get pending diffs | ||
*/ | ||
androidPendingDiffs: (editor: Editor) => TextDiff[] | undefined; | ||
/** | ||
* Experimental and android specific: Flush all pending diffs and cancel composition at the next possible time. | ||
*/ | ||
androidScheduleFlush: (editor: Editor) => void; | ||
/** | ||
* Blur the editor. | ||
*/ | ||
blur: (editor: ReactEditor) => void; | ||
/** | ||
* Deselect the editor. | ||
*/ | ||
deselect: (editor: ReactEditor) => void; | ||
/** | ||
* Find the DOM node that implements DocumentOrShadowRoot for the editor. | ||
*/ | ||
findDocumentOrShadowRoot: (editor: ReactEditor) => Document | ShadowRoot; | ||
/** | ||
* Get the target range from a DOM `event`. | ||
*/ | ||
findEventRange: (editor: ReactEditor, event: any) => Range; | ||
/** | ||
* Find a key for a Slate node. | ||
*/ | ||
findKey: (editor: ReactEditor, node: Node) => Key; | ||
/** | ||
* Find the path of Slate node. | ||
*/ | ||
findPath: (editor: ReactEditor, node: Node) => Path; | ||
/** | ||
* Focus the editor. | ||
*/ | ||
focus: (editor: ReactEditor, options?: { | ||
retries: number; | ||
}) => void; | ||
/** | ||
* Return the host window of the current editor. | ||
*/ | ||
getWindow: (editor: ReactEditor) => Window; | ||
/** | ||
* Check if a DOM node is within the editor. | ||
*/ | ||
hasDOMNode: (editor: ReactEditor, target: DOMNode, options?: { | ||
editable?: boolean; | ||
}) => boolean; | ||
/** | ||
* Check if the target is editable and in the editor. | ||
*/ | ||
hasEditableTarget: (editor: ReactEditor, target: EventTarget | null) => target is DOMNode; | ||
/** | ||
* | ||
*/ | ||
hasRange: (editor: ReactEditor, range: Range) => boolean; | ||
/** | ||
* Check if the target can be selectable | ||
*/ | ||
hasSelectableTarget: (editor: ReactEditor, target: EventTarget | null) => boolean; | ||
/** | ||
* Check if the target is in the editor. | ||
*/ | ||
hasTarget: (editor: ReactEditor, target: EventTarget | null) => target is DOMNode; | ||
/** | ||
* Insert data from a `DataTransfer` into the editor. | ||
*/ | ||
insertData: (editor: ReactEditor, data: DataTransfer) => void; | ||
/** | ||
* Insert fragment data from a `DataTransfer` into the editor. | ||
*/ | ||
insertFragmentData: (editor: ReactEditor, data: DataTransfer) => boolean; | ||
/** | ||
* Insert text data from a `DataTransfer` into the editor. | ||
*/ | ||
insertTextData: (editor: ReactEditor, data: DataTransfer) => boolean; | ||
/** | ||
* Check if the user is currently composing inside the editor. | ||
*/ | ||
isComposing: (editor: ReactEditor) => boolean; | ||
/** | ||
* Check if the editor is focused. | ||
*/ | ||
isFocused: (editor: ReactEditor) => boolean; | ||
/** | ||
* Check if the editor is in read-only mode. | ||
*/ | ||
isReadOnly: (editor: ReactEditor) => boolean; | ||
/** | ||
* Check if the target is inside void and in an non-readonly editor. | ||
*/ | ||
isTargetInsideNonReadonlyVoid: (editor: ReactEditor, target: EventTarget | null) => boolean; | ||
/** | ||
* Sets data from the currently selected fragment on a `DataTransfer`. | ||
*/ | ||
setFragmentData: (editor: ReactEditor, data: DataTransfer, originEvent?: 'drag' | 'copy' | 'cut') => void; | ||
/** | ||
* Find the native DOM element from a Slate node. | ||
*/ | ||
toDOMNode: (editor: ReactEditor, node: Node) => HTMLElement; | ||
/** | ||
* Find a native DOM selection point from a Slate point. | ||
*/ | ||
toDOMPoint: (editor: ReactEditor, point: Point) => DOMPoint; | ||
/** | ||
* Find a native DOM range from a Slate `range`. | ||
* | ||
* Notice: the returned range will always be ordinal regardless of the direction of Slate `range` due to DOM API limit. | ||
* | ||
* there is no way to create a reverse DOM Range using Range.setStart/setEnd | ||
* according to https://dom.spec.whatwg.org/#concept-range-bp-set. | ||
*/ | ||
toDOMRange: (editor: ReactEditor, range: Range) => DOMRange; | ||
/** | ||
* Find a Slate node from a native DOM `element`. | ||
*/ | ||
toSlateNode: (editor: ReactEditor, domNode: DOMNode) => Node; | ||
/** | ||
* Find a Slate point from a DOM selection's `domNode` and `domOffset`. | ||
*/ | ||
toSlatePoint: <T extends boolean>(editor: ReactEditor, domPoint: DOMPoint, options: { | ||
exactMatch: boolean; | ||
suppressThrow: T; | ||
/** | ||
* The direction to search for Slate leaf nodes if `domPoint` is | ||
* non-editable and non-void. | ||
*/ | ||
searchDirection?: 'forward' | 'backward'; | ||
}) => T extends true ? Point | null : Point; | ||
/** | ||
* Find a Slate range from a DOM range or selection. | ||
*/ | ||
toSlateRange: <T extends boolean>(editor: ReactEditor, domRange: DOMRange | DOMStaticRange | DOMSelection, options: { | ||
exactMatch: boolean; | ||
suppressThrow: T; | ||
}) => T extends true ? Range | null : Range; | ||
export interface ReactEditorInterface extends DOMEditorInterface { | ||
} | ||
export declare const ReactEditor: ReactEditorInterface; | ||
//# sourceMappingURL=react-editor.d.ts.map |
export declare const REACT_MAJOR_VERSION: number; | ||
export declare const IS_IOS: boolean; | ||
export declare const IS_APPLE: boolean; | ||
export declare const IS_ANDROID: boolean; | ||
export declare const IS_FIREFOX: boolean; | ||
export declare const IS_WEBKIT: boolean; | ||
export declare const IS_EDGE_LEGACY: boolean; | ||
export declare const IS_CHROME: boolean; | ||
export declare const IS_CHROME_LEGACY: boolean; | ||
export declare const IS_ANDROID_CHROME_LEGACY: boolean; | ||
export declare const IS_FIREFOX_LEGACY: boolean; | ||
export declare const IS_UC_MOBILE: boolean; | ||
export declare const IS_WECHATBROWSER: boolean; | ||
export declare const CAN_USE_DOM: boolean; | ||
export declare const IS_SAFARI_LEGACY: boolean; | ||
export declare const HAS_BEFORE_INPUT_SUPPORT: boolean; | ||
//# sourceMappingURL=environment.d.ts.map |
{ | ||
"name": "slate-react", | ||
"description": "Tools for building completely customizable richtext editors with React.", | ||
"version": "0.110.3", | ||
"version": "0.111.0-20241031142807", | ||
"license": "MIT", | ||
@@ -38,2 +38,3 @@ "repository": "git://github.com/ianstormtaylor/slate.git", | ||
"slate": "^0.110.2", | ||
"slate-dom": "0.111.0-20241031142807", | ||
"slate-hyperscript": "^0.100.0", | ||
@@ -45,3 +46,4 @@ "source-map-loader": "^4.0.1" | ||
"react-dom": ">=18.2.0", | ||
"slate": ">=0.99.0" | ||
"slate": ">=0.99.0", | ||
"slate-dom": "0.111.0-20241031142807" | ||
}, | ||
@@ -48,0 +50,0 @@ "umdGlobals": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
2441258
11
15
68
39565