mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-02-08 21:38:13 -05:00
✨ Feature: url encode in manage page
This commit is contained in:
parent
b97f79b49f
commit
9fa989e430
@ -581,7 +581,7 @@ https://www.baidu.com/img/bd_logo1.png"
|
|||||||
size="20"
|
size="20"
|
||||||
style="cursor: pointer;"
|
style="cursor: pointer;"
|
||||||
color="#409EFF"
|
color="#409EFF"
|
||||||
@click="copyToClipboard(formatLink(item.url, item.fileName, manageStore.config.settings.pasteForma ?? '$markdown', manageStore.config.settings.customPasteFormat ?? '$url'))"
|
@click="copyToClipboard(formatLink(item.url, item.fileName, manageStore.config.settings.pasteFormat ?? '$markdown', manageStore.config.settings.customPasteFormat ?? '$url'))"
|
||||||
>
|
>
|
||||||
<CopyDocument />
|
<CopyDocument />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
@ -1506,7 +1506,7 @@ const isShowVideoFileDialog = ref(false)
|
|||||||
const videoFileUrl = ref('')
|
const videoFileUrl = ref('')
|
||||||
const videoPlayerHeaders = ref({})
|
const videoPlayerHeaders = ref({})
|
||||||
const showFileStyle = ref<'list' | 'grid'>('grid')
|
const showFileStyle = ref<'list' | 'grid'>('grid')
|
||||||
const isUploadKeepDirStructure = ref(manageStore.config.settings.isUploadKeepDirStructure ?? true)
|
const isUploadKeepDirStructure = computed(() => manageStore.config.settings.isUploadKeepDirStructure ?? true)
|
||||||
const isShowBatchRenameDialog = ref(false)
|
const isShowBatchRenameDialog = ref(false)
|
||||||
const batchRenameMatch = ref('')
|
const batchRenameMatch = ref('')
|
||||||
const batchRenameReplace = ref('')
|
const batchRenameReplace = ref('')
|
||||||
@ -3489,7 +3489,7 @@ const columns: Column<any>[] = [
|
|||||||
size="20"
|
size="20"
|
||||||
style="cursor: pointer;"
|
style="cursor: pointer;"
|
||||||
color="#409EFF"
|
color="#409EFF"
|
||||||
onClick={() => copyToClipboard(formatLink(item.url, item.fileName, manageStore.config.settings.pasteForma ?? '$markdown', manageStore.config.settings.customPasteFormat ?? '$url'))}
|
onClick={() => copyToClipboard(formatLink(item.url, item.fileName, manageStore.config.settings.pasteFormat ?? '$markdown', manageStore.config.settings.customPasteFormat ?? '$url'))}
|
||||||
>
|
>
|
||||||
<CopyDocument />
|
<CopyDocument />
|
||||||
</ElIcon>
|
</ElIcon>
|
||||||
@ -3629,6 +3629,7 @@ const columns: Column<any>[] = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
|
console.log('onBeforeMount')
|
||||||
await manageStore.refreshConfig()
|
await manageStore.refreshConfig()
|
||||||
showLoadingPage.value = true
|
showLoadingPage.value = true
|
||||||
await initCustomUrlList()
|
await initCustomUrlList()
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
style="width: 100%;"
|
style="width: 100%;"
|
||||||
>
|
>
|
||||||
<el-form
|
<el-form
|
||||||
lable-position="left"
|
label-position="left"
|
||||||
label-width="50%"
|
label-width="50%"
|
||||||
size="default"
|
size="default"
|
||||||
style="position: relative;width: 100%;"
|
style="position: relative;width: 100%;"
|
||||||
@ -422,7 +422,7 @@
|
|||||||
<el-radio label="markdown">
|
<el-radio label="markdown">
|
||||||
{{ $T('MANAGE_SETTING_CHOOSE_COPY_FORMAT_MARKDOWN') }}
|
{{ $T('MANAGE_SETTING_CHOOSE_COPY_FORMAT_MARKDOWN') }}
|
||||||
</el-radio>
|
</el-radio>
|
||||||
<el-radio lable="markdown-with-link">
|
<el-radio label="markdown-with-link">
|
||||||
{{ $T('MANAGE_SETTING_CHOOSE_COPY_FORMAT_MARKDOWN_WITH_LINK') }}
|
{{ $T('MANAGE_SETTING_CHOOSE_COPY_FORMAT_MARKDOWN_WITH_LINK') }}
|
||||||
</el-radio>
|
</el-radio>
|
||||||
<el-radio label="rawurl">
|
<el-radio label="rawurl">
|
||||||
@ -573,7 +573,7 @@ async function initData () {
|
|||||||
form.customRename = config.settings.customRename ?? false
|
form.customRename = config.settings.customRename ?? false
|
||||||
customRenameFormat.value = config.settings.customRenameFormat ?? '{filename}'
|
customRenameFormat.value = config.settings.customRenameFormat ?? '{filename}'
|
||||||
customPasteFormat.value = config.settings.customPasteFormat ?? '$url'
|
customPasteFormat.value = config.settings.customPasteFormat ?? '$url'
|
||||||
form.pasteFormat = config.settings.pasteForma ?? 'markdown'
|
pasteFormat.value = config.settings.pasteFormat ?? 'markdown'
|
||||||
downloadDir.value = config.settings.downloadDir ?? ''
|
downloadDir.value = config.settings.downloadDir ?? ''
|
||||||
form.isAutoRefresh = config.settings.isAutoRefresh ?? false
|
form.isAutoRefresh = config.settings.isAutoRefresh ?? false
|
||||||
form.isShowThumbnail = config.settings.isShowThumbnail ?? false
|
form.isShowThumbnail = config.settings.isShowThumbnail ?? false
|
||||||
|
@ -50,24 +50,25 @@ export function renameFile (typeMap : IStringKeyMap, oldName: string): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function formatLink (url: string, fileName: string, type: string, format?: string) : string {
|
export function formatLink (url: string, fileName: string, type: string, format?: string) : string {
|
||||||
|
const encodedUrl = encodeURI(url)
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'markdown':
|
case 'markdown':
|
||||||
return `![${fileName}](${url})`
|
return `![${fileName}](${encodedUrl})`
|
||||||
case 'html':
|
case 'html':
|
||||||
return `<img src="${url}" alt="${fileName}"/>`
|
return `<img src="${encodedUrl}" alt="${fileName}"/>`
|
||||||
case 'bbcode':
|
case 'bbcode':
|
||||||
return `[img]${url}[/img]`
|
return `[img]${encodedUrl}[/img]`
|
||||||
case 'url':
|
case 'url':
|
||||||
return url
|
return encodedUrl
|
||||||
case 'markdown-with-link':
|
case 'markdown-with-link':
|
||||||
return `[![${fileName}](${url})](${url})`
|
return `[![${fileName}](${encodedUrl})](${encodedUrl})`
|
||||||
case 'custom':
|
case 'custom':
|
||||||
if (format && (format.includes('$url') || format.includes('$fileName'))) {
|
if (format && (format.includes('$url') || format.includes('$fileName'))) {
|
||||||
return format.replace(/\$url/g, url).replace(/\$fileName/g, fileName)
|
return format.replace(/\$url/g, encodedUrl).replace(/\$fileName/g, fileName)
|
||||||
}
|
}
|
||||||
return url
|
return encodedUrl
|
||||||
default:
|
default:
|
||||||
return url
|
return encodedUrl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
id="upload-view-title"
|
id="upload-view-title"
|
||||||
@click="handlePicBedNameClick(picBedName, picBedConfigName)"
|
@click="handlePicBedNameClick(picBedName, picBedConfigName)"
|
||||||
>
|
>
|
||||||
{{ $T('PICTURE_UPLOAD') }} - {{ picBedName }} - {{ picBedConfigName }}
|
{{ picBedName }} - {{ picBedConfigName }}
|
||||||
</span>
|
</span>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-icon
|
<el-icon
|
||||||
|
Loading…
Reference in New Issue
Block a user