mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-23 23:06:06 +08:00
修改新建订阅提示
This commit is contained in:
parent
a75df03243
commit
23bfbeb995
|
@ -11,7 +11,7 @@ if (!process.env.QL_DIR) {
|
||||||
if (qlHomePath.endsWith('/static/')) {
|
if (qlHomePath.endsWith('/static/')) {
|
||||||
qlHomePath = path.join(qlHomePath, '../');
|
qlHomePath = path.join(qlHomePath, '../');
|
||||||
}
|
}
|
||||||
process.env.QL_DIR = qlHomePath;
|
process.env.QL_DIR = qlHomePath.replace(/\/$/g, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
const lastVersionFile = `http://qn.whyour.cn/version.ts?v=${Date.now()}`;
|
const lastVersionFile = `http://qn.whyour.cn/version.ts?v=${Date.now()}`;
|
||||||
|
|
|
@ -190,8 +190,8 @@ const SubscriptionModal = ({
|
||||||
};
|
};
|
||||||
|
|
||||||
const onPaste = useCallback((e: any) => {
|
const onPaste = useCallback((e: any) => {
|
||||||
const text = e.clipboardData.getData('text');
|
const text = e.clipboardData.getData('text') as string;
|
||||||
if (!subscription && text.includes('ql ')) {
|
if (text.startsWith('ql ')) {
|
||||||
const [
|
const [
|
||||||
,
|
,
|
||||||
type,
|
type,
|
||||||
|
@ -225,6 +225,13 @@ const SubscriptionModal = ({
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const onNamePaste = useCallback((e) => {
|
||||||
|
const text = e.clipboardData.getData('text') as string;
|
||||||
|
if (text.startsWith('ql ')) {
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
window.addEventListener('paste', onPaste);
|
window.addEventListener('paste', onPaste);
|
||||||
|
@ -243,34 +250,10 @@ const SubscriptionModal = ({
|
||||||
}
|
}
|
||||||
}, [subscription, visible]);
|
}, [subscription, visible]);
|
||||||
|
|
||||||
const isFirefox = navigator.userAgent.includes('Firefox');
|
|
||||||
const isSafari =
|
|
||||||
navigator.userAgent.includes('Safari') &&
|
|
||||||
!navigator.userAgent.includes('Chrome');
|
|
||||||
const isQQBrowser = navigator.userAgent.includes('QQBrowser');
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
title={
|
title={
|
||||||
subscription ? (
|
subscription ? '编辑订阅' : '新建订阅'
|
||||||
'编辑订阅'
|
|
||||||
) : (
|
|
||||||
<span>
|
|
||||||
新建订阅
|
|
||||||
<small
|
|
||||||
style={{
|
|
||||||
color: '#999',
|
|
||||||
fontWeight: 400,
|
|
||||||
fontSize: isFirefox ? 9 : 12,
|
|
||||||
marginLeft: 2,
|
|
||||||
zoom: isSafari ? 0.66 : 0.8,
|
|
||||||
letterSpacing: isQQBrowser ? -2 : 0,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
支持repo/raw命令,粘贴导入
|
|
||||||
</small>
|
|
||||||
</span>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
open={visible}
|
open={visible}
|
||||||
forceRender
|
forceRender
|
||||||
|
@ -291,7 +274,7 @@ const SubscriptionModal = ({
|
||||||
>
|
>
|
||||||
<Form form={form} name="form_in_modal" layout="vertical">
|
<Form form={form} name="form_in_modal" layout="vertical">
|
||||||
<Form.Item name="name" label="名称">
|
<Form.Item name="name" label="名称">
|
||||||
<Input placeholder="请输入订阅名" />
|
<Input placeholder="支持拷贝ql repo/raw命令,粘贴导入" onPaste={onNamePaste} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="type"
|
name="type"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user