mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-01-23 06: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"
|
||||
style="cursor: pointer;"
|
||||
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 />
|
||||
</el-icon>
|
||||
@ -1506,7 +1506,7 @@ const isShowVideoFileDialog = ref(false)
|
||||
const videoFileUrl = ref('')
|
||||
const videoPlayerHeaders = ref({})
|
||||
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 batchRenameMatch = ref('')
|
||||
const batchRenameReplace = ref('')
|
||||
@ -3489,7 +3489,7 @@ const columns: Column<any>[] = [
|
||||
size="20"
|
||||
style="cursor: pointer;"
|
||||
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 />
|
||||
</ElIcon>
|
||||
@ -3629,6 +3629,7 @@ const columns: Column<any>[] = [
|
||||
]
|
||||
|
||||
onBeforeMount(async () => {
|
||||
console.log('onBeforeMount')
|
||||
await manageStore.refreshConfig()
|
||||
showLoadingPage.value = true
|
||||
await initCustomUrlList()
|
||||
|
@ -19,7 +19,7 @@
|
||||
style="width: 100%;"
|
||||
>
|
||||
<el-form
|
||||
lable-position="left"
|
||||
label-position="left"
|
||||
label-width="50%"
|
||||
size="default"
|
||||
style="position: relative;width: 100%;"
|
||||
@ -422,7 +422,7 @@
|
||||
<el-radio label="markdown">
|
||||
{{ $T('MANAGE_SETTING_CHOOSE_COPY_FORMAT_MARKDOWN') }}
|
||||
</el-radio>
|
||||
<el-radio lable="markdown-with-link">
|
||||
<el-radio label="markdown-with-link">
|
||||
{{ $T('MANAGE_SETTING_CHOOSE_COPY_FORMAT_MARKDOWN_WITH_LINK') }}
|
||||
</el-radio>
|
||||
<el-radio label="rawurl">
|
||||
@ -573,7 +573,7 @@ async function initData () {
|
||||
form.customRename = config.settings.customRename ?? false
|
||||
customRenameFormat.value = config.settings.customRenameFormat ?? '{filename}'
|
||||
customPasteFormat.value = config.settings.customPasteFormat ?? '$url'
|
||||
form.pasteFormat = config.settings.pasteForma ?? 'markdown'
|
||||
pasteFormat.value = config.settings.pasteFormat ?? 'markdown'
|
||||
downloadDir.value = config.settings.downloadDir ?? ''
|
||||
form.isAutoRefresh = config.settings.isAutoRefresh ?? 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 {
|
||||
const encodedUrl = encodeURI(url)
|
||||
switch (type) {
|
||||
case 'markdown':
|
||||
return `![${fileName}](${url})`
|
||||
return `![${fileName}](${encodedUrl})`
|
||||
case 'html':
|
||||
return `<img src="${url}" alt="${fileName}"/>`
|
||||
return `<img src="${encodedUrl}" alt="${fileName}"/>`
|
||||
case 'bbcode':
|
||||
return `[img]${url}[/img]`
|
||||
return `[img]${encodedUrl}[/img]`
|
||||
case 'url':
|
||||
return url
|
||||
return encodedUrl
|
||||
case 'markdown-with-link':
|
||||
return `[![${fileName}](${url})](${url})`
|
||||
return `[![${fileName}](${encodedUrl})](${encodedUrl})`
|
||||
case 'custom':
|
||||
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:
|
||||
return url
|
||||
return encodedUrl
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
id="upload-view-title"
|
||||
@click="handlePicBedNameClick(picBedName, picBedConfigName)"
|
||||
>
|
||||
{{ $T('PICTURE_UPLOAD') }} - {{ picBedName }} - {{ picBedConfigName }}
|
||||
{{ picBedName }} - {{ picBedConfigName }}
|
||||
</span>
|
||||
</el-tooltip>
|
||||
<el-icon
|
||||
|
Loading…
Reference in New Issue
Block a user