mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 07:47:04 +00:00
Merge pull request #31992 from dddotsev/update-prosemirror-invisibles
Update @guardian/prosemirror-invisibles typings
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
import invisibles, { hardBreak, paragraph, space } from 'guardian__prosemirror-invisibles';
|
||||
import { Node } from 'prosemirror-model';
|
||||
import { Plugin } from 'prosemirror-state';
|
||||
|
||||
const plugin = invisibles([hardBreak, paragraph, space]);
|
||||
import invisibles, { hardBreak, paragraph, space, Builder } 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()]);
|
||||
|
||||
+13
-5
@@ -1,17 +1,25 @@
|
||||
// Type definitions for @guardian/prosemirror-invisibles 0.1
|
||||
// Type definitions for @guardian/prosemirror-invisibles 1.0
|
||||
// Project: https://github.com/guardian/prosemirror-invisibles
|
||||
// Definitions by: Daniil Dotsev <https://github.com/dddotsev>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { Node } from 'prosemirror-model';
|
||||
import { DecorationSet } from "prosemirror-view";
|
||||
import { Decoration, DecorationSet } from "prosemirror-view";
|
||||
import { Plugin } from 'prosemirror-state';
|
||||
|
||||
export type Builder = (from: number, to: number, doc: Node, decos: DecorationSet) => DecorationSet;
|
||||
|
||||
export interface TextBetweenPosition {
|
||||
pos: number;
|
||||
text: string;
|
||||
}
|
||||
|
||||
export default function(builders: Builder[]): Plugin;
|
||||
|
||||
export const hardBreak: Builder;
|
||||
export const paragraph: Builder;
|
||||
export const space: 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;
|
||||
|
||||
export function createDeco(pos: number, type: string): Decoration;
|
||||
export function textBetween(from: number, to: number, doc: Node): TextBetweenPosition[];
|
||||
|
||||
Reference in New Issue
Block a user