diff --git a/img/minter.png b/img/minter.png new file mode 100644 index 00000000..ffc89be4 Binary files /dev/null and b/img/minter.png differ diff --git a/plugins/plugins/core/components/ChatHead.js b/plugins/plugins/core/components/ChatHead.js index 6b9b177f..a22f1eeb 100644 --- a/plugins/plugins/core/components/ChatHead.js +++ b/plugins/plugins/core/components/ChatHead.js @@ -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 {
- ${this.chatInfo.groupId !== undefined ? 'id: ' + this.chatInfo.groupId : ''} + ${this.chatInfo.groupId !== undefined ? 'id: ' + this.chatInfo.groupId : 'Private Chat'}
diff --git a/plugins/plugins/core/components/ChatPage.js b/plugins/plugins/core/components/ChatPage.js index fc84eeaa..36ed523c 100644 --- a/plugins/plugins/core/components/ChatPage.js +++ b/plugins/plugins/core/components/ChatPage.js @@ -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` - ${unsafeHTML(generateHTML(this.repliedToMessageObj.message, [StarterKit, Underline, Highlight, Mention]))} + + ${this.repliedToMessageObj.decodedMessage.includes('specialId') ? + this.convertHubMessageToJson(this.repliedToMessageObj.message) : + unsafeHTML(generateHTML(this.repliedToMessageObj.message, [StarterKit, Underline, Highlight, Mention])) + } + ` : '' } @@ -362,7 +367,12 @@ class ChatPage extends LitElement {

${translate("chatpage.cchange25")}

- ${unsafeHTML(generateHTML(this.editedMessageObj.message, [StarterKit, Underline, Highlight, Mention]))} + + ${this.editedMessageObj.decodedMessage.includes('specialId') && !this.editedMessageObj.decodedMessage.includes('messageText') ? + this.convertHubMessageToJson(this.editedMessageObj.message) : + unsafeHTML(generateHTML(this.editedMessageObj.message, [StarterKit, Underline, Highlight, Mention])) + } +
this.closeEditMessageContainer()}>
@@ -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() { diff --git a/plugins/plugins/core/components/ChatScroller.js b/plugins/plugins/core/components/ChatScroller.js index 44a6ea3d..47c4593a 100644 --- a/plugins/plugins/core/components/ChatScroller.js +++ b/plugins/plugins/core/components/ChatScroller.js @@ -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 {
{if (this.version === '0') {this.versionErrorSnack(); return;} this.setEditedMessageObj(this.originalMessage);}} + @click=${() => { + if (this.version === '0') { + this.versionErrorSnack(); + return; + } + this.setEditedMessageObj(this.originalMessage); + }} >
diff --git a/plugins/plugins/core/components/plugins-css.js b/plugins/plugins/core/components/plugins-css.js index cc782eb5..f5454e97 100644 --- a/plugins/plugins/core/components/plugins-css.js +++ b/plugins/plugins/core/components/plugins-css.js @@ -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; }