@@ -47,43 +47,43 @@ export default class GistrPlugin extends Plugin
47
47
Rehash Reading View
48
48
*/
49
49
50
- renderModeReading ( ) : void
50
+ renderModeReading ( ) : void
51
51
{
52
- this . app . workspace . iterateRootLeaves ( ( leaf : WorkspaceLeaf ) =>
52
+ this . app . workspace . iterateRootLeaves ( ( leaf : WorkspaceLeaf ) =>
53
53
{
54
- if ( leaf . view instanceof MarkdownView && leaf . view . getMode ( ) === "preview" )
55
- leaf . view . previewMode . rerender ( true )
56
- } )
57
- }
54
+ if ( leaf . view instanceof MarkdownView && leaf . view . getMode ( ) === "preview" )
55
+ leaf . view . previewMode . rerender ( true )
56
+ } )
57
+ }
58
58
59
59
/*
60
60
Development use re-rendering
61
61
*/
62
62
63
- async renderDevelopment ( )
63
+ async renderDevelopment ( )
64
64
{
65
- for ( const leaf of this . app . workspace . getLeavesOfType ( 'markdown' ) )
65
+ for ( const leaf of this . app . workspace . getLeavesOfType ( 'markdown' ) )
66
66
{
67
- const view = leaf . view as MarkdownView
68
- const state = view . getState ( )
69
- const etateEph = view . getEphemeralState ( )
67
+ const view = leaf . view as MarkdownView
68
+ const state = view . getState ( )
69
+ const etateEph = view . getEphemeralState ( )
70
70
71
- view . previewMode . rerender ( true )
71
+ view . previewMode . rerender ( true )
72
72
73
- const editor = view . editor
74
- editor . setValue ( editor . getValue ( ) )
73
+ const editor = view . editor
74
+ editor . setValue ( editor . getValue ( ) )
75
75
76
- if ( state . mode === 'preview' )
76
+ if ( state . mode === 'preview' )
77
77
{
78
- state . mode = 'source'
79
- await view . setState ( state , { history : false } )
80
- state . mode = 'preview'
81
- await view . setState ( state , { history : false } )
82
- }
78
+ state . mode = 'source'
79
+ await view . setState ( state , { history : false } )
80
+ state . mode = 'preview'
81
+ await view . setState ( state , { history : false } )
82
+ }
83
83
84
- view . setEphemeralState ( etateEph )
85
- }
86
- }
84
+ view . setEphemeralState ( etateEph )
85
+ }
86
+ }
87
87
88
88
/*
89
89
Portal > Initialize
@@ -115,13 +115,25 @@ export default class GistrPlugin extends Plugin
115
115
{
116
116
console . debug ( lng ( "base_debug_loading" , process . env . NAME , process . env . PLUGIN_VERSION , process . env . AUTHOR ) )
117
117
118
+ if ( process . env . ENV === "dev" )
119
+ {
120
+ console . log ( process . env . NODE_ENV )
121
+ console . log ( process . env . ENV )
122
+ console . log ( process . env . BUILD )
123
+ console . log ( process . env . PLUGIN_VERSION )
124
+ console . log ( process . env . BUILD_GUID )
125
+ console . log ( process . env . BUILD_UUID )
126
+ console . log ( process . env . BUILD_DATE )
127
+ console . log ( process . env . AUTHOR )
128
+ }
129
+
118
130
await this . loadSettings ( )
119
131
await this . InitializePortal ( )
120
132
this . addSettingTab ( new SettingsSection ( this . app , this ) )
121
133
this . registerPortal ( )
122
134
SaturynCodeblock ( this )
123
135
124
- this . app . workspace . onLayoutReady ( async ( ) =>
136
+ this . app . workspace . onLayoutReady ( async ( ) =>
125
137
{
126
138
if ( this . settings . firststart === true )
127
139
{
@@ -167,7 +179,7 @@ export default class GistrPlugin extends Plugin
167
179
} )
168
180
)
169
181
170
- } )
182
+ } )
171
183
172
184
/*
173
185
Command Palette Items
@@ -399,7 +411,6 @@ export default class GistrPlugin extends Plugin
399
411
const { sy_enable_autosave } = await SettingsGet ( this )
400
412
if ( sy_enable_autosave )
401
413
{
402
-
403
414
await denounce_register [ file . path ] ( note_full , file )
404
415
405
416
if ( process . env . ENV === "dev" )
@@ -438,11 +449,11 @@ export default class GistrPlugin extends Plugin
438
449
Ribbon > Unregister
439
450
*/
440
451
441
- async unregisterRibbon ( )
452
+ async unregisterRibbon ( )
442
453
{
443
- this . ribbonIcon_pub . remove ( )
454
+ this . ribbonIcon_pub . remove ( )
444
455
this . ribbonIcon_sec . remove ( )
445
- }
456
+ }
446
457
447
458
/*
448
459
Ribbon > Register > Debug
@@ -484,88 +495,88 @@ export default class GistrPlugin extends Plugin
484
495
removeButtonFromAllLeaves
485
496
*/
486
497
487
- async addHeaderButtons ( viewActions : Element , button : LeafButtonBase )
498
+ async addHeaderButtons ( viewActions : Element , button : LeafButtonBase )
488
499
{
489
- const { id, icon, name } = button
490
- const iconSize = GetIconSize ( )
491
- const classNames = [ 'view-action' , 'clickable-icon' , Env . pluginId ]
492
- const btn_Ico = GetButtonIcon ( name , id , icon , iconSize , classNames )
500
+ const { id, icon, name } = button
501
+ const iconSize = GetIconSize ( )
502
+ const classNames = [ 'view-action' , 'clickable-icon' , Env . pluginId ]
503
+ const btn_Ico = GetButtonIcon ( name , id , icon , iconSize , classNames )
493
504
494
- btn_Ico . addEventListener ( 'click' , ( ) =>
505
+ btn_Ico . addEventListener ( 'click' , ( ) =>
495
506
{
496
507
this . reloadPlugin ( this . app , this )
497
- } )
508
+ } )
498
509
499
- viewActions . prepend ( btn_Ico )
500
- }
510
+ viewActions . prepend ( btn_Ico )
511
+ }
501
512
502
513
/*
503
514
Leafy > Remove button from header leaf
504
515
*/
505
516
506
- async removeButtonFromLeaf ( leaf : WorkspaceLeaf , button : LeafButtonBase )
517
+ async removeButtonFromLeaf ( leaf : WorkspaceLeaf , button : LeafButtonBase )
507
518
{
508
- const activeLeaf = leaf ?. view . containerEl
509
- const viewActions = activeLeaf ?. getElementsByClassName ( 'view-actions' ) [ 0 ]
519
+ const activeLeaf = leaf ?. view . containerEl
520
+ const viewActions = activeLeaf ?. getElementsByClassName ( 'view-actions' ) [ 0 ]
510
521
511
- if ( ! viewActions ) return
522
+ if ( ! viewActions ) return
512
523
513
524
/*
514
525
Remove existing elements
515
526
*/
516
527
517
- viewActions . getElementsByClassName ( `view-action ${ Env . pluginId } ${ button . id } ` ) [ 0 ] ?. detach ( )
518
- }
528
+ viewActions . getElementsByClassName ( `view-action ${ Env . pluginId } ${ button . id } ` ) [ 0 ] ?. detach ( )
529
+ }
519
530
520
531
/*
521
532
Leafy > Add button to header leaf
522
533
*/
523
534
524
- async addButtonToLeaf ( leaf : WorkspaceLeaf , button : LeafButtonBase )
535
+ async addButtonToLeaf ( leaf : WorkspaceLeaf , button : LeafButtonBase )
525
536
{
526
- const activeLeaf = leaf ?. view . containerEl
527
- const viewActions = activeLeaf ?. getElementsByClassName ( 'view-actions' ) [ 0 ]
537
+ const activeLeaf = leaf ?. view . containerEl
538
+ const viewActions = activeLeaf ?. getElementsByClassName ( 'view-actions' ) [ 0 ]
528
539
529
- if ( ! viewActions ) return
540
+ if ( ! viewActions ) return
530
541
531
542
/*
532
543
Remove existing elements
533
544
*/
534
545
535
- viewActions . getElementsByClassName ( `view-action ${ Env . pluginId } ${ button . id } ` ) [ 0 ] ?. detach ( )
546
+ viewActions . getElementsByClassName ( `view-action ${ Env . pluginId } ${ button . id } ` ) [ 0 ] ?. detach ( )
536
547
537
548
/*
538
549
Add new button
539
550
*/
540
551
541
- this . addHeaderButtons ( viewActions , button )
542
- }
552
+ this . addHeaderButtons ( viewActions , button )
553
+ }
543
554
544
555
/*
545
556
Leafy > Add button to all leafs
546
557
*/
547
558
548
- async addButtonToAllLeaves ( )
559
+ async addButtonToAllLeaves ( )
549
560
{
550
- this . app . workspace . iterateAllLeaves ( ( leaf ) =>
551
- this . addButtonToLeaf ( leaf , LeafButton_Refresh )
552
- )
561
+ this . app . workspace . iterateAllLeaves ( ( leaf ) =>
562
+ this . addButtonToLeaf ( leaf , LeafButton_Refresh )
563
+ )
553
564
554
- this . app . workspace . onLayoutChange ( )
555
- }
565
+ this . app . workspace . onLayoutChange ( )
566
+ }
556
567
557
568
/*
558
569
Leafy > remove button from all leafs
559
570
*/
560
571
561
- async removeButtonFromAllLeaves ( )
572
+ async removeButtonFromAllLeaves ( )
562
573
{
563
- this . app . workspace . iterateAllLeaves ( ( leaf ) =>
564
- this . removeButtonFromLeaf ( leaf , LeafButton_Refresh )
565
- )
574
+ this . app . workspace . iterateAllLeaves ( ( leaf ) =>
575
+ this . removeButtonFromLeaf ( leaf , LeafButton_Refresh )
576
+ )
566
577
567
- this . app . workspace . onLayoutChange ( )
568
- }
578
+ this . app . workspace . onLayoutChange ( )
579
+ }
569
580
570
581
/*
571
582
Settings > Load
@@ -630,26 +641,26 @@ export default class GistrPlugin extends Plugin
630
641
utilizes env variables in rollup.config.js
631
642
*/
632
643
633
- async versionCheck ( )
644
+ async versionCheck ( )
634
645
{
635
- const ver_running = this . manifest . version
636
- const ver_stable = await requestUrl ( lng ( "ver_url" , "main" ) ) . then ( async ( res ) =>
646
+ const ver_running = this . manifest . version
647
+ const ver_stable = await requestUrl ( lng ( "ver_url" , "main" ) ) . then ( async ( res ) =>
637
648
{
638
- if ( res . status === 200 )
649
+ if ( res . status === 200 )
639
650
{
640
- const resp = await res . json
641
- return resp . version
642
- }
643
- } )
651
+ const resp = await res . json
652
+ return resp . version
653
+ }
654
+ } )
644
655
645
- const ver_beta = await requestUrl ( lng ( "ver_url" , "beta" ) ) . then ( async ( res ) =>
656
+ const ver_beta = await requestUrl ( lng ( "ver_url" , "beta" ) ) . then ( async ( res ) =>
646
657
{
647
- if ( res . status === 200 )
658
+ if ( res . status === 200 )
648
659
{
649
- const resp = await res . json
650
- return resp . version
651
- }
652
- } )
660
+ const resp = await res . json
661
+ return resp . version
662
+ }
663
+ } )
653
664
654
665
/*
655
666
Output notice to user on possible updates
@@ -682,13 +693,15 @@ export default class GistrPlugin extends Plugin
682
693
badge : AssetGithubIcon ,
683
694
} )
684
695
}
685
- }
696
+ }
686
697
687
698
/*
688
- Portal > Generate UUID
699
+ Generate UUID
700
+
701
+ utilized to generate temp ids for portal and gist embed frame ids
689
702
*/
690
703
691
- private generateUuid ( )
704
+ public generateUuid ( )
692
705
{
693
706
const uuid = crypto . randomUUID ( ) ;
694
707
return `${ uuid } `
0 commit comments