File tree Expand file tree Collapse file tree 4 files changed +45
-10
lines changed Expand file tree Collapse file tree 4 files changed +45
-10
lines changed Original file line number Diff line number Diff line change @@ -88,20 +88,22 @@ export default class IconizePlugin extends Plugin {
8888 async onload ( ) {
8989 console . log ( `loading ${ config . PLUGIN_NAME } ` ) ;
9090
91- // Registers all modified internal plugins.
92- // Only adds star plugin for obsidian under v0.12.6.
93- if ( ! requireApiVersion ( '0.12.6' ) ) {
94- this . modifiedInternalPlugins . push ( new StarredInternalPlugin ( this ) ) ;
95- } else if ( requireApiVersion ( '1.2.0' ) ) {
96- this . modifiedInternalPlugins . push ( new BookmarkInternalPlugin ( this ) ) ;
97- }
98-
99- this . modifiedInternalPlugins . push ( new OutlineInternalPlugin ( this ) ) ;
100-
10191 await this . loadIconFolderData ( ) ;
10292 logger . toggleLogging ( this . getSettings ( ) . debugMode ) ;
10393 setPath ( this . getSettings ( ) . iconPacksPath ) ;
10494
95+ if ( this . getSettings ( ) . useInternalPlugins ) {
96+ // Registers all modified internal plugins.
97+ // Only adds star plugin for obsidian under v0.12.6.
98+ if ( ! requireApiVersion ( '0.12.6' ) ) {
99+ this . modifiedInternalPlugins . push ( new StarredInternalPlugin ( this ) ) ;
100+ } else if ( requireApiVersion ( '1.2.0' ) ) {
101+ this . modifiedInternalPlugins . push ( new BookmarkInternalPlugin ( this ) ) ;
102+ }
103+
104+ this . modifiedInternalPlugins . push ( new OutlineInternalPlugin ( this ) ) ;
105+ }
106+
105107 await createDefaultDirectory ( this ) ;
106108 await this . checkRecentlyUsedIcons ( ) ;
107109
Original file line number Diff line number Diff line change @@ -180,6 +180,12 @@ export interface IconFolderSettings {
180180 * in the console.
181181 */
182182 debugMode ?: boolean ;
183+ /**
184+ * Adds icons to internal plugins such as the bookmarks and outline plugins.
185+ * This is experimental.
186+ * @default false
187+ */
188+ useInternalPlugins ?: boolean ;
183189}
184190
185191export const DEFAULT_SETTINGS : IconFolderSettings = {
@@ -209,4 +215,5 @@ export const DEFAULT_SETTINGS: IconFolderSettings = {
209215 iconIdentifier : ':' ,
210216 lucideIconPackType : 'native' ,
211217 debugMode : false ,
218+ useInternalPlugins : false ,
212219} ;
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import ToggleIconsInNotes from './toggleIconsInNotes';
1717import ToggleIconsInLinks from './toggleIconsInLinks' ;
1818import IconIdentifierSetting from './iconIdentifier' ;
1919import DebugMode from './debugMode' ;
20+ import UseInternalPlugins from './useInternalPlugins' ;
2021
2122export default class IconFolderSettings extends PluginSettingTab {
2223 private plugin : IconizePlugin ;
@@ -37,6 +38,7 @@ export default class IconFolderSettings extends PluginSettingTab {
3738 new IconPacksBackgroundChecker ( plugin , containerEl ) . display ( ) ;
3839 new EmojiStyleSetting ( plugin , containerEl ) . display ( ) ;
3940 new IconIdentifierSetting ( plugin , containerEl ) . display ( ) ;
41+ new UseInternalPlugins ( plugin , containerEl ) . display ( ) ;
4042 new DebugMode ( plugin , containerEl ) . display ( ) ;
4143
4244 containerEl . createEl ( 'h3' , { text : 'Visibility of icons' } ) ;
Original file line number Diff line number Diff line change 1+ import { Notice , Setting } from 'obsidian' ;
2+ import IconFolderSetting from './iconFolderSetting' ;
3+ import config from '@app/config' ;
4+
5+ export default class UseInternalPlugins extends IconFolderSetting {
6+ public display ( ) : void {
7+ new Setting ( this . containerEl )
8+ . setName ( 'EXPERIMENTAL: Use internal plugins' )
9+ . setDesc (
10+ 'Toggles whether to try to add icons to the bookmark and outline internal plugins.' ,
11+ )
12+ . addToggle ( ( toggle ) => {
13+ toggle
14+ . setValue ( this . plugin . getSettings ( ) . useInternalPlugins )
15+ . onChange ( async ( enabled ) => {
16+ this . plugin . getSettings ( ) . useInternalPlugins = enabled ;
17+ await this . plugin . saveIconFolderData ( ) ;
18+ new Notice (
19+ `[${ config . PLUGIN_NAME } ] Obsidian has to be restarted for this change to take effect.` ,
20+ ) ;
21+ } ) ;
22+ } ) ;
23+ }
24+ }
You can’t perform that action at this time.
0 commit comments