Bugfix: when left panel disabled and dragstart messages, show panel

This commit is contained in:
the-djmaze 2022-11-22 11:14:56 +01:00
parent 1032d0eb45
commit 434ac21103
7 changed files with 21 additions and 18 deletions

View file

@ -18,7 +18,6 @@ export const
dropdowns = [], dropdowns = [],
dropdownVisibility = ko.observable(false).extend({ rateLimit: 0 }), dropdownVisibility = ko.observable(false).extend({ rateLimit: 0 }),
moveAction = ko.observable(false),
leftPanelDisabled = ko.observable(false), leftPanelDisabled = ko.observable(false),
toggleLeftPanel = () => leftPanelDisabled(!leftPanelDisabled()), toggleLeftPanel = () => leftPanelDisabled(!leftPanelDisabled()),
@ -69,9 +68,4 @@ dropdownVisibility.subscribe(value => {
} }
}); });
leftPanelDisabled.subscribe(value => { leftPanelDisabled.subscribe(value => $htmlCL.toggle('rl-left-panel-disabled', value));
value && moveAction() && moveAction(false);
$htmlCL.toggle('rl-left-panel-disabled', value);
});
moveAction.subscribe(value => value && leftPanelDisabled(false));

View file

@ -1,7 +1,7 @@
import { MessageFlagsCache } from 'Common/Cache'; import { MessageFlagsCache } from 'Common/Cache';
import { Notification } from 'Common/Enums'; import { Notification } from 'Common/Enums';
import { MessageSetAction, ComposeType/*, FolderType*/ } from 'Common/EnumsUser'; import { MessageSetAction, ComposeType/*, FolderType*/ } from 'Common/EnumsUser';
import { doc, createElement, elementById, dropdowns, dropdownVisibility, SettingsGet } from 'Common/Globals'; import { doc, createElement, elementById, dropdowns, dropdownVisibility, SettingsGet, leftPanelDisabled } from 'Common/Globals';
import { plainToHtml } from 'Common/Html'; import { plainToHtml } from 'Common/Html';
import { getNotification } from 'Common/Translator'; import { getNotification } from 'Common/Translator';
import { EmailModel } from 'Model/Email'; import { EmailModel } from 'Model/Email';
@ -15,6 +15,8 @@ import Remote from 'Remote/User/Fetch';
export const export const
moveAction = ko.observable(false),
dropdownsDetectVisibility = (() => dropdownsDetectVisibility = (() =>
dropdownVisibility(!!dropdowns.find(item => item.classList.contains('show'))) dropdownVisibility(!!dropdowns.find(item => item.classList.contains('show')))
).debounce(50), ).debounce(50),
@ -356,3 +358,6 @@ populateMessageBody = (oMessage, popup) => {
}, oMessage.folder, oMessage.uid); }, oMessage.folder, oMessage.uid);
} }
}; };
leftPanelDisabled.subscribe(value => value && moveAction(false));
moveAction.subscribe(value => value && leftPanelDisabled(false));

View file

@ -3,7 +3,7 @@ import ko from 'ko';
import { HtmlEditor } from 'Common/Html'; import { HtmlEditor } from 'Common/Html';
import { timeToNode } from 'Common/Translator'; import { timeToNode } from 'Common/Translator';
import { doc, elementById, addEventsListeners, dropdowns } from 'Common/Globals'; import { doc, elementById, addEventsListeners, dropdowns } from 'Common/Globals';
import { dropdownsDetectVisibility } from 'Common/UtilsUser'; import { dropdownsDetectVisibility, moveAction } from 'Common/UtilsUser';
import { EmailAddressesComponent } from 'Component/EmailAddresses'; import { EmailAddressesComponent } from 'Component/EmailAddresses';
import { ThemeStore } from 'Stores/Theme'; import { ThemeStore } from 'Stores/Theme';
import { moveMessagesToFolder, dropFilesInFolder } from 'Common/Folders'; import { moveMessagesToFolder, dropFilesInFolder } from 'Common/Folders';
@ -144,12 +144,17 @@ Object.assign(ko.bindingHandlers, {
// Remove the Chrome visibility // Remove the Chrome visibility
dragImage.style.cssText = ''; dragImage.style.cssText = '';
moveAction(true);
} else { } else {
e.preventDefault(); e.preventDefault();
} }
}, false); }, false);
element.addEventListener("dragend", () => dragData = null); element.addEventListener("dragend", () => {
dragData = null;
moveAction(false);
});
} }
}, },

View file

