aboutsummaryrefslogtreecommitdiff
path: root/editor/prosemirror
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@chimrod.com>2021-04-08 20:27:36 +0200
committerSébastien Dailly <sebastien@dailly.me>2022-02-07 16:43:33 +0100
commit7d83ee3912582d3435d5a7c5fe4cb8a21617425b (patch)
tree39d374dfa22c7f4092226082c9d1260462cb8a88 /editor/prosemirror
parent210a4d94836d07bb71cad46b3e670c1977cfe833 (diff)
Added custom link popin in text editor
Diffstat (limited to 'editor/prosemirror')
-rwxr-xr-xeditor/prosemirror/bindings.ml37
-rwxr-xr-xeditor/prosemirror/prosemirror.ml18
-rwxr-xr-xeditor/prosemirror/prosemirror.mli7
3 files changed, 54 insertions, 8 deletions
diff --git a/editor/prosemirror/bindings.ml b/editor/prosemirror/bindings.ml
index 1711829..49c0904 100755
--- a/editor/prosemirror/bindings.ml
+++ b/editor/prosemirror/bindings.ml
@@ -116,11 +116,14 @@ module Classes = struct
class type mark = object ('this)
- method eq
- : 'this t -> bool t meth
+ method attrs
+ : 'a TypedObject.t prop
method isInSet
- : mark t js_array t -> mark t opt meth
+ : mark t js_array t -> bool t meth
+
+ method eq
+ : 'this t -> bool t meth
end
@@ -142,7 +145,7 @@ module Classes = struct
: bool t opt prop
method attrs
- : < .. > t opt prop
+ : 'a TypedObject.t prop
method selectable
: bool t opt prop
@@ -190,6 +193,12 @@ module Classes = struct
method index
: depth -> int meth
+ method start
+ : depth -> int meth
+
+ method _end
+ : depth -> int meth
+
method after
: depth -> int meth
@@ -258,8 +267,8 @@ module Classes = struct
method node:
Jstr.t -> < .. > t opt -> fragment t opt -> mark t js_array t opt -> node t meth
- method mark_type:
- mark_type t -> < .. > t opt -> mark t meth
+ method mark_fromType:
+ mark_type t -> 'a TypedObject.t opt -> mark t meth
end
@@ -335,8 +344,11 @@ module Classes = struct
unit -> Jstr.t meth
(** Return a debugging string that describes this element. *)
- method forEach:
- (node t -> int -> int) -> unit meth
+ method descendants
+ : (node t -> pos:int -> node t -> bool t) callback -> unit meth
+
+ method forEach
+ : (node t -> offset:int -> index:int -> unit) callback -> unit meth
end
@@ -415,6 +427,9 @@ module Classes = struct
method handleDOMEvents
: (editor_view t -> Jv.t -> bool t) callback TypedObject.t prop
+ method handleClickOn
+ : (editor_view t -> int t -> node t -> int -> Brr.Ev.Mouse.t Brr.Ev.type' -> bool t -> bool t) callback prop
+
method nodeViews
: (node t -> editor_view t -> (unit -> int) -> < .. > t) TypedObject.t prop
@@ -468,6 +483,9 @@ module Classes = struct
method coordsAtPos:
int -> int opt -> < left: float prop; right: float prop; top: float prop; bottom: float prop > t meth
+ method domAtPos:
+ pos:int -> side:int opt -> < node: Brr.El.t t prop; offset: int prop > t meth
+
method destroy
: unit meth
@@ -566,6 +584,9 @@ module Classes = struct
method addMark
: from:int -> to_:int -> mark t -> 'this t meth
+ method removeMark
+ : from:int -> to_:int -> mark t -> 'this t meth
+
method replace
: from:int -> to_:int -> slice t opt -> 'this t meth
diff --git a/editor/prosemirror/prosemirror.ml b/editor/prosemirror/prosemirror.ml
index 8c436a3..2a9b92c 100755
--- a/editor/prosemirror/prosemirror.ml
+++ b/editor/prosemirror/prosemirror.ml
@@ -16,6 +16,24 @@ module Model = struct
include Bindings.Model
+ module Mark = struct
+
+ let _set_from
+ : t -> 'a Js.t -> mark Js.t
+ = fun t element ->
+ let model = Jv.get t "model" in
+ let class_ = Jv.get model "Mark" in
+ Jv.call (Jv.Id.to_jv class_ ) "setFrom" [|Jv.Id.to_jv element |]
+ |> Jv.Id.of_jv
+
+
+ let set_from_mark
+ : t -> mark Js.t -> mark Js.t
+ = _set_from
+
+
+ end
+
module DOMParser = struct
diff --git a/editor/prosemirror/prosemirror.mli b/editor/prosemirror/prosemirror.mli
index 76545d2..9260af6 100755
--- a/editor/prosemirror/prosemirror.mli
+++ b/editor/prosemirror/prosemirror.mli
@@ -90,6 +90,13 @@ and Model : sig
val schema
: t -> schema_spec Js.t -> schema Js.t
+ module Mark : sig
+
+ val set_from_mark
+ : t -> mark Js.t -> mark Js.t
+
+ end
+
module DOMParser : sig
type parser