blob: cb0c16dc33ab7fa6a258f574d3cbdcc1393b9d90 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
module Js = Js_of_ocaml.Js
module M = struct
type t = Forms.Selector.t
let update
: t -> State.t -> State.t
= fun t state ->
match t with
| None -> state
| Some file ->
(* Back to UTF-16 *)
let content = file.Elements.Input.content in
Brr.Console.(log [content] );
match State.Storage.of_json content with
| Error _ -> state
| Ok _obj ->
State.load_page state.State.page_id state
end
let create () =
let title = Jstr.v "Importer des notes" in
let ev = Elements.Popup.create
~title
~form:(Some (Forms.Selector.create ())) in
Note.E.map
(fun v -> State.E
( v
, (module M : State.Event with type t = M.t )))
(Note.E.Option.on_some ev)
|