Skip to content

Releases: ianstormtaylor/slate

[email protected]

01 Jun 19:11
dbf9962
Compare
Choose a tag to compare

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

[email protected]

13 May 01:32
39b0254
Compare
Choose a tag to compare

Minor Changes

  • #4230 796389c7 Thanks @TheSpyder! - Applying invalid insert_node operations will now throw an exception for all invalid paths, not just invalid parent paths.

Patch Changes

  • #4245 b33a531b Thanks @JonasKruckenberg! - Removed lodash dependecy to reduce bundled footprint

  • #4208 feb293aa Thanks @TheSpyder! - Fix Error: Cannot get the start point in the node at path [...] because it has no start text node caused by normalizing a document where some elements have no children

  • #4230 796389c7 Thanks @TheSpyder! - Exceptions in editor.apply() and Editor.withoutNormalizing() will no longer leave the editor in an invalid state

  • #4227 e6413d46 Thanks @ulion! - Fixed a bug that would allow multiple changes to be scheduled at the same time.

[email protected]

13 May 01:32
39b0254
Compare
Choose a tag to compare

Patch Changes

  • #4238 c14e1fbc Thanks @clauderic! - Fix duplicated content and other bugs related to drag and drop handling

  • #4237 623960a7 Thanks @dylans! - Fixed text insertion logic to prevent crashing in newer Firefox versions.

[email protected]

05 May 23:13
f2d1101
Compare
Choose a tag to compare

Patch Changes

[email protected]

05 May 23:13
f2d1101
Compare
Choose a tag to compare

Patch Changes

v0.61.3

21 Apr 08:14
Compare
Choose a tag to compare
v0.61.3

0.19.0

28 Mar 18:07
Compare
Choose a tag to compare
BREAKING CHANGES
  • The filterDescendants and findDescendants methods are now depth-first. This shouldn't affect almost anyone, since they are usually not the best things to be using for performance reasons. If you happen to have a very specific use case that needs breadth-first, (or even likely something better), you'll need to implement it yourself.
DEPRECATION CHANGES
  • Some Node methods have been deprecated! There were a few methods that had been added over time that were either poorly named that have been deprecated and renamed, and a handful of methods that are no longer useful for the core library that have been deprecated. Here's a full list:
    • areDescendantSorted -> areDescendantsSorted
    • getHighestChild -> getFurthestAncestor
    • getHighestOnlyChildParent -> getFurthestOnlyChildAncestor
    • concatChildren
    • decorateTexts
    • filterDescendantsDeep
    • findDescendantDeep
    • getChildrenBetween
    • getChildrenBetweenIncluding
    • isInlineSplitAtRange

0.18.0

28 Mar 18:06
Compare
Choose a tag to compare
BREAKING CHANGES
  • The plugin.render property is now called plugin.renderPortal. This is to make way for the new plugin.render property that offers HOC-like behavior, so that plugins can augment the editor however they choose.

0.17.0

28 Mar 18:06
Compare
Choose a tag to compare
DEPRECATION CHANGES
  • Some Selection methods have been deprecated! Previously there were many inconsistencies in the naming and handling of selection changes. This has all been cleaned up, but in the process some methods have been deprecated. Here is a full list of the deprecated methods and their new alternatives:

    • moveToOffsets -> moveOffsetsTo
    • moveForward -> move
    • moveBackward -> move
    • moveAnchorOffset -> moveAnchor
    • moveFocusOffset -> moveFocus
    • moveStartOffset -> moveStart
    • moveEndOffset -> moveEnd
    • extendForward -> extend
    • extendBackward -> extend
    • unset -> deselect
  • Some selection transforms have been deprecated! Along with the methods, the selection-based transforms have also been refactored, resulting in deprecations. Here is a full list of the deprecated transforms and their new alternatives:

    • moveTo -> select
    • moveToOffsets -> moveOffsetsTo
    • moveForward -> move
    • moveBackward -> move
    • moveStartOffset -> moveStart
    • moveEndOffset -> moveEnd
    • extendForward -> extend
    • extendBackward -> extend
    • flipSelection -> flip
    • unsetSelection -> deselect
    • unsetMarks

0.16.0

28 Mar 18:06
Compare
Choose a tag to compare
BREAKING CHANGES
  • Inline nodes are now always surrounded by text nodes. Previously this behavior only occured for inline nodes with isVoid: true. Now, all inline nodes will always be surrounded by text nodes. If text nodes don't exist, empty ones will be created. This allows for more consistent behavior across Slate, and parity with other editing experiences.