Skip to content

Commit

Permalink
decorate
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfeng33 committed Dec 17, 2024
1 parent a7f7027 commit ed7c677
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 54 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/lib/static/utils/pipeDecorate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const pipeDecorate = (
if (decorateProp) {
addRanges(
decorateProp({
editor: editor,
editor,
entry,
})
);
Expand Down
7 changes: 5 additions & 2 deletions packages/core/src/react/hooks/useEditableProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import { useDeepCompareMemo } from 'use-deep-compare';

import type { PlateProps } from '../components';

import { pipeDecorate } from '../../lib/static/utils/pipeDecorate';
import { useEditorRef, usePlateSelectors } from '../stores';
import { DOM_HANDLERS } from '../utils/dom-attributes';
import { pipeDecorate } from '../utils/pipeDecorate';
import { pipeHandler } from '../utils/pipeHandler';
import { pipeRenderElement } from '../utils/pipeRenderElement';
import { pipeRenderLeaf } from '../utils/pipeRenderLeaf';
Expand All @@ -33,7 +33,10 @@ export const useEditableProps = ({
const storeRenderElement = selectors.renderElement();

const decorateMemo = useMemoOnce(() => {
return pipeDecorate(editor, storeDecorate ?? editableProps?.decorate);
return pipeDecorate(
editor,
storeDecorate ?? (editableProps?.decorate as any)
);
}, [editableProps?.decorate, editor, storeDecorate]);

const decorate: typeof decorateMemo = useMemoOnce(() => {
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/react/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export * from './createPlateFallbackEditor';
export * from './dom-attributes';
export * from './getRenderNodeProps';
export * from './hotkeys';
export * from './pipeDecorate';
export * from './pipeHandler';
export * from './pipeOnChange';
export * from './pipeRenderElement';
Expand Down
50 changes: 0 additions & 50 deletions packages/core/src/react/utils/pipeDecorate.ts

This file was deleted.

0 comments on commit ed7c677

Please sign in to comment.