diff --git a/packages/core/src/helpers/node/index.ts b/packages/core/src/helpers/node/index.ts index 3e5901f..53d7669 100644 --- a/packages/core/src/helpers/node/index.ts +++ b/packages/core/src/helpers/node/index.ts @@ -2,7 +2,7 @@ import { Editor, Node as SlateNode } from 'slate'; export default SlateNode; -export const copyNode = async (editor: Editor) => { +export const copySelectedNodeToClipBoard = async (editor: Editor) => { const dataTransfer = new DataTransfer(); editor.setFragmentData(dataTransfer, 'copy'); const clipboardBlobList = dataTransfer.types.map((type) => { @@ -12,7 +12,7 @@ export const copyNode = async (editor: Editor) => { const clipBoardItem: Record = {}; const removeType = 'application/x-slate-fragment'; clipboardBlobList - .filter((value) => value.type !== removeType) + .filter((blob) => blob.type !== removeType) .forEach((blob) => { clipBoardItem[blob.type] = blob; }); diff --git a/packages/core/src/toolmenu/index.tsx b/packages/core/src/toolmenu/index.tsx index b081169..83660e5 100644 --- a/packages/core/src/toolmenu/index.tsx +++ b/packages/core/src/toolmenu/index.tsx @@ -53,7 +53,7 @@ export const Toolmenu: React.FC = ({ path, onDone }) => { offset: lastOffset, }, }; - await helpers.nodeHelpers.copyNode(editor); + await helpers.nodeHelpers.copySelectedNodeToClipBoard(editor); editor.selection = { anchor: { path: [...path, 0], @@ -65,7 +65,7 @@ export const Toolmenu: React.FC = ({ path, onDone }) => { }, }; } else { - helpers.nodeHelpers.copyNode(editor); + helpers.nodeHelpers.copySelectedNodeToClipBoard(editor); } onDone(); }, [editor, path, onDone]);