github ianstormtaylor/slate slate-react@0.65.0

latest releases: slate-react@0.106.0, slate-react@0.105.0, slate-react@0.104.0...
3 years ago

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 own onCopy, onPaste, onDrop, and onKeyDown 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 of slate-history inside slate-react

  • #4307 a7e3a181 Thanks @clauderic! - Fix deletion of selected inline void nodes in Chrome. Chrome does not fire a beforeinput 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 accessing globalThis in browsers that do not implement it

  • #4295 dfc03960 Thanks @dubzzz! - Fix React warnings related to autoCorrect and autoCapitalize attributes being passed as a boolean instead of a string.

  • #4271 ff267767 Thanks @omerg! - Fixed typo: Renamed toSlatePoint argument extractMatch to exactMatch

Don't miss a new slate release

NewReleases is sending notifications on new releases.