Skip to content

Releases: ianstormtaylor/slate

slate@0.94.0

20 Apr 12:35
33a1e9b
Compare
Choose a tag to compare

Minor Changes

  • #5307 3243c7e3 Thanks @zbeyens! - New Features:

    • All Editor and Transforms methods now call editor methods. For example: Transforms.insertBreak now calls editor.insertBreak.
    • editor.setNodes now calls setNodes, an exported function that implements the default editor behavior.
    • You can now override editor.setNodes with your own implementation.
    • You can use either Editor.setNodes or editor.setNodes in your code, and both will use your overridden behavior.

    The editor object now has many more methods:

    export interface BaseEditor {
      // Core state.
    
      children: Descendant[]
      selection: Selection
      operations: Operation[]
      marks: EditorMarks | null
    
      // Overrideable core methods.
    
      apply: (operation: Operation) => void
      getDirtyPaths: (operation: Operation) => Path[]
      getFragment: () => Descendant[]
      isElementReadOnly: (element: Element) => boolean
      isSelectable: (element: Element) => boolean
      markableVoid: (element: Element) => boolean
      normalizeNode: (
        entry: NodeEntry,
        options?: { operation?: Operation }
      ) => void
      onChange: (options?: { operation?: Operation }) => void
      shouldNormalize: ({
        iteration,
        dirtyPaths,
        operation,
      }: {
        iteration: number
        initialDirtyPathsLength: number
        dirtyPaths: Path[]
        operation?: Operation
      }) => boolean
    
      // Overrideable core transforms.
    
      addMark: OmitFirstArg<typeof Editor.addMark>
      collapse: OmitFirstArg<typeof Transforms.collapse>
      delete: OmitFirstArg<typeof Transforms.delete>
      deleteBackward: (unit: TextUnit) => void
      deleteForward: (unit: TextUnit) => void
      deleteFragment: OmitFirstArg<typeof Editor.deleteFragment>
      deselect: OmitFirstArg<typeof Transforms.deselect>
      insertBreak: OmitFirstArg<typeof Editor.insertBreak>
      insertFragment: OmitFirstArg<typeof Transforms.insertFragment>
      insertNode: OmitFirstArg<typeof Editor.insertNode>
      insertNodes: OmitFirstArg<typeof Transforms.insertNodes>
      insertSoftBreak: OmitFirstArg<typeof Editor.insertSoftBreak>
      insertText: OmitFirstArg<typeof Transforms.insertText>
      liftNodes: OmitFirstArg<typeof Transforms.liftNodes>
      mergeNodes: OmitFirstArg<typeof Transforms.mergeNodes>
      move: OmitFirstArg<typeof Transforms.move>
      moveNodes: OmitFirstArg<typeof Transforms.moveNodes>
      normalize: OmitFirstArg<typeof Editor.normalize>
      removeMark: OmitFirstArg<typeof Editor.removeMark>
      removeNodes: OmitFirstArg<typeof Transforms.removeNodes>
      select: OmitFirstArg<typeof Transforms.select>
      setNodes: <T extends Node>(
        props: Partial<T>,
        options?: {
          at?: Location
          match?: NodeMatch<T>
          mode?: MaximizeMode
          hanging?: boolean
          split?: boolean
          voids?: boolean
          compare?: PropsCompare
          merge?: PropsMerge
        }
      ) => void
      setNormalizing: OmitFirstArg<typeof Editor.setNormalizing>
      setPoint: OmitFirstArg<typeof Transforms.setPoint>
      setSelection: OmitFirstArg<typeof Transforms.setSelection>
      splitNodes: OmitFirstArg<typeof Transforms.splitNodes>
      unsetNodes: OmitFirstArg<typeof Transforms.unsetNodes>
      unwrapNodes: OmitFirstArg<typeof Transforms.unwrapNodes>
      withoutNormalizing: OmitFirstArg<typeof Editor.withoutNormalizing>
      wrapNodes: OmitFirstArg<typeof Transforms.wrapNodes>
    
      // Overrideable core queries.
    
      above: <T extends Ancestor>(
        options?: EditorAboveOptions<T>
      ) => NodeEntry<T> | undefined
      after: OmitFirstArg<typeof Editor.after>
      before: OmitFirstArg<typeof Editor.before>
      edges: OmitFirstArg<typeof Editor.edges>
      elementReadOnly: OmitFirstArg<typeof Editor.elementReadOnly>
      end: OmitFirstArg<typeof Editor.end>
      first: OmitFirstArg<typeof Editor.first>
      fragment: OmitFirstArg<typeof Editor.fragment>
      getMarks: OmitFirstArg<typeof Editor.marks>
      hasBlocks: OmitFirstArg<typeof Editor.hasBlocks>
      hasInlines: OmitFirstArg<typeof Editor.hasInlines>
      hasPath: OmitFirstArg<typeof Editor.hasPath>
      hasTexts: OmitFirstArg<typeof Editor.hasTexts>
      isBlock: OmitFirstArg<typeof Editor.isBlock>
      isEdge: OmitFirstArg<typeof Editor.isEdge>
      isEmpty: OmitFirstArg<typeof Editor.isEmpty>
      isEnd: OmitFirstArg<typeof Editor.isEnd>
      isInline: OmitFirstArg<typeof Editor.isInline>
      isNormalizing: OmitFirstArg<typeof Editor.isNormalizing>
      isStart: OmitFirstArg<typeof Editor.isStart>
      isVoid: OmitFirstArg<typeof Editor.isVoid>
      last: OmitFirstArg<typeof Editor.last>
      leaf: OmitFirstArg<typeof Editor.leaf>
      levels: <T extends Node>(
        options?: EditorLevelsOptions<T>
      ) => Generator<NodeEntry<T>, void, undefined>
      next: <T extends Descendant>(
        options?: EditorNextOptions<T>
      ) => NodeEntry<T> | undefined
      node: OmitFirstArg<typeof Editor.node>
      nodes: <T extends Node>(
        options?: EditorNodesOptions<T>
      ) => Generator<NodeEntry<T>, void, undefined>
      parent: OmitFirstArg<typeof Editor.parent>
      path: OmitFirstArg<typeof Editor.path>
      pathRef: OmitFirstArg<typeof Editor.pathRef>
      pathRefs: OmitFirstArg<typeof Editor.pathRefs>
      point: OmitFirstArg<typeof Editor.point>
      pointRef: OmitFirstArg<typeof Editor.pointRef>
      pointRefs: OmitFirstArg<typeof Editor.pointRefs>
      positions: OmitFirstArg<typeof Editor.positions>
      previous: <T extends Node>(
        options?: EditorPreviousOptions<T>
      ) => NodeEntry<T> | undefined
      range: OmitFirstArg<typeof Editor.range>
      rangeRef: OmitFirstArg<typeof Editor.rangeRef>
      rangeRefs: OmitFirstArg<typeof Editor.rangeRefs>
      start: OmitFirstArg<typeof Editor.start>
      string: OmitFirstArg<typeof Editor.string>
      unhangRange: OmitFirstArg<typeof Editor.unhangRange>
      void: OmitFirstArg<typeof Editor.void>
    }

    Note:

    • None of these method implementations have changed.
    • getMarks is an exception, as there is already editor.marks that stores the current marks.
    • Transforms.insertText has not been moved to editor yet: there is already an editor.insertText method with extended behavior. This may change in a future release, but this release is trying to avoid any breaking changes.
    • editor.insertText has a new argument (third): options?: TextInsertTextOptions to match Transforms.insertText.

    Bug Fixes:

    • Moving JSDoc's to the interface type to allow IDEs access to the interface methods.

