aboutsummaryrefslogtreecommitdiff
path: root/editor/actions/editor_actions.ml
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@dailly.me>2022-02-07 14:58:00 +0100
committerSébastien Dailly <sebastien@dailly.me>2022-02-07 16:43:33 +0100
commitcee939ada70967b70fe92ca24b3428cc8c8b7c38 (patch)
treecb8df06a6d93c94c221eb2209dee048d04df4bd5 /editor/actions/editor_actions.ml
parenta6e30a95b5dcd34fb9e65d9a26f0844ec75bb004 (diff)
Update editor
Diffstat (limited to 'editor/actions/editor_actions.ml')
-rwxr-xr-xeditor/actions/editor_actions.ml37
1 files changed, 16 insertions, 21 deletions
diff --git a/editor/actions/editor_actions.ml b/editor/actions/editor_actions.ml
index 5b2a3d3..91d2a24 100755
--- a/editor/actions/editor_actions.ml
+++ b/editor/actions/editor_actions.ml
@@ -4,7 +4,7 @@ open Brr_note
module Js = Js_of_ocaml.Js
-(** This is the attribute attached to each link in which containing the node id
+(** This is the attribute attached to each link and containing the node id
pointed by the link. *)
let note_id_attribute = Jstr.v "data-note-id"
@@ -47,8 +47,7 @@ let build
[]
~at:At.[ class' (Jstr.v "fa")
; class' (Jstr.v "fa-2x")
- ; class' (Jstr.v "fa-download") ]
- ]
+ ; class' (Jstr.v "fa-download") ] ]
and load_button = El.button
~at:At.[class' (Jstr.v "action-button")]
@@ -56,8 +55,7 @@ let build
[]
~at:At.[ class' (Jstr.v "fa")
; class' (Jstr.v "fa-2x")
- ; class' (Jstr.v "fa-upload") ]
- ]
+ ; class' (Jstr.v "fa-upload") ] ]
in
(* We are waiting for event inside another event ( form validation inside
@@ -139,8 +137,7 @@ let build
; class' (Jstr.v "fa-cog") ]
]
; El.hr ()
- ; ul
- ] in
+ ; ul ] in
let result_event =
Note.E.select
@@ -148,15 +145,13 @@ let build
; redirect_event
; add_event
; export_event
- ; import_event
- ] in
+ ; import_event ] in
{ ev = result_event
; childs
; ul
; delete_button
- ; completed = false
- }
+ ; completed = false }
let get_event
: t -> State.event Note.event
@@ -178,19 +173,19 @@ let get_notes _ =
let complete
: t -> State.t Note.signal -> El.t list
- = fun ({ childs; ul ; completed ; delete_button ; _ } as t) change ->
+ = fun t change ->
+ (* As we register some events, we have to prevent many execution of this
+ function *)
let () =
- if completed then
+ if t.completed then
raise (Failure "The action panel is already registered") in
-
- let note_list =
- Note.S.map get_notes
- change
- in
t.completed <- true;
- Elr.def_children ul note_list;
+ Elr.def_children
+ t.ul
+ (Note.S.map get_notes change);
+
Elr.def_at
(Jstr.v "disabled")
(Note.S.map
@@ -199,6 +194,6 @@ let complete
| None -> Some Jstr.empty
| Some _ -> None)
change)
- delete_button;
+ t.delete_button;
- childs
+ t.childs