Skip to content

Commit

Permalink
fix(lib): issue with incorrect font size in tab (#531)
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianWoelki committed Jul 22, 2024
1 parent bbc8e92 commit efa2f05
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/lib/icon-tabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const add = async (
iconName = value;
}

dom.setIconForNode(plugin, iconName, iconContainer, iconColor);
dom.setIconForNode(plugin, iconName, iconContainer, iconColor, false);
// TODO: Refactor to include option to `insertIconToNode` function.
iconContainer.style.margin = null;
};
Expand Down
9 changes: 7 additions & 2 deletions src/lib/util/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const setIconForNode = (
iconName: string,
node: HTMLElement,
color?: string,
applyAllStyles: boolean = true, // TODO: Needs some refactor.
): void => {
// Gets the possible icon based on the icon name.
const iconNextIdentifier = nextIdentifier(iconName);
Expand All @@ -66,7 +67,9 @@ const setIconForNode = (

if (possibleIcon) {
// The icon is possibly not an emoji.
let iconContent = style.applyAll(plugin, possibleIcon, node);
let iconContent = applyAllStyles
? style.applyAll(plugin, possibleIcon, node)
: possibleIcon;
if (color) {
node.style.color = color;
iconContent = svg.colorize(iconContent, color);
Expand All @@ -75,7 +78,9 @@ const setIconForNode = (
} else {
const parsedEmoji =
emoji.parseEmoji(plugin.getSettings().emojiStyle, iconName) ?? iconName;
node.innerHTML = style.applyAll(plugin, parsedEmoji, node);
node.innerHTML = applyAllStyles
? style.applyAll(plugin, parsedEmoji, node)
: parsedEmoji;
}

node.setAttribute('title', iconName);
Expand Down

0 comments on commit efa2f05

Please sign in to comment.