From edf00d7498e24bea1db38c2bc2750a635c1bff49 Mon Sep 17 00:00:00 2001 From: MasanobuRyuman <22011376mr@tama.ac.jp> Date: Tue, 20 Jun 2023 15:38:39 +0900 Subject: [PATCH] refactor: rename copyNode to copySelectedNodeToClipBoard :recycle: --- packages/core/src/helpers/node/index.ts | 4 ++-- packages/core/src/toolmenu/index.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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]);