Minor Changes
-
#4299
2c17e2b7
Thanks @georgberecz! - Allow custom event handlers on Editable component to return boolean flag to specify whether the event can be treated as being handled.By default, the
Editable
component comes with a set of event handlers that handle typical rich-text editing behaviors (for example, it implements its ownonCopy
,onPaste
,onDrop
, andonKeyDown
handlers).In some cases you may want to extend or override Slate's default behavior, which can be done by passing your own event handler(s) to the
Editable
component.Your custom event handler can control whether or not Slate should execute its own event handling for a given event after your handler runs depending on the return value of your event handler as described below.
import {Editable} from 'slate-react'; function MyEditor() { const onClick = event => { // Implement custom event logic... // When no value is returned, Slate will execute its own event handler when // neither isDefaultPrevented nor isPropagationStopped was set on the event }; const onDrop = event => { // Implement custom event logic... // No matter the state of the event, treat it as being handled by returning // true here, Slate will skip its own event handler return true; }; const onDragStart = event => { // Implement custom event logic... // No matter the status of the event, treat event as *not* being handled by // returning false, Slate will exectue its own event handler afterward return false; }; return ( <Editable onClick={onClick} onDrop={onDrop} onDragStart={onDragStart} {/*...*/} /> ) }
Patch Changes
-
#4266
411e5a19
Thanks @TheSpyder! - Removed accidental bundling ofslate-history
insideslate-react
-
#4307
a7e3a181
Thanks @clauderic! - Fix deletion of selected inline void nodes in Chrome. Chrome does not fire abeforeinput
event when deleting backwards within an inline void node, so we need to add special logic to handle this edge-case for Chrome only. -
#4272
294d5120
Thanks @clauderic! - Fix errors accessingglobalThis
in browsers that do not implement it -
#4295
dfc03960
Thanks @dubzzz! - Fix React warnings related toautoCorrect
andautoCapitalize
attributes being passed as a boolean instead of a string. -
#4271
ff267767
Thanks @omerg! - Fixed typo: RenamedtoSlatePoint
argumentextractMatch
toexactMatch