feat: opt table truncate style
This commit is contained in:
+1
-1
@@ -16,7 +16,7 @@ type UserClaims struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GenerateToken(username, password string) (string, error) {
|
func GenerateToken(username, password string) (string, error) {
|
||||||
expHours := 1 * 24 * time.Hour
|
expHours := 2 * 24 * time.Hour
|
||||||
//expHours := 1 * time.Minute
|
//expHours := 1 * time.Minute
|
||||||
SetClaims := UserClaims{
|
SetClaims := UserClaims{
|
||||||
Username: username,
|
Username: username,
|
||||||
|
|||||||
@@ -36,8 +36,26 @@ const linkedHtml = computed(() => {
|
|||||||
if (start > lastIndex) {
|
if (start > lastIndex) {
|
||||||
html += escapeHtml(value.slice(lastIndex, start))
|
html += escapeHtml(value.slice(lastIndex, start))
|
||||||
}
|
}
|
||||||
const escapedUrl = escapeHtml(url)
|
// 处理结尾多余的标点,如 ) ] } . , ; : ! ? 等(不属于URL的一部分)
|
||||||
html += `<a href="${escapedUrl}" target="_blank" rel="noopener noreferrer" class="underline break-all text-blue-600 dark:text-blue-400">${escapedUrl}</a>`
|
let trimmed = url
|
||||||
|
let suffix = ''
|
||||||
|
while (trimmed.length && /[)\]\}\.,;:!?,。;:、!?"'”’]$/.test(trimmed)) {
|
||||||
|
const ch = trimmed[trimmed.length - 1]
|
||||||
|
if (ch === ')') {
|
||||||
|
const opens = (trimmed.match(/\(/g) || []).length
|
||||||
|
const closes = (trimmed.match(/\)/g) || []).length
|
||||||
|
if (closes < opens) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
suffix = ch + suffix
|
||||||
|
trimmed = trimmed.slice(0, -1)
|
||||||
|
}
|
||||||
|
const escapedTrimmed = escapeHtml(trimmed)
|
||||||
|
html += `<a href="${escapedTrimmed}" target="_blank" rel="noopener noreferrer" class="underline break-all text-blue-600 dark:text-blue-400">${escapedTrimmed}</a>`
|
||||||
|
if (suffix) {
|
||||||
|
html += escapeHtml(suffix)
|
||||||
|
}
|
||||||
lastIndex = start + url.length
|
lastIndex = start + url.length
|
||||||
}
|
}
|
||||||
if (value.length > lastIndex) {
|
if (value.length > lastIndex) {
|
||||||
|
|||||||
Reference in New Issue
Block a user