diff --git a/frontend/controller/app/identity.js b/frontend/controller/app/identity.js index 68d573745..f6a2746f0 100644 --- a/frontend/controller/app/identity.js +++ b/frontend/controller/app/identity.js @@ -390,6 +390,16 @@ export default (sbp('sbp/selectors/register', { try { await sbp('chelonia/contract/sync', identityContractID) } catch (e) { + // Since we're throwing or returning, the `await` below will not + // be used. In either case, login won't complete after this point, + // so errors there aren't relevant anymore. + loginCompletePromise.catch((e) => { + // Using `warn` level because this error is not so relevant + // However, errors might be helpful for debugging purposes, so + // we still log it. + console.warn('[gi.app/identity/login] Error in login complete promise', e) + }) + // To make it easier to test things during development, if the // identity contract no longer exists, we automatically log out // If we're in production mode, we show a prompt instead as logging diff --git a/frontend/views/containers/chatroom/MessageBase.vue b/frontend/views/containers/chatroom/MessageBase.vue index 8eebf4f3a..1bf4583bc 100644 --- a/frontend/views/containers/chatroom/MessageBase.vue +++ b/frontend/views/containers/chatroom/MessageBase.vue @@ -221,7 +221,9 @@ export default ({ this.$emit('add-emoticon', emoticon.native || emoticon) }, openMenu () { - this.$refs.messageAction.$refs.menu.handleTrigger() + if (this.$refs.messageAction?.$refs?.menu) { + this.$refs.messageAction.$refs.menu.handleTrigger() + } }, longPressHandler (e) { const wrappingLinkTag = e.target.closest('a.link[href]') @@ -230,7 +232,7 @@ export default ({ const url = wrappingLinkTag.getAttribute('href') sbp('okTurtles.events/emit', OPEN_TOUCH_LINK_HELPER, url) e?.preventDefault() - } else { + } else if (!this.isEditing) { this.openMenu() } } diff --git a/frontend/views/containers/chatroom/SendArea.vue b/frontend/views/containers/chatroom/SendArea.vue index e3f6700a6..e41cf978d 100644 --- a/frontend/views/containers/chatroom/SendArea.vue +++ b/frontend/views/containers/chatroom/SendArea.vue @@ -562,6 +562,11 @@ export default ({ } }, handlePaste (e) { + if (e.clipboardData.files.length > 0) { + this.fileAttachmentHandler(e.clipboardData.files, true) + return + } + // fix for the edge-case related to 'paste' action when nothing has been typed // (reference: https://github.com/okTurtles/group-income/issues/2369) const currVal = this.$refs.textarea.value diff --git a/frontend/views/containers/chatroom/chat-mentions/chat-mentions-utils.js b/frontend/views/containers/chatroom/chat-mentions/chat-mentions-utils.js index b623dc12c..7d47c68ff 100644 --- a/frontend/views/containers/chatroom/chat-mentions/chat-mentions-utils.js +++ b/frontend/views/containers/chatroom/chat-mentions/chat-mentions-utils.js @@ -61,6 +61,7 @@ function createRecursiveDomObjects (element: any): DomObject { const isNodeTypeText = element?.nodeType === Node.TEXT_NODE const isNodeCodeElement = element?.nodeName === 'CODE' // ... element needs a special treatment in the chat. + const isBodyElement = element?.nodeName === 'BODY' const nodeObj: DomObject = isNodeTypeText ? { tagName: null, attributes: {}, text: element.textContent } @@ -87,9 +88,14 @@ function createRecursiveDomObjects (element: any): DomObject { nodeObj.children.push(createRecursiveDomObjects(child)) } - nodeObj.children = nodeObj.children.filter( - child => child.tagName || (child.text || '').trim().length - ) + nodeObj.children = nodeObj.children.filter(child => { + if (child.tagName) return true + else { + return isBodyElement + ? child.text !== '\n' // DOMParser.parseFromString() adds a '\n' at the end of the body content which needs to be removed. + : (child.text || '').length + } + }) } return nodeObj diff --git a/frontend/views/utils/markdown-utils.js b/frontend/views/utils/markdown-utils.js index c4f92e1b2..0c25e3c46 100644 --- a/frontend/views/utils/markdown-utils.js +++ b/frontend/views/utils/markdown-utils.js @@ -59,7 +59,6 @@ export function renderMarkdown (str: string): any { // STEP 3. Remove the unecessary starting/end line-breaks added in/outside of the converted html tags. converted = converted.replace(/<([a-z]+)>\n/g, '<$1>') .replace(/\n<\/([a-z]+)>/g, '') - return converted }