summaryrefslogtreecommitdiff
path: root/editor/actions/export.ml
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@dailly.me>2022-02-07 16:40:45 +0100
committerSébastien Dailly <sebastien@dailly.me>2022-02-07 16:43:33 +0100
commit8d23a029c57be92a7aed0f18d9fcf1c931c1038e (patch)
tree5bce8907c420b171de9f49679045723aad03e247 /editor/actions/export.ml
parent6f1b152a6927171b0c0bfed207307ed1bac1900d (diff)
Reformat
Diffstat (limited to 'editor/actions/export.ml')
-rwxr-xr-xeditor/actions/export.ml50
1 files changed, 23 insertions, 27 deletions
diff --git a/editor/actions/export.ml b/editor/actions/export.ml
index 27c6a26..3c70bd3 100755
--- a/editor/actions/export.ml
+++ b/editor/actions/export.ml
@@ -2,35 +2,31 @@ module Js = Js_of_ocaml.Js
module App = Editor_app
module M = struct
-
type t = unit
- let process
- : t -> State.t -> State.t
- = fun _ state ->
-
- (* Save this as a json element. The text may contains UTF-16 characters,
- which will raise an error in the btoa function.
-
- As an easy solution, we convert them into UTF-8 through the native
- OCaml representation of string.
- *)
- let json = State.Storage.to_json ()
- |> Jstr.to_string (* Encode into UTF-8 *)
- |> Obj.magic (* Then type the element again as a string. *)
- in
- Elements.Transfert.send
- ~mime_type:(Jstr.v "application/json")
- ~filename:(Jstr.v "export.json")
- json;
-
- (* The function does not actually update the state, and return it
- unchanged *)
- state
-
+ let process : t -> State.t -> State.t =
+ fun _ state ->
+ (* Save this as a json element. The text may contains UTF-16 characters,
+ which will raise an error in the btoa function.
+
+ As an easy solution, we convert them into UTF-8 through the native
+ OCaml representation of string.
+ *)
+ let json =
+ State.Storage.to_json ()
+ |> Jstr.to_string (* Encode into UTF-8 *)
+ |> Obj.magic
+ (* Then type the element again as a string. *)
+ in
+ Elements.Transfert.send
+ ~mime_type:(Jstr.v "application/json")
+ ~filename:(Jstr.v "export.json")
+ json;
+
+ (* The function does not actually update the state, and return it
+ unchanged *)
+ state
end
(** Create a new element *)
-let create
- : unit -> App.event
- = fun () -> App.dispatch (module M) ()
+let create : unit -> App.event = fun () -> App.dispatch (module M) ()