github remirror/remirror v1.0.0-next.42

Minor Changes

  • 9fa07878 #721 Thanks @ifiokjr! - Add new helpers getChangedRanges, getChangedNodeRanges and getChangedNodes which take a transaction and return a list of changed ranges, node ranges or nodes with positions.

    This is useful for increasing the performance and only checking the parts of the document that have changed between updates.

  • 6f2ababd #721 Thanks @ifiokjr! - Improve performance of the CodeBlockExtension by only updating syntax highlighting for the changed code block(s).

Patch Changes

  • ef1f57c2 #718 Thanks @ronnyroeller! - Remove annotations when their content is deleted

    Users can create annotations on pieces of content. The annotations are automatically updated as the content is moved around, e.g. if a new word is inserted before the annotation. Yet, the extension missed the case that all annotated content is deleted. Before, this would lead to an empty annotation (to and from parameter are equal). With this commit, annotations are automatically removed when the content is completed deleted.

  • 44754a5d #723 Thanks @ronnyroeller! - Support multi-line annotations in positioner

    The annotation positioner placed the bottom on the bottom of the first line. This meant that a popup placed on the bottom would overlay the rest of a multi-line annotation. Now, the positioner returns the bottom of the last line, allowing to place the popup below all content.

  • 802d5f04 #720 Thanks @ronnyroeller! - Gracefully handle annotations with positions outside the content

    Annotations are loaded separately from the content into the editor (helpers.setAnnotations vs setContent). This can lead to situations where annotations are pointing to positions that are outside the content. For example, the editor shows content with annotations. Then, the user requests to change the content to an empty document. At this point, until helpers.setAnnotations() is called, the editor will have an empty document but still a list of annotations.

    At that point, helpers.getAnnotations() would throw the following error because it couldn't find the matching text for the from/to positions: TypeError: Cannot read property 'nodeSize' of 'undefined'.

  • d33f43bf #717 Thanks @ifiokjr! - Fix type annotations for createCommands functions. This was causing issues with inferring all the commands available across the extensions since the types were compiling as any.

    The following should now work with full type inference.

    import React from 'react';
    import { useRemirror } from 'remirror/react';
    
    const EditorButton = () => {
      const { commands, chain } = useRemirror();
    
      return (
        <>
          <button onClick={() => commands.toggleBulletList()}>Toggle List</button>
          <button
            onClick={() => chain.toggleBold().toggleStrike().toggleItalic()}
          >
            Cray!
          </button>
        </>
      );
    };
  • d33f43bf #717 Thanks @ifiokjr! - Improve type inference for @remirror/styles/emotion, @remirror/styles/dom and @remirror/styles/styled-components.

  • d33f43bf #717 Thanks @ifiokjr! - Improve inference for multishift exports.

  • Updated dependencies [ef1f57c2, 44754a5d, 802d5f04, 6f2ababd, 9fa07878, d33f43bf]

Don't miss a new remirror release

NewReleases is sending notifications on new releases.