@remirror/preset-core

@remirror/preset-core

npm i @remirror/preset-core

224 Versions

2.0.0-beta.13

beta
15 days ago

0.0.0-pr1801.3

pr1801
18 days ago

0.0.0-pr1801.2

22 days ago

0.0.0-pr1801.1

22 days ago

2.0.0-beta.12

1 month ago

2.0.0-beta.11

1 month ago

2.0.0-beta.10

1 month ago

2.0.0-beta.9

1 month ago

2.0.0-beta.8

1 month ago

2.0.0-beta.7

1 month ago

2.0.0-beta.6

1 month ago

2.0.0-beta.5

2 months ago

2.0.0-beta.4

2 months ago

2.0.0-beta.3

2 months ago

2.0.0-beta.2

2 months ago

2.0.0-beta.1

2 months ago

0.0.0-pr1713.12

pr1713
2 months ago

0.0.0-pr1713.11

2 months ago

0.0.0-pr1713.10

2 months ago

0.0.0-pr1713.9

2 months ago

0.0.0-pr1713.8

2 months ago

0.0.0-pr1713.7

2 months ago

0.0.0-pr1713.6

2 months ago

0.0.0-pr1713.5

2 months ago

1.0.31

latest
2 months ago

0.0.0-pr1713.4

2 months ago

0.0.0-pr1713.3

2 months ago

0.0.0-pr1713.2

2 months ago

0.0.0-pr1713.1

2 months ago

1.0.30

2 months ago

2.0.0-beta.0

3 months ago

1.0.29

3 months ago

1.0.28

3 months ago

0.0.0-pr1654.1

pr1654
3 months ago

1.0.27

3 months ago

0.0.0-pr1629.1

pr1629
4 months ago

0.0.0-pr1581.3

pr1581
4 months ago

0.0.0-pr1581.2

4 months ago

0.0.0-pr1581.1

4 months ago

1.0.26

4 months ago

0.0.0-pr1608.1

pr1608
4 months ago

1.0.25

4 months ago

0.0.0-pr1586.1

pr1586
4 months ago

1.0.24

5 months ago

1.0.23

5 months ago

0.0.0-pr1558.1

pr1558
5 months ago

0.0.0-pr1552.3

pr1552
5 months ago

0.0.0-pr1552.2

5 months ago

0.0.0-pr1552.1

5 months ago

0.0.0-pr1549.1

pr1549
5 months ago

1.0.22

6 months ago

0.0.0-pr1545.1

pr1545
6 months ago

0.0.0-pr1532.1

pr1532
6 months ago

1.0.21

6 months ago

1.0.20

6 months ago

1.0.19

6 months ago

1.0.18

7 months ago

0.0.0-pr1496.1

pr1496
7 months ago

1.0.17

7 months ago

0.0.0-pr1463.1

pr1463
7 months ago

1.0.16

8 months ago

0.0.0-pr1452.1

pr1452
8 months ago

1.0.15

8 months ago

0.0.0-pr1392.1

pr1392
9 months ago

1.0.14

9 months ago

1.0.13

9 months ago

0.0.0-pr1367.1

pr1367
9 months ago

1.0.12

9 months ago

0.0.0-pr1365.1

pr1365
9 months ago

1.0.11

10 months ago

0.0.0-pr1344.1

pr1344
10 months ago

1.0.10

10 months ago

0.0.0-pr1340.1

pr1340
10 months ago

1.0.9

10 months ago

0.0.0-pr1310.1

pr1310
10 months ago

0.0.0-pr1305.1

pr1305
10 months ago

1.0.8

1 year ago

2021-08-18

Patch Changes

1.0.7

1 year ago
Patch Changes

0.0.0-pr1242.4

pr1242
1 year ago

0.0.0-pr1242.3

1 year ago

0.0.0-pr1242.2

1 year ago

0.0.0-pr1242.1

1 year ago

1.0.6

1 year ago
Patch Changes
  • #1055 b288d665f Thanks @ocavue! - Fix a crash when the code block node contains an invalid language name in @remirror/extension-code-block.

1.0.5

1 year ago

1.0.4

1 year ago

0.0.0-pr1174.1

pr1174
1 year ago

1.0.3

1 year ago

0.0.0-pr1161.2

pr1161
1 year ago

0.0.0-pr1161.1

1 year ago

0.0.0-pr1158.1

pr1158
1 year ago

1.0.2

1 year ago

