-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a0486a2
commit 0c77147
Showing
10 changed files
with
164 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
# @pear-rec/web | ||
|
||
## 1.3.13 | ||
|
||
feat: 首页增加编辑动图 | ||
|
||
## 1.3.12 | ||
|
||
fix: 编辑动图初始化渲染bug | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import React, { useImperativeHandle, forwardRef, useRef } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { EditOutlined, GifOutlined } from '@ant-design/icons'; | ||
import { Space, Card, Dropdown, Modal } from 'antd'; | ||
|
||
const EditGifCard = forwardRef((props: any, ref: any) => { | ||
const { t } = useTranslation(); | ||
const fileRef = useRef(null); | ||
|
||
function handleUploadFile(event) { | ||
const file = event.target.files[0]; | ||
if (window.electronAPI) { | ||
window.electronAPI.sendEiOpenWin({ imgUrl: file.path }); | ||
} else { | ||
const imgUrl = window.URL.createObjectURL(file); | ||
Modal.confirm({ | ||
title: '提示', | ||
content: `是否编辑${file.name}`, | ||
okText: t('modal.ok'), | ||
cancelText: t('modal.cancel'), | ||
onOk() { | ||
window.open(`/editGif.html?imgUrl=${encodeURIComponent(imgUrl)}`); | ||
}, | ||
}); | ||
} | ||
event.target.value = ''; | ||
} | ||
|
||
function handleClipScreenClick(type) { | ||
if (window.isElectron) { | ||
window.electronAPI.sendCsOpenWin({ type }); | ||
window.electronAPI.sendMaCloseWin(); | ||
} else { | ||
location.href = `/recorderScreen.html?type=${type}`; | ||
} | ||
} | ||
|
||
return ( | ||
<Card hoverable bordered={false} style={{ maxWidth: 300, minWidth: 140, height: 130 }}> | ||
<span className="extra" onClick={() => fileRef.current.click()}> | ||
{t('home.edit')} | ||
</span> | ||
<div className="cardContent"> | ||
<GifOutlined className="cardIcon" onClick={() => handleClipScreenClick('gif')} /> | ||
<div className="cardTitle">{t('home.gif')}</div> | ||
</div> | ||
<input | ||
type="file" | ||
ref={fileRef} | ||
accept=".gif" | ||
className="fileRef" | ||
onChange={handleUploadFile} | ||
/> | ||
</Card> | ||
); | ||
}); | ||
|
||
export default EditGifCard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters