diff --git a/CHANGES.md b/CHANGES.md index be21f0b7b..35b420347 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,6 +4,7 @@ - #1083: Add support for XEP-0393 Message Styling - #2275: Allow punctuation to immediately precede a mention +- Bugfix: Connection protocol not updated based on XEP-0156 connection methods - Bugfix: `null` inserted by emoji picker and can't switch between skintones - New configuration setting: [show_tab_notifications](https://conversejs.org/docs/html/configuration.html#show-tab-notifications) diff --git a/sass/_messages.scss b/sass/_messages.scss index 9003b1734..57a75bbc2 100644 --- a/sass/_messages.scss +++ b/sass/_messages.scss @@ -16,6 +16,7 @@ color: var(--subdued-color); border-left: 0.3em solid var(--subdued-color); padding-left: 0.5em; + display: inline-block; } code { font-family: monospace; diff --git a/spec/styling.js b/spec/styling.js index ce023b0fd..f8dfd8078 100644 --- a/spec/styling.js +++ b/spec/styling.js @@ -256,7 +256,7 @@ describe("An incoming chat Message", function () { msg_el = Array.from(view.el.querySelectorAll('converse-chat-message-body')).pop(); expect(msg_el.innerText).toBe(msg_text); await u.waitUntil(() => msg_el.innerHTML.replace(//g, '') === - '
This is quoted text\nThis is also quoted
This is not quoted'); + '
This is quoted text\nThis is also quoted
\nThis is not quoted'); msg_text = `> This is *quoted* text\n>This is \`also _quoted_\`\nThis is not quoted`; msg = mock.createChatMessage(_converse, contact_jid, msg_text) @@ -266,7 +266,7 @@ describe("An incoming chat Message", function () { expect(msg_el.innerText).toBe(msg_text); await u.waitUntil(() => msg_el.innerHTML.replace(//g, '') === '
This is *quoted* text\n'+ - 'This is `also _quoted_`
'+ + 'This is `also _quoted_`\n'+ 'This is not quoted'); msg_text = `> > This is doubly quoted text`; @@ -298,7 +298,7 @@ describe("An incoming chat Message", function () { msg_el = Array.from(view.el.querySelectorAll('converse-chat-message-body')).pop(); expect(msg_el.innerText).toBe(msg_text); await u.waitUntil(() => msg_el.innerHTML.replace(//g, '') === - '
```\n (println "Hello, world!")
\n'+ + '
```\n (println "Hello, world!")
\n\n'+ 'The entire blockquote is a preformatted text block, but this line is plaintext!'); msg_text = '> Also, icons.js is loaded from /dist, instead of dist.\nhttps://conversejs.org/docs/html/configuration.html#assets-path' @@ -308,7 +308,7 @@ describe("An incoming chat Message", function () { msg_el = Array.from(view.el.querySelectorAll('converse-chat-message-body')).pop(); expect(msg_el.innerText).toBe(msg_text); await u.waitUntil(() => msg_el.innerHTML.replace(//g, '') === - '
Also, icons.js is loaded from /dist, instead of dist.
'+ + '
Also, icons.js is loaded from /dist, instead of dist.
\n'+ 'https://conversejs.org/docs/html/configuration.html#assets-path'); msg_text = '> Where is it located?\ngeo:37.786971,-122.399677'; @@ -318,7 +318,7 @@ describe("An incoming chat Message", function () { msg_el = Array.from(view.el.querySelectorAll('converse-chat-message-body')).pop(); expect(msg_el.innerText).toBe(msg_text); await u.waitUntil(() => msg_el.innerHTML.replace(//g, '') === - '
Where is it located?
'+ + '
Where is it located?
\n'+ 'https://www.openstreetmap.org/?mlat=37.786971&mlon=-122.399677#map=18/37.786971/-122.399677'); @@ -329,7 +329,16 @@ describe("An incoming chat Message", function () { msg_el = Array.from(view.el.querySelectorAll('converse-chat-message-body')).pop(); expect(msg_el.innerText).toBe(msg_text); await u.waitUntil(() => msg_el.innerHTML.replace(//g, '') === - '
What do you think of it?
💩'); + '
What do you think of it?
\n 💩'); + + msg_text = '> What do you think of it?\n~hello~'; + msg = mock.createChatMessage(_converse, contact_jid, msg_text) + await _converse.handleMessageStanza(msg); + await new Promise(resolve => view.model.messages.once('rendered', resolve)); + msg_el = Array.from(view.el.querySelectorAll('converse-chat-message-body')).pop(); + expect(msg_el.innerText).toBe(msg_text); + await u.waitUntil(() => msg_el.innerHTML.replace(//g, '') === + '
What do you think of it?
\n~hello~'); done(); })); }); diff --git a/src/shared/message/text.js b/src/shared/message/text.js index 4c1b3de8b..2125c23e1 100644 --- a/src/shared/message/text.js +++ b/src/shared/message/text.js @@ -100,8 +100,8 @@ export class MessageText extends String { for (const m of matches) { this.addTemplateResult( m.index+offset, - m.index+m.input.length+offset, - u.convertUrlToHyperlink(m.input.replace(regex, _converse.geouri_replacement)) + m.index+m[0].length+offset, + u.convertUrlToHyperlink(m[0].replace(regex, _converse.geouri_replacement)) ); } } @@ -169,7 +169,7 @@ export class MessageText extends String { const { d, length } = getDirectiveAndLength(this, i); if (d && length) { const begin = d === '```' ? i+d.length+1 : i+d.length; - const end = isQuoteDirective(d) ? i+length+1 : i+length; + const end = i+length; const slice_end = isQuoteDirective(d) ? end : end-d.length; references.push({ 'begin': i,