Fix useFontSize hook in decomp.me

This commit is contained in:
Luke Street
2025-03-19 12:01:55 -06:00
parent ce2101c3d9
commit d438bc2fc6
3 changed files with 7 additions and 4 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
"displayName": "objdiff",
"description": "A local diffing tool for decompilation projects",
"publisher": "decomp-dev",
"version": "0.1.0",
"version": "0.2.0",
"repository": {
"type": "git",
"url": "https://github.com/encounter/objdiff-web"
+1
View File
@@ -47,6 +47,7 @@ const extensionConfig: RsbuildConfig = {
root: 'dist',
},
externals: ['vscode'],
legalComments: 'none',
},
},
webview: {
+5 -3
View File
@@ -3,9 +3,7 @@ import styles from './util.module.css';
import { useEffect, useState } from 'react';
export const getCssVariablePx = (name: string) => {
const value = getComputedStyle(document.documentElement).getPropertyValue(
name,
);
const value = getComputedStyle(document.body).getPropertyValue(name);
if (!value.endsWith('px')) {
throw new Error(`Expected ${name} to be in px, got ${value}`);
}
@@ -26,6 +24,10 @@ export const useFontSize = () => {
attributes: true,
attributeFilter: ['style'],
});
observer.observe(document.body, {
attributes: true,
attributeFilter: ['style'],
});
return () => {
observer.disconnect();
};