mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 23:16:49 +00:00
Merge remote-tracking branch 'origin/feat/notion-page-link-convert' into release/4.5.2
This commit is contained in:
@@ -93,6 +93,35 @@ export function checkContainHttp(str) {
|
||||
}
|
||||
}
|
||||
|
||||
// 检查一个字符串是否notionid : 32位,仅由数字英文构成
|
||||
export function checkStrIsNotionId(str) {
|
||||
if (!str) {
|
||||
return false
|
||||
}
|
||||
// 使用正则表达式进行匹配
|
||||
const regex = /^[a-zA-Z0-9]{32}$/
|
||||
return regex.test(str)
|
||||
}
|
||||
|
||||
// 截取url中最后一个 / 后面的内容
|
||||
export function getLastPartOfUrl(url) {
|
||||
if (!url) {
|
||||
return ''
|
||||
}
|
||||
// 找到最后一个斜杠的位置
|
||||
const lastSlashIndex = url.lastIndexOf('/')
|
||||
|
||||
// 如果找不到斜杠,则返回整个字符串
|
||||
if (lastSlashIndex === -1) {
|
||||
return url
|
||||
}
|
||||
|
||||
// 截取最后一个斜杠后面的内容
|
||||
const lastPart = url.substring(lastSlashIndex + 1)
|
||||
|
||||
return lastPart
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载外部资源
|
||||
* @param url 地址 例如 https://xx.com/xx.js
|
||||
|
||||
Reference in New Issue
Block a user