aboutsummaryrefslogtreecommitdiff
path: root/editor/prosemirror/prosemirror.mli
blob: 1e0e889cf474df00c00b26376d9792838cbb329c (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
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