@@ -26,9 +26,10 @@ export default class PluginSample extends Plugin {
2626
2727 private customTab : ( ) => IModel ;
2828 private isMobile : boolean ;
29+ private blockIconEventBindThis = this . blockIconEvent . bind ( this ) ;
2930
3031 async onload ( ) {
31- this . data [ STORAGE_NAME ] = { readonlyText : "Readonly" } ;
32+ this . data [ STORAGE_NAME ] = { readonlyText : "Readonly" } ;
3233
3334 console . log ( "loading plugin-sample" , this . i18n ) ;
3435
@@ -72,7 +73,7 @@ export default class PluginSample extends Plugin {
7273 statusIconTemp . content . firstElementChild . addEventListener ( "click" , ( ) => {
7374 confirm ( "⚠️" , this . i18n . confirmRemove . replace ( "${name}" , this . name ) , ( ) => {
7475 this . removeData ( STORAGE_NAME ) . then ( ( ) => {
75- this . data [ STORAGE_NAME ] = { readonlyText : "Readonly" } ;
76+ this . data [ STORAGE_NAME ] = { readonlyText : "Readonly" } ;
7677 showMessage ( `[${ this . name } ]: ${ this . i18n . removedData } ` ) ;
7778 } ) ;
7879 } ) ;
@@ -113,7 +114,7 @@ export default class PluginSample extends Plugin {
113114 this . addDock ( {
114115 config : {
115116 position : "LeftBottom" ,
116- size : { width : 200 , height : 0 } ,
117+ size : { width : 200 , height : 0 } ,
117118 icon : "iconSaving" ,
118119 title : "Custom Dock" ,
119120 } ,
@@ -144,7 +145,7 @@ export default class PluginSample extends Plugin {
144145 const textareaElement = document . createElement ( "textarea" ) ;
145146 this . setting = new Setting ( {
146147 confirmCallback : ( ) => {
147- this . saveData ( STORAGE_NAME , { readonlyText : textareaElement . value } ) ;
148+ this . saveData ( STORAGE_NAME , { readonlyText : textareaElement . value } ) ;
148149 }
149150 } ) ;
150151 this . setting . addItem ( {
@@ -210,11 +211,11 @@ export default class PluginSample extends Plugin {
210211 } ) ;
211212 }
212213
213- private eventBusLog ( { detail} : any ) {
214+ private eventBusLog ( { detail } : any ) {
214215 console . log ( detail ) ;
215216 }
216217
217- private blockIconEvent ( { detail} : any ) {
218+ private blockIconEvent ( { detail } : any ) {
218219 const ids : string [ ] = [ ] ;
219220 detail . blockElements . forEach ( ( item : HTMLElement ) => {
220221 ids . push ( item . getAttribute ( "data-node-id" ) ) ;
@@ -359,13 +360,13 @@ export default class PluginSample extends Plugin {
359360 icon : "iconSelect" ,
360361 label : "On click-blockicon" ,
361362 click : ( ) => {
362- this . eventBus . on ( "click-blockicon" , this . blockIconEvent ) ;
363+ this . eventBus . on ( "click-blockicon" , this . blockIconEventBindThis ) ;
363364 }
364365 } , {
365366 icon : "iconClose" ,
366367 label : "Off click-blockicon" ,
367368 click : ( ) => {
368- this . eventBus . off ( "click-blockicon" , this . blockIconEvent ) ;
369+ this . eventBus . off ( "click-blockicon" , this . blockIconEventBindThis ) ;
369370 }
370371 } , {
371372 icon : "iconSelect" ,
@@ -427,6 +428,102 @@ export default class PluginSample extends Plugin {
427428 click : ( ) => {
428429 this . eventBus . off ( "loaded-protyle" , this . eventBusLog ) ;
429430 }
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+ }
430527 } ]
431528 } ) ;
432529 menu . addSeparator ( ) ;
0 commit comments