@@ -8,17 +8,9 @@ export default class MyPlugin extends Plugin {
8
8
id : 'insert-footnote' ,
9
9
name : 'Insert Footnote' ,
10
10
checkCallback : ( checking : boolean ) => {
11
- if ( checking ) {
12
- return ! ! this . app . workspace . getActiveViewOfType ( MarkdownView ) ;
13
- }
14
-
11
+ if ( checking ) return ! ! this . app . workspace . getActiveViewOfType ( MarkdownView ) ;
15
12
this . insertFootnote ( ) ;
16
- } ,
17
- hotkeys : [
18
- {
19
- modifiers : [ "Command" , "Shift" ] ,
20
- key : "6" ,
21
- } ]
13
+ }
22
14
} ) ;
23
15
}
24
16
@@ -35,7 +27,7 @@ export default class MyPlugin extends Plugin {
35
27
let markdownText = mdView . data ;
36
28
37
29
// check if we're in a footnote detail line ("[^1]: footnote")
38
- // if so, jump cursor back to original line if we have a previous jumping-off point
30
+ // if so, jump cursor back to the footnote in the text
39
31
let detailLineRegex = / \[ \^ ( \d + ) \] \: / ;
40
32
const cursorPosition = editor . getCursor ( ) ;
41
33
let lineText = editor . getLine ( cursorPosition . line ) ;
@@ -47,7 +39,7 @@ export default class MyPlugin extends Plugin {
47
39
let footnote = s . replace ( ":" , "" ) ;
48
40
49
41
let returnLineIndex = cursorPosition . line ;
50
- // find the first line where this footnote exists in the text
42
+ // find the FIRST OCCURENCE where this footnote exists in the text
51
43
for ( let i = 0 ; i < doc . lineCount ( ) ; i ++ ) {
52
44
let scanLine = doc . getLine ( i ) ;
53
45
if ( scanLine . contains ( footnote ) ) {
0 commit comments