|
@@ -17,6 +17,7 @@
|
|
package model
|
|
package model
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
+ "github.com/88250/lute/parse"
|
|
"os"
|
|
"os"
|
|
"path/filepath"
|
|
"path/filepath"
|
|
"sync"
|
|
"sync"
|
|
@@ -62,6 +63,17 @@ func RemoveRecentDoc(ids []string) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func SetRecentDocByTree(tree *parse.Tree) {
|
|
|
|
+ recentDoc := &RecentDoc{
|
|
|
|
+ RootID: tree.Root.ID,
|
|
|
|
+ Icon: tree.Root.IALAttr("icon"),
|
|
|
|
+ Title: tree.Root.IALAttr("title"),
|
|
|
|
+ ScrollAttr: tree.Root.IALAttr("scroll"),
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ SetRecentDoc(recentDoc)
|
|
|
|
+}
|
|
|
|
+
|
|
func SetRecentDoc(doc *RecentDoc) (err error) {
|
|
func SetRecentDoc(doc *RecentDoc) (err error) {
|
|
recentDocLock.Lock()
|
|
recentDocLock.Lock()
|
|
defer recentDocLock.Unlock()
|
|
defer recentDocLock.Unlock()
|