mirror of
https://github.com/encounter/objdiff-web.git
synced 2026-07-10 12:18:37 -07:00
Fix useFontSize hook in decomp.me
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
"displayName": "objdiff",
|
"displayName": "objdiff",
|
||||||
"description": "A local diffing tool for decompilation projects",
|
"description": "A local diffing tool for decompilation projects",
|
||||||
"publisher": "decomp-dev",
|
"publisher": "decomp-dev",
|
||||||
"version": "0.1.0",
|
"version": "0.2.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/encounter/objdiff-web"
|
"url": "https://github.com/encounter/objdiff-web"
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ const extensionConfig: RsbuildConfig = {
|
|||||||
root: 'dist',
|
root: 'dist',
|
||||||
},
|
},
|
||||||
externals: ['vscode'],
|
externals: ['vscode'],
|
||||||
|
legalComments: 'none',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
webview: {
|
webview: {
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ import styles from './util.module.css';
|
|||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
|
|
||||||
export const getCssVariablePx = (name: string) => {
|
export const getCssVariablePx = (name: string) => {
|
||||||
const value = getComputedStyle(document.documentElement).getPropertyValue(
|
const value = getComputedStyle(document.body).getPropertyValue(name);
|
||||||
name,
|
|
||||||
);
|
|
||||||
if (!value.endsWith('px')) {
|
if (!value.endsWith('px')) {
|
||||||
throw new Error(`Expected ${name} to be in px, got ${value}`);
|
throw new Error(`Expected ${name} to be in px, got ${value}`);
|
||||||
}
|
}
|
||||||
@@ -26,6 +24,10 @@ export const useFontSize = () => {
|
|||||||
attributes: true,
|
attributes: true,
|
||||||
attributeFilter: ['style'],
|
attributeFilter: ['style'],
|
||||||
});
|
});
|
||||||
|
observer.observe(document.body, {
|
||||||
|
attributes: true,
|
||||||
|
attributeFilter: ['style'],
|
||||||
|
});
|
||||||
return () => {
|
return () => {
|
||||||
observer.disconnect();
|
observer.disconnect();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user