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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user