fix: chat-mention 被消去
This commit is contained in:
@@ -85,9 +85,9 @@ const markedInstance = new marked.Marked({
|
|||||||
} else
|
} else
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "UserMention":
|
case "UserMention":
|
||||||
return `<chat-mention user-id="${escapeHTML(/^tws:\/\/user\?id=(.*)/.exec(href)?.[1] || '')}" text="${escapeHTML(/^UserMention=(.*)/.exec(text)?.[1] || '')}"></chat-mention>`
|
return `<chat-mention user-id="${escapeHTML(/^tws:\/\/user\?id=(.*)/.exec(href)?.[1] || '')}" text="${escapeHTML(/^UserMention=(.*)/.exec(text)?.[1] || '')}">PH</chat-mention>`
|
||||||
case "ChatMention":
|
case "ChatMention":
|
||||||
return `<chat-mention chat-id="${escapeHTML(/^tws:\/\/chat\?id=(.*)/.exec(href)?.[1] || '')}" text="${escapeHTML(/^ChatMention=(.*)/.exec(text)?.[1] || '')}"></chat-mention>`
|
return `<chat-mention chat-id="${escapeHTML(/^tws:\/\/chat\?id=(.*)/.exec(href)?.[1] || '')}" text="${escapeHTML(/^ChatMention=(.*)/.exec(text)?.[1] || '')}">PH</chat-mention>`
|
||||||
}
|
}
|
||||||
return `<chat-text em="true">(不支持的附件语法: )</chat-text>`
|
return `<chat-text em="true">(不支持的附件语法: )</chat-text>`
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -33,8 +33,9 @@ function prettyFlatParsedMessage(html: string) {
|
|||||||
]
|
]
|
||||||
function checkContinuousElement(tagName: string) {
|
function checkContinuousElement(tagName: string) {
|
||||||
if (lastElementType != tagName) {
|
if (lastElementType != tagName) {
|
||||||
console.log(lastElementType, ls.map((v) => v.innerHTML))
|
|
||||||
if (textElementTags.indexOf(lastElementType) != -1) {
|
if (textElementTags.indexOf(lastElementType) != -1) {
|
||||||
|
// 由于 chat-mention 不是用内部元素实现的, 因此在这个元素的生成中必须放置占位字符串
|
||||||
|
// 尽管显示上占位字符串不会显示, 但是在这里依然是会被处理的, 因为本身还是 innerHTML
|
||||||
if (ls.map((v) => v.innerHTML).join('').trim() != '')
|
if (ls.map((v) => v.innerHTML).join('').trim() != '')
|
||||||
ret += `<chat-text-container>${ls.map((v) => v.outerHTML).join('')}</chat-text-container>`
|
ret += `<chat-text-container>${ls.map((v) => v.outerHTML).join('')}</chat-text-container>`
|
||||||
} else
|
} else
|
||||||
|
|||||||
Reference in New Issue
Block a user