All Versions
139
Latest Version
Avg Release Cycle
8 days
Latest Release
1416 days ago

Changelog History
Page 8

  • v0.22.9

    September 27, 2019
  • v0.22.8

    August 27, 2019
  • v0.22.7

    August 22, 2019
  • v0.22.6

    August 19, 2019
  • v0.22.5

    August 19, 2019
  • v0.22.4

    June 07, 2019
  • v0.22.3

    May 21, 2019
  • v0.22.0 Changes

    September 05, 2017
    NEW

    The state.activeMarks returns the intersection of marks in the selection. Previously there was only state.marks which returns marks that appeared on any character in the selection. But state.activeMarks returns marks that appear on every character in the selection, which is often more useful for implementing standard richtext editor behaviors.

    BREAKING

    The Plain serializer now adds line breaks between blocks. Previously between blocks the text would be joined without any space whatsoever, but this wasn't really that useful or what you'd expect.

    The toggleMark transform now checks the intersection of marks. Previously, toggling would remove the mark from the range if any of the characters in a range didn't have it. However, this wasn't what all other richtext editors did, so the behavior has changed to mimic the standard behavior. Now, if any characters in the selection have the mark applied, it will first be added when toggling.

    🚚 The .length property of nodes has been removed. This property caused issues with code like in Lodash that checked for "array-likeness" by simply looking for a .length property that was a number.

    onChange now receives a Change object (previously named Transform) instead of a State. This is needed because it enforces that all changes are represented by a single set of operations. Otherwise right now it's possible to do things like state.transform()....apply({ save: false }).transform()....apply() and result in losing the operation information in the history. With OT, we need all transforms that may happen to be exposed and emitted by the editor. The new syntax looks like:

    onChange(change) {
      this.setState({ state: change.state })
    }
    
    onChange({ state }) {
      this.setState({ state })
    }
    

    Similarly, handlers now receive e, data, change instead of e, data, state. Instead of doing return state.transform()....apply() the plugins can now act on the change object directly. Plugins can still return change... if they want to break the stack from continuing on to other plugins. (Any != null value will break out.) But they can also now not return anything, and the stack will apply their changes and continue onwards. This was previously impossible. The new syntax looks like:

    function onKeyDown(e, data, change) {
      if (data.key == 'enter') {
        return change.splitBlock()
      }
    }
    

    The onChange and on[Before]Change handlers now receive Change objects. Previously they would also receive a state object, but now they receive change objects like the rest of the plugin API.

    The .apply({ save }) option is now state.change({ save }) instead. This is the easiest way to use it, but requires that you know whether to save or not up front. If you want to use it inline after already saving some changes, you can use the change.setOperationFlag('save', true) flag instead. This shouldn't be necessary for 99% of use cases though.

    0️⃣ The .undo() and .redo() transforms don't save by default. Previously you had to specifically tell these transforms not to save into the history, which was awkward. Now they won't save the operations they're undoing/redoing by default.

    onBeforeChange is no longer called from componentWillReceiveProps, when a new state is passed in as props to the <Editor> component. This caused lots of state-management issues and was weird in the first place because passing in props would result in changes firing. It is now the parent component's responsibility to not pass in improperly formatted State objects.

    The splitNodeByKey change method has changed to be shallow. Previously, it would deeply split to an offset. But now it is shallow and another splitDescendantsByKey change method has been added (with a different signature) for the deep splitting behavior. This is needed because splitting and joining operations have been changed to all be shallow, which is required so that operational transforms can be written against them.

    Blocks cannot have mixed "inline" and "block" children anymore. Blocks were implicitly expected to either contain "text" and "inline" nodes only, or to contain "block" nodes only. Invalid case are now normalized by the core schema.

    The shape of many operations has changed. This was needed to make operations completely invertible without any extra context. The operations were never really exposed in a consumable way, so I won't detail all of the changes here, but feel free to look at the source to see the details.

    🔀 All references to "joining" nodes is now called "merging". This is to be slightly clearer, since merging can only happen with adjacent nodes already, and to have a nicer parallel with "splitting", as in cells. The operation is now called merge_node, and the transforms are now merge*.

    🗄 ###### DEPRECATED

    🗄 The transform.apply() method is deprecated. Previously this is where the saving into the history would happen, but it created an awkward convention that wasn't necessary. Now operations are saved into the history as they are created with change methods, instead of waiting until the end. You can access the new State of a change at any time via change.state.


  • v0.21.0 Changes

    July 20, 2017
    BREAKING

    📜 The Html serializer now uses DOMParser instead of cheerio. Previously, the Html serializer used the cheerio library for representing elements in the serialization rule logic, but cheerio was a very large dependency. It has been removed, and the native browser DOMParser is now used instead. All HTML serialization rules will need to be updated. If you are working with Slate on the server, you can now pass in a custom serializer to the Html constructor, using the parse5 library.


  • v0.20.0 Changes

    May 17, 2017
    BREAKING

    Returning null from the Html serializer skips the element. Previously, null and undefined had the same behavior of skipping the rule and trying the rest of the rules. Now if you explicitly return null it will skip the element itself.