This commit is contained in:
2026-04-25 16:36:34 +08:00
commit db90e7579b
1876 changed files with 189777 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
{
"label": "Bigger Font Size",
"label.zh-CN": "字号放大",
"name": "com.msgbyte.biggerfont",
"url": "/plugins/com.msgbyte.biggerfont/index.js",
"version": "0.0.0",
"author": "moonrailgun",
"description": "Add the feature of enlarging the font size to Tailchat, which is convenient for different user",
"description.zh-CN": "为Tailchat增加放大字号的功能,方便不同用户群体",
"requireRestart": true
}

View File

@@ -0,0 +1,19 @@
{
"name": "@plugins/com.msgbyte.biggerfont",
"main": "src/index.tsx",
"version": "0.0.0",
"description": "为Tailchat增加放大字号的功能,方便不同用户群体",
"private": true,
"scripts": {
"sync:declaration": "tailchat declaration github"
},
"dependencies": {
"lodash": "^4.17.21"
},
"devDependencies": {
"@types/lodash": "^4.14.191",
"@types/styled-components": "^5.1.26",
"react": "18.2.0",
"styled-components": "^5.3.6"
}
}

View File

@@ -0,0 +1,3 @@
export const PLUGIN_ID = 'com.msgbyte.biggerfont';
export const PLUGIN_CONFIG = `${PLUGIN_ID}.config`;

View File

@@ -0,0 +1,49 @@
import {
regPluginSettings,
getCachedUserSettings,
sharedEvent,
} from '@capital/common';
import { PLUGIN_CONFIG, PLUGIN_ID } from './const';
import { Translate } from './translate';
import _get from 'lodash/get';
console.log(`Plugin ${PLUGIN_ID} is loaded`);
regPluginSettings({
name: PLUGIN_CONFIG,
label: Translate.name,
position: 'system',
type: 'select',
defaultValue: '',
options: [
{ label: Translate.default, value: '' },
{ label: Translate.md, value: 'md' },
{ label: Translate.lg, value: 'lg' },
{ label: Translate.xl, value: 'xl' },
],
});
getCachedUserSettings().then((settings) => {
updateFontsize(settings);
});
sharedEvent.on('userSettingsUpdate', (settings) => {
updateFontsize(settings);
});
function updateFontsize(settings: any) {
const fontSize = _get(settings, PLUGIN_CONFIG);
if (typeof settings === 'object' && typeof fontSize === 'string') {
if (fontSize === '') {
// 清除字号设置
document.documentElement.style.fontSize = '';
} else if (fontSize === 'md') {
document.documentElement.style.fontSize = '18px';
} else if (fontSize === 'lg') {
document.documentElement.style.fontSize = '20px';
} else if (fontSize === 'xl') {
document.documentElement.style.fontSize = '22px';
}
}
}

View File

@@ -0,0 +1,18 @@
import { localTrans } from '@capital/common';
export const Translate = {
name: localTrans({
'zh-CN': '放大字号',
'en-US': 'Increase font size',
}),
default: localTrans({ 'zh-CN': '默认', 'en-US': 'Default' }),
md: localTrans({ 'zh-CN': '中号', 'en-US': 'Middle' }),
lg: localTrans({
'zh-CN': '大号',
'en-US': 'Large',
}),
xl: localTrans({
'zh-CN': '特大号',
'en-US': 'Extra Large',
}),
};

View File

@@ -0,0 +1,7 @@
{
"compilerOptions": {
"esModuleInterop": true,
"jsx": "react",
"importsNotUsedAsValues": "error"
}
}

View File

@@ -0,0 +1,2 @@
declare module '@capital/common';
declare module '@capital/component';