Since this really just calls setNodes, it seems like it should offer the same options.
Without this change, doing something like applying a mark to the contents of a selected block with `hanging` works one way, while trying to do the reverse (remove the mark) cannot include the "hang".
`Editor.unhangRange()` could decide to proceed with an adjustment in cases where the range was not hanging.
Because the algorithm it uses *always* skips over the first node it encounters, this meant the selection was adjusted in non-hanging cases.
This change reduces the chances of an incorrect decision to adjust.
Transforms now pass the `voids` flag to `unhangRange()` as it seems logical that the adjusted range should reflect the intention of the operation.
This fixes a unit test I added for markable voids that had to be skipped because of the `unhangRange()` error, and fixes a couple other long-skipped tests.
* Update `isHistory` to match new interface.
This change merely preserves the original functionality and does not add verification of Batch's new `selectionBefore` property.
* Add changeset.
* Create new function hasSelectableTarget and use it instead of hasEditableTarget. Fixes Copy/pasting void elements is not working https://github.com/ianstormtaylor/slate/issues/4808
* Add changeset
* Revert a change that made editable void not editable and add cypress test for editing editable void
* Extract methoods into easily overridable with help from @alex-vladut
Some void elements are effectively stand-ins for text, such as with the mentions example,
where the mention element renders the character's name. Users might want to format Void
elements like this with bold, or set their font and size, so `editor.markableVoid` tells
Slate whether or not to apply Marks to the text children of void elements.
- Adds `markableVoid()` as a schema-specific overrideable test.
- Changes `addMark` and `removeMark` so marks can apply to voids. Also changes behavior
of collapsed selection so that if a markable Void is selected, the mark will be applied /
removed.
- Shows how `markableVoid()` can work in the mentions example
* Ensure the min-height for placeholders is set on the correct editor
* Add changeset
* Run prettier on changeset
Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
* Move getDirtyPaths to the Editor object to allow for customization
* Add changeset for getDirtyPaths customization
Co-authored-by: Tom Krenzke <tom@daybreakhealth.com>
* wip
* wip
* wip - fully working without hard marks
* fix editor crashes when inserting/deleting at the edges of marks
* fix various restore dom related crashes
* fix delete with pending changes, zero widths on android, mutation tracking
* track placeholder delete in detached strings, zero-widths
* wip mark placeholders
* get rid of mutation detection in favor of beforeinput
* fix various selection race conditions
* fix various crashes when deleting at the beginning of nodes
* wip diff transforms, selection handling fixes
* cleanup restoreDOM and fix noop restore edge-case
* fix mark placeholders
* fix toSlatePoint edge-case
* properly flush user select with pending changes
* Prevent editor crash when deleting before a non-contenteditable element
* wip markdown shortcut example
* transform pending changes and selection by remote changes, simplify pending actions, handle all input types
* improve change transform, mark(-placeholder) handling
* manually handle gboard bug, fix restoredom nested editor
* fix parent mutation condition
* cleanup, mark placeholder fixes
* mark placeholder fixes
* fix mark placeholder condition
* hide placeholder if we have pending diffs
* cleanup
* yarn install
* add workaround for swiftkey placeholder issue
* cleanup
* add changeset
* feat(slate-react): fix edge-case crash, add androidPendingDiffs, rename scheduleFlushPendingChanges
* flush pending selection on same line without pending changes/action
* keep formatting of pending diffs when adding/removing selection marks
* unref selection ref on unmatching dom state
* improve markdown shortcut example flush trigger to show how a more generic solution would work
* fix markdown shortcut example trigger logic
* fix isInsertAfterMarkPlaceholder logic
* Fix DOM selection sync when there are unexpected rerenders
* Create a useSlateSelection hook and expose it
* update docs
* add changeset
* Undo the useEffect change and add a useSlateValue method
* Use a version counter instead for SlateContext
* comment out layout effect prevention for now
* Undo useV comparison for now
* Change the changeset
* Fix lint
* Remove the useSlateValue hook
* remove some unused imports
* Add useSlateWithV to the docs
* fix changeset lint
* Change changeset to minor instead