Skip to content

Commit 91c7634

Browse files
committed
chore(cut/copy): safeguard selection
1 parent fc23b21 commit 91c7634

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/dispatcher.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,15 @@ export default class Dispatcher {
111111
const block = this.getEditableBlockByEvent(evt)
112112
if (!block) return
113113
const selection = this.selectionWatcher.getFreshSelection()
114-
if (selection.isSelection) {
114+
if (selection && selection.isSelection) {
115115
this.notify('clipboard', block, 'copy', selection)
116116
}
117117
})
118118
.setupDocumentListener('cut', function cutListener (evt) {
119119
const block = this.getEditableBlockByEvent(evt)
120120
if (!block) return
121121
const selection = this.selectionWatcher.getFreshSelection()
122-
if (selection.isSelection) {
122+
if (selection && selection.isSelection) {
123123
this.notify('clipboard', block, 'cut', selection)
124124
this.triggerChangeEvent(block)
125125
}

0 commit comments

Comments
 (0)