Skip to content

Commit 23eb5de

Browse files
committed
added flow
1 parent 76d9e88 commit 23eb5de

12 files changed

+4187
-7
lines changed

.babelrc

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
{
2-
"presets": ["es2015", "stage-0"]
2+
"presets": [
3+
[
4+
"env",
5+
{
6+
"modules": false,
7+
}
8+
],
9+
"flow"
10+
],
311
}

.flowconfig

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[ignore]
2+
.*/node_modules/draft-js/lib/BlockNode.js.flow
3+
.*/node_modules/draft-js/lib/DraftEditorDragHandler.js.flow
4+
.*/node_modules/draft-js/lib/DraftEditorLeaf.react.js.flow
5+
.*/node_modules/draft-js/lib/DraftEditor.react.js.flow
6+
.*/node_modules/jsonlint/.*
7+
.*/build/.*
8+
9+
[include]
10+
flow-typed
11+
12+
[options]
13+
module.system.node.resolve_dirname=node_modules
14+
module.system=haste
15+
16+
[lints]
17+
18+
[version]
19+
^0.69.0

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ node_modules
3232
# Optional REPL history
3333
.node_repl_history
3434

35-
lib/
35+
build/

flow-typed/draft-js/BlockNode.js.flow

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/**
2+
* Copyright (c) 2013-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*
9+
* @providesModule BlockNode
10+
* @format
11+
* @flow
12+
*/
13+
14+
'use strict';
15+
16+
import type CharacterMetadata from '../../node_modules/draft-js/lib/CharacterMetadata';
17+
import type { DraftBlockType } from '../../node_modules/draft-js/lib/DraftBlockType';
18+
import type { DraftInlineStyle } from '../../node_modules/draft-js/lib/DraftInlineStyle';
19+
import type { List, Map } from 'immutable';
20+
21+
export type BlockNodeKey = string;
22+
23+
export type BlockNodeConfig = {
24+
characterList?: List<CharacterMetadata>;
25+
data?: Map<any, any>;
26+
depth?: number;
27+
key?: BlockNodeKey;
28+
text?: string;
29+
type?: DraftBlockType;
30+
};
31+
32+
// https://github.com/facebook/draft-js/issues/1492
33+
// prettier-ignore
34+
export interface BlockNode {
35+
+findEntityRanges: (filterFn: (value: CharacterMetadata) => boolean, callback: (start: number, end: number) => void) => void;
36+
37+
+findStyleRanges: (filterFn: (value: CharacterMetadata) => boolean, callback: (start: number, end: number) => void) => void;
38+
39+
+getCharacterList: () => List<CharacterMetadata>;
40+
41+
+getData: () => Map<any, any>;
42+
43+
+getDepth: () => number;
44+
45+
+getEntityAt: (offset: number) => ?string;
46+
47+
+getInlineStyleAt: (offset: number) => DraftInlineStyle;
48+
49+
+getKey: () => BlockNodeKey;
50+
51+
+getLength: () => number;
52+
53+
+getText: () => string;
54+
55+
+getType: () => DraftBlockType;
56+
}

0 commit comments

Comments
 (0)