Skip to content
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
3 changes: 3 additions & 0 deletions src/editor/icons-suggestion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ export default class SuggestionIcon extends EditorSuggest<string> {
})
.map((iconObject) => iconObject.prefix + iconObject.name);

if (this.plugin.getSettings().emojiStyle === 'disabled') {
return [...iconsNameArray]
}
// Store all emojis correspoding to the current query - parsing whitespaces and
// colons for shortcodes compatibility.
const emojisNameArray = Object.keys(emoji.shortNames).filter((e) =>
Expand Down
2 changes: 1 addition & 1 deletion src/settings/data.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type EmojiStyle = 'native' | 'twemoji';
export type EmojiStyle = 'native' | 'twemoji' | 'disabled';

export enum IconInTitlePosition {
Above = 'above',
Expand Down
1 change: 1 addition & 0 deletions src/settings/ui/emojiStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default class EmojiStyleSetting extends IconFolderSetting {
emojiStyle.addDropdown((dropdown) => {
dropdown.addOption('native', 'Native');
dropdown.addOption('twemoji', 'Twemoji');
dropdown.addOption('disabled', 'Disabled');
dropdown.setValue(this.plugin.getSettings().emojiStyle);
dropdown.onChange(async (value: 'native' | 'twemoji') => {
this.plugin.getSettings().emojiStyle = value;
Expand Down
50 changes: 27 additions & 23 deletions src/ui/icons-picker-modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default class IconsPickerModal extends FuzzySuggestModal<any> {
this.plugin = plugin;
this.path = path;
this.limit = 150;
this.emojiStyle = plugin.getSettings().emojiStyle;

const pluginRecentltyUsedItems = [
...plugin.getSettings().recentlyUsedIcons,
Expand Down Expand Up @@ -59,6 +60,9 @@ export default class IconsPickerModal extends FuzzySuggestModal<any> {
if (this.inputEl.value.length === 0) {
this.renderIndex = 0;
this.recentlyUsedItems.forEach((iconName) => {
if (this.emojiStyle === 'disabled' && emoji.isEmoji(iconName)) {
return;
}
if (emoji.isEmoji(iconName)) {
iconKeys.push({
name: emoji.shortNames[iconName],
Expand Down Expand Up @@ -95,30 +99,30 @@ export default class IconsPickerModal extends FuzzySuggestModal<any> {
for (const icon of this.plugin.getIconPackManager().allLoadedIconNames) {
iconKeys.push(icon);
}

Object.entries(emoji.shortNames).forEach(([unicode, shortName]) => {
iconKeys.push({
name: shortName,
prefix: 'Emoji',
displayName: unicode,
iconPackName: null,
filename: '',
svgContent: '',
svgElement: '',
svgViewbox: '',
});
iconKeys.push({
name: unicode,
prefix: 'Emoji',
displayName: unicode,
iconPackName: null,
filename: '',
svgContent: '',
svgElement: '',
svgViewbox: '',
if (this.emojiStyle !== 'disabled') {
Object.entries(emoji.shortNames).forEach(([unicode, shortName]) => {
iconKeys.push({
name: shortName,
prefix: 'Emoji',
displayName: unicode,
iconPackName: null,
filename: '',
svgContent: '',
svgElement: '',
svgViewbox: '',
});
iconKeys.push({
name: unicode,
prefix: 'Emoji',
displayName: unicode,
iconPackName: null,
filename: '',
svgContent: '',
svgElement: '',
svgViewbox: '',
});
});
});

}
return iconKeys;
}

Expand Down