🐛 Fix: urlEncode bug when copy

ISSUES CLOSED: #731
This commit is contained in:
PiEgg 2021-08-23 23:21:58 +08:00
parent a676c083fe
commit 6c6f84779a

View File

@ -1,9 +1,8 @@
import { IPasteStyle } from '#/types/enum' import { IPasteStyle } from '#/types/enum'
import { handleUrlEncode } from './common'
const formatCustomLink = (customLink: string, item: ImgInfo) => { const formatCustomLink = (customLink: string, item: ImgInfo) => {
let fileName = item.fileName!.replace(new RegExp(`\\${item.extname}$`), '') let fileName = item.fileName!.replace(new RegExp(`\\${item.extname}$`), '')
const url = handleUrlEncode(item.url || item.imgUrl) const url = item.url || item.imgUrl
const formatObj = { const formatObj = {
url, url,
fileName fileName
@ -19,7 +18,7 @@ const formatCustomLink = (customLink: string, item: ImgInfo) => {
} }
export default (style: IPasteStyle, item: ImgInfo, customLink: string | undefined) => { export default (style: IPasteStyle, item: ImgInfo, customLink: string | undefined) => {
const url = handleUrlEncode(item.url || item.imgUrl) const url = item.url || item.imgUrl
const _customLink = customLink || '$url' const _customLink = customLink || '$url'
const tpl = { const tpl = {
'markdown': `![](${url})`, 'markdown': `![](${url})`,