Added typings for prosemirror-inputrules 0.18.0

This commit is contained in:
David Hahn
2017-03-07 10:18:35 +01:00
parent 3a68ea2769
commit 96aac2f425
3 changed files with 63 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
// Type definitions for prosemirror-inputrules 0.18.0
// Project: https://github.com/ProseMirror/prosemirror-inputrules
// Definitions by: David Hahn <https://github.com/davidka>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { EditorState } from 'prosemirror-state'
import { Transaction } from 'prosemirror-state'
import { Plugin } from 'prosemirror-state'
import { NodeType } from 'prosemirror-model'
import { ProsemirrorNode } from 'prosemirror-model'
declare module "prosemirror-inputrules" {
export class InputRule {
constructor(match: RegExp, handler: string | ((state: EditorState, match: string[], start: number, end: number) => Transaction))
}
export function inputRules(config: { rules: InputRule[] }): Plugin
export let emDash: InputRule;
export let ellipsis: InputRule;
export let openDoubleQuote: InputRule;
export let closeDoubleQuote: InputRule;
export let openSingleQuote: InputRule;
export let closeSingleQuote: InputRule;
export let smartQuotes: InputRule[];
export let allInputRules: InputRule[];
export function wrappingInputRule(regexp: RegExp, nodeType: NodeType, getAttrs?: Object | ((p: string[]) => Object | void), joinPredicate?: (p1: string[], p2: ProsemirrorNode) => boolean): InputRule
export function textblockTypeInputRule(regexp: RegExp, nodeType: NodeType, getAttrs?: Object | ((p: string[]) => Object | void)): InputRule
export function blockQuoteRule(nodeType: NodeType): InputRule
export function orderedListRule(nodeType: NodeType): InputRule
export function bulletListRule(nodeType: NodeType): InputRule
export function codeBlockRule(nodeType: NodeType): InputRule
export function headingRule(nodeType: NodeType, maxLevel: number): InputRule
}
@@ -0,0 +1,5 @@
import * as inputrules from 'prosemirror-inputrules';
import { NodeType } from 'prosemirror-model'
let nodeType = new NodeType();
let rule = inputrules.blockQuoteRule(nodeType);
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"prosemirror-inputrules-tests.ts"
]
}