Skip to content

Commit

Permalink
fix: remove extra static props for DocExtension
Browse files Browse the repository at this point in the history
This was causing errors on the build when tests were run.
  • Loading branch information
ifiokjr committed Jul 28, 2020
1 parent 90991e5 commit 0b98816
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 19 deletions.
7 changes: 2 additions & 5 deletions docs/concepts/keymap.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,14 @@ The `next` method allows full control beyond the return value. It allows both ca
priority key bindings regardless of whether true or false has been called.

```tsx
import { BaseExtensionOptions, Extension, KeyBindings } from '@remirror/core';
import { BaseExtensionOptions, Extension, KeyBindings, extensionDecorator } from '@remirror/core';

interface CustomKeymapExtensionOptions {
override?: boolean;
}

@extensionDecorator({ defaultOptions: { override: false } })
export class CustomKeymapExtension extends Extension<CustomKeymapExtensionOptions> {
static readonly defaultOptions = {
override: false,
};

get name() {
return 'customKeymap' as const;
}
Expand Down
11 changes: 6 additions & 5 deletions docs/concepts/priority.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,16 @@ Now your customExtension will have a priority level that's higher than other ext
run prior to other extensions.

If you have full control of the extension you can also set the `defaultPriority` as a static
property to achieve the same effect.
property with the `extension.

```ts
import { Extension, ExtensionPriority } from 'remirror/core';
import { Extension, ExtensionPriority, extensionDecorator } from 'remirror/core';

class CustomExtension extends Extension {
@extensionDecorator({
// Now every custom extension created will have a `High` priority than default.
static readonly defaultPriority = ExtensionPriority.High;

defaultPriority: ExtensionPriority.High,
})
class CustomExtension extends Extension {
get name() {
return 'custom' as const;
}
Expand Down
7 changes: 5 additions & 2 deletions packages/@remirror/core-types/src/annotation-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,17 @@ export type Dynamic<Type> = Type & DynamicAnnotation;
* to automate this.
*
* ```ts
* import { PlainExtension } from 'remirror/core';
* import { PlainExtension, extensionDecorator } from 'remirror/core';
* interface CustomOptions {
* simple: boolean; // Automatically a dynamic property
* onChange: Handler<(value: string) => void>;
* }
*
* @extensionDecorator({ handlerKeys: ['onChange'] })
* class CustomExtension extends PlainExtension<CustomOptions> {
* static readonly handlerKeys = ['onChange'];
* get name() {
* return 'custom' as const;
* }
* }
*
* // No prompt to include the `onChange` handler due to the annotation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
EditorState,
extensionDecorator,
Handler,
HandlerKeyList,
invariant,
isArray,
isNumber,
Expand Down Expand Up @@ -36,8 +35,6 @@ import { Step } from '@remirror/pm/transform';
handlerKeys: ['onSendableReceived'],
})
export class CollaborationExtension extends PlainExtension<CollaborationOptions> {
static readonly handlerKeys: HandlerKeyList<CollaborationOptions> = ['onSendableReceived'];

get name() {
return 'collaboration';
}
Expand Down
5 changes: 1 addition & 4 deletions packages/@remirror/extension-doc/src/doc-extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,9 @@ export interface DocOptions {
},
defaultPriority: ExtensionPriority.Medium,
staticKeys: ['content'],
disableExtraAttributes: true,
})
export class DocExtension extends NodeExtension<DocOptions> {
static readonly defaultPriority = ExtensionPriority.Medium;

static readonly disableExtraAttributes = true;

get name() {
return 'doc' as const;
}
Expand Down

1 comment on commit 0b98816

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Published on https://remirror.io as production
🚀 Deployed on https://5f20476b69b18f5cfb952887--remirror.netlify.app

Please sign in to comment.