diff --git a/qortal-ui-plugins/plugins/core/components/ChatPage.js b/qortal-ui-plugins/plugins/core/components/ChatPage.js index ad197b91..4f92363b 100644 --- a/qortal-ui-plugins/plugins/core/components/ChatPage.js +++ b/qortal-ui-plugins/plugins/core/components/ChatPage.js @@ -510,7 +510,6 @@ class ChatPage extends LitElement { constructor() { super() - this.changeMsgInput = this.changeMsgInput.bind(this) this.getOldMessage = this.getOldMessage.bind(this) this._sendMessage = this._sendMessage.bind(this) this.insertImage = this.insertImage.bind(this) @@ -629,9 +628,7 @@ class ChatPage extends LitElement { .chatEditor=${this.chatEditor} .imageFile=${this.imageFile} .insertImage=${this.insertImage} - .chatMessageInput=${this.chatMessageInput} .editedMessageObj=${this.editedMessageObj} - .mirrorChatInput=${this.mirrorChatInput} ?isLoading=${this.isLoading} ?isLoadingMessages=${this.isLoadingMessages} ?isEditMessageOpen=${this.isEditMessageOpen}> @@ -726,9 +723,6 @@ class ChatPage extends LitElement { if (file.type.includes('image')) { this.imageFile = file; this.chatEditor.disable(); - // this.changeMsgInput('newChat') - // this.initChatEditor(); - // this.chatEditor.disable(); return; } parentEpml.request('showSnackBar', get("chatpage.cchange28")); @@ -739,13 +733,6 @@ class ChatPage extends LitElement { this.chatEditor.enable(); } - changeMsgInput(id) { - - this.chatEditor.remove() - this.chatMessageInput = this.shadowRoot.getElementById(id); - this.initChatEditor(); - } - async firstUpdated() { window.addEventListener('storage', () => { const checkLanguage = localStorage.getItem('qortalLanguage'); diff --git a/qortal-ui-plugins/plugins/core/components/ChatTextEditor.js b/qortal-ui-plugins/plugins/core/components/ChatTextEditor.js index b2a16f89..77719560 100644 --- a/qortal-ui-plugins/plugins/core/components/ChatTextEditor.js +++ b/qortal-ui-plugins/plugins/core/components/ChatTextEditor.js @@ -172,7 +172,7 @@ class ChatTextEditor extends LitElement { } return html`
{ this.preventUserSendingImage(e) @@ -300,7 +300,6 @@ class ChatTextEditor extends LitElement { } }) - this.emojiPickerHandler = this.shadowRoot.querySelector('.emoji-button'); this.mirrorChatInput = this.shadowRoot.getElementById('messageBox'); this.chatMessageInput = this.shadowRoot.getElementById(this.iframeId); diff --git a/qortal-ui-plugins/plugins/core/messaging/q-chat/q-chat.src.js b/qortal-ui-plugins/plugins/core/messaging/q-chat/q-chat.src.js index 5de97d52..49d5c148 100644 --- a/qortal-ui-plugins/plugins/core/messaging/q-chat/q-chat.src.js +++ b/qortal-ui-plugins/plugins/core/messaging/q-chat/q-chat.src.js @@ -34,7 +34,10 @@ class Chat extends LitElement { balance: { type: Number }, theme: { type: String, reflect: true }, blockedUsers: { type: Array }, - blockedUserList: { type: Array } + blockedUserList: { type: Array }, + privateMessagePlaceholder: { type: String}, + chatEditor: { type: Object }, + imageFile: { type: Object } } } @@ -321,9 +324,12 @@ class Chat extends LitElement { this.isLoading = false this.showNewMesssageBar = this.showNewMesssageBar.bind(this) this.hideNewMesssageBar = this.hideNewMesssageBar.bind(this) + this.insertImage = this.insertImage.bind(this) this.theme = localStorage.getItem('qortalTheme') ? localStorage.getItem('qortalTheme') : 'light' this.blockedUsers = [] this.blockedUserList = [] + this.privateMessagePlaceholder = "" + this.imageFile = null } render() { @@ -362,17 +368,33 @@ class Chat extends LitElement {

${translate("chatpage.cchange6")}

- -

- -

+ + this.setChatEditor(editor)} + .chatEditor=${this.chatEditor} + .imageFile=${this.imageFile} + .insertImage=${this.insertImage} + ?isLoading=${this.isLoading}> + + - ${this.isLoading === false ? this.renderSendText() : html``} + ${this.isLoading === false ? this.renderSendText() : html``} - ${translate("general.close")} + ${translate("general.close")} @@ -416,7 +438,6 @@ class Chat extends LitElement { } firstUpdated() { - this.changeLanguage() this.changeTheme() this.getChatBlockedList() @@ -523,6 +544,7 @@ class Chat extends LitElement { this.config = JSON.parse(c) }) parentEpml.subscribe('chat_heads', chatHeads => { + console.log("here51"); chatHeads = JSON.parse(chatHeads) this.getChatHeadFromState(chatHeads) }) @@ -542,6 +564,19 @@ class Chat extends LitElement { parentEpml.imReady() } + setChatEditor(editor) { + this.chatEditor = editor; + } + + insertImage(file) { + if (file.type.includes('image')) { + this.imageFile = file; + this.chatEditor.disable(); + return; + } + parentEpml.request('showSnackBar', get("chatpage.cchange28")); + } + renderLoadingText() { return html`${translate("chatpage.cchange2")}` } @@ -712,7 +747,7 @@ class Chat extends LitElement { const compareArgs = (a, b) => { return b.timestamp - a.timestamp } - + console.log({chatHeadMasterList}); this.chatHeads = chatHeadMasterList.sort(compareArgs) }