Skip to content

Commit

Permalink
Merge pull request DefinitelyTyped#33049 from dddotsev/feature/update…
Browse files Browse the repository at this point in the history
…-prosemirror-invisibles

Update @guardian/prosemirror-invisibles to 1.2
  • Loading branch information
minestarks authored Feb 14, 2019
2 parents a2a9141 + 99e12dc commit f37d7b0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { Node } from 'prosemirror-model';
import { Plugin } from 'prosemirror-state';

import invisibles, { hardBreak, paragraph, space, Builder } from 'guardian__prosemirror-invisibles';
import invisibles, { hardBreak, paragraph, space, Builder, character, node } from 'guardian__prosemirror-invisibles';

const plugin1: Plugin = invisibles([hardBreak((node: Node) => true), paragraph(), space((char: string) => false)]);

const plugin2: Plugin = invisibles([hardBreak(), paragraph((node: Node) => false), space()]);
const a: Builder = character('letter-a')(char => char === 'a');

const someNode: Builder = node('some-node', (node: Node, pos: number) => 1)((node: Node) => true);

const plugin2: Plugin = invisibles([hardBreak(), paragraph((node: Node) => false), space(), a, someNode]);
6 changes: 5 additions & 1 deletion types/guardian__prosemirror-invisibles/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Type definitions for @guardian/prosemirror-invisibles 1.0
// Type definitions for @guardian/prosemirror-invisibles 1.2
// Project: https://github.com/guardian/prosemirror-invisibles
// Definitions by: Daniil Dotsev <https://github.com/dddotsev>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
Expand All @@ -17,6 +17,10 @@ export interface TextBetweenPosition {

export default function(builders: Builder[]): Plugin;

export function character(type: string): (predicate: (char: string) => boolean) => Builder;
export function node(type: string, toPosition: (node: Node, pos: number) => number):
(predicate: (node: Node) => boolean) => Builder;

export function hardBreak(predicate?: (node: Node) => boolean): Builder;
export function paragraph(predicate?: (node: Node) => boolean): Builder;
export function space(predicate?: (char: string) => boolean): Builder;
Expand Down

0 comments on commit f37d7b0

Please sign in to comment.