feat(office): scrollable panes, nav tree drill-down, and item actions
Add viewports to all three columns with cursor sync scrolling. Support Shift+Tab reverse pane focus. Replace flat menu with hierarchical NavTree (list loads only on leaf nodes; dynamic project subnodes with Tasks/Files). Enter or a opens per-item action menu (view, delete, download) wired to the OnlyOffice API. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package model
|
||||
|
||||
import "strings"
|
||||
|
||||
// InjectProjectNodes adds dynamic project branches under projects.dynamic.
|
||||
func (t *NavTree) InjectProjectNodes(projects []Item) {
|
||||
// Drop prior dynamic project.* nodes.
|
||||
for id := range t.nodes {
|
||||
if strings.HasPrefix(id, "project.") {
|
||||
delete(t.nodes, id)
|
||||
}
|
||||
}
|
||||
t.children["projects.dynamic"] = nil
|
||||
for _, p := range projects {
|
||||
pid := "project." + p.ID
|
||||
t.nodes[pid] = NavNode{ID: pid, Label: p.Title, Branch: true, ParentID: "projects.dynamic"}
|
||||
t.children["projects.dynamic"] = append(t.children["projects.dynamic"], pid)
|
||||
taskID := pid + ".tasks"
|
||||
fileID := pid + ".files"
|
||||
t.nodes[taskID] = NavNode{
|
||||
ID: taskID, Label: "Tasks", Branch: false, ParentID: pid,
|
||||
List: &ListSpec{Subject: SubjectTasks, ProjectID: p.ID},
|
||||
}
|
||||
t.nodes[fileID] = NavNode{
|
||||
ID: fileID, Label: "Files", Branch: false, ParentID: pid,
|
||||
List: &ListSpec{Subject: SubjectProjectFiles, ProjectID: p.ID},
|
||||
}
|
||||
t.children[pid] = []string{taskID, fileID}
|
||||
}
|
||||
t.rebuildVisible()
|
||||
}
|
||||
Reference in New Issue
Block a user