remirror v1.0.0-next.33 Release Notes

Release Date: 2020-09-07 // over 3 years ago
  • Major Changes

    • 💥 92ed413: BREAKING : 💥 Remove export of useSetState and use default useState instead.

    Minor Changes

    👍 7a34e15: Add support for returning a Dispose method from the onCreate and onView lifecycle methods for automatic cleanup in the onDestroy handler.

    👍 7a34e15: Add support for early return handler predicate checks. Now it's possible to use a function to check if the value received from a handler should trigger an early return.

    ⚡️ 7a34e15: Update return signature of getMarkRange from @remirror/core-utils to also include the mark found. Additionally, to better support optional chaining it now returns undefined instead of false when no range can be found.

    👍 7a34e15: Add invalidMarks support.

    • Add the ability to disable all input rules if a certain mark is active.
    • Fix the ItalicExtension regex which was over eager.
    • Expose decorationSet for the prosemirror-suggest state.
    • Export markActiveInRange, rangeHasMarks, positionHasMarks from prosemirror-suggest.

    - Add helpers getMarksByTags and getNodesByTags to the TagsExtension.

    7a34e15: Add new properties chain, commands and helpers to simplify usage of commands and helpers within extensions. Also allow using setExtensionStore within the onView lifecycle handler, which previously was prevented.

    🚀 Deprecate getCommands, getChain and getHelpers methods on the Remirror.ExtensionStore interface. They will be removed in a future release.

    7a34e15: Add priority parameter to the addHandler method. Now hooks which consume the addHandler methods can alter the priority with which they will be run.

    0️⃣ 525ac3d: Add AcceptUndefined annotation which allows options to accept undefined as their default value.

    7a34e15: Add isSuggesterActive helper to the SuggestExtension.

    7a34e15: Enable disabling input rules with a shouldSkip method. This is now available as a handler for the InputRulesExtension via shouldSkipInputRule.

    Consuming this API looks something like this.

    import { PlainExtension, Dispose } from 'remirror/core';class CoolExtension extends PlainExtension {get name() {return 'cool';}onCreate(): Dispose {// Add the `shouldSkip` predicate check to this extension.return this.store.getExtension(InputRulesExtension).addHandler('shouldSkipInputRule', () =\> {if (something) {return true;}return false;});}}
    

    7a34e15: Add getExtension and getPreset methods to the Remirror.ExtensionStore.

    🍱 d47bd78: 🎉 Brings support for adding extra attributes to the RemirrorManager via extension tags. Attributes can now be added to all nodes and marks with a specific tag like ExtensionTag.Alignment or ExtensionTag.NodeBlock. Every matching tag in the Schema receives the extra attributes defined.

    With tags, you can select a specific sub selection of marks and nodes. This will be the basis for adding advanced formatting to remirror.

    import { ExtensionTag } from 'remirror/core';import { createCoreManager, CorePreset } from 'remirror/preset/core';import { WysiwygPreset } from 'remirror/preset/wysiwyg';const manager = createCoreManager(() =\> [new WysiwygPreset(), new CorePreset()], {extraAttributes: [{identifiers: {tags: [ExtensionTag.NodeBlock],// Can be limited by type to `node | mark`.type: 'node',},attributes: { role: 'presentation' },},],});
    

    Each item in the tags array should be read as an OR so the following would match Tag1 OR Tag2 OR Tag3.

    { "tags": ["Tag1", "Tag2", "Tag3"] }
    

    The type property (mark | node) is exclusive and limits the type of matches that will be matched.

    92ed413: Add new AnchorHeadParameter export and make it a part of PrimitiveSelection type.

    7a34e15: Skip input rules when the mention is active or one of the included suggester names are active.

    7a34e15: Add forwardDelete to jest-remirror and jest-prosemirror.

    92ed413: Add support for anchor and head cursors when writing tests. Also fix selectText when position is 0.

    7a34e15: Multiple improvements to the prosemirror-suggest implementation.

    ➕ Add support for setting a function to determine whether decorations should be ignored. ShouldDisableDecorations takes the current state and the active match and returns true when decorations should be disabled.

    ➕ Add support for checkNextValidSelection which is called for all suggesters to provide the opportunity to peek forward into the next valid text selection and decide whether or not any action should be taken. This is used in the @remirror/extension-mention to fix #639.

    ➕ Add option emptySelectionsOnly to prevent matches when the text selection is not empty.

    Prevent non-text selection from triggering matches.

    ➕ Adds missing range check to invalidMarks tests.

    Patch Changes

    ⚡️ 92ed413: Fix editable mentions support for exiting when text is selected. Also update getSelection to support anchor and head selections.

    7a34e15: Fix forward deleting when using the @remirror/extension-mention #639.

    04378b5: Fix text selection causing range error when creating table.

    ⚡️ Updated dependencies [7a34e15]

    ⚡️ Updated dependencies [7a34e15]

    ⚡️ Updated dependencies [04378b5]

    ⚡️ Updated dependencies [92ed413]

    ⚡️ Updated dependencies [7a34e15]

    ⚡️ Updated dependencies [7a34e15]

    ⚡️ Updated dependencies [7a34e15]

    ⚡️ Updated dependencies [7a34e15]

    ⚡️ Updated dependencies [7a34e15]

    ⚡️ Updated dependencies [525ac3d]

    ⚡️ Updated dependencies [7a34e15]

    ⚡️ Updated dependencies [7a34e15]

    ⚡️ Updated dependencies [7a34e15]

    ⚡️ Updated dependencies [7a34e15]

    ⚡️ Updated dependencies [92ed413]

    ⚡️ Updated dependencies [d47bd78]

    ⚡️ Updated dependencies [92ed413]