Skip to content

Commit

Permalink
refactor: rename copyNode to copySelectedNodeToClipBoard ♻️
Browse files Browse the repository at this point in the history
  • Loading branch information
MasanobuRyuman committed Jun 20, 2023
1 parent 4067c8d commit edf00d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/helpers/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -12,7 +12,7 @@ export const copyNode = async (editor: Editor) => {
const clipBoardItem: Record<string, Blob> = {};
const removeType = 'application/x-slate-fragment';
clipboardBlobList
.filter((value) => value.type !== removeType)
.filter((blob) => blob.type !== removeType)
.forEach((blob) => {
clipBoardItem[blob.type] = blob;
});
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/toolmenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const Toolmenu: React.FC<ToolmenuProps> = ({ path, onDone }) => {
offset: lastOffset,
},
};
await helpers.nodeHelpers.copyNode(editor);
await helpers.nodeHelpers.copySelectedNodeToClipBoard(editor);
editor.selection = {
anchor: {
path: [...path, 0],
Expand All @@ -65,7 +65,7 @@ export const Toolmenu: React.FC<ToolmenuProps> = ({ path, onDone }) => {
},
};
} else {
helpers.nodeHelpers.copyNode(editor);
helpers.nodeHelpers.copySelectedNodeToClipBoard(editor);
}
onDone();
}, [editor, path, onDone]);
Expand Down

0 comments on commit edf00d7

Please sign in to comment.