Commit de583cbd authored by JC Brand's avatar JC Brand

Don't nest chat-msg__txt inside `converse-chat-message-body`

instead just set the classes directly on the custom element

As far as I can tell, this fixes #1346 (or it was fixed already)
parent 59a5acf2
...@@ -164,7 +164,7 @@ ...@@ -164,7 +164,7 @@
} }
converse-chat-message-body { converse-chat-message-body {
display: inline-block; display: inline;
} }
.chat-msg__message { .chat-msg__message {
...@@ -193,7 +193,6 @@ ...@@ -193,7 +193,6 @@
.chat-msg__text { .chat-msg__text {
color: var(--message-text-color); color: var(--message-text-color);
padding: 0; padding: 0;
width: 100%;
white-space: pre-wrap; white-space: pre-wrap;
word-wrap: break-word; word-wrap: break-word;
word-break: break-word; word-break: break-word;
......
import { CustomElement } from './element.js'; import { CustomElement } from './element.js';
import { renderBodyText } from './../templates/directives/body'; import { renderBodyText } from './../templates/directives/body';
import { html } from 'lit-element';
class MessageBody extends CustomElement { class MessageBody extends CustomElement {
static get properties () { static get properties () {
return { return {
is_only_emojis: { type: Boolean },
is_spoiler: { type: Boolean },
is_spoiler_visible: { type: Boolean },
is_me_message: { type: Boolean }, is_me_message: { type: Boolean },
model: { type: Object }, model: { type: Object },
text: { type: String }, text: { type: String },
...@@ -17,13 +13,8 @@ class MessageBody extends CustomElement { ...@@ -17,13 +13,8 @@ class MessageBody extends CustomElement {
} }
render () { render () {
const spoiler_classes = this.is_spoiler ? `spoiler ${this.is_spoiler_visible ? '' : 'collapsed'}` : ''; return renderBodyText(this);
return html`
<div class="chat-msg__text ${this.is_only_emojis ? 'chat-msg__text--larger' : ''} ${spoiler_classes}"
>${renderBodyText(this)}</div>
`;
} }
} }
customElements.define('converse-chat-message-body', MessageBody); customElements.define('converse-chat-message-body', MessageBody);
...@@ -223,11 +223,13 @@ class Message extends CustomElement { ...@@ -223,11 +223,13 @@ class Message extends CustomElement {
</a> </a>
</div> </div>
`; `;
const spoiler_classes = this.is_spoiler ? `spoiler ${this.is_spoiler_visible ? '' : 'collapsed'}` : '';
return html` return html`
${ this.is_spoiler ? tpl_spoiler_hint : '' } ${ this.is_spoiler ? tpl_spoiler_hint : '' }
${ this.subject ? html`<div class="chat-msg__subject">${this.subject}</div>` : '' } ${ this.subject ? html`<div class="chat-msg__subject">${this.subject}</div>` : '' }
<span> <span>
<converse-chat-message-body <converse-chat-message-body
class="chat-msg__text ${this.is_only_emojis ? 'chat-msg__text--larger' : ''} ${spoiler_classes}"
.model="${this.model}" .model="${this.model}"
?is_me_message="${this.is_me_message}" ?is_me_message="${this.is_me_message}"
?is_only_emojis="${this.is_only_emojis}" ?is_only_emojis="${this.is_only_emojis}"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment