Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More Sticker Flexibility with what icons are displayed. #180

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions src/components/ui/modals/stickerModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,27 @@ export class stickerModal extends FuzzySuggestModal<Sticker> {
}

getItems(): Sticker[] {
const allLucide: Sticker[] = lucideIcons.map((f) => ({
let stickers: Sticker[] = [];

if (this.plugin.settings.stickerIcon) stickers = stickers.concat(lucideIcons.map((f) => ({
name: f,
type: "lucide",
keywords: f,
value: f,
html: getIcon(f).outerHTML,
}));
const allCustom: Sticker[] = [...this.plugin.index.iconsCache.keys()].map(
})));

if (this.plugin.settings.stickerSVG) stickers = stickers.concat([...this.plugin.index.iconsCache.keys()].map(
(f) => ({
name: f,
type: "vault",
keywords: f,
value: f,
html: this.plugin.index.iconsCache.get(f),
})
);
const allEmojis: Sticker[] = Object.keys(emojis as EmojiData).reduce(
));

if (this.plugin.settings.stickerEmoji) stickers = stickers.concat(Object.keys(emojis as EmojiData).reduce(
(p, c: string) => [
...p,
...emojis[c].map((e) => ({
Expand All @@ -75,8 +79,11 @@ export class stickerModal extends FuzzySuggestModal<Sticker> {
})),
],
[]
);
return [...allCustom, ...allEmojis, ...allLucide];
));

console.log(stickers);

return stickers;
}

onChooseItem(item: Sticker, evt: MouseEvent | KeyboardEvent) {
Expand Down
15 changes: 12 additions & 3 deletions src/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,11 +404,11 @@ class T {
},
spacesStickers: {
name: "Stickers",
desc: `Use Emojis to make it easier to find your notes`,
desc: `Add stickers to your files to make them easier to find.`,
},
spacesAlias: {
name: "Alias",
desc: `Use the alias metadata to show in Spaces`,
desc: `Use the file's alias (if specified) instead of the file name in Spaces.`,
},
spacesFileExplorerDual: {
name: "Compatibility Mode",
Expand All @@ -435,7 +435,16 @@ class T {
name: "Performance Mode",
desc: `Turn on performance mode for Spaces, may affect scrolling appearance. Requires Restart`,
},
indexSVG: {

stickerEmoji: {
name: "Use Emojis as Stickers",
desc: `Use vanilla emojis as stickers`,
},
stickerIcon: {
name: "Use Lucide Icons as Stickers",
desc: `Use line art Lucide icons as stickers (https://lucide.dev)`,
},
stickerSvg: {
name: "Use SVGs as Stickers",
desc: `Use any svg file in your vault as a sticker`,
},
Expand Down
123 changes: 77 additions & 46 deletions src/settings/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ export const DEFAULT_SETTINGS: MakeMDPluginSettings = {
fmKeyColor: 'color',
fmKeySticker: 'sticker',
openSpacesOnLaunch: true,
indexSVG: false
stickerSVG: false,
stickerEmoji: true,
stickerIcon: true,
};

export class MakeMDPluginSettingsTab extends PluginSettingTab {
Expand Down Expand Up @@ -111,7 +113,7 @@ export class MakeMDPluginSettingsTab extends PluginSettingTab {
this.refreshView();
})
);

if (this.plugin.settings.spacesEnabled) {
containerEl.createEl("h3", { text: t.settings.sectionAppearance });
const spaceAppearances = containerEl.createEl("div");
Expand Down Expand Up @@ -149,7 +151,7 @@ if (this.plugin.settings.spacesEnabled) {
this.plugin.saveSettings();
})
);

new Setting(spaceAppearances)
.setName(t.settings.folderIndentationLines.name)
.setDesc(t.settings.folderIndentationLines.desc)
Expand All @@ -163,18 +165,6 @@ if (this.plugin.settings.spacesEnabled) {
})
);
new Setting(spaceAppearances)
.setName(t.settings.spacesStickers.name)
.setDesc(t.settings.spacesStickers.desc)
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.spacesStickers)
.onChange((value) => {
this.plugin.settings.spacesStickers = value;
this.plugin.saveSettings();
this.refreshView();
})
);
new Setting(spaceAppearances)
.setName(t.settings.spacesAlias.name)
.setDesc(t.settings.spacesAlias.desc)
.addToggle((toggle) =>
Expand Down Expand Up @@ -209,7 +199,60 @@ if (this.plugin.settings.spacesEnabled) {
await this.plugin.saveSettings();
});
});


containerEl.createEl("h3", { text: "Stickers" });

new Setting(containerEl)
.setName(t.settings.spacesStickers.name)
.setDesc(t.settings.spacesStickers.desc)
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.spacesStickers)
.onChange((value) => {
this.plugin.settings.spacesStickers = value;
this.plugin.saveSettings();
this.refreshView();
})
);
new Setting(containerEl)
.setName(t.settings.stickerSvg.name)
.setDesc(t.settings.stickerSvg.desc)
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.stickerSVG)
.onChange((value) => {
this.plugin.settings.stickerSVG = value;
this.plugin.saveSettings();
})
);

new Setting(containerEl)
.setName(t.settings.stickerEmoji.name)
.setDesc(t.settings.stickerEmoji.desc)
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.stickerEmoji)
.onChange((value) => {
this.plugin.settings.stickerEmoji = value;
this.plugin.saveSettings();
})
);

