Commit graph

14 commits

Author SHA1 Message Date
Tulir Asokan
29367766fd Fix "decend" typo
Signed-off-by: Tulir Asokan <tulir@maunium.net>
2019-10-13 14:31:32 +03:00
Bruno Windels
905aa81bf8 safeguard if the offsetnode is null when determining caret position 2019-10-10 16:39:41 +02:00
Bruno Windels
e0668e8517 improve algorithm to reduce selection to text node + charactar offset
this follows the documentation of {focus|anchor}{Offset|Node} better
and was causing problems for creating ranges from the document selection
when doing ctrl+A in firefox as the anchorNode/Offset was expressed
as childNodes from the editor root.
2019-09-04 16:40:34 +02:00
Bruno Windels
4691108a16 only increase offset if caret hasn't been found yet
also rename caret away as this isn't used for the caret solely anymore
2019-09-04 16:40:34 +02:00
Bruno Windels
b35a3531bb move quote formatting out of react component 2019-09-04 16:40:34 +02:00
Bruno Windels
b72d1a78ec move inline formatting code out of react component 2019-09-04 16:40:34 +02:00
Bruno Windels
eb87301855 allow getting the DocumentOffset for any node+offset, not just focusNode
we need this to get both offsets of the selection boundaries

getSelectionOffsetAndText offers the extra flexibility,
getCaretOffsetAndText keeps the old api for focusNode/focusOffset

Also did some renaming here now that it's not just for the caret anymore
2019-09-03 15:58:50 +02:00
Bruno Windels
e531b29307 don't ignore BR elements when converting to editor dom to text 2019-08-29 13:00:31 +02:00
Bruno Windels
c443dd7a32 clarify why use a BOM marker for the caret nodes 2019-06-21 16:37:29 +02:00
Bruno Windels
366a4aa308 put zero-width spaces in caret nodes so chrome doesn't ignore them
this requires an update of the editor DOM > text & caret offset logic,
as the ZWS need to be ignored.
2019-06-20 14:44:18 +02:00
Bruno Windels
b0d87e7e47 allow enterNodeCallback to decide whether to decend into a node 2019-05-29 14:27:36 +02:00
Bruno Windels
6b1134bdf0 add matrix foundation copyright header 2019-05-22 16:16:32 +02:00
Bruno Windels
fd31e793d1 fix lint 2019-05-14 15:49:53 +01:00
Bruno Windels
9e0816c51c find caret offset and calculate editor text in same tree-walking algo
instead of having the same logic twice
2019-05-14 15:38:16 +01:00