File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 1+ import { Transaction } from "@codemirror/state" ;
12import {
23 ViewUpdate ,
34 PluginValue ,
@@ -22,9 +23,19 @@ class EditorPlugin implements PluginValue {
2223 }
2324
2425 const tr = update . transactions [ 0 ] ;
25- if ( ! tr ) return ;
26+
27+ if ( ! tr ) {
28+ return ;
29+ }
30+
31+ // When selecting text with Shift+Home the userEventType is undefined.
32+ // This is probably a bug in codemirror, for the time being doing an explict check
33+ // for the type allows us to update the stats for the selection.
34+ const userEventTypeUndefined =
35+ tr . annotation ( Transaction . userEvent ) === undefined ;
36+
2637 if (
27- tr . isUserEvent ( "select" ) &&
38+ ( tr . isUserEvent ( "select" ) || userEventTypeUndefined ) &&
2839 tr . newSelection . ranges [ 0 ] . from !== tr . newSelection . ranges [ 0 ] . to
2940 ) {
3041 let text = "" ;
You can’t perform that action at this time.
0 commit comments