Remirror: v1.0.0-next.42 Release

Release date:
September 26, 2020
Previous version:
v1.0.0-next.41 (released September 26, 2020)
Magnitude:
2,714 Diff Delta
Contributors:
3 total committers
Data confidence:
Commits:

Top Contributors in v1.0.0-next.42

ifiokjr
github-actions[bot]
ronnyroeller

Directory Browser for v1.0.0-next.42

We haven't yet finished calculating and confirming the files and directories changed in this release. Please check back soon.

Release Notes Published

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

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>
      </>
    );
  };