1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-06-15 15:45:20 -04:00

feat(Notepad): Complete refactor - New popout mode & settings

- Add a full popout Notepad experience w/new layout settings
- New ability to choose the left or right side of the screen
- Add more safegaurds to preserve user data throughout
- New banner to show file reload/conflict handling
- New extensionless file support
- Polish settings with gap controls, compact buttons, and shortcuts help
This commit is contained in:
purian23
2026-06-14 20:20:36 -04:00
parent 9d1a81c93c
commit db56c8d74d
13 changed files with 1301 additions and 303 deletions
@@ -23,6 +23,49 @@ Singleton {
property var tabsBeingCreated: ({})
property bool metadataLoaded: false
// Shared live edit state across slideout and popout surfaces.
property var sessionBuffers: ({})
property int sessionBufferRevision: 0
function setSessionBuffer(tabId, content, baseline) {
if (tabId === undefined || tabId === null || tabId < 0)
return
var next = Object.assign({}, sessionBuffers)
if (content !== baseline) {
next[tabId] = { content: content, baseline: baseline }
} else {
delete next[tabId]
}
sessionBuffers = next
sessionBufferRevision++
}
function getSessionBuffer(tabId) {
return sessionBuffers[tabId]
}
function clearSessionBuffer(tabId) {
if (sessionBuffers[tabId] === undefined)
return
var next = Object.assign({}, sessionBuffers)
delete next[tabId]
sessionBuffers = next
sessionBufferRevision++
}
property var conflictTabId: -1
property string conflictDiskContent: ""
function flagConflict(tabId, diskContent) {
conflictDiskContent = diskContent
conflictTabId = tabId
}
function clearConflict() {
conflictTabId = -1
conflictDiskContent = ""
}
Component.onCompleted: {
ensureDirectories()
}
@@ -209,6 +252,10 @@ Singleton {
if (tabIndex < 0 || tabIndex >= tabs.length) return
var newTabs = tabs.slice()
var closedTabId = newTabs[tabIndex] ? newTabs[tabIndex].id : -1
clearSessionBuffer(closedTabId)
if (conflictTabId === closedTabId)
clearConflict()
if (newTabs.length <= 1) {
var id = Date.now()
+45 -1
View File
@@ -789,21 +789,65 @@ Singleton {
networkInfoModal?.close();
}
function openNotepad() {
function openNotepadSlideout() {
if (notepadSlideouts.length > 0) {
notepadSlideouts[0]?.show();
}
}
function openNotepad() {
if (SettingsData.notepadDefaultMode === "popout") {
openNotepadPopout();
return;
}
openNotepadSlideout();
}
function closeNotepad() {
if (SettingsData.notepadDefaultMode === "popout") {
notepadPopout?.hide();
return;
}
if (notepadSlideouts.length > 0) {
notepadSlideouts[0]?.hide();
}
}
function toggleNotepad() {
if (SettingsData.notepadDefaultMode === "popout") {
toggleNotepadPopout();
return;
}
if (notepadSlideouts.length > 0) {
notepadSlideouts[0]?.toggle();
}
}
property var notepadPopout: null
property var notepadPopoutLoader: null
property bool _notepadPopoutWantsOpen: false
function openNotepadPopout() {
if (notepadPopout) {
notepadPopout.show();
} else if (notepadPopoutLoader) {
_notepadPopoutWantsOpen = true;
notepadPopoutLoader.active = true;
}
}
function _onNotepadPopoutLoaded() {
if (_notepadPopoutWantsOpen && notepadPopout) {
_notepadPopoutWantsOpen = false;
notepadPopout.show();
}
}
function toggleNotepadPopout() {
if (notepadPopout) {
notepadPopout.toggle();
} else {
openNotepadPopout();
}
}
}