Skip to content

Commit

Permalink
[DEV-19138] Drop unused combineOnDOMBeforeInput method from the Ext…
Browse files Browse the repository at this point in the history
…ension interface
  • Loading branch information
e1himself committed Jan 15, 2025
1 parent b61534a commit 11439c4
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 32 deletions.
2 changes: 0 additions & 2 deletions packages/slate-commons/src/types/Extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type { Element, Node } from 'slate';
import type { DecorateFactory } from './DecorateFactory';
import type { DeserializeHtml } from './DeserializeHtml';
import type { Normalize } from './Normalize';
import type { OnDOMBeforeInput } from './OnDOMBeforeInput';
import type { OnKeyDown } from './OnKeyDown';
import type { RenderElement } from './RenderElement';
import type { RenderLeaf } from './RenderLeaf';
Expand All @@ -24,7 +23,6 @@ export interface Extension {
isRichBlock?: (node: Node) => boolean;
isVoid?: (node: Node) => boolean;
normalizeNode?: Normalize | Normalize[];
onDOMBeforeInput?: OnDOMBeforeInput;
onKeyDown?: OnKeyDown | null;
renderElement?: RenderElement;
renderLeaf?: RenderLeaf;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import React, { useCallback, useMemo } from 'react';

import {
combineDecorate,
combineOnDOMBeforeInput,
combineOnKeyDown,
combineRenderElement,
combineRenderLeaf,
Expand All @@ -37,9 +36,7 @@ export interface Props {
*/
extensions?: Extension[];
onCut?: (event: React.ClipboardEvent<HTMLDivElement>) => void;
onDOMBeforeInput?: OnDOMBeforeInput[];
// Dependencies of `onDOMBeforeInput`
onDOMBeforeInputDeps?: any[];
onDOMBeforeInput?: OnDOMBeforeInput;
/**
* Handlers when we press a key
*/
Expand Down Expand Up @@ -73,8 +70,7 @@ export function EditableWithExtensions({
decorate,
editor,
extensions = [],
onDOMBeforeInput: onDOMBeforeInputList = [],
onDOMBeforeInputDeps = [],
onDOMBeforeInput,
onKeyDown: onKeyDownList = [],
onKeyDownDeps = [],
renderElement: renderElementList = [],
Expand All @@ -90,10 +86,6 @@ export function EditableWithExtensions({
},
[decorate, editor, extensions],
);
const combinedOnDOMBeforeInput = useCallback(
combineOnDOMBeforeInput(editor, extensions, onDOMBeforeInputList),
onDOMBeforeInputDeps,
);
const combinedOnKeyDown = useCallback(
combineOnKeyDown(editor, extensions, onKeyDownList),
onKeyDownDeps,
Expand All @@ -113,7 +105,7 @@ export function EditableWithExtensions({
className={classNames(className, 'notranslate')}
translate="no"
decorate={combinedDecorate}
onDOMBeforeInput={combinedOnDOMBeforeInput}
onDOMBeforeInput={onDOMBeforeInput}
onKeyDown={combinedOnKeyDown}
renderElement={combinedRenderElement}
renderLeaf={combinedRenderLeaf}
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion packages/slate-editor/src/modules/editable/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export { combineDecorate } from './combineDecorate';
export { combineOnDOMBeforeInput } from './combineOnDOMBeforeInput';
export { combineOnKeyDown } from './combineOnKeyDown';
export { combineRenderElement } from './combineRenderElement';
export { combineRenderLeaf } from './combineRenderLeaf';
Expand Down

0 comments on commit 11439c4

Please sign in to comment.