aboutsummaryrefslogtreecommitdiff
path: root/editor/prosemirror/bindings.ml
diff options
context:
space:
mode:
Diffstat (limited to 'editor/prosemirror/bindings.ml')
-rwxr-xr-xeditor/prosemirror/bindings.ml376
1 files changed, 376 insertions, 0 deletions
diff --git a/editor/prosemirror/bindings.ml b/editor/prosemirror/bindings.ml
new file mode 100755
index 0000000..d2ef2e6
--- /dev/null
+++ b/editor/prosemirror/bindings.ml
@@ -0,0 +1,376 @@
+open Js_of_ocaml.Js
+
+module Model = struct
+
+ type mark
+
+ type schema
+
+ type content_match
+
+ type node_spec
+
+ type slice
+
+ class type _node_props = object ('this)
+
+ method inlineContent:
+ bool readonly_prop
+ (** True if this node type has inline content. *)
+
+ method isBlock:
+ bool readonly_prop
+
+ method isText:
+ bool readonly_prop
+
+ method isInline:
+ bool readonly_prop
+
+ method isTextblock:
+ bool readonly_prop
+
+ method isLeaf:
+ bool readonly_prop
+
+ method isAtom:
+ bool readonly_prop
+
+ end
+
+ class type node_type = object ('this)
+
+ inherit _node_props
+
+ method name:
+ string readonly_prop
+
+ method schema:
+ schema t readonly_prop
+
+ method spec:
+ node_spec t readonly_prop
+
+ method contentMatch:
+ content_match t readonly_prop
+
+ method hasRequiredAttrs:
+ unit -> bool meth
+
+ end
+
+ class type mark_type = object ('this)
+ end
+
+ (** Common signature between fragment and node *)
+ class type _element = object ('this)
+
+ method childCount:
+ int readonly_prop
+ (** The number of children that the node has. *)
+
+ method child:
+ int -> node t meth
+ (** Get the child node at the given index. Raise an error when the index
+ is out of range. *)
+
+ method maybeChild:
+ int -> node t opt meth
+ (** Get the child node at the given index, if it exists. *)
+
+ method eq:
+ 'this t -> bool meth
+ (** Compare this element to another one. *)
+
+ method cut:
+ int -> int opt -> 'this meth
+ (** Cut out the element between the two given positions. *)
+
+ method toString:
+ unit -> Jstr.t meth
+ (** Return a debugging string that describes this element. *)
+
+ method forEach:
+ (node t -> int -> int) -> unit meth
+
+ end
+
+ and fragment = object ('this)
+
+ inherit _element
+
+ method size:
+ int readonly_prop
+ (** The size of the fragment, which is the total of the size of its
+ content nodes. *)
+
+ method append:
+ 'this t -> 'this t meth
+
+ method lastChild:
+ node t opt readonly_prop
+
+ method firstChild:
+ node t opt readonly_prop
+
+ end
+
+ and node = object ('this)
+
+ inherit _element
+
+ inherit _node_props
+
+ method _type:
+ node_type t readonly_prop
+
+ method attrs:
+ < .. > t readonly_prop
+
+ method content:
+ fragment t readonly_prop
+
+ method marks:
+ mark t js_array t readonly_prop
+
+ method sameMarkupd:
+ node t -> bool meth
+ end
+
+end
+
+module Transform = struct
+
+ type step_result
+
+ class type step = object ('this)
+
+ end
+
+ class type replace_step = object ('this)
+
+ inherit step
+
+ end
+
+ class type replace_around_step = object ('this)
+
+ inherit step
+
+ end
+
+ class type add_mark_step = object ('this)
+
+ inherit step
+
+ end
+
+
+ class type transform = object ('this)
+
+ method doc:
+ Model.node t readonly_prop
+
+ method steps:
+ step t js_array t readonly_prop
+
+ method docs:
+ Model.node t js_array t readonly_prop
+
+ method step:
+ step t -> 'this t meth
+
+ end
+
+end
+
+(**
+
+ The class is defined outside of the module View for prevent recursive
+ declaration.
+
+*)
+class type _editor_props = object ('this)
+
+end
+
+
+module State = struct
+
+ class type plugin = object ('this)
+
+ method props : _editor_props t readonly_prop
+
+ end
+
+ class type selection = object ('this)
+
+ method content:
+ unit -> Model.slice t meth
+
+ method replace:
+ transaction t -> Model.slice t -> unit meth
+
+ end
+
+ and transaction = object ('this)
+
+ inherit Transform.transform
+
+ method time:
+ int readonly_prop
+
+ method setTime:
+ int -> 'this t meth
+
+ method storedMarks:
+ Model.mark t js_array t opt readonly_prop
+
+ method setStoredMarks:
+ Model.mark t js_array t opt -> 'this t meth
+
+ method addStoredMark:
+ Model.mark t -> 'this t meth
+
+ method removeStoredMark_mark:
+ Model.mark t -> 'this t meth
+
+ method removeStoredMark_marktype:
+ Model.mark_type t -> 'this t meth
+
+ method ensureMarks:
+ Model.mark t js_array t -> 'this t meth
+
+ method storedMarksSet:
+ bool readonly_prop
+
+ method selection:
+ selection t readonly_prop
+
+ method setSelection:
+ selection t -> 'this t meth
+
+ method deleteSelection:
+ 'this t meth
+
+ method replaceSelection:
+ Model.slice t -> 'this t meth
+
+ method selectionSet:
+ bool readonly_prop
+
+ method before:
+ Model.node t readonly_prop
+
+ end
+
+ class type configuration_prop = object ('this)
+
+ method schema:
+ Model.schema t opt prop
+
+ method plugins:
+ plugin t js_array t opt prop
+
+ end
+
+ class type creation_prop = object ('this)
+
+ inherit configuration_prop
+
+ method doc:
+ Model.node t opt prop
+
+ method selection:
+ selection t opt prop
+
+ method storedMarks:
+ Model.mark t js_array t opt prop
+
+ end
+
+ class type editor_state = object ('this)
+
+ method doc :
+ Model.node t readonly_prop
+
+ method selection:
+ selection t readonly_prop
+
+ method storedMarks:
+ Model.mark t js_array t opt readonly_prop
+
+ method schema:
+ Model.schema t readonly_prop
+
+ method plugins:
+ plugin t js_array t readonly_prop
+
+ method apply:
+ transaction t -> 'this t meth
+
+ method tr:
+ transaction t readonly_prop
+
+ method reconfigure:
+ configuration_prop t meth
+
+ method toJSON:
+ unit -> Brr.Json.t meth
+
+ end
+
+end
+
+module View = struct
+
+ class type editor_props = _editor_props
+
+ class type direct_editor_props = object ('this)
+
+ inherit editor_props
+
+ method state:
+ State.editor_state t writeonly_prop
+
+ (** The call back is called with this = instance of editor_view *)
+ method dispatchTransaction:
+ (editor_view t, State.transaction t -> unit) meth_callback writeonly_prop
+
+ end
+
+ and editor_view = object ('this)
+
+ method state:
+ State.editor_state t readonly_prop
+
+ method dom:
+ Brr.El.t readonly_prop prop
+
+ method editable:
+ bool readonly_prop prop
+
+ method update:
+ direct_editor_props t -> unit meth
+
+ method setProps:
+ direct_editor_props t -> unit meth
+
+ method updateState:
+ State.editor_state t -> unit meth
+
+ end
+
+end
+
+module History = struct
+
+ class type history_prop = object ('this)
+
+ method depth: int opt prop
+
+ method newGroupDelay: int opt prop
+
+ end
+
+end