From d438bc2fc66018aea7a3f046e35c56c14d367798 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Wed, 19 Mar 2025 12:01:55 -0600 Subject: [PATCH] Fix useFontSize hook in decomp.me --- package.json | 2 +- rsbuild.config.ts | 1 + webview/util/util.ts | 8 +++++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 9406971..d77b59b 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/rsbuild.config.ts b/rsbuild.config.ts index ba2f27e..746c2e8 100644 --- a/rsbuild.config.ts +++ b/rsbuild.config.ts @@ -47,6 +47,7 @@ const extensionConfig: RsbuildConfig = { root: 'dist', }, externals: ['vscode'], + legalComments: 'none', }, }, webview: { diff --git a/webview/util/util.ts b/webview/util/util.ts index f9d064a..2b1dd1b 100644 --- a/webview/util/util.ts +++ b/webview/util/util.ts @@ -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(); };