refactor(重构提升): 完善水印接口与编辑稳定性
build.yaml / build (push) Successful in 43s

This commit is contained in:
xiaoqidun committed 2026-09-29 23:47:50 +08:00
1 parent accd0a2973
commit fef7e75920
8 files changed
+266 -143

No files matched your search

+7 -1
View File
@@ -37,8 +37,13 @@ func (e *Editor) Transaction(edit func(*Editor) error) error {
next := e.transactionSnapshot()
next.history, next.historyIndex, next.historyLimit = nil, 0, 0
*e = next
committed := false
defer func() {
if !committed {
*e = before
}
}()
if err := edit(e); err != nil {
*e = before
return err
}
changed := e.revision != before.revision
@@ -54,6 +59,7 @@ func (e *Editor) Transaction(edit func(*Editor) error) error {
change.redo = func(e *Editor) { e.restoreTransaction(after) }
}
}
committed = true
return nil
}