From 210a4d94836d07bb71cad46b3e670c1977cfe833 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Sun, 21 Mar 2021 20:24:15 +0100 Subject: Updated PM examples --- editor/prosemirror/prosemirror.mli | 140 +++++++++++++++++++++++-------------- 1 file changed, 89 insertions(+), 51 deletions(-) (limited to 'editor/prosemirror/prosemirror.mli') diff --git a/editor/prosemirror/prosemirror.mli b/editor/prosemirror/prosemirror.mli index eac895a..76545d2 100755 --- a/editor/prosemirror/prosemirror.mli +++ b/editor/prosemirror/prosemirror.mli @@ -10,58 +10,9 @@ val v module O = Bindings.TypedObject -module rec Model : sig - - include module type of Bindings.Model - - val schema_spec: - node_spec Bindings.ordered_map Js.t - -> mark_spec Bindings.ordered_map Js.t option - -> string option - -> schema_spec Js.t - - val schema - : t -> schema_spec Js.t -> schema Js.t - - module DOMParser : sig - - type parser - - val from_schema - : t -> schema Js.t -> parser - - val parse - : parser -> El.t -> node Js.t - - end - - val empty_fragment - : t -> fragment Js.t - - module Dom_output_spec : sig - - val v - : ?attrs:< .. > -> string -> domOutputSpec Js.t list -> domOutputSpec Js.t - - (** Hole element inside an output_spec element *) - val hole - : domOutputSpec Js.t - - val of_el - : Brr.El.t -> domOutputSpec Js.t - - val of_jstr - : Jstr.t -> domOutputSpec Js.t - - val of_obj - : < dom: node Js.t Js.readonly_prop ; contentDOM : node Js.t Js.opt Js.readonly_prop > Js.t -> domOutputSpec Js.t - end - -end - (* State *) -and State : sig +module rec State : sig include module type of Bindings.State @@ -77,6 +28,9 @@ and State : sig val fromJSON : t -> configuration_prop Js.t -> Brr.Json.t -> editor_state Js.t + val selection_from + : selection Js.t -> Model.resolved_pos Js.t + val selection_to : selection Js.t -> Model.resolved_pos Js.t @@ -98,6 +52,9 @@ and State : sig val cursor : selection Js.t -> Model.resolved_pos Js.t Js.opt + val create_str_meta_data + : Jstr.t -> 'a meta_data Js.t + end (* Editor view *) @@ -120,6 +77,73 @@ and View : sig end +and Model : sig + + include module type of Bindings.Model + + val schema_spec: + node_spec Bindings.ordered_map Js.t + -> mark_spec Bindings.ordered_map Js.t option + -> string option + -> schema_spec Js.t + + val schema + : t -> schema_spec Js.t -> schema Js.t + + module DOMParser : sig + + type parser + + val from_schema + : t -> schema Js.t -> parser + + val parse + : parser -> El.t -> node Js.t + + end + + val empty_fragment + : t -> fragment Js.t + + module Dom_output_spec : sig + + val v + : ?attrs:< .. > -> string -> domOutputSpec Js.t list -> domOutputSpec Js.t + + (** Hole element inside an output_spec element *) + val hole + : domOutputSpec Js.t + + val of_el + : Brr.El.t -> domOutputSpec Js.t + + val of_jstr + : Jstr.t -> domOutputSpec Js.t + + val of_obj + : < dom: node Js.t Js.readonly_prop ; contentDOM : node Js.t Js.opt Js.readonly_prop > Js.t -> domOutputSpec Js.t + end + + module ParseRule : sig + + val tag: Jstr.t -> parse_rule Js.t + + end + +end + +and Transform : sig + + include module type of Bindings.Transform + + val offset + : t -> int -> step_map Js.t + + val insertPoint + : t -> Model.node Js.t -> pos:int -> Model.node_type Js.t -> int Js.opt + +end + module Commands : sig type t = State.editor_state Js.t -> State.dispatch Js.opt -> bool Js.t @@ -190,6 +214,17 @@ module SchemaList : sig end +module Menu : sig + + include module type of Bindings.Menu + + val menuItemSpec + : unit -> menuItemSpec Js.t + + val menu_item + : t -> menuItemSpec Js.t -> menuItem Js.t +end + (* Example Setup *) module Example : sig @@ -201,4 +236,7 @@ module Example : sig val example_setup : t -> options Js.t -> State.plugin Js.t Js.js_array Js.t -end + + val buildMenuItems + : t -> Model.schema Js.t -> menuItems Js.t +end -- cgit v1.2.3