Commit 19d9e281 authored by JC Brand's avatar JC Brand

Update css and keep input and textarea values across toggles

parent d5348ea8
This diff is collapsed.
This diff is collapsed.
...@@ -230,7 +230,8 @@ ...@@ -230,7 +230,8 @@
position: relative; position: relative;
} }
} }
form.sendXMPPMessage {
.sendXMPPMessage {
-moz-background-clip: padding; -moz-background-clip: padding;
-webkit-background-clip: padding-box; -webkit-background-clip: padding-box;
@include border-bottom-radius($chatbox-border-radius); @include border-bottom-radius($chatbox-border-radius);
...@@ -248,9 +249,10 @@ ...@@ -248,9 +249,10 @@
@media screen and (max-width: $mobile-portrait-length) { @media screen and (max-width: $mobile-portrait-length) {
width: 100%; width: 100%;
} }
.chat-textarea-hint { .spoiler-hint {
width: 100%; width: 100%;
} }
.chat-textarea { .chat-textarea {
@include border-bottom-radius($chatbox-border-radius); @include border-bottom-radius($chatbox-border-radius);
border: 0; border: 0;
......
...@@ -284,7 +284,9 @@ ...@@ -284,7 +284,9 @@
'label_send': __('Send'), 'label_send': __('Send'),
'show_send_button': _converse.show_send_button, 'show_send_button': _converse.show_send_button,
'show_textarea': true, 'show_textarea': true,
'show_toolbar': _converse.show_toolbar 'show_toolbar': _converse.show_toolbar,
'hint_value': _.get(this.el.querySelector('.spoiler-hint'), 'value'),
'message_value': _.get(this.el.querySelector('.chat-textarea'), 'value')
})); }));
}, },
...@@ -784,9 +786,9 @@ ...@@ -784,9 +786,9 @@
.c(_converse.ACTIVE, {'xmlns': Strophe.NS.CHATSTATES}).up(); .c(_converse.ACTIVE, {'xmlns': Strophe.NS.CHATSTATES}).up();
if (this.message_form_view.model.get('sending_spoiler')) { if (this.message_form_view.model.get('sending_spoiler')) {
const has_hint = this.el.querySelector('.chat-textarea-hint').value.length > 0; const has_hint = this.el.querySelector('.spoiler-hint').value.length > 0;
if (has_hint) { if (has_hint) {
const hint = document.querySelector('.chat-textarea-hint').value; const hint = document.querySelector('.spoiler-hint').value;
stanza.c('spoiler', {'xmlns': Strophe.NS.SPOILER }, hint); stanza.c('spoiler', {'xmlns': Strophe.NS.SPOILER }, hint);
} else { } else {
stanza.c('spoiler', {'xmlns': Strophe.NS.SPOILER }); stanza.c('spoiler', {'xmlns': Strophe.NS.SPOILER });
...@@ -867,7 +869,7 @@ ...@@ -867,7 +869,7 @@
'is_spoiler': is_spoiler 'is_spoiler': is_spoiler
}; };
if (is_spoiler) { if (is_spoiler) {
const spoiler = this.el.querySelector('.chat-textarea-hint') const spoiler = this.el.querySelector('.spoiler-hint')
attrs.spoiler_hint = spoiler.textContent.length > 0 ? spoiler.textContent : __('Spoiler'); attrs.spoiler_hint = spoiler.textContent.length > 0 ? spoiler.textContent : __('Spoiler');
} }
return attrs; return attrs;
......
...@@ -5,15 +5,15 @@ ...@@ -5,15 +5,15 @@
<ul class="chat-toolbar no-text-select"></ul> <ul class="chat-toolbar no-text-select"></ul>
{[ } ]} {[ } ]}
{[ if (o.allow_spoiler_messages) { ]} {[ if (o.allow_spoiler_messages) { ]}
<input type="text" placeholder="{{o.label_spoiler_hint}}" <input type="text" placeholder="{{o.label_spoiler_hint}}" value="{{ o.hint_value }}"
class="{[ if (!o.sending_spoiler) { ]} hidden {[ } ]} chat-textarea-hint"/> class="{[ if (!o.sending_spoiler) { ]} hidden {[ } ]} spoiler-hint"/>
{[ } ]} {[ } ]}
<textarea <textarea
type="text" type="text"
class="chat-textarea class="chat-textarea
{[ if (o.show_send_button) { ]} chat-textarea-send-button {[ } ]} {[ if (o.show_send_button) { ]} chat-textarea-send-button {[ } ]}
{[ if (o.sending_spoiler) { ]} spoiler {[ } ]}" {[ if (o.sending_spoiler) { ]} spoiler {[ } ]}"
placeholder="{{{o.label_personal_message}}}"></textarea> placeholder="{{{o.label_personal_message}}}">{{ o.message_value }}</textarea>
{[ if (o.show_send_button) { ]} {[ if (o.show_send_button) { ]}
<button type="submit" class="pure-button send-button">{{{ o.label_send }}}</button> <button type="submit" class="pure-button send-button">{{{ o.label_send }}}</button>
{[ } ]} {[ } ]}
......
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