Fix: убрана binding text: pane.editorContent из TextArea — только явное присвоение через loadContent() (onDocIndexChanged + Timer 50ms + Connections.activeIndexChanged). Календарь: cal.currentMonth как явная зависимость в hasNote.
This commit is contained in:
+18
-13
@@ -224,7 +224,6 @@ Item {
|
||||
id: editor
|
||||
anchors.fill: parent
|
||||
visible: pane.editMode
|
||||
text: pane.editorContent
|
||||
onTextEdited: documentManager.updateContent(pane.docIndex, text)
|
||||
selectByMouse: true
|
||||
font.family: "Menlo, Consolas, 'DejaVu Sans Mono', monospace"
|
||||
@@ -251,6 +250,17 @@ Item {
|
||||
}
|
||||
|
||||
// ---------- Просмотр (режим просмотра) ----------
|
||||
function loadContent() {
|
||||
if (pane.docIndex >= 0) {
|
||||
const c = documentManager.contentAt(pane.docIndex)
|
||||
editor.text = c
|
||||
pane.editorContent = c
|
||||
console.log("loadContent docIndex=" + pane.docIndex + " len=" + c.length)
|
||||
} else {
|
||||
editor.text = ""
|
||||
pane.editorContent = ""
|
||||
}
|
||||
}
|
||||
function pathDir(p) {
|
||||
const idx = p.lastIndexOf("/")
|
||||
return idx >= 0 ? p.substring(0, idx) : p
|
||||
@@ -304,9 +314,12 @@ Item {
|
||||
// Просмотр обновляется при изменении контента
|
||||
Connections {
|
||||
target: documentManager
|
||||
function onActiveIndexChanged() {
|
||||
pane.loadContent()
|
||||
}
|
||||
function onContentChanged(i) {
|
||||
if (i === pane.docIndex) {
|
||||
pane.editorContent = documentManager.contentAt(i)
|
||||
pane.loadContent()
|
||||
if (!pane.editMode)
|
||||
pane.renderView()
|
||||
}
|
||||
@@ -316,22 +329,14 @@ Item {
|
||||
onDocIndexChanged: {
|
||||
pane.refreshHeader()
|
||||
pane.renderView()
|
||||
pane.loadContent()
|
||||
loadTimer.start()
|
||||
}
|
||||
|
||||
// Таймер для надёжной загрузки контента (обходит тайминг layout/QML)
|
||||
Timer {
|
||||
id: loadTimer
|
||||
interval: 30
|
||||
onTriggered: {
|
||||
if (pane.docIndex >= 0) {
|
||||
pane.editorContent = documentManager.contentAt(pane.docIndex)
|
||||
if (pane.editMode)
|
||||
editor.forceActiveFocus()
|
||||
} else {
|
||||
pane.editorContent = ""
|
||||
}
|
||||
}
|
||||
interval: 50
|
||||
onTriggered: pane.loadContent()
|
||||
}
|
||||
onEditModeChanged: {
|
||||
if (!pane.editMode)
|
||||
|
||||
Reference in New Issue
Block a user