@@ -26,9 +26,10 @@ export default class PluginSample extends Plugin {
26
26
27
27
private customTab : ( ) => IModel ;
28
28
private isMobile : boolean ;
29
+ private blockIconEventBindThis = this . blockIconEvent . bind ( this ) ;
29
30
30
31
async onload ( ) {
31
- this . data [ STORAGE_NAME ] = { readonlyText : "Readonly" } ;
32
+ this . data [ STORAGE_NAME ] = { readonlyText : "Readonly" } ;
32
33
33
34
console . log ( "loading plugin-sample" , this . i18n ) ;
34
35
@@ -72,7 +73,7 @@ export default class PluginSample extends Plugin {
72
73
statusIconTemp . content . firstElementChild . addEventListener ( "click" , ( ) => {
73
74
confirm ( "⚠️" , this . i18n . confirmRemove . replace ( "${name}" , this . name ) , ( ) => {
74
75
this . removeData ( STORAGE_NAME ) . then ( ( ) => {
75
- this . data [ STORAGE_NAME ] = { readonlyText : "Readonly" } ;
76
+ this . data [ STORAGE_NAME ] = { readonlyText : "Readonly" } ;
76
77
showMessage ( `[${ this . name } ]: ${ this . i18n . removedData } ` ) ;
77
78
} ) ;
78
79
} ) ;
@@ -113,7 +114,7 @@ export default class PluginSample extends Plugin {
113
114
this . addDock ( {
114
115
config : {
115
116
position : "LeftBottom" ,
116
- size : { width : 200 , height : 0 } ,
117
+ size : { width : 200 , height : 0 } ,
117
118
icon : "iconSaving" ,
118
119
title : "Custom Dock" ,
119
120
} ,
@@ -144,7 +145,7 @@ export default class PluginSample extends Plugin {
144
145
const textareaElement = document . createElement ( "textarea" ) ;
145
146
this . setting = new Setting ( {
146
147
confirmCallback : ( ) => {
147
- this . saveData ( STORAGE_NAME , { readonlyText : textareaElement . value } ) ;
148
+ this . saveData ( STORAGE_NAME , { readonlyText : textareaElement . value } ) ;
148
149
}
149
150
} ) ;
150
151
this . setting . addItem ( {
@@ -210,11 +211,11 @@ export default class PluginSample extends Plugin {
210
211
} ) ;
211
212
}
212
213
213
- private eventBusLog ( { detail} : any ) {
214
+ private eventBusLog ( { detail } : any ) {
214
215
console . log ( detail ) ;
215
216
}
216
217
217
- private blockIconEvent ( { detail} : any ) {
218
+ private blockIconEvent ( { detail } : any ) {
218
219
const ids : string [ ] = [ ] ;
219
220
detail . blockElements . forEach ( ( item : HTMLElement ) => {
220
221
ids . push ( item . getAttribute ( "data-node-id" ) ) ;
@@ -359,13 +360,13 @@ export default class PluginSample extends Plugin {
359
360
icon : "iconSelect" ,
360
361
label : "On click-blockicon" ,
361
362
click : ( ) => {
362
- this . eventBus . on ( "click-blockicon" , this . blockIconEvent ) ;
363
+ this . eventBus . on ( "click-blockicon" , this . blockIconEventBindThis ) ;
363
364
}
364
365
} , {
365
366
icon : "iconClose" ,
366
367
label : "Off click-blockicon" ,
367
368
click : ( ) => {
368
- this . eventBus . off ( "click-blockicon" , this . blockIconEvent ) ;
369
+ this . eventBus . off ( "click-blockicon" , this . blockIconEventBindThis ) ;
369
370
}
370
371
} , {
371
372
icon : "iconSelect" ,
@@ -427,6 +428,102 @@ export default class PluginSample extends Plugin {
427
428
click : ( ) => {
428
429
this . eventBus . off ( "loaded-protyle" , this . eventBusLog ) ;
429
430
}
431
+ } , {
432
+ icon : "iconSelect" ,
433
+ label : "On open-menu-blockref" ,
434
+ click : ( ) => {
435
+ this . eventBus . on ( "open-menu-blockref" , this . eventBusLog ) ;
436
+ }
437
+ } , {
438
+ icon : "iconClose" ,
439
+ label : "Off open-menu-blockref" ,
440
+ click : ( ) => {
441
+ this . eventBus . off ( "open-menu-blockref" , this . eventBusLog ) ;
442
+ }
443
+ } , {
444
+ icon : "iconSelect" ,
445
+ label : "On open-menu-fileannotationref" ,
446
+ click : ( ) => {
447
+ this . eventBus . on ( "open-menu-fileannotationref" , this . eventBusLog ) ;
448
+ }
449
+ } , {
450
+ icon : "iconClose" ,
451
+ label : "Off open-menu-fileannotationref" ,
452
+ click : ( ) => {
453
+ this . eventBus . off ( "open-menu-fileannotationref" , this . eventBusLog ) ;
454
+ }
455
+ } , {
456
+ icon : "iconSelect" ,
457
+ label : "On open-menu-tag" ,
458
+ click : ( ) => {
459
+ this . eventBus . on ( "open-menu-tag" , this . eventBusLog ) ;
460
+ }
461
+ } , {
462
+ icon : "iconClose" ,
463
+ label : "Off open-menu-tag" ,
464
+ click : ( ) => {
465
+ this . eventBus . off ( "open-menu-tag" , this . eventBusLog ) ;
466
+ }
467
+ } , {
468
+ icon : "iconSelect" ,
469
+ label : "On open-menu-link" ,
470
+ click : ( ) => {
471
+ this . eventBus . on ( "open-menu-link" , this . eventBusLog ) ;
472
+ }
473
+ } , {
474
+ icon : "iconClose" ,
475
+ label : "Off open-menu-link" ,
476
+ click : ( ) => {
477
+ this . eventBus . off ( "open-menu-link" , this . eventBusLog ) ;
478
+ }
479
+ } , {
480
+ icon : "iconSelect" ,
481
+ label : "On open-menu-image" ,
482
+ click : ( ) => {
483
+ this . eventBus . on ( "open-menu-image" , this . eventBusLog ) ;
484
+ }
485
+ } , {
486
+ icon : "iconClose" ,
487
+ label : "Off open-menu-image" ,
488
+ click : ( ) => {
489
+ this . eventBus . off ( "open-menu-image" , this . eventBusLog ) ;
490
+ }
491
+ } , {
492
+ icon : "iconSelect" ,
493
+ label : "On open-menu-av" ,
494
+ click : ( ) => {
495
+ this . eventBus . on ( "open-menu-av" , this . eventBusLog ) ;
496
+ }
497
+ } , {
498
+ icon : "iconClose" ,
499
+ label : "Off open-menu-av" ,
500
+ click : ( ) => {
501
+ this . eventBus . off ( "open-menu-av" , this . eventBusLog ) ;
502
+ }
503
+ } , {
504
+ icon : "iconSelect" ,
505
+ label : "On open-menu-content" ,
506
+ click : ( ) => {
507
+ this . eventBus . on ( "open-menu-content" , this . eventBusLog ) ;
508
+ }
509
+ } , {
510
+ icon : "iconClose" ,
511
+ label : "Off open-menu-content" ,
512
+ click : ( ) => {
513
+ this . eventBus . off ( "open-menu-content" , this . eventBusLog ) ;
514
+ }
515
+ } , {
516
+ icon : "iconSelect" ,
517
+ label : "On open-menu-breadcrumbmore" ,
518
+ click : ( ) => {
519
+ this . eventBus . on ( "open-menu-breadcrumbmore" , this . eventBusLog ) ;
520
+ }
521
+ } , {
522
+ icon : "iconClose" ,
523
+ label : "Off open-menu-breadcrumbmore" ,
524
+ click : ( ) => {
525
+ this . eventBus . off ( "open-menu-breadcrumbmore" , this . eventBusLog ) ;
526
+ }
430
527
} ]
431
528
} ) ;
432
529
menu . addSeparator ( ) ;
0 commit comments