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 { textarea {
box-sizing: border-box; box-sizing: border-box;
width: 2*@sidebar_block-width !important; resize: vertical;
width: 100%;
max-width: 100% !important; max-width: 100% !important;
padding: 10px 15px; padding: 10px 15px;
height: 300px; 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 { .cp-support-search-container {
display: flex; display: flex;

View File

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