mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-02-12 10:15:50 +00:00
fix remove text when modal closes
This commit is contained in:
parent
d78bebe623
commit
51bc261452
@ -654,7 +654,10 @@ class ChatPage extends LitElement {
|
|||||||
</div>
|
</div>
|
||||||
`: ''}
|
`: ''}
|
||||||
<wrapper-modal
|
<wrapper-modal
|
||||||
.removeImage=${() => this.removeImage()}
|
.removeImage=${() => {
|
||||||
|
this.chatEditorNewChat.resetValue()
|
||||||
|
this.removeImage()
|
||||||
|
} }
|
||||||
style=${(this.imageFile && !this.isUploadingImage) ? "display: block" : "display: none"}>
|
style=${(this.imageFile && !this.isUploadingImage) ? "display: block" : "display: none"}>
|
||||||
<div>
|
<div>
|
||||||
<div class="dialog-container">
|
<div class="dialog-container">
|
||||||
@ -673,17 +676,23 @@ class ChatPage extends LitElement {
|
|||||||
.insertImage=${this.insertImage}
|
.insertImage=${this.insertImage}
|
||||||
.editedMessageObj=${this.editedMessageObj}
|
.editedMessageObj=${this.editedMessageObj}
|
||||||
?isLoading=${this.isLoading}
|
?isLoading=${this.isLoading}
|
||||||
?isLoadingMessages=${this.isLoadingMessages}>
|
?isLoadingMessages=${this.isLoadingMessages}
|
||||||
|
id="chatTextCaption"
|
||||||
|
>
|
||||||
</chat-text-editor>
|
</chat-text-editor>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-button-row">
|
<div class="modal-button-row">
|
||||||
<button class="modal-button-red" @click=${() => this.removeImage()}>
|
<button class="modal-button-red" @click=${() => {
|
||||||
|
this.chatEditorNewChat.resetValue()
|
||||||
|
this.removeImage()
|
||||||
|
}}>
|
||||||
${translate("chatpage.cchange33")}
|
${translate("chatpage.cchange33")}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
class="modal-button"
|
class="modal-button"
|
||||||
@click=${()=> {
|
@click=${()=> {
|
||||||
this._sendMessage({
|
const chatTextEditor = this.shadowRoot.getElementById('chatTextCaption')
|
||||||
|
chatTextEditor.sendMessageFunc({
|
||||||
type: 'image',
|
type: 'image',
|
||||||
imageFile: this.imageFile,
|
imageFile: this.imageFile,
|
||||||
})
|
})
|
||||||
@ -699,6 +708,8 @@ class ChatPage extends LitElement {
|
|||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
showLastMessageRefScroller(props) {
|
showLastMessageRefScroller(props) {
|
||||||
this.lastMessageRefVisible = props;
|
this.lastMessageRefVisible = props;
|
||||||
}
|
}
|
||||||
@ -1700,6 +1711,7 @@ class ChatPage extends LitElement {
|
|||||||
const getSendChatResponse = (response) => {
|
const getSendChatResponse = (response) => {
|
||||||
if (response === true) {
|
if (response === true) {
|
||||||
this.chatEditor.resetValue();
|
this.chatEditor.resetValue();
|
||||||
|
this.chatEditorNewChat.resetValue()
|
||||||
} else if (response.error) {
|
} else if (response.error) {
|
||||||
parentEpml.request('showSnackBar', response.message);
|
parentEpml.request('showSnackBar', response.message);
|
||||||
} else {
|
} else {
|
||||||
|
@ -150,6 +150,7 @@ class ChatTextEditor extends LitElement {
|
|||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
this.getMessageSize = this.getMessageSize.bind(this)
|
this.getMessageSize = this.getMessageSize.bind(this)
|
||||||
this.calculateIFrameHeight = this.calculateIFrameHeight.bind(this)
|
this.calculateIFrameHeight = this.calculateIFrameHeight.bind(this)
|
||||||
|
this.resetIFrameHeight = this.resetIFrameHeight.bind(this)
|
||||||
this.addGlobalEventListener = this.addGlobalEventListener.bind(this)
|
this.addGlobalEventListener = this.addGlobalEventListener.bind(this)
|
||||||
this.sendMessageFunc = this.sendMessageFunc.bind(this)
|
this.sendMessageFunc = this.sendMessageFunc.bind(this)
|
||||||
this.removeGlobalEventListener = this.removeGlobalEventListener.bind(this)
|
this.removeGlobalEventListener = this.removeGlobalEventListener.bind(this)
|
||||||
@ -402,14 +403,25 @@ class ChatTextEditor extends LitElement {
|
|||||||
...message,
|
...message,
|
||||||
messageText: trimmedMessage,
|
messageText: trimmedMessage,
|
||||||
}
|
}
|
||||||
} else {
|
} else if(this.imageFile && this.iframeId === 'newChat') {
|
||||||
messageObject = {
|
messageObject = {
|
||||||
messageText: trimmedMessage,
|
messageText: trimmedMessage,
|
||||||
images: [''],
|
images: [{
|
||||||
|
service: "QCHAT_IMAGE",
|
||||||
|
name: '123456789123456789123456789',
|
||||||
|
identifier: '123456'
|
||||||
|
}],
|
||||||
repliedTo: '',
|
repliedTo: '',
|
||||||
version: 1
|
version: 1
|
||||||
};
|
};
|
||||||
}
|
} else {
|
||||||
|
messageObject = {
|
||||||
|
messageText: trimmedMessage,
|
||||||
|
images: [''],
|
||||||
|
repliedTo: '',
|
||||||
|
version: 1
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const stringified = JSON.stringify(messageObject);
|
const stringified = JSON.stringify(messageObject);
|
||||||
const size = new Blob([stringified]).size;
|
const size = new Blob([stringified]).size;
|
||||||
@ -426,7 +438,9 @@ class ChatTextEditor extends LitElement {
|
|||||||
this.iframeHeight = editorTest + 20;
|
this.iframeHeight = editorTest + 20;
|
||||||
}, 50)
|
}, 50)
|
||||||
}
|
}
|
||||||
|
resetIFrameHeight(height) {
|
||||||
|
this.iframeHeight = 42;
|
||||||
|
}
|
||||||
initChatEditor() {
|
initChatEditor() {
|
||||||
const ChatEditor = function (editorConfig) {
|
const ChatEditor = function (editorConfig) {
|
||||||
const ChatEditor = function () {
|
const ChatEditor = function () {
|
||||||
@ -458,7 +472,7 @@ class ChatTextEditor extends LitElement {
|
|||||||
editor.contentDiv.innerHTML = '';
|
editor.contentDiv.innerHTML = '';
|
||||||
editor.updateMirror();
|
editor.updateMirror();
|
||||||
editor.focus();
|
editor.focus();
|
||||||
editorConfig.calculateIFrameHeight()
|
editorConfig.resetIFrameHeight()
|
||||||
};
|
};
|
||||||
|
|
||||||
ChatEditor.prototype.styles = function () {
|
ChatEditor.prototype.styles = function () {
|
||||||
@ -802,7 +816,8 @@ class ChatTextEditor extends LitElement {
|
|||||||
addGlobalEventListener: this.addGlobalEventListener,
|
addGlobalEventListener: this.addGlobalEventListener,
|
||||||
removeGlobalEventListener: this.removeGlobalEventListener,
|
removeGlobalEventListener: this.removeGlobalEventListener,
|
||||||
iframeId: this.iframeId,
|
iframeId: this.iframeId,
|
||||||
theme: this.theme
|
theme: this.theme,
|
||||||
|
resetIFrameHeight: this.resetIFrameHeight
|
||||||
};
|
};
|
||||||
const newChat = new ChatEditor(editorConfig);
|
const newChat = new ChatEditor(editorConfig);
|
||||||
this.setChatEditor(newChat);
|
this.setChatEditor(newChat);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user