mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-04 04:42:05 -04:00
refactor(Notepad): Streamline hide behavior & auto-save function
This commit is contained in:
@@ -21,6 +21,7 @@ Item {
|
||||
property var currentTab: NotepadStorageService.tabs.length > NotepadStorageService.currentTabIndex ? NotepadStorageService.tabs[NotepadStorageService.currentTabIndex] : null
|
||||
property bool showSettingsMenu: false
|
||||
property string pendingSaveContent: ""
|
||||
property var slideout: null
|
||||
|
||||
signal hideRequested
|
||||
signal previewRequested(string content)
|
||||
@@ -29,6 +30,14 @@ Item {
|
||||
service: NotepadStorageService
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: slideout
|
||||
enabled: slideout !== null
|
||||
function onAboutToHide() {
|
||||
textEditor.autoSaveToSession()
|
||||
}
|
||||
}
|
||||
|
||||
function hasUnsavedChanges() {
|
||||
return textEditor.hasUnsavedChanges();
|
||||
}
|
||||
@@ -204,7 +213,8 @@ Item {
|
||||
}
|
||||
|
||||
onEscapePressed: {
|
||||
root.hideRequested();
|
||||
textEditor.autoSaveToSession()
|
||||
root.hideRequested()
|
||||
}
|
||||
|
||||
onSettingsRequested: {
|
||||
|
||||
@@ -555,7 +555,9 @@ Column {
|
||||
})
|
||||
}
|
||||
function onTabsChanged() {
|
||||
if (NotepadStorageService.tabs.length > 0 && !contentLoaded) {/* Lines 444-445 omitted */}
|
||||
if (NotepadStorageService.tabs.length > 0 && !contentLoaded) {
|
||||
loadCurrentTabContent()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user