mirror of
https://github.com/LingChair/LingChair-V0.git
synced 2025-12-08 10:05:49 +08:00
change: 切换标签页不会滚动到底部
This commit is contained in:
@@ -53,9 +53,9 @@ ChatMsgAdapter.initMsgElementEvents()
|
|||||||
|
|
||||||
ChatMsgAdapter.initInputResizer()
|
ChatMsgAdapter.initInputResizer()
|
||||||
|
|
||||||
const showLinkDialog = (link) => mdui.alert(decodeURI(link) + "<br/>如果你确认此链接是安全的, 那么请<a class=\"mdui-text-color-theme-accent\" href=\"" + link + "\">点我</a>", '链接', () => { }, { confirmText: "关闭" })
|
const showLinkDialog = (link) => mdui.alert(decodeURI(link) + "<br/>如果你确认此链接是安全的, 那么请<a class=\"mdui-text-color-theme\" href=\"" + link + "\">点我</a>", '链接', () => { }, { confirmText: "关闭" })
|
||||||
|
|
||||||
const showImageDialog = (link, id, alt) => mdui.alert(`此图片链接来源未知: ${decodeURI(link)}<br/>如果你希望加载, 请<a class="mdui-text-color-theme-accent" mdui-dialog-close onclick="$('#${id}').html('<img src=\\'${link}\\' alt=\\'${decodeURI(alt)}\\' class=\\'message-image\\'></img>')">点我</a>`, '外部图片', () => { }, { confirmText: "关闭" })
|
const showImageDialog = (link, id, alt) => mdui.alert(`此图片链接来源未知: ${decodeURI(link)}<br/>如果你希望加载, 请<a class="mdui-text-color-theme" mdui-dialog-close onclick="$('#${id}').html('<img src=\\'${link}\\' alt=\\'${decodeURI(alt)}\\' class=\\'message-image\\'></img>')">点我</a>`, '外部图片', () => { }, { confirmText: "关闭" })
|
||||||
|
|
||||||
const showCodeDialog = (code) => mdui.alert(`<pre><code>${decodeURI(code)}</code></pre>`, '代码块', () => { }, { confirmText: "关闭" })
|
const showCodeDialog = (code) => mdui.alert(`<pre><code>${decodeURI(code)}</code></pre>`, '代码块', () => { }, { confirmText: "关闭" })
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ const renderer = {
|
|||||||
return text
|
return text
|
||||||
},
|
},
|
||||||
link(href, title, text) {
|
link(href, title, text) {
|
||||||
return `<a class="mdui-text-color-theme-accent" onclick="showLinkDialog('${encodeURI(href)}')">[链接] ${text}</a>`
|
return `<a class="mdui-text-color-theme" onclick="showLinkDialog('${encodeURI(href)}')">[链接] ${text}</a>`
|
||||||
},
|
},
|
||||||
image(href, title, text) {
|
image(href, title, text) {
|
||||||
let h = Hash.sha256(href)
|
let h = Hash.sha256(href)
|
||||||
@@ -81,10 +81,10 @@ const renderer = {
|
|||||||
if (out)
|
if (out)
|
||||||
return `<img src="${encodeURI(href)}" alt="${text}" class="message-image"></img>`
|
return `<img src="${encodeURI(href)}" alt="${text}" class="message-image"></img>`
|
||||||
else
|
else
|
||||||
return `<div id="${h}"><a class="mdui-text-color-theme-accent" onclick="showImageDialog('${encodeURI(href)}', '${h}', '${encodeURI(text)}')">[外部图片] ${text}</a></div>`
|
return `<div id="${h}"><a class="mdui-text-color-theme" onclick="showImageDialog('${encodeURI(href)}', '${h}', '${encodeURI(text)}')">[外部图片] ${text}</a></div>`
|
||||||
},
|
},
|
||||||
code(src) {
|
code(src) {
|
||||||
return `<a class="mdui-text-color-theme-accent" onclick="showCodeDialog(\`${encodeURI(src)}\`)">[代码块]</a>`
|
return `<a class="mdui-text-color-theme" onclick="showCodeDialog(\`${encodeURI(src)}\`)">[代码块]</a>`
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
// ================================
|
// ================================
|
||||||
|
|
||||||
class CurrentUser {
|
class CurrentUser {
|
||||||
|
/** @type { String } */
|
||||||
static myAccessToken
|
static myAccessToken
|
||||||
/**
|
/**
|
||||||
* 登录账号
|
* 登录账号
|
||||||
@@ -303,7 +304,9 @@ class ChatPage {
|
|||||||
this.chatType = type
|
this.chatType = type
|
||||||
ChatTabManager.add(title, this.chatTarget)
|
ChatTabManager.add(title, this.chatTarget)
|
||||||
this.chatPageElement = $($.parseHTML(`<div class="chat-seesion" id="chatPageTargetIs${this.chatTarget}" target="${this.chatTarget}"></div>`))
|
this.chatPageElement = $($.parseHTML(`<div class="chat-seesion" id="chatPageTargetIs${this.chatTarget}" target="${this.chatTarget}"></div>`))
|
||||||
|
this.chatPageElement.hide()
|
||||||
this.chatPageElement.appendTo(viewBinding.pageChatSeesion)
|
this.chatPageElement.appendTo(viewBinding.pageChatSeesion)
|
||||||
|
;(async () => await this.loadMore())()
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 获取当前的聊天栏
|
* 获取当前的聊天栏
|
||||||
@@ -335,13 +338,12 @@ class ChatPage {
|
|||||||
tbe.removeClass("mdui-tab-active")
|
tbe.removeClass("mdui-tab-active")
|
||||||
}
|
}
|
||||||
|
|
||||||
$(this.chatPageElement).empty()
|
|
||||||
$(this.chatPageElement).attr("actived", "true")
|
$(this.chatPageElement).attr("actived", "true")
|
||||||
$(this.chatPageElement).show()
|
|
||||||
ChatTabManager.find(this.chatTarget).addClass("mdui-tab-active")
|
ChatTabManager.find(this.chatTarget).addClass("mdui-tab-active")
|
||||||
|
|
||||||
await this.loadMore()
|
|
||||||
ChatMsgAdapter.scrollToBottom()
|
$(this.chatPageElement).show()
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 连带Tab一起销毁
|
* 连带Tab一起销毁
|
||||||
|
|||||||
Reference in New Issue
Block a user