From 9b973c41ebfe5b03f027dfc7459c5d13fe4681eb Mon Sep 17 00:00:00 2001 From: Alexander T Date: Mon, 4 Nov 2019 23:06:19 +0200 Subject: [PATCH] braft-editor: Provides its own types (#39646) --- notNeededPackages.json | 6 ++ types/braft-editor/braft-editor-tests.tsx | 31 --------- types/braft-editor/index.d.ts | 81 ----------------------- types/braft-editor/tsconfig.json | 25 ------- types/braft-editor/tslint.json | 1 - 5 files changed, 6 insertions(+), 138 deletions(-) delete mode 100644 types/braft-editor/braft-editor-tests.tsx delete mode 100644 types/braft-editor/index.d.ts delete mode 100644 types/braft-editor/tsconfig.json delete mode 100644 types/braft-editor/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index f5cdbb3ffc..672234a63e 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -348,6 +348,12 @@ "sourceRepoURL": "https://github.com/sindresorhus/boxen", "asOfVersion": "3.0.1" }, + { + "libraryName": "braft-editor", + "typingsPackageName": "braft-editor", + "sourceRepoURL": "https://github.com/margox/braft#readme", + "asOfVersion": "2.2.0" + }, { "libraryName": "broccoli-plugin", "typingsPackageName": "broccoli-plugin", diff --git a/types/braft-editor/braft-editor-tests.tsx b/types/braft-editor/braft-editor-tests.tsx deleted file mode 100644 index 48513f6de4..0000000000 --- a/types/braft-editor/braft-editor-tests.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import * as React from "react"; -import BraftEditor = require("braft-editor"); -import { - RawDraftContentState, -} from 'draft-js'; -class BraftEditorTest extends React.Component { - state = { - content: null - }; - render() { - const editorProps = { - height: 500, - initialContent: this.state.content, - onChange: this.handleChange, - onHTMLChange: this.handleHTMLChange, - }; - return ( -
- -
- ); - } - private readonly handleChange = (content: RawDraftContentState) => { - console.log(content); - } - private readonly handleHTMLChange = (html: string) => { - console.log(html); - } -} diff --git a/types/braft-editor/index.d.ts b/types/braft-editor/index.d.ts deleted file mode 100644 index 442b07acb7..0000000000 --- a/types/braft-editor/index.d.ts +++ /dev/null @@ -1,81 +0,0 @@ -// Type definitions for braft-editor 1.9 -// Project: https://github.com/margox/braft#readme -// Definitions by: Jonny Yao -// Munif Tanjim -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.9 - -import * as React from "react"; -import { RawDraftContentState } from 'draft-js'; -export as namespace BraftEditor; -export = BraftEditor; -declare namespace BraftEditor { - interface fontFamiliesRange { - name: string; - family: string; - } - interface editorProps { - editorState?: any; - contentFormat?: 'raw' | 'html'; - initialContent?: string | null; - contentId?: string | number; - onChange?: (content: RawDraftContentState) => void; - onRawChange?: (content: RawDraftContentState) => void; - onHTMLChange?: (content: string) => void; - onTab?: (event: Event) => void; - onSave?: () => void; - onFocus?: () => void; - onBlur?: () => void; - controls?: string[]; - excludeControls?: string[]; - extendControls?: any[]; - extendAtomics?: any[]; - disabled?: boolean; - height?: number; - language?: string; - placeholder?: string; - viewWrapper?: string; - tabIndents?: number; - forceNewLine?: boolean; - textAlignOptions?: string[]; - colors?: string[]; - allowSetTextBackgroundColor?: boolean; - fontSizes?: number[]; - lineHeights?: number[]; - letterSpacings?: number[]; - indents?: number[]; - fontFamilies?: fontFamiliesRange[]; - emojis?: string[]; - pasteMode?: 'text' | ''; - media?: { [key: string]: any }; - imageControls?: any; - getContent?: (format?: string) => RawDraftContentState; - setContent?: (content: RawDraftContentState, format?: string) => void; - toggleSelectionBlockType?: (blockquote: string) => any; - toggleSelectionInlineStyle?: (style: string, stylesToBeRemoved?: string[]) => any; - insertMedias?: (medias: Array<{ type: string, name: string, url: string }>) => any; - insertText?: (text: string, replace?: boolean) => any; - insertHTML?: (htmlString: string) => any; - toggleSelectionLink?: (href: string, target: string) => void; - toggleSelectionAlignment?: (alignment: string) => any; - toggleSelectionColor?: (hexColor: string) => void; - toggleSelectionBackgroundColor?: (hexColor: string) => void; - toggleSelectionFontSize?: (fontSize: number) => void; - toggleSelectionFontFamily?: (fontFamily: string) => void; - selectionCollapsed?: () => boolean; - selectionHasInlineStyle?: () => boolean; - getSelectionBlockType?: () => string; - getEditorState?: () => void; - forceRender?: () => void; - getDraftInstance?: () => any; - getMediaLibraryInstance?: () => any; - getSelectionInlineStyle?: () => any; - isEmpty?: () => boolean; - clear?: () => any; - undo?: () => any; - redo?: () => any; - focus?: () => any; - blur?: () => any; - } -} -declare class BraftEditor extends React.Component { } diff --git a/types/braft-editor/tsconfig.json b/types/braft-editor/tsconfig.json deleted file mode 100644 index f04b8febfe..0000000000 --- a/types/braft-editor/tsconfig.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "jsx": "react", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "braft-editor-tests.tsx" - ] -} \ No newline at end of file diff --git a/types/braft-editor/tslint.json b/types/braft-editor/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/braft-editor/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" }