@ -1,8 +1,8 @@
import { Scope } from 'Common/Enums'; import { Scope } from 'Common/Enums';
import { Layout, ClientSideKeyNameMessageListSize } from 'Common/EnumsUser'; import { Layout, ClientSideKeyNameMessageListSize } from 'Common/EnumsUser';
import { doc, createElement, leftPanelDisabled, moveAction, Settings, elementById } from 'Common/Globals'; import { doc, createElement, leftPanelDisabled, Settings, elementById } from 'Common/Globals';
import { pString, pInt } from 'Common/Utils'; import { pString, pInt } from 'Common/Utils';
import { setLayoutResizer } from 'Common/UtilsUser'; import { setLayoutResizer, moveAction } from 'Common/UtilsUser';
import { getFolderFromCacheList, getFolderFullName, getFolderInboxName } from 'Common/Cache'; import { getFolderFromCacheList, getFolderFullName, getFolderInboxName } from 'Common/Cache';
import { i18n, initOnStartOrLangChange } from 'Common/Translator'; import { i18n, initOnStartOrLangChange } from 'Common/Translator';
import { SettingsUserStore } from 'Stores/User/Settings'; import { SettingsUserStore } from 'Stores/User/Settings';

View file

@ -1,7 +1,7 @@
import ko from 'ko'; import ko from 'ko';
import { Scope } from 'Common/Enums'; import { Scope } from 'Common/Enums';
import { moveAction, addShortcut } from 'Common/Globals'; import { addShortcut } from 'Common/Globals';
import { mailBox, settings } from 'Common/Links'; import { mailBox, settings } from 'Common/Links';
//import { setFolderHash } from 'Common/Cache'; //import { setFolderHash } from 'Common/Cache';
import { addComputablesTo } from 'External/ko'; import { addComputablesTo } from 'External/ko';
@ -15,7 +15,7 @@ import { MessagelistUserStore } from 'Stores/User/Messagelist';
import { showScreenPopup } from 'Knoin/Knoin'; import { showScreenPopup } from 'Knoin/Knoin';
import { AbstractViewLeft } from 'Knoin/AbstractViews'; import { AbstractViewLeft } from 'Knoin/AbstractViews';
import { showMessageComposer } from 'Common/UtilsUser'; import { showMessageComposer, moveAction } from 'Common/UtilsUser';
import { FolderCreatePopupView } from 'View/Popup/FolderCreate'; import { FolderCreatePopupView } from 'View/Popup/FolderCreate';
import { ContactsPopupView } from 'View/Popup/Contacts'; import { ContactsPopupView } from 'View/Popup/Contacts';
import { ComposePopupView } from 'View/Popup/Compose'; import { ComposePopupView } from 'View/Popup/Compose';

View file

@ -5,13 +5,13 @@ import { Scope } from 'Common/Enums';
import { ComposeType, FolderType, MessageSetAction } from 'Common/EnumsUser'; import { ComposeType, FolderType, MessageSetAction } from 'Common/EnumsUser';
import { leftPanelDisabled, toggleLeftPanel, moveAction, import { leftPanelDisabled, toggleLeftPanel,
Settings, SettingsCapa, Settings, SettingsCapa,
addEventsListeners, addEventsListeners,
addShortcut, registerShortcut, formFieldFocused addShortcut, registerShortcut, formFieldFocused
} from 'Common/Globals'; } from 'Common/Globals';
import { computedPaginatorHelper, showMessageComposer, populateMessageBody, download } from 'Common/UtilsUser'; import { computedPaginatorHelper, showMessageComposer, populateMessageBody, download, moveAction } from 'Common/UtilsUser';
import { FileInfo } from 'Common/File'; import { FileInfo } from 'Common/File';
import { isFullscreen, toggleFullscreen } from 'Common/Fullscreen'; import { isFullscreen, toggleFullscreen } from 'Common/Fullscreen';

View file

@ -15,7 +15,6 @@ import {
elementById, elementById,
leftPanelDisabled, leftPanelDisabled,
keyScopeReal, keyScopeReal,
moveAction,
Settings, Settings,
SettingsCapa, SettingsCapa,
fireEvent, fireEvent,
@ -24,7 +23,7 @@ import {
} from 'Common/Globals'; } from 'Common/Globals';
import { arrayLength } from 'Common/Utils'; import { arrayLength } from 'Common/Utils';
import { download, mailToHelper, showMessageComposer } from 'Common/UtilsUser'; import { download, mailToHelper, showMessageComposer, moveAction } from 'Common/UtilsUser';
import { isFullscreen, exitFullscreen, toggleFullscreen } from 'Common/Fullscreen'; import { isFullscreen, exitFullscreen, toggleFullscreen } from 'Common/Fullscreen';
import { SMAudio } from 'Common/Audio'; import { SMAudio } from 'Common/Audio';