From d17d17261faccb3eb42e91f88ca035e5b1730c66 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Sun, 31 Jan 2021 04:21:01 +0100 Subject: Bindings to prosemirror --- editor/prosemirror/prosemirror.mli | 145 +++++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100755 editor/prosemirror/prosemirror.mli (limited to 'editor/prosemirror/prosemirror.mli') diff --git a/editor/prosemirror/prosemirror.mli b/editor/prosemirror/prosemirror.mli new file mode 100755 index 0000000..1e0e889 --- /dev/null +++ b/editor/prosemirror/prosemirror.mli @@ -0,0 +1,145 @@ +open Js_of_ocaml +open Brr + +type t + +val v + : unit -> t + +type schema_list + +type pm_schema + +type pm_state + +type pm_view + +type pm_model + +type pm_transform + +val state + : (t, pm_state) J.prop + +val view + : (t, pm_view) J.prop + +val model + : (t, pm_model) J.prop + +type schema + +val schema_basic + : (t, Jv.t) J.prop + +val schema_list + : (t, schema_list) J.prop + + +val transform + : (t, pm_transform) J.prop + + +module rec Model : sig + + include module type of Bindings.Model + + + module DOMParser : sig + type t + + val from_schema + : pm_model -> schema Js.t -> t + + val parse + : t -> El.t -> node Js.t + + end + + val empty_fragment + : t -> fragment Js.t + +end + +and SchemaList : sig + + val add_list_nodes + : schema_list -> ?listGroup:string -> node:Model.node Js.t -> itemContent:string -> unit + +end + +(* State *) + +and State : sig + + include module type of Bindings.State + + val configuration_prop + : unit -> configuration_prop Js.t + + val creation_prop + : unit -> creation_prop Js.t + + val create + : pm_state -> creation_prop Js.t -> editor_state Js.t + + val fromJSON + : pm_state -> configuration_prop Js.t -> Brr.Json.t -> editor_state Js.t + +end + +(* Editor view *) + +and View : sig + + module EditorProps : sig + + type t + + end + + include module type of Bindings.View + + val direct_editor_props + : unit -> direct_editor_props Js.t + + val editor_view + : pm_view -> El.t -> direct_editor_props Js.t -> editor_view Js.t + +end + +module History : sig + + include module type of Bindings.History + + val history_prop + : unit -> history_prop Js.t + + val history + : t -> history_prop Js.t -> State.plugin Js.t + + val undo + : t -> State.editor_state Js.t -> (State.transaction -> unit) -> bool + + val redo + : t -> State.editor_state Js.t -> (State.transaction -> unit) -> bool +end + +module Keymap : sig + + val keymap + : t -> (string * (State.editor_state Js.t -> (State.transaction -> unit) -> bool)) array -> State.plugin Js.t + +end + +module Commands : sig + + val baseKeymap + : t -> (string * (State.editor_state Js.t -> (State.transaction -> unit) -> bool)) array + +end + +(* Example Setup *) + +val example_setup + : t -> Model.schema Js.t -> State.plugin Js.t Js.js_array Js.t -- cgit v1.2.3