Skip to content

Commit

Permalink
fix: don't copy if the string is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
MasanobuRyuman committed Jun 19, 2023
1 parent 71246de commit 53d4dcc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/core/src/toolmenu/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useCallback } from 'react';
import { Path } from 'slate';
import { Path, last } from 'slate';
import { useSlate } from 'slate-react';
import { CopyIcon } from '../components/icons/copy';
import { DustboxIcon } from '../components/icons/dustbox';
Expand Down Expand Up @@ -39,6 +39,10 @@ export const Toolmenu: React.FC<ToolmenuProps> = ({ path, onDone }) => {
return;
}
const lastOffset = lastTextNode.text.length;
if (!lastOffset) {
onDone();
return;
}
editor.selection = {
anchor: {
path: [...path, 0],
Expand Down

0 comments on commit 53d4dcc

Please sign in to comment.