0.0.0-pr1102.1

pr1102
1 year ago

0.0.0-pr1031.1

pr1031
1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

The new version of remirror comes with a number of enhancements and quite a few breaking changes if you were using the remirror@1.0.0-next.* pre-releases.

The following sections outline the breaking changes and how they can be migrated if your last version was @next. For those upgrading from 0.11.0 the library has changed drastically and you'd be better off browsing the documentation.

Changes All extensions are available via remirror/extensions

When you install the top level remirror package you are given access to every extension developed by remirror via the remirror/extension entry point.

- import { BoldExtension } from 'remirror/extension/bold';
- import { ItalicExtension } from 'remirror/extension/italic';
+ import { BoldExtension, ItalicExtension } from 'remirror/extensions';

You can also still install the extensions directly from their scoped packages.

import { BoldExtension } from '@remirror/extension-bold';
Remove remirror/react which has been replaced by @remirror/react

If your code is importing from remirror/react you should now change the import to @remirror/react.

- import { useManager } from 'remirror/react';
+ import { useRemirror } from '@remirror/react';
Update the @remirror/react API
  • Rename the original useRemirror to now be called useRemirrorContext.
  • Add new @remirror/react-components package.
  • @remirror/react exports all the hooks, components, core modules and react specific extensions from @remirror/react-core, @remirror/react-components, @remirror/react-hooks and @remirror/extension-react.

useManager was too focused on the implementation details. We've updated the API to be used in a different way and useRemirror is now the way to initialize an editor.

import React from 'react';
import { BoldExtension, ItalicExtension, UnderlineExtension } from 'remirror/extensions';
import { Remirror, useRemirror } from '@remirror/react';

const extensions = () => [new BoldExtension(), new ItalicExtension(), new UnderlineExtension()];

const Editor = () => {
  const { manager } = useRemirror({ extensions });

  return <Remirror manager={manager} />;
};

The previous useRemirror is now called useRemirrorContext since it plucks the context from the outer Remirror Component. The <RemirrorProvider /> has been renamed to <Remirror /> and automatically renders an editor.

When no children are provided to the <Remirror /> component it will automatically render a container div where the prosemirror editor will be placed. If you do add children it is up to you to import the <EditorComponent /> and add it to the children or set the autoRender prop to 'start' | 'end' | true.

useManager has been marked as @internal (although it is still exported) and going forward you should be using useRemirror as shown in the above example.

@remirror/extension-tables

@remirror/preset-table is now @remirror/extension-tables. The TableExtension uses the new createExtension method to inject the TableRowExtension which in turn injects the TableCellExtension and TableHeaderCellExtension. To use tables in your editor the following is sufficient.

import { TableExtension } from 'remirror/extensions';
import { Remirror, useRemirror } from '@remirror/react';

const Editor = () => {
  const { manager } = useRemirror({ extensions: () => [TableExtension()] });

  return <Remirror manager={manager} />;
};
@remirror/extension-positioner
  • New Rect interface returned by the positioner x: number; y: number; width: number; height: number;

  • Added visible property which shows if the position currently visible within the editor viewport.

  • Improved scrolling when using the positioner.

  • Fixed a lot of bugs in the positioner API.

  • This DOMRect represents an absolute position within the document. It is up to your consuming component to consume the rect.

  • Renamed the positioners in line with the new functionality.

import React from 'react';
import { BoldExtension, CorePreset, ItalicExtension, MarkdownExtension } from 'remirror/extension';
import { Remirror, useRemirror } from '@remirror/react';

const Editor = () => {
  const { manager, onChange, state } = useRemirror({
    extensions: () => [new BoldExtension(), new ItalicExtension()],
    content: '<p><strong>I am strong.</strong> and <em>I am emphasized</em></p>',
    stringHandler: 'html',
  });

  return <Remirror manager={manager} onChange={onChange} state={state} />;
};
@remirror/react-hooks
  • Rename useKeymap to useKeymaps. The original useKeymap now has a different signature.
import { useCallback } from 'react';
import { BoldExtension } from 'remirror/extensions';
import { Remirror, useHelpers, useKeymap, useRemirror, useRemirrorContext } from '@remirror/react';

const hooks = [
  () => {
    const active = useActive();
    const { insertText } = useCommands();
    const boldActive = active.bold();
    const handler = useCallback(() => {
      if (!boldActive) {
        return false;
      }

      return insertText.original('\n\nWoah there!')(props);
    }, [boldActive, insertText]);

    useKeymap('Shift-Enter', handler); // Add the handler to the keypress pattern.
  },
];

