You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.7 KiB
68 lines
1.7 KiB
import Folder from '@/assets/image/dashboard/file/folder.svg' |
|
import Upload from '@/assets/image/dashboard/file/upload.svg' |
|
import Document from '@/assets/image/dashboard/file/document.svg' |
|
export enum floeType { |
|
folder, |
|
file, |
|
} |
|
export const breadcrumbList = ref([{ name: '全部文件', id: 0 }]) |
|
|
|
export const fileDropdownMenu = [ |
|
{ command: 'open', label: '打开', icon: '' }, |
|
{ command: 'rename', label: '重命名', icon: '' }, |
|
{ command: 'delete', label: '删除', icon: '' }, |
|
] |
|
export const operationDropdownMenu = [ |
|
{ command: 'newFolder', label: '新建文件夹', icon: Folder }, |
|
// { command: 'upload', label: '上传', icon: Upload }, |
|
{ command: 'newMarkdown', label: '新建文档', icon: Document }, |
|
] |
|
|
|
export const vditorToolbar = [ |
|
'edit-mode', |
|
'headings', |
|
'bold', |
|
'italic', |
|
'strike', |
|
'emoji', |
|
'line', |
|
'quote', |
|
'list', |
|
'upload', |
|
'ordered-list', |
|
'check', |
|
'outdent', |
|
'indent', |
|
'table', |
|
'code', |
|
'inline-code', |
|
'insert-after', |
|
'insert-before', |
|
'link', |
|
'both', |
|
'outline', |
|
'code-theme', |
|
'export', |
|
'undo', |
|
'redo', |
|
'fullscreen', |
|
] |
|
|
|
// 拼接前缀函数 |
|
function addPrefixToImages(str: string, prefix: string) { |
|
return str.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, (match, alt, url) => { |
|
// 检查是否已经有前缀,避免重复拼接 |
|
if (!url.startsWith(prefix)) { |
|
return `})` |
|
} |
|
return match |
|
}) |
|
} |
|
|
|
// 去除前缀函数 |
|
function removePrefixFromImages(str: string, prefix: string) { |
|
const prefixPattern = new RegExp(`^${prefix.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}/?`) |
|
return str.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, (match, alt, url) => { |
|
return `})` |
|
}) |
|
}
|
|
|