diff --git a/dev/Common/Globals.js b/dev/Common/Globals.js index e098809c1..cd53ff55a 100644 --- a/dev/Common/Globals.js +++ b/dev/Common/Globals.js @@ -18,7 +18,6 @@ export const dropdowns = [], dropdownVisibility = ko.observable(false).extend({ rateLimit: 0 }), - moveAction = ko.observable(false), leftPanelDisabled = ko.observable(false), toggleLeftPanel = () => leftPanelDisabled(!leftPanelDisabled()), @@ -69,9 +68,4 @@ dropdownVisibility.subscribe(value => { } }); -leftPanelDisabled.subscribe(value => { - value && moveAction() && moveAction(false); - $htmlCL.toggle('rl-left-panel-disabled', value); -}); - -moveAction.subscribe(value => value && leftPanelDisabled(false)); +leftPanelDisabled.subscribe(value => $htmlCL.toggle('rl-left-panel-disabled', value)); diff --git a/dev/Common/UtilsUser.js b/dev/Common/UtilsUser.js index c9813674d..d78bec7ed 100644 --- a/dev/Common/UtilsUser.js +++ b/dev/Common/UtilsUser.js @@ -1,7 +1,7 @@ import { MessageFlagsCache } from 'Common/Cache'; import { Notification } from 'Common/Enums'; 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 { getNotification } from 'Common/Translator'; import { EmailModel } from 'Model/Email'; @@ -15,6 +15,8 @@ import Remote from 'Remote/User/Fetch'; export const +moveAction = ko.observable(false), + dropdownsDetectVisibility = (() => dropdownVisibility(!!dropdowns.find(item => item.classList.contains('show'))) ).debounce(50), @@ -356,3 +358,6 @@ populateMessageBody = (oMessage, popup) => { }, oMessage.folder, oMessage.uid); } }; + +leftPanelDisabled.subscribe(value => value && moveAction(false)); +moveAction.subscribe(value => value && leftPanelDisabled(false)); diff --git a/dev/External/User/ko.js b/dev/External/User/ko.js index 6bbaa5965..8629fff9b 100644 --- a/dev/External/User/ko.js +++ b/dev/External/User/ko.js @@ -3,7 +3,7 @@ import ko from 'ko'; import { HtmlEditor } from 'Common/Html'; import { timeToNode } from 'Common/Translator'; 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 { ThemeStore } from 'Stores/Theme'; import { moveMessagesToFolder, dropFilesInFolder } from 'Common/Folders'; @@ -144,12 +144,17 @@ Object.assign(ko.bindingHandlers, { // Remove the Chrome visibility dragImage.style.cssText = ''; + + moveAction(true); } else { e.preventDefault(); } }, false); - element.addEventListener("dragend", () => dragData = null); + element.addEventListener("dragend", () => { + dragData = null; + moveAction(false); + }); } }, diff --git a/dev/Screen/User/MailBox.js b/dev/Screen/User/MailBox.js index ba3852c7b..f3e47823d 100644 --- a/dev/Screen/User/MailBox.js +++ b/dev/Screen/User/MailBox.js @@ -1,8 +1,8 @@ import { Scope } from 'Common/Enums'; 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 { setLayoutResizer } from 'Common/UtilsUser'; +import { setLayoutResizer, moveAction } from 'Common/UtilsUser'; import { getFolderFromCacheList, getFolderFullName, getFolderInboxName } from 'Common/Cache'; import { i18n, initOnStartOrLangChange } from 'Common/Translator'; import { SettingsUserStore } from 'Stores/User/Settings'; diff --git a/dev/View/User/MailBox/FolderList.js b/dev/View/User/MailBox/FolderList.js index ac10ada46..1c6b18572 100644 --- a/dev/View/User/MailBox/FolderList.js +++ b/dev/View/User/MailBox/FolderList.js @@ -1,7 +1,7 @@ import ko from 'ko'; import { Scope } from 'Common/Enums'; -import { moveAction, addShortcut } from 'Common/Globals'; +import { addShortcut } from 'Common/Globals'; import { mailBox, settings } from 'Common/Links'; //import { setFolderHash } from 'Common/Cache'; import { addComputablesTo } from 'External/ko'; @@ -15,7 +15,7 @@ import { MessagelistUserStore } from 'Stores/User/Messagelist'; import { showScreenPopup } from 'Knoin/Knoin'; import { AbstractViewLeft } from 'Knoin/AbstractViews'; -import { showMessageComposer } from 'Common/UtilsUser'; +import { showMessageComposer, moveAction } from 'Common/UtilsUser'; import { FolderCreatePopupView } from 'View/Popup/FolderCreate'; import { ContactsPopupView } from 'View/Popup/Contacts'; import { ComposePopupView } from 'View/Popup/Compose'; diff --git a/dev/View/User/MailBox/MessageList.js b/dev/View/User/MailBox/MessageList.js index 1ba1d4ee2..69fcbecce 100644 --- a/dev/View/User/MailBox/MessageList.js +++ b/dev/View/User/MailBox/MessageList.js @@ -5,13 +5,13 @@ import { Scope } from 'Common/Enums'; import { ComposeType, FolderType, MessageSetAction } from 'Common/EnumsUser'; -import { leftPanelDisabled, toggleLeftPanel, moveAction, +import { leftPanelDisabled, toggleLeftPanel, Settings, SettingsCapa, addEventsListeners, addShortcut, registerShortcut, formFieldFocused } 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 { isFullscreen, toggleFullscreen } from 'Common/Fullscreen'; diff --git a/dev/View/User/MailBox/MessageView.js b/dev/View/User/MailBox/MessageView.js index aca6556e9..5bd1910fe 100644 --- a/dev/View/User/MailBox/MessageView.js +++ b/dev/View/User/MailBox/MessageView.js @@ -15,7 +15,6 @@ import { elementById, leftPanelDisabled, keyScopeReal, - moveAction, Settings, SettingsCapa, fireEvent, @@ -24,7 +23,7 @@ import { } from 'Common/Globals'; 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 { SMAudio } from 'Common/Audio';