const Editor = () => {
  const { manager } = useRemirror({ extensions: () => [new BoldExtension()] });

  return <Remirror manager={manager} hooks={hooks} />;
};
Breaking Changes
  • Editor selection now defaults to the end of the document. You can change the starting point as shown below.

    import { Remirror, useRemirror } from '@remirror/react';
    
    const Editor = () => {
      const { manager, state } = useRemirror({ selection: 'start' });
    
      return <Remirror manger={manager} initialState={state} />;
    };
    
  • All interfaces which were named with the pattern *Parameter have been renamed to to *Props. The only exceptions are *FrameworkParameter which are now *FrameworkOptions.

  • Remove Presets completely. In their place a function that returns a list of Extensions should be used. They were clunky, difficult to use and provided little to no value.

  • Remove @remirror/core entry-point and add all core exports to the main remirror entry-point.

  • Add all Extensions and Preset package exports to the remirror/extensions subdirectory. It doesn't include framework specific exports which are made available from @remirror/react.

  • Rename @remirror/preset-table to @remirror/extension-tables.

  • Rename preset-list to extension-lists. ListPreset is now BulletListExtension and OrderListExtension.

  • Create new decorator pattern for adding @commands, @helper functions and @keyBindings.

  • Deprecate tags property on extension and encourage the use of createTags which is a method instead.

  • Rename interface CreatePluginReturn to CreateExtensionPlugin.

  • Add support for directly updating the doc attributes.

  • Deprecate top level context methods focus and blur. They should now be consumed as commands.

Removed Packages

The following packages have been removed.

  • Remove @remirror/showcase
  • Remove @remirror/react-social
  • Remove @remirror/react-wysiwyg
  • Remove package @remirror/extension-auto-link. The functionality is now self-contained within @remirror/extension-link.
ExtensionStore Extensions
  • New createDecorations extension method for adding decorations to the ProseMirror EditorView.
  • New lifecycle methods: onInitState, onApplyState, and onApplyTransaction lifecycle methods. These correspond exactly the the plugin methods which ProseMirror exposes and can be used to create plugin functionality without creating a new plugin.
  • @command, @keyBinding, @helper decorators for increased type safety when configuring extensions.
  • NamedShortcut keybindings which can be set on the keymap extension. Currently remirror defaults to using the same shortcuts as Google Docs.
  • Add the nodeOverrides property to the extensions which for advanced users allows overriding of the default NodeSpec and MarkSpec.
  • Rename addOrReplacePlugins to updatePlugins in ExtensionStore.
  • Remove reconfigureStatePlugins and auto apply it for all plugin updating methods.
Inference of Extension Types
  • Make sure all your commands in an extension are annotated with a return type of CommandFunction. Failure to do so will break all type inference wherever the extension is used.

    import { CommandFunction } from 'remirror';
    
  • When setting the name of the extension make sure to use as const otherwise it will be a string and ruin autocompletion for extension names, nodes and marks.

    class MyExtension extends PlainExtension {
      get name() {
        return 'makeItConst' as const;
      }
    }
    
  • The Remirror component now has a convenient hooks props. The hooks prop takes an array of zero parameter hook functions which are rendered into the RemirrorContext. It's a shorthand to writing out your own components. You can see the pattern in use above.

Commands

There are new hooks for working with commands.

  • Each command has an original method attached for using the original command that was used to create the command. The original command has the same type signature as the (...args: any[]) => CommandFunction. So you would call it with the command arguments and then also provide the CommandProps. This is useful when composing commands together or using commands within keyBindings which need to return a boolean.

    • You can see the insertText.original being used in the useKeymap example above.
  • useCommands() provides all the commands as hook. useChainedCommands provides all the chainable commands.

    import { useCallback } from 'react';
    import { useChainedCommands, useKeymap } from '@remirror/react';
    
    function useLetItGo() {
      const chain = useChainedCommands();
      const handler = useCallback(() => {
        chain.selectText('all').insertText('Let it goo 🤫').run();
      }, [chain]);
    
      // Whenever the user types `a` they let it all go
      useKeymap('a', handler);
    }
    
Dependencies
  • Upgrade React to require minimum versions of ^16.14.0 || ^17. This is because of the codebase now using the new jsx transform.
  • Upgrade TypeScript to a minimum of 4.3. Several of the new features make use of the new types and it is a requirement to upgrade.
  • General upgrades across all dependencies to using the latest versions.
    • All prosemirror-* packages.

