From e78c236a8d28784370f192a3410693c456dc628f Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Thu, 2 Dec 2021 21:36:42 +0100 Subject: Added comment in editor event loop --- editor/editor.ml | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'editor/editor.ml') 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 -- cgit v1.2.3