slate-react@0.65.0
Minor Changes
-
#4299
2c17e2b7Thanks @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
Editablecomponent comes with a set of event handlers that handle typical rich-text editing behaviors (for example, it implements its ownonCopy,onPaste,onDrop, andonKeyDownhandlers).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
Editablecomponent.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
411e5a19Thanks @TheSpyder! - Removed accidental bundling ofslate-historyinsideslate-react -
#4307
a7e3a181Thanks @clauderic! - Fix deletion of selected inline void nodes in Chrome. Chrome does not fire abeforeinputevent when deleting backwards within an inline void node, so we need to add special logic to handle this edge-case for Chrome only. -
#4272
294d5120Thanks @clauderic! - Fix errors accessingglobalThisin browsers that do not implement it -
#4295
dfc03960Thanks @dubzzz! - Fix React warnings related toautoCorrectandautoCapitalizeattributes being passed as a boolean instead of a string. -
#4271
ff267767Thanks @omerg! - Fixed typo: RenamedtoSlatePointargumentextractMatchtoexactMatch