new Setting(containerEl)
.setName(t.settings.stickerIcon.name)
.setDesc(t.settings.stickerIcon.desc)
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.stickerIcon)
.onChange((value) => {
this.plugin.settings.stickerIcon = value;
this.plugin.saveSettings();
})
);

containerEl.createEl("h3", { text: "Folder Note" });

new Setting(containerEl)
.setName(t.settings.folderNote.name)
.setDesc(t.settings.folderNote.desc)
Expand Down Expand Up @@ -258,7 +301,7 @@ if (this.plugin.settings.spacesEnabled) {
await this.plugin.saveSettings();
});
});

new Setting(containerEl)
.setName(t.settings.spaceAutoBackup.name)
.setDesc(t.settings.spaceAutoBackup.desc)
Expand All @@ -270,7 +313,7 @@ if (this.plugin.settings.spacesEnabled) {
this.plugin.saveSettings();
})
);

new Setting(containerEl)
.setName(t.settings.spaceAutoBackupInterval.name)
.setDesc(t.settings.spaceAutoBackupInterval.desc)
Expand Down Expand Up @@ -308,7 +351,7 @@ if (this.plugin.settings.spacesEnabled) {
this.plugin.saveSettings();
})
);

new Setting(containerEl)
.setName(t.settings.spacesFileExplorerDual.name)
.setDesc(t.settings.spacesFileExplorerDual.desc)
Expand All @@ -320,7 +363,7 @@ if (this.plugin.settings.spacesEnabled) {
this.plugin.saveSettings();
})
);

new Setting(containerEl)
.setName(t.settings.spacesPerformance.name)
.setDesc(t.settings.spacesPerformance.desc)
Expand All @@ -333,18 +376,6 @@ if (this.plugin.settings.spacesEnabled) {
})
);

new Setting(containerEl)
.setName(t.settings.indexSVG.name)
.setDesc(t.settings.indexSVG.desc)
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.indexSVG)
.onChange((value) => {
this.plugin.settings.indexSVG = value;
this.plugin.saveSettings();
})
);

new Setting(containerEl)
.setName(t.settings.spacesDeleteOption.name)
.setDesc(t.settings.spacesDeleteOption.desc)
Expand All @@ -365,7 +396,7 @@ if (this.plugin.settings.spacesEnabled) {
});
});
}

containerEl.createEl("h1", { text: "Context" });
new Setting(containerEl)
.setName(t.settings.contexts.name)
Expand All @@ -391,9 +422,9 @@ if (this.plugin.settings.spacesEnabled) {
await this.plugin.saveSettings();
});
});



containerEl.createEl("h3", { text: t.settings.sectionAdvanced });
new Setting(containerEl)
.setName(t.settings.openFileContext.name)
Expand All @@ -406,7 +437,7 @@ if (this.plugin.settings.spacesEnabled) {
this.plugin.saveSettings();
})
);

new Setting(containerEl)
.setName(t.settings.syncContextToFrontmatter.name)
.setDesc(t.settings.syncContextToFrontmatter.desc)
Expand All @@ -431,7 +462,7 @@ if (this.plugin.settings.spacesEnabled) {
this.plugin.reloadExtensions(false);
})
);

containerEl.createEl("h1", { text: t.settings.sectionFlow });
new Setting(containerEl)
.setName(t.settings.editorMakerMode.name)
Expand All @@ -445,8 +476,8 @@ if (this.plugin.settings.spacesEnabled) {
);
if (this.plugin.settings.makerMode) {

containerEl.createEl("h3", { text: "Inline Context" });

containerEl.createEl("h3", { text: "Inline Context" });
new Setting(containerEl)
.setName(t.settings.inlineContextExplorer.name)
.setDesc(t.settings.inlineContextExplorer.desc)
Expand Down Expand Up @@ -530,7 +561,7 @@ if (this.plugin.settings.spacesEnabled) {
this.plugin.reloadExtensions(false);
})
);
containerEl.createEl("h3", { text: "Flow Block" });
containerEl.createEl("h3", { text: "Flow Block" });
new Setting(containerEl)
.setName(t.settings.editorFlowReplace.name)
.setDesc(t.settings.editorFlowReplace.desc)
Expand All @@ -553,7 +584,7 @@ if (this.plugin.settings.spacesEnabled) {
this.plugin.reloadExtensions(false);
})
);

new Setting(containerEl)
.setName(t.settings.editorFlowStyle.name)
.setDesc(t.settings.editorFlowStyle.desc)
Expand All @@ -577,10 +608,10 @@ if (this.plugin.settings.spacesEnabled) {
});
});







containerEl.createEl("h3", { text: "Flow Menu" });
new Setting(containerEl)
.setName(t.settings.editorMakeMenu.name)
Expand Down Expand Up @@ -619,7 +650,7 @@ if (this.plugin.settings.spacesEnabled) {
await this.plugin.saveSettings();
});
});

new Setting(containerEl)
.setName(t.settings.editorMakePlacholder.name)
.setDesc(t.settings.editorMakePlacholder.desc)
Expand All @@ -633,7 +664,7 @@ if (this.plugin.settings.spacesEnabled) {
})
);
containerEl.createEl("h3", { text: "Flow Styler" });


new Setting(containerEl)
.setName(t.settings.inlineStyler.name)
Expand Down Expand Up @@ -698,7 +729,7 @@ if (this.plugin.settings.spacesEnabled) {
// });
// });


// new Setting(containerEl)
// .setName(t.settings.editorMarkSans.name)
// .setDesc(t.settings.editorMarkSans.desc)
Expand Down
Loading