fix task article link drawer
This commit is contained in:
@@ -344,6 +344,12 @@ async function cleanupEmptyFreeCreate(): Promise<void> {
|
||||
}
|
||||
|
||||
function navigateBack(): void {
|
||||
const returnTo = normalizeReturnTo(route.query.return_to)
|
||||
if (returnTo) {
|
||||
void router.push(returnTo)
|
||||
return
|
||||
}
|
||||
|
||||
if (window.history.length > 1) {
|
||||
void router.back()
|
||||
return
|
||||
@@ -352,6 +358,18 @@ function navigateBack(): void {
|
||||
void router.push('/articles/templates')
|
||||
}
|
||||
|
||||
function normalizeReturnTo(value: unknown): string | null {
|
||||
const raw = Array.isArray(value) ? value[0] : value
|
||||
if (typeof raw !== 'string') {
|
||||
return null
|
||||
}
|
||||
const trimmed = raw.trim()
|
||||
if (!trimmed || !trimmed.startsWith('/') || trimmed.startsWith('//')) {
|
||||
return null
|
||||
}
|
||||
return trimmed
|
||||
}
|
||||
|
||||
function handleStay(): void {
|
||||
leaveModalOpen.value = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user