Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Display relative font sizes in em https://github.com/siyuan-note/siyuan/issues/13858

Danielc5762b44bce9
diff --git a/app/src/protyle/toolbar/Font.ts b/app/src/protyle/toolbar/Font.ts
index 58303af0da..07b303bc6b 100644
--- a/app/src/protyle/toolbar/Font.ts
+++ b/app/src/protyle/toolbar/Font.ts
@@ -8,20 +8,6 @@ import {lineNumberRender} from "../render/highlightRender";
const MAX_RECENT_FONT_STYLES = 14;
-const getRecentFontSizeDisplay = (fontSize: string) => {
- if (fontSize.endsWith("em")) {
- const percentage = `${(parseFloat(fontSize) * 100).toFixed(0)}%`;
- return {
- label: percentage,
- tooltip: `${window.siyuan.languages.fontSize} ${percentage}`,
- };
- }
- return {
- label: fontSize,
- tooltip: `${window.siyuan.languages.fontSize} ${fontSize}`,
- };
-};
-
export const limitRecentFontStyleRows = (element: HTMLElement) => {
const wrapElement = element.querySelector('[data-id="lastUsedWrap"]');
if (!wrapElement) {
@@ -164,8 +150,7 @@ export const appearanceMenu = (protyle: IProtyle, nodeElements?: Element[],
break;
case "fontSize":
if (!disableFont) {
- const fontSizeDisplay = getRecentFontSizeDisplay(lastFontStatus[1]);
- lastColorHTML += `<button data-type="${lastFontStatus[0]}" data-value="${lastFontStatus[1]}" class="protyle-font__style ariaLabel" data-position="3south" aria-label="${fontSizeDisplay.tooltip}">${fontSizeDisplay.label}</button>`;
+ lastColorHTML += `<button data-type="${lastFontStatus[0]}" data-value="${lastFontStatus[1]}" class="protyle-font__style ariaLabel" data-position="3south" aria-label="${window.siyuan.languages.fontSize} ${lastFontStatus[1]}">${lastFontStatus[1]}</button>`;
}
break;
case "style1":