0.0.0-pr706.36

pr706
1 year ago

0.0.0-pr997.1

pr997
1 year ago

0.0.0-pr993.1

pr993
1 year ago

0.0.0-pr706.35

1 year ago

0.0.0-pr706.34

1 year ago

224 Versions

TagPublished
2.0.0-beta.13beta15d ago
0.0.0-pr1801.3pr180118d ago
0.0.0-pr1801.222d ago
0.0.0-pr1801.122d ago
2.0.0-beta.121mo ago
2.0.0-beta.111mo ago
2.0.0-beta.101mo ago
2.0.0-beta.91mo ago
2.0.0-beta.81mo ago
2.0.0-beta.71mo ago
2.0.0-beta.61mo ago
2.0.0-beta.52mos ago
2.0.0-beta.42mos ago
2.0.0-beta.32mos ago
2.0.0-beta.22mos ago
2.0.0-beta.12mos ago
0.0.0-pr1713.12pr17132mos ago
0.0.0-pr1713.112mos ago
0.0.0-pr1713.102mos ago
0.0.0-pr1713.92mos ago
0.0.0-pr1713.82mos ago
0.0.0-pr1713.72mos ago
0.0.0-pr1713.62mos ago
0.0.0-pr1713.52mos ago
1.0.31latest2mos ago
0.0.0-pr1713.42mos ago
0.0.0-pr1713.32mos ago
0.0.0-pr1713.22mos ago
0.0.0-pr1713.12mos ago
1.0.302mos ago
2.0.0-beta.03mos ago
1.0.293mos ago
1.0.283mos ago
0.0.0-pr1654.1pr16543mos ago
1.0.273mos ago
0.0.0-pr1629.1pr16294mos ago
0.0.0-pr1581.3pr15814mos ago
0.0.0-pr1581.24mos ago
0.0.0-pr1581.14mos ago
1.0.264mos ago
0.0.0-pr1608.1pr16084mos ago
1.0.254mos ago
0.0.0-pr1586.1pr15864mos ago
1.0.245mos ago
1.0.235mos ago
0.0.0-pr1558.1pr15585mos ago
0.0.0-pr1552.3pr15525mos ago
0.0.0-pr1552.25mos ago
0.0.0-pr1552.15mos ago
0.0.0-pr1549.1pr15495mos ago
1.0.226mos ago
0.0.0-pr1545.1pr15456mos ago
0.0.0-pr1532.1pr15326mos ago
1.0.216mos ago
1.0.206mos ago
1.0.196mos ago
1.0.187mos ago
0.0.0-pr1496.1pr14967mos ago
1.0.177mos ago
0.0.0-pr1463.1pr14637mos ago
1.0.168mos ago
0.0.0-pr1452.1pr14528mos ago
1.0.158mos ago
0.0.0-pr1392.1pr13929mos ago
1.0.149mos ago
1.0.139mos ago
0.0.0-pr1367.1pr13679mos ago
1.0.129mos ago
0.0.0-pr1365.1pr13659mos ago
1.0.1110mos ago
0.0.0-pr1344.1pr134410mos ago
1.0.1010mos ago
0.0.0-pr1340.1pr134010mos ago
1.0.910mos ago
0.0.0-pr1310.1pr131010mos ago
0.0.0-pr1305.1pr130510mos ago
1.0.81yr ago
1.0.71yr ago
0.0.0-pr1242.4pr12421yr ago
0.0.0-pr1242.31yr ago
0.0.0-pr1242.21yr ago
0.0.0-pr1242.11yr ago
1.0.61yr ago
1.0.51yr ago
1.0.41yr ago
0.0.0-pr1174.1pr11741yr ago
1.0.31yr ago
0.0.0-pr1161.2pr11611yr ago
0.0.0-pr1161.11yr ago
0.0.0-pr1158.1pr11581yr ago
1.0.21yr ago
0.0.0-pr1102.1pr11021yr ago
0.0.0-pr1031.1pr10311yr ago
1.0.11yr ago
1.0.01yr ago
0.0.0-pr706.36pr7061yr ago
0.0.0-pr997.1pr9971yr ago
0.0.0-pr993.1pr9931yr ago
0.0.0-pr706.351yr ago
0.0.0-pr706.341yr ago