@@ -55,7 +55,7 @@ function highlightCurrentLine() {
5555 }
5656 getDeco(view : EditorView ) {
5757 const dropPos = view .state .field (dropCursorPos , false )
58- const pos = dropPos != null ? dropPos : view .state .selection .main .head
58+ const pos = typeof dropPos === ' number ' ? dropPos : view .state .selection .main .head
5959 const line = view .state .doc .lineAt (pos )
6060 currentLine .value = line .number
6161 return Decoration .set ([
@@ -72,15 +72,15 @@ function highlightCurrentLine() {
7272// so that fields can be tracked here
7373const setDropCursorPos = StateEffect .define <number | null >({
7474 map(pos , mapping ) {
75- return pos == null ? null : mapping .mapPos (pos )
75+ return pos === null ? null : mapping .mapPos (pos )
7676 },
7777})
7878const dropCursorPos = StateField .define <number | null >({
7979 create() {
8080 return null
8181 },
8282 update(pos , tr ) {
83- if (pos != null ) pos = tr .changes .mapPos (pos )
83+ if (pos !== null ) pos = tr .changes .mapPos (pos )
8484 return tr .effects .reduce ((pos , e ) => (e .is (setDropCursorPos ) ? e .value : pos ), pos )
8585 },
8686})
@@ -104,8 +104,8 @@ const drawDropCursor = ViewPlugin.fromClass(
104104 }
105105 update(update : ViewUpdate ) {
106106 const cursorPos = update .state .field (dropCursorPos )
107- if (cursorPos == null ) {
108- if (this .cursor != null ) {
107+ if (cursorPos === null ) {
108+ if (this .cursor !== null ) {
109109 this .cursor ?.remove ()
110110 this .cursor = null
111111 }
@@ -115,7 +115,7 @@ const drawDropCursor = ViewPlugin.fromClass(
115115 this .cursor ! .className = ' cm-dropCursor'
116116 }
117117 if (
118- update .startState .field (dropCursorPos ) != cursorPos ||
118+ update .startState .field (dropCursorPos ) !== cursorPos ||
119119 update .docChanged ||
120120 update .geometryChanged
121121 )
@@ -125,7 +125,7 @@ const drawDropCursor = ViewPlugin.fromClass(
125125 readPos(): { left: number ; top: number ; height: number } | null {
126126 const { view } = this
127127 const pos = view .state .field (dropCursorPos )
128- const rect = pos != null && view .coordsAtPos (pos )
128+ const rect = pos !== null && view .coordsAtPos (pos )
129129 if (! rect ) return null
130130 const outer = view .scrollDOM .getBoundingClientRect ()
131131 return {
@@ -150,7 +150,7 @@ const drawDropCursor = ViewPlugin.fromClass(
150150 if (this .cursor ) this .cursor .remove ()
151151 }
152152 setDropPos(pos : number | null ) {
153- if (this .view .state .field (dropCursorPos ) != pos )
153+ if (this .view .state .field (dropCursorPos ) !== pos )
154154 this .view .dispatch ({ effects: setDropCursorPos .of (pos ) })
155155 }
156156 },
@@ -161,7 +161,7 @@ const drawDropCursor = ViewPlugin.fromClass(
161161 },
162162 dragleave(event ) {
163163 if (
164- event .target == this .view .contentDOM ||
164+ event .target === this .view .contentDOM ||
165165 ! this .view .contentDOM .contains (event .relatedTarget as HTMLElement )
166166 )
167167 this .setDropPos (null )
@@ -212,7 +212,7 @@ onMounted(() => {
212212 highlightCompartment .of ([]),
213213 editableCompartment .of (EditorView .editable .of (! props .readonly )),
214214 ... (props .extensions || []),
215- ].filter ((e ) => !! e ),
215+ ].filter ((e ) => e !== null ),
216216 })
217217})
218218onUnmounted (() => {
0 commit comments