4
1
mirror of https://github.com/Qortal/qortal-ui.git synced 2025-02-23 15:45:48 +00:00

Merge pull request #356 from AlphaX-Qortal/master

Fixes
This commit is contained in:
AlphaX 2025-02-14 16:19:45 +01:00 committed by GitHub
commit b74cd40cd3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 46 additions and 12 deletions

BIN
img/minter.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -5,7 +5,7 @@ import localForage from 'localforage'
import '@material/mwc-icon'
// Multi language support
import { translate } from '../../../../core/translate'
import { get, translate } from '../../../../core/translate'
const parentEpml = new Epml({ type: 'WINDOW', source: window.parent })
@ -66,6 +66,9 @@ class ChatHead extends LitElement {
} else if (groupString === 'Group_1') {
const avatarUrl = `/img/qdcgroup.png`
this.avatarImg = this.createImage(avatarUrl)
} else if (groupString === 'Group_694') {
const avatarUrl = `/img/minter.png`
this.avatarImg = this.createImage(avatarUrl)
} else if (this.chatInfo.name) {
const avatarUrl = `${nodeUrl}/arbitrary/THUMBNAIL/${this.chatInfo.name}/qortal_avatar?async=true`
this.avatarImg = this.createImage(avatarUrl)
@ -146,7 +149,7 @@ class ChatHead extends LitElement {
</div>
<div class="about" style="margin-top:7px">
<div class="name">
<span style="float:left; padding-left: 8px; color: var(--chat-group);font-size:12px">${this.chatInfo.groupId !== undefined ? 'id: ' + this.chatInfo.groupId : ''}</span>
<span style="float:left; padding-left: 8px; color: var(--chat-group);font-size:12px">${this.chatInfo.groupId !== undefined ? 'id: ' + this.chatInfo.groupId : 'Private Chat'}</span>
<div style="color: var(--black); display: flex;font-size: 12px; align-items:center">
<div style="width: 8px; height: 8px;border-radius: 50%;background: ${isUnread ? 'var(--error)' : 'none'} ; margin-right:5px;"></div>
<message-time style="display: ${(this.chatInfo.timestamp && this.chatInfo.timestamp > 100000) ? 'block' : 'none'}" timestamp=${this.chatInfo.timestamp}></message-time>

View File

@ -3,7 +3,7 @@ import { ifDefined } from 'lit/directives/if-defined.js'
import { unsafeHTML } from 'lit/directives/unsafe-html.js'
import { animate } from '@lit-labs/motion'
import { Epml } from '../../../epml'
import { Editor, Extension, generateHTML } from '@tiptap/core'
import { Editor, Extension, generateHTML, generateJSON } from '@tiptap/core'
import { escape } from 'html-escaper'
import { inputKeyCodes, replaceMessagesEdited, generateIdFromAddresses } from '../../utils/functions'
import { publishData, modalHelper, RequestQueue } from '../../utils/classes'
@ -345,7 +345,12 @@ class ChatPage extends LitElement {
}
${+this.repliedToMessageObj.version > 1 ?
html`
<span style="color: var(--black);">${unsafeHTML(generateHTML(this.repliedToMessageObj.message, [StarterKit, Underline, Highlight, Mention]))}</span>
<span style="color: var(--black);">
${this.repliedToMessageObj.decodedMessage.includes('specialId') ?
this.convertHubMessageToJson(this.repliedToMessageObj.message) :
unsafeHTML(generateHTML(this.repliedToMessageObj.message, [StarterKit, Underline, Highlight, Mention]))
}
</span>
`
: ''
}
@ -362,7 +367,12 @@ class ChatPage extends LitElement {
<vaadin-icon class="reply-icon" icon="vaadin:pencil" slot="icon"></vaadin-icon>
<div class="repliedTo-message">
<p class="senderName">${translate("chatpage.cchange25")}</p>
<span style="color: var(--black);">${unsafeHTML(generateHTML(this.editedMessageObj.message, [StarterKit, Underline, Highlight, Mention]))}</span>
<span style="color: var(--black);">
${this.editedMessageObj.decodedMessage.includes('specialId') && !this.editedMessageObj.decodedMessage.includes('messageText') ?
this.convertHubMessageToJson(this.editedMessageObj.message) :
unsafeHTML(generateHTML(this.editedMessageObj.message, [StarterKit, Underline, Highlight, Mention]))
}
</span>
</div>
<vaadin-icon class="close-icon" icon="vaadin:close-big" slot="icon" @click=${() => this.closeEditMessageContainer()}></vaadin-icon>
</div>
@ -845,7 +855,12 @@ class ChatPage extends LitElement {
if (isEnabledChatEnter) {
this.isEnabledChatEnter = isEnabledChatEnter === 'false' ? false : true
}
}
convertHubMessageToJson(message) {
let newJson = generateJSON(`${message}`, [StarterKit, Underline, Highlight, Mention])
return unsafeHTML(generateHTML(newJson, [StarterKit, Underline, Highlight, Mention]))
}
getNodeUrl() {

View File

@ -3,7 +3,7 @@ import { repeat } from 'lit/directives/repeat.js'
import { unsafeHTML } from 'lit/directives/unsafe-html.js'
import { Epml } from '../../../epml'
import { cropAddress, roundToNearestDecimal } from '../../utils/functions'
import { generateHTML } from '@tiptap/core'
import { generateHTML, generateJSON } from '@tiptap/core'
import { chatLimit, totalMsgCount } from './ChatPage'
import { chatStyles } from './plugins-css'
import isElectron from 'is-electron'
@ -280,6 +280,7 @@ class ChatScroller extends LitElement {
render() {
let formattedMessages = this.messagesToRender
return html`
${this.isLoadingBefore
? html`
@ -1091,7 +1092,7 @@ class MessageTemplate extends LitElement {
messageVersion2WithLink = processText(messageVersion2)
}
if (parsedMessageObj.version > 1 && parsedMessageObj.message) {
if (parsedMessageObj.version > 1 && parsedMessageObj.message && !parsedMessageObj.messageText) {
messageVersion2 = parsedMessageObj.message
messageVersion2WithLink = processText(messageVersion2)
}
@ -1271,6 +1272,10 @@ class MessageTemplate extends LitElement {
try {
repliedToMessageText = generateHTML(repliedToData.decodedMessage.messageText, [StarterKit, Underline, Highlight, Mention])
} catch (error) { /* empty */ }
} else if (repliedToData && repliedToData.decodedMessage && repliedToData.decodedMessage.message) {
try {
repliedToMessageText = this.convertHubMessageToJson(repliedToData.decodedMessage.message)
} catch (error) { /* empty */ }
}
let replacedMessage = ''
@ -2072,6 +2077,11 @@ class MessageTemplate extends LitElement {
}, 60000)
}
convertHubMessageToJson(message) {
let newJson = generateJSON(`${message}`, [StarterKit, Underline, Highlight, Mention])
return generateHTML(newJson, [StarterKit, Underline, Highlight, Mention])
}
async closeDownloadProgressDialog() {
const closeDelay = ms => new Promise(res => setTimeout(res, ms))
this.shadowRoot.getElementById('downloadProgressDialog').close()
@ -2355,7 +2365,13 @@ class ChatMenu extends LitElement {
<div
class=${`menu-icon ${!this.firstMessageInChat ? 'tooltip' : ''}`}
data-text="${translate('blockpage.bcchange12')}"
@click=${() => {if (this.version === '0') {this.versionErrorSnack(); return;} this.setEditedMessageObj(this.originalMessage);}}
@click=${() => {
if (this.version === '0') {
this.versionErrorSnack();
return;
}
this.setEditedMessageObj(this.originalMessage);
}}
>
<vaadin-icon icon="vaadin:pencil" slot="icon"></vaadin-icon>
</div>

View File

@ -1649,7 +1649,7 @@ export const chatStyles = css`
position: absolute;
top: 5px;
left: 10px;
height: 75%;
height: 85%;
width: 2.6px;
background-color: var(--mdc-theme-primary);
}
@ -1669,7 +1669,7 @@ export const chatStyles = css`
overflow: hidden;
text-overflow: ellipsis;
max-width: 500px;
max-height: 40px;
max-height: 80px;
margin: 0;
padding: 0;
}
@ -8524,7 +8524,7 @@ export const groupManagementStyles = css`
position: absolute;
top: 5px;
left: 10px;
height: 75%;
height: 85%;
width: 2.6px;
background-color: var(--mdc-theme-primary);
}
@ -8548,7 +8548,7 @@ export const groupManagementStyles = css`
overflow: hidden;
text-overflow: ellipsis;
max-width: 500px;
max-height: 40px;
max-height: 80px;
margin: 0;
padding: 0;
}