mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-06 16:07:03 +03:00
make sure that KO bindings are re-applied
This commit is contained in:
parent
6f2f40b983
commit
0a4cea5e4c
1 changed files with 19 additions and 9 deletions
|
|
@ -17,18 +17,28 @@
|
||||||
addEventListener('rl-view-model', e => {
|
addEventListener('rl-view-model', e => {
|
||||||
const vm = e.detail;
|
const vm = e.detail;
|
||||||
if ('PopupsCompose' === vm.viewModelTemplateID && rl.settings.get('editorWysiwyg') === 'CompactComposer') {
|
if ('PopupsCompose' === vm.viewModelTemplateID && rl.settings.get('editorWysiwyg') === 'CompactComposer') {
|
||||||
vm.querySelector('.tabs label[for="tab-body"]').dataset.bind = "visible: canMailvelope";
|
// add visible binding to the label
|
||||||
|
const bodyLabel = vm.querySelector('.tabs label[for="tab-body"]');
|
||||||
|
bodyLabel.dataset.bind = 'visible: canMailvelope';
|
||||||
|
// re-apply the binding
|
||||||
|
const labelNext = bodyLabel.nextElementSibling;
|
||||||
|
ko.removeNode(bodyLabel);
|
||||||
|
labelNext.parentElement.insertBefore(bodyLabel, labelNext);
|
||||||
|
ko.applyBindingAccessorsToNode(bodyLabel, null, vm);
|
||||||
|
|
||||||
// Now move the attachments tab to the bottom of the screen
|
// Now move the attachments tab to the bottom of the screen
|
||||||
const
|
const area = vm.querySelector('.tabs .attachmentAreaParent');
|
||||||
input = vm.querySelector('.tabs input[value="attachments"]'),
|
vm.querySelector('.tabs input[value="attachments"]').remove();
|
||||||
label = vm.querySelector('.tabs label[for="tab-attachments"]'),
|
vm.querySelector('.tabs label[for="tab-attachments"]').remove();
|
||||||
area = vm.querySelector('.tabs .attachmentAreaParent');
|
area.querySelector('.no-attachments-desc').remove();
|
||||||
input.remove();
|
|
||||||
label.remove();
|
|
||||||
area.remove();
|
|
||||||
area.classList.add('compact');
|
area.classList.add('compact');
|
||||||
area.querySelector('.b-attachment-place').dataset.bind = "visible: addAttachmentEnabled(), css: {dragAndDropOver: dragAndDropVisible}";
|
|
||||||
vm.viewModelDom.append(area);
|
vm.viewModelDom.append(area);
|
||||||
|
// Add and re-apply the bindings for the attachment-place
|
||||||
|
const place = area.querySelector('.b-attachment-place');
|
||||||
|
ko.removeNode(place);
|
||||||
|
area.insertBefore(place, area.firstElementChild);
|
||||||
|
place.dataset.bind = 'visible: addAttachmentEnabled(), css: {dragAndDropOver: dragAndDropVisible}';
|
||||||
|
ko.applyBindingAccessorsToNode(place, null, vm);
|
||||||
// There is a better way to do this probably,
|
// There is a better way to do this probably,
|
||||||
// but we need this for drag and drop to work
|
// but we need this for drag and drop to work
|
||||||
e.detail.attachmentsArea = e.detail.bodyArea;
|
e.detail.attachmentsArea = e.detail.bodyArea;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue