summaryrefslogtreecommitdiff
path: root/editor/editor.ml
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@dailly.me>2021-12-02 21:36:42 +0100
committerSébastien Dailly <sebastien@dailly.me>2022-02-07 16:43:33 +0100
commite78c236a8d28784370f192a3410693c456dc628f (patch)
tree3898c5d140f7900a983d814cb9d29b7da9db9b09 /editor/editor.ml
parentf30e3eeb06bb932e6735868d404926cc7a9cd8aa (diff)
Added comment in editor event loop
Diffstat (limited to 'editor/editor.ml')
-rwxr-xr-xeditor/editor.ml11
1 files changed, 11 insertions, 0 deletions
diff --git a/editor/editor.ml b/editor/editor.ml
index 5883ec8..2441265 100755
--- a/editor/editor.ml
+++ b/editor/editor.ml
@@ -131,8 +131,14 @@ let app id content =
let init_state = State.init pm view last_backup page_id in
+ (* Initialize the buttons actions and get the associated events.
+ At this point, the HTML element is not yet created, and cannot be
+ inserted in the document.
+ *)
let side_elements = Editor_actions.build pm in
let btn_events = Editor_actions.get_event side_elements in
+
+ (* Create the main event loop with all the collected events *)
let app_state = State.run
~eq:State.eq
init_state
@@ -146,7 +152,12 @@ let app id content =
; btn_events
]) in
+ (* Get the html element associated with the buttons, and add it in the
+ page.
+ The state event is already created, and can be given in the html
+ creation in order to update the elements when the state change.
+ *)
let childs = Editor_actions.complete side_elements app_state in
let () = El.append_children sidebar childs in
let _ = Note.(Logr.hold (S.log app_state (fun _ -> ()))) in