File tree 1 file changed +9
-1
lines changed
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,7 @@ module AttributeActions = struct
89
89
Brr.Console. (log [ body ]);
90
90
let args = Jv.Function. [ (" slip" , Fun. id) ] in
91
91
let f = Jv.Function. v ~body ~args in
92
+ let undos_ref = ref [] in
92
93
let arg =
93
94
Jv. obj
94
95
[|
@@ -106,12 +107,19 @@ module AttributeActions = struct
106
107
| None -> Brr.El. remove_inline_style style elem
107
108
| Some old_value -> Brr.El. set_inline_style style old_value elem
108
109
in
110
+ undos_ref := undo :: ! undos_ref;
109
111
Jv. callback ~arity: 1 undo );
110
112
| ]
111
113
in
112
114
let u = f arg in
113
115
let undo () =
114
- Fut. return @@ try ignore @@ Jv. call u " undo" [||] with _ -> ()
116
+ try Fut. return (ignore @@ Jv. call u " undo" [||])
117
+ with _ ->
118
+ List. fold_left
119
+ (fun acc f ->
120
+ let * () = acc in
121
+ f () )
122
+ (Fut. return () ) ! undos_ref
115
123
in
116
124
Undoable. return ~undo ()
117
125
in
You can’t perform that action at this time.
0 commit comments