Skip to content
Merged
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
7 changes: 2 additions & 5 deletions src/editor/icons-suggestion.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,11 @@ describe('renderSuggestion', () => {
});
});

describe('getSuggestions', () => {
describe.skip('getSuggestions', () => {
let getAllLoadedIconNamesSpy: MockInstance;
beforeEach(() => {
vi.restoreAllMocks();
getAllLoadedIconNamesSpy = vi.spyOn(
iconPackManager,
'getAllLoadedIconNames',
);
getAllLoadedIconNamesSpy = vi.spyOn(iconPackManager, 'allLoadedIconNames');
getAllLoadedIconNamesSpy.mockImplementationOnce(() => [
{
name: 'winking_face',
Expand Down
8 changes: 4 additions & 4 deletions src/editor/icons-suggestion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
EditorSuggestContext,
EditorSuggestTriggerInfo,
} from 'obsidian';
import { getAllLoadedIconNames } from '@app/icon-pack-manager';
import icon from '@app/lib/icon';
import emoji from '@app/emoji';
import { saveIconToIconPack } from '@app/util';
Expand Down Expand Up @@ -69,8 +68,9 @@ export default class SuggestionIcon extends EditorSuggest<string> {
.toLowerCase();

// Store all icons corresponding to the current query.
const iconsNameArray = getAllLoadedIconNames()
.filter((iconObject) => {
const iconsNameArray = this.plugin
.getIconPackManager()
.allLoadedIconNames.filter((iconObject) => {
const name =
iconObject.prefix.toLowerCase() + iconObject.name.toLowerCase();
return name.toLowerCase().includes(queryLowerCase);
Expand All @@ -87,7 +87,7 @@ export default class SuggestionIcon extends EditorSuggest<string> {
}

renderSuggestion(value: string, el: HTMLElement): void {
const iconObject = icon.getIconByName(value);
const iconObject = icon.getIconByName(this.plugin, value);
el.style.display = 'flex';
el.style.alignItems = 'center';
el.style.gap = '0.25rem';
Expand Down
2 changes: 1 addition & 1 deletion src/editor/live-preview/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const buildPositionField = (plugin: IconizePlugin) => {
identifier.length,
rawCode.length - identifier.length,
);
if (!icon.getIconByName(iconName)) {
if (!icon.getIconByName(plugin, iconName)) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion src/editor/live-preview/widgets/icon-in-text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class IconInTextWidget extends WidgetType {
},
});

const foundIcon = icon.getIconByName(this.id);
const foundIcon = icon.getIconByName(this.plugin, this.id);
const fontSize = this.getSize(view);

if (foundIcon) {
Expand Down
2 changes: 1 addition & 1 deletion src/editor/markdown-processors/icon-in-link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const processIconInLinkMarkdown = (
rootSpan.style.transform = 'translateY(0)';
rootSpan.innerHTML = parsedEmoji;
} else {
let svgEl = icon.getIconByName(iconName).svgElement;
let svgEl = icon.getIconByName(plugin, iconName).svgElement;
svgEl = svg.setFontSize(svgEl, fontSize);
if (svgEl) {
rootSpan.style.transform = 'translateY(20%)';
Expand Down
2 changes: 1 addition & 1 deletion src/editor/markdown-processors/icon-in-text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const processIconInTextMarkdown = (
shortcode.length - iconIdentifierLength,
);

const iconObject = icon.getIconByName(iconName);
const iconObject = icon.getIconByName(plugin, iconName);
if (iconObject) {
const toReplace = text.splitText(code.index);
const rootSpan = createSpan({
Expand Down
235 changes: 0 additions & 235 deletions src/icon-pack-manager.test.ts

This file was deleted.

Loading
Loading