This commit is contained in:
Alex-larget
2026-04-07 15:59:13 +08:00
parent 7b285a7b70
commit 36b8524bc9
22 changed files with 340 additions and 1164 deletions

View File

@@ -129,6 +129,8 @@ function parseBlockToSegments(block, config) {
const tagIdMatch = tag.match(/data-tag-id="([^"]*)"/)
const appIdMatch = tag.match(/data-app-id="([^"]*)"/)
const mpKeyMatch = tag.match(/data-mp-key="([^"]*)"/)
const passPhoneMatch = tag.match(/data-pass-phone="([^"]*)"/)
const phoneParamMatch = tag.match(/data-phone-param-name="([^"]*)"/)
const innerText = cleanSingleLineField(tag.replace(/<[^>]+>/g, '').replace(/^#/, ''))
const url = urlMatch ? urlMatch[1] : ''
const tagType = tagTypeMatch ? tagTypeMatch[1] : 'url'
@@ -136,7 +138,9 @@ function parseBlockToSegments(block, config) {
const tagId = tagIdMatch ? tagIdMatch[1] : ''
const appId = appIdMatch ? appIdMatch[1] : ''
const mpKey = mpKeyMatch ? mpKeyMatch[1] : ''
segs.push({ type: 'linkTag', label: innerText || '#', url, tagType, pagePath, tagId, appId, mpKey })
const passPhone = !!(passPhoneMatch && (passPhoneMatch[1] === '1' || /^true$/i.test(passPhoneMatch[1])))
const phoneParamName = (phoneParamMatch && phoneParamMatch[1]) ? phoneParamMatch[1] : 'phone'
segs.push({ type: 'linkTag', label: innerText || '#', url, tagType, pagePath, tagId, appId, mpKey, passPhone, phoneParamName })
} else if (/^<a /i.test(tag)) {
// #linkTag — 旧格式 <a href>insertLinkTag 旧版产生url 可能为空)
@@ -327,7 +331,9 @@ function matchLineToSegments(line, config) {
pagePath: tag.pagePath || '',
tagId: tag.tagId || '',
appId: tag.appId || '',
mpKey: tag.mpKey || ''
mpKey: tag.mpKey || '',
passPhone: !!tag.passPhone,
phoneParamName: tag.phoneParamName || 'phone'
})
} else {
segs.push({ type: 'text', text: full })