feat: web panel support add background color which useful for transparent background website

pull/147/merge
moonrailgun 2 years ago
parent 3b7973e9e1
commit 5fe0ff06d7

@ -1,4 +1,4 @@
import React, { useEffect } from 'react';
import React from 'react';
import { Form, Checkbox } from 'antd';
import type { FastifyFormFieldComponent } from 'react-fastify-form';
import { getValidateStatus } from '../utils';

@ -20,10 +20,15 @@ const GroupWebPanelRender: React.FC<{ panelInfo: any }> = (props) => {
// 不包含协议, 但是是个网址
url = 'https://' + url;
}
const background = panelInfo?.meta?.background ?? false;
return (
<GroupPanelContainer groupId={groupId} panelId={panelId}>
<WebviewKeepAlive key={String(url)} className="w-full h-full" url={url} />
<WebviewKeepAlive
key={String(url)}
className={`w-full h-full ${background ? 'bg-white' : ''}`}
url={url}
/>
</GroupPanelContainer>
);
};

@ -13,6 +13,11 @@ regGroupPanel({
name: 'url',
label: Translate.website,
},
{
type: 'checkbox',
name: 'background',
label: Translate.addBackground,
},
],
render: Loadable(() => import('./group/GroupWebPanelRender')),
menus: [

@ -14,6 +14,10 @@ export const Translate = {
'zh-CN': '网址',
'en-US': 'Website',
}),
addBackground: localTrans({
'zh-CN': '添加背景色',
'en-US': 'Add Background Color',
}),
htmlcode: localTrans({
'zh-CN': 'HTML代码',
'en-US': 'HTML Code',

@ -56,7 +56,7 @@ export const ModalModifyGroupPanel: React.FC<{
}
return (
<ModalWrapper title={t('编辑群组面板')} style={{ maxWidth: 600 }}>
<ModalWrapper title={t('编辑群组面板')} style={{ width: 600 }}>
<WebMetaForm
schema={schema}
fields={fields.filter((f) => f.type !== 'type')} // 变更时不显示类型

@ -64,7 +64,7 @@ export interface GroupPanel {
/**
*
*/
meta?: object;
meta?: Record<string, any>;
/**
*

Loading…
Cancel
Save