Fix overflowing text snippets for support messages

This commit is contained in:
yflory 2024-03-27 17:04:34 +01:00
parent 719f21111f
commit c0a21eeb82
3 changed files with 25 additions and 6 deletions

View File

@ -33,7 +33,8 @@
}
textarea {
box-sizing: border-box;
width: 2*@sidebar_block-width !important;
resize: vertical;
width: 100%;
max-width: 100% !important;
padding: 10px 15px;
height: 300px;

View File

@ -109,6 +109,24 @@
}
}
}
[data-item="open-ticket"] {
.cp-support-form-container {
textarea {
width: 2*@sidebar_block-width !important;
}
}
}
.cp-support-recorded {
.cp-dropdown-container > button {
margin-left: @sidebar_base-margin !important;
margin-right: 0 !important;
}
.cp-fake-dropdown {
margin-left: @sidebar_base-margin !important;
margin-right: 0 !important;
}
}
.cp-support-search-container {
display: flex;

View File

@ -243,7 +243,7 @@ define([
$recorded.append(h('span.cp-support-recorded-insert',
Messages.support_insertRecorded));
let $span = $(h('span')).appendTo($recorded);
let $fakeMore = $(h('button.btn.btn-secondary.fa.fa-ellipsis-h')).appendTo($recorded);
let $fakeMore = $(h('button.btn.btn-secondary.fa.fa-ellipsis-h.cp-fake-dropdown')).appendTo($recorded);
let opts = [];
let all = recorded.all;
@ -253,7 +253,9 @@ define([
return a - b;
};
let overflow = false;
let maxWidth = $recorded.width();
let $label = $recorded.find('.cp-support-recorded-insert');
let maxWidth = $recorded.width() - $label.outerWidth(true)
- $fakeMore.outerWidth(true);
Object.keys(all).sort(sort).forEach(id => {
let action = () => {
insertText(all[id].content);
@ -265,10 +267,8 @@ define([
if (!overflow) {
let button = h('button.btn.btn-secondary', id);
$span.append(button);
let margin = parseFloat(getComputedStyle($fakeMore[0]).marginRight);
let buttonWidth = $fakeMore.width();
let current = $span.width();
if ((current + buttonWidth + margin) < maxWidth) {
if (current < maxWidth) {
return Util.onClickEnter($(button), action);
}
$(button).remove();