Patch Changes

  • #5396 bc945eb1 Thanks @Moerphy! - Correct core normalization that could cause wrong nodes to be removed

slate-react@0.94.0

20 Apr 12:35
33a1e9b
Compare
Choose a tag to compare

Patch Changes

slate@0.93.0

03 Apr 23:55
07b049f
Compare
Choose a tag to compare

Minor Changes

  • #5374 b52e08b0 Thanks @12joan! - - Add isSelectable to editor (default true). A non-selectable element is skipped over when navigating using arrow keys.

    • Add ignoreNonSelectable to Editor.nodes, Editor.positions, Editor.after and Editor.before (default false)
    • Transforms.move ignores non-selectable elements
  • #5374 b52e08b0 Thanks @12joan! - - Add isElementReadOnly to editor. A read-only element behaves much like a void with regard to selection and deletion, but renders its children the same as any other non-void node.

slate-react@0.93.0

03 Apr 23:55
07b049f
Compare
Choose a tag to compare

Patch Changes

slate-history@0.93.0

03 Apr 23:55
07b049f
Compare
Choose a tag to compare

Minor Changes

slate-react@0.92.0

17 Mar 20:10
3c0abeb
Compare
Choose a tag to compare

Minor Changes

  • #5363 d42cd005 Thanks @aciccarello! - update dependencies on react hooks to be more senstive to changes

    The code should now meet eslint react hook standards

    This could result in more renders

    closes #3886

Patch Changes

slate-react@0.91.11

16 Mar 13:28
4244a8d
Compare
Choose a tag to compare

Patch Changes

  • #5362 43999356 Thanks @jason0x43! - Fix an issue where pastes in Safari wouldn't include application/x-slate-fragment data

  • #5359 9825d29b Thanks @jason0x43! - Fix an issue on Android where content containing a newline wouldn't be pasted properly

slate-react@0.91.10

08 Mar 05:31
2a0a530
Compare
Choose a tag to compare

Patch Changes

  • #5346 a5e833f6 Thanks @edhager! - Fix a problem with Editable not calling the decorate function passed as a prop when it should.

  • #5343 f7f02a8b Thanks @12joan! - Fix error when triple-clicking a word preceding a contenteditable="false" DOM node in Chrome

slate-react@0.91.9

06 Mar 16:48
bc07cf8
Compare
Choose a tag to compare

Patch Changes

  • #5339 62f8ddd9 Thanks @12joan! - Fixes #5335. To prevent performance issues, make sure to wrap custom renderPlaceholder values in useCallback.

slate-react@0.91.8

02 Mar 19:10
429f5fe
Compare
Choose a tag to compare

Patch Changes

  • #5325 af3f828b Thanks @clauderic! - Fix edge-cases in the Android input manager when text leaf nodes are deleted, such as when deleting text leaf nodes adjacent to inline void nodes.

  • #5327 4205e0f0 Thanks @YasinChan! - Fix the issue of composition API and beforeinput event triggering between Chrome versions 60-75 on the Android platform.