Remirror: v1.0.0-next.32 Release

Release date:
September 5, 2020
Previous version:
v1.0.0-next.31 (released September 3, 2020)
Magnitude:
3,417 Diff Delta
Contributors:
4 total committers
Data confidence:
Commits:

15 Commits in this Release

Ordered by the degree to which they evolved the repo in this version.

Top Contributors in v1.0.0-next.32

ifiokjr
github-actions[bot]
ankon
StefKors

Directory Browser for v1.0.0-next.32

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

Release Notes Published

Major Changes

Minor Changes

  • 5786901c #645 Thanks @ifiokjr! - Add support for prioritized keymaps. It's now possible to make sure that a hook which consumes useKeymap runs before the extension keybindings.
  import React from 'react';
  import { ExtensionPriority } from 'remirror/core';
  import { useKeymap } from 'remirror/react/hooks';

  const KeymapHook = () => {
    // Make sure this keybinding group is run first!
    useKeymap({ Enter: () => doSomething() }, ExtensionPriority.Highest);

    // This one we don't care about πŸ€·β€β™€οΈ
    useKeymap({ 'Shift-Delete': () => notImportant() }, ExtensionPriority.Lowest);

    return <div />;
  };

Here is a breakdown of the default priorities when consuming keymaps.

  • Hooks within remirror/react/hooks which consume useKeymap have a priority of ExtensionPriority.High.
  • useKeymap is given a priority of ExtensionPriority.Medium.
  • The createKeymap method for extensions is given a priority of ExtensionPriority.Default.
  • The baseKeymap which is added by default is given a priority of ExtensionPriority.Low.

To change the default priority of the createKeymap method in a custom extension wrap the KeyBindings return in a tuple with the priority as the first parameter.

  import { PlainExtension, KeyBindingsTuple, ExtensionPriority, KeyBindings } from 'remirror/core';

  class CustomExtension extends PlainExtension {
    get name() {
      return 'custom' as const;
    }

    createKeymap(): KeyBindingsTuple {
      const bindings = {
        Enter: () => return true,
        Backspace: () => return true,
      }

      return [ExtensionPriority.High, bindings];
    }
  }
  • aa27e968 #635 Thanks @ifiokjr! - Add onError and stringHandler methods to the Remirror.ManagerSettings.

  • a830c70f #633 Thanks @ifiokjr! - Make focus command chainable and add manager.tr property for creating chainable commands. This means that the focus method returned by useRemirror() can now be safely used within a controlled editor. It uses the shared chainable transaction so that the state update does not override other state updates.

  • bed5a9e3 #616 Thanks @ankon! - Optionally allow to style the currently selected text

This adds a new option for the builtin preset, persistentSelectionClass. If that is set to a valid CSS class name any selection in the editor will be decorated with this class.

This can be used to keep an indication for the current selection even when the focus changes away from the editor.

  • e7b0bb0f #641 Thanks @ifiokjr! - Move isEmptyBlockNode function from @remirror/extension-positioner to @remirror/core-utils. Re-export to prevent breaking change.

  • 55e11ba3 #634 Thanks @ifiokjr! - Make mentionAtom selectable.

  • 28d1fd48 #642 Thanks @ifiokjr! - Add new signature return for useExtension and usePreset. If only provided the constructor they return a the extension or preset instance from within the manager.

Patch Changes