- Prevent empty text from being inserted
(See
82ac3eb
) - Prevent empty or negative ranges from being created for empty elements
(See
b79d013
)
- Fix missing backspace behaviour on
opts.indentation
for non-plaintext-only browsers (See093b10e
)
- Fix Chrome quirk where initial focus would immediately lose its selected range by switching to
selectstart
and checking forwindow.getSelection().rangeCount
(See71ae9a2
)
- Add
Edit#getState()
method to returnedEdit
handle.useEditable
returns theEdit
object with several methods to allow manipulating the current editable. ThegetState()
method allows you to retrieve the current text and position of the editable. (See98cb706
)
- Fix regression from
2.2.1
, which would misplace the indentation pattern and not recognise lines with content when backspace is pressed. (Seebc2be15
)
- Add space-only indentation when
opts.indentation
is passed. This means thatuseEditable
now inserts spaces over tabs whenopts.indentation
is set and overrides the default backspace behaviour to delete multiple spaces as needed. (See9291f6c
)
- Add
Edit#move()
method to edit the caret position programmatically. The caret can now be moved to a specific character index or row/column coordinates. (See15cea68
)
- Fix undo/redo key combination, which regressed previously, since it was switched to
event.key
rather thanevent.code
(See7147dca
) - Fix changes from being flushed to eagerly, which was meant to preserve the selected ranges more eagerly
(See
1feaec5
)
- Fix key repeats (held keys) not flushing changes correctly
(See
3807bbf
)
- Support non-collpsed selection restoration, in other words, when a range is selected and the component updates in the meantime, the selection is restored correctly.
This is achieved by storing the selection's "extent", i.e. the number of characters it selects past its start.
(See
a15f8fc
)
- Fix inconsistency of deletion behaviour on the beginning of lines. Due to the lack of
plaintext-only
support in Firefox, computing the current position would be relative to the root element, when plain text is selected. This makes it extremely difficult to get the current position without small offsets. (See1644f51
)
- Fix
onChange
not being triggered when the cursor moves (See9dfadda
)
- Add
Edit
return value touseEditable
. TheuseEditable
hook now returns an object with multiple methods that may be useful for controlling the editable's content, behaviour and cursor. Specifically it returnsEdit#update
, which was its previous return value for updating its content, andEdit#insert
to append new text. (Seec031d7e
)