Merge pull request #33049 from dddotsev/feature/update-prosemirror-invisibles

Update @guardian/prosemirror-invisibles to 1.2
This commit is contained in:
Mine Starks
2019-02-14 08:53:35 -08:00
committed by GitHub
2 changed files with 11 additions and 3 deletions
@@ -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]);
+5 -1
View File
@@ -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
@@ -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;