Daniel 2024-04-08 10:49:47 +08:00
parent 8f566f251c
commit de0b64f8ca
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 15 additions and 1 deletions

View file

@ -1312,10 +1312,15 @@ func (tx *Transaction) commit() (err error) {
if err = writeJSONQueue(tree); nil != err {
return
}
var sources []interface{}
for _, op := range tx.DoOperations {
sources = append(sources, op.Action)
}
util.PushSaveDoc(tree.ID, "tx", sources)
}
refreshDynamicRefTexts(tx.nodes, tx.trees)
IncSync()
tx.trees = nil
tx.state.Store(2)
tx.m.Unlock()
return

View file

@ -220,6 +220,15 @@ func PushReloadDoc(rootID string) {
BroadcastByType("main", "reloaddoc", 0, "", rootID)
}
func PushSaveDoc(rootID, typ string, sources interface{}) {
data := map[string]interface{}{
"rootID": rootID,
"type": typ,
"sources": sources,
}
BroadcastByType("main", "savedoc", 0, "", data)
}
func PushProtyleReload(rootID string) {
BroadcastByType("protyle", "reload", 0, "", rootID)
}