Фикс: таймер загрузки контента (30ms debounce для editorContent), точки календаря — привязка к cal.currentMonth для корректного обновления при смене месяца

This commit is contained in:
Flora (opencode)
2026-08-17 16:15:39 +03:00
parent 84be13a32d
commit 3290727d88
2 changed files with 17 additions and 6 deletions
+15 -6
View File
@@ -316,12 +316,21 @@ Item {
onDocIndexChanged: { onDocIndexChanged: {
pane.refreshHeader() pane.refreshHeader()
pane.renderView() pane.renderView()
if (pane.docIndex >= 0) { loadTimer.start()
pane.editorContent = documentManager.contentAt(pane.docIndex) }
if (pane.editMode)
editor.forceActiveFocus() // Таймер для надёжной загрузки контента (обходит тайминг layout/QML)
} else { Timer {
pane.editorContent = "" id: loadTimer
interval: 30
onTriggered: {
if (pane.docIndex >= 0) {
pane.editorContent = documentManager.contentAt(pane.docIndex)
if (pane.editMode)
editor.forceActiveFocus()
} else {
pane.editorContent = ""
}
} }
} }
onEditModeChanged: { onEditModeChanged: {
+2
View File
@@ -90,6 +90,8 @@ Item {
// Проверяем, есть ли заметка за этот день // Проверяем, есть ли заметка за этот день
readonly property bool hasNote: { readonly property bool hasNote: {
// Явная зависимость от currentMonth — пересчитываем при смене месяца
const _ = cal.currentMonth
if (modelData <= 0 || !fileStore.ready) return false if (modelData <= 0 || !fileStore.ready) return false
const ds = Qt.formatDate(new Date(cal.year, cal.month, modelData), "yyyy-MM-dd") const ds = Qt.formatDate(new Date(cal.year, cal.month, modelData), "yyyy-MM-dd")
return fileStore.fileExists(fileStore.vault + "/Журнал/" + ds + ".md") return fileStore.fileExists(fileStore.vault + "/Журнал/" + ds + ".md")