@@ -11,7 +11,7 @@ import {
1111 IModel ,
1212 Setting ,
1313 fetchPost ,
14- Protyle
14+ Protyle , openWindow
1515} from "siyuan" ;
1616import "@/index.scss" ;
1717
@@ -105,7 +105,7 @@ export default class PluginSample extends Plugin {
105105
106106 this . addCommand ( {
107107 langKey : "showDialog" ,
108- hotkey : "⇧⌘M " ,
108+ hotkey : "⇧⌘O " ,
109109 callback : ( ) => {
110110 this . showDialog ( ) ;
111111 } ,
@@ -119,6 +119,13 @@ export default class PluginSample extends Plugin {
119119 console . log ( element , "dockCallback" ) ;
120120 } ,
121121 } ) ;
122+ this . addCommand ( {
123+ langKey : "getTab" ,
124+ hotkey : "⇧⌘M" ,
125+ globalCallback : ( ) => {
126+ console . log ( this . getOpenedTab ( ) ) ;
127+ } ,
128+ } ) ;
122129
123130 this . addDock ( {
124131 config : {
@@ -267,7 +274,7 @@ export default class PluginSample extends Plugin {
267274 } ) ;
268275 if ( ! this . isMobile ) {
269276 menu . addItem ( {
270- icon : "iconLayoutBottom " ,
277+ icon : "iconFace " ,
271278 label : "Open Custom Tab" ,
272279 click : ( ) => {
273280 const tab = openTab ( {
@@ -278,14 +285,14 @@ export default class PluginSample extends Plugin {
278285 data : {
279286 text : "This is my custom tab" ,
280287 } ,
281- fn : this . customTab
288+ id : this . name + TAB_TYPE
282289 } ,
283290 } ) ;
284291 console . log ( tab ) ;
285292 }
286293 } ) ;
287294 menu . addItem ( {
288- icon : "iconLayoutBottom " ,
295+ icon : "iconImage " ,
289296 label : "Open Asset Tab(open help first)" ,
290297 click : ( ) => {
291298 const tab = openTab ( {
@@ -298,7 +305,7 @@ export default class PluginSample extends Plugin {
298305 }
299306 } ) ;
300307 menu . addItem ( {
301- icon : "iconLayoutBottom " ,
308+ icon : "iconFile " ,
302309 label : "Open Doc Tab(open help first)" ,
303310 click : async ( ) => {
304311 const tab = await openTab ( {
@@ -311,7 +318,7 @@ export default class PluginSample extends Plugin {
311318 }
312319 } ) ;
313320 menu . addItem ( {
314- icon : "iconLayoutBottom " ,
321+ icon : "iconSearch " ,
315322 label : "Open Search Tab" ,
316323 click : ( ) => {
317324 const tab = openTab ( {
@@ -324,7 +331,7 @@ export default class PluginSample extends Plugin {
324331 }
325332 } ) ;
326333 menu . addItem ( {
327- icon : "iconLayoutBottom " ,
334+ icon : "iconRiffCard " ,
328335 label : "Open Card Tab" ,
329336 click : ( ) => {
330337 const tab = openTab ( {
@@ -348,6 +355,15 @@ export default class PluginSample extends Plugin {
348355 } ) ;
349356 }
350357 } ) ;
358+ menu . addItem ( {
359+ icon : "iconOpenWindow" ,
360+ label : "Open Doc Window(open help first)" ,
361+ click : ( ) => {
362+ openWindow ( {
363+ doc : { id : "20200812220555-lj3enxa" }
364+ } ) ;
365+ }
366+ } ) ;
351367 }
352368 menu . addItem ( {
353369 icon : "iconScrollHoriz" ,
@@ -431,6 +447,30 @@ export default class PluginSample extends Plugin {
431447 click : ( ) => {
432448 this . eventBus . on ( "loaded-protyle" , this . eventBusLog ) ;
433449 }
450+ } , {
451+ icon : "iconSelect" ,
452+ label : "On loaded-protyle-dynamic" ,
453+ click : ( ) => {
454+ this . eventBus . on ( "loaded-protyle-dynamic" , this . eventBusLog ) ;
455+ }
456+ } , {
457+ icon : "iconClose" ,
458+ label : "Off loaded-protyle-dynamic" ,
459+ click : ( ) => {
460+ this . eventBus . off ( "loaded-protyle-dynamic" , this . eventBusLog ) ;
461+ }
462+ } , {
463+ icon : "iconSelect" ,
464+ label : "On destroy-protyle" ,
465+ click : ( ) => {
466+ this . eventBus . on ( "destroy-protyle" , this . eventBusLog ) ;
467+ }
468+ } , {
469+ icon : "iconClose" ,
470+ label : "Off destroy-protyle" ,
471+ click : ( ) => {
472+ this . eventBus . off ( "destroy-protyle" , this . eventBusLog ) ;
473+ }
434474 } , {
435475 icon : "iconClose" ,
436476 label : "Off loaded-protyle" ,
0 commit comments