@@ -3,7 +3,7 @@ import { OrderedSet, Map } from 'immutable';
3
3
const SPACE = ' ' ;
4
4
const MAX_DEPTH = 4 ;
5
5
6
- const getWhitespaceChunk = ( entityId : ?string ) : Object => {
6
+ export const getWhitespaceChunk = ( entityId : ?string ) : Object => {
7
7
return {
8
8
text : SPACE ,
9
9
inlines : [ new OrderedSet ( ) ] ,
@@ -12,7 +12,7 @@ const getWhitespaceChunk = (entityId: ?string): Object => {
12
12
} ;
13
13
} ;
14
14
15
- const createTextChunk = ( node : Object , inlineStyle : OrderedSet , entityId : number ) : Object => {
15
+ export const createTextChunk = ( node : Object , inlineStyle : OrderedSet , entityId : number ) : Object => {
16
16
const text = node . textContent ;
17
17
if ( text . trim ( ) === '' ) {
18
18
return { chunk : getWhitespaceChunk ( entityId ) } ;
@@ -27,7 +27,7 @@ const createTextChunk = (node: Object, inlineStyle: OrderedSet, entityId: number
27
27
} ;
28
28
} ;
29
29
30
- const getSoftNewlineChunk = ( ) : Object => {
30
+ export const getSoftNewlineChunk = ( ) : Object => {
31
31
return {
32
32
text : '\n' ,
33
33
inlines : [ new OrderedSet ( ) ] ,
@@ -36,7 +36,7 @@ const getSoftNewlineChunk = (): Object => {
36
36
} ;
37
37
} ;
38
38
39
- const getEmptyChunk = ( ) : Object => {
39
+ export const getEmptyChunk = ( ) : Object => {
40
40
return {
41
41
text : '' ,
42
42
inlines : [ ] ,
@@ -45,7 +45,7 @@ const getEmptyChunk = (): Object => {
45
45
} ;
46
46
} ;
47
47
48
- const getFirstBlockChunk = ( blockType : string , data : Object ) : Object => {
48
+ export const getFirstBlockChunk = ( blockType : string , data : Object ) : Object => {
49
49
return {
50
50
text : '' ,
51
51
inlines : [ ] ,
@@ -58,7 +58,7 @@ const getFirstBlockChunk = (blockType: string, data: Object): Object => {
58
58
} ;
59
59
} ;
60
60
61
- const getBlockDividerChunk = ( blockType : string , depth : number , data : Object ) : Object => {
61
+ export const getBlockDividerChunk = ( blockType : string , depth : number , data : Object ) : Object => {
62
62
return {
63
63
text : '\r' ,
64
64
inlines : [ ] ,
@@ -71,7 +71,7 @@ const getBlockDividerChunk = (blockType: string, depth: number, data: Object): O
71
71
} ;
72
72
} ;
73
73
74
- const getAtomicBlockChunk = ( entityId : number ) : Object => {
74
+ export const getAtomicBlockChunk = ( entityId : number ) : Object => {
75
75
return {
76
76
text : '\r ' ,
77
77
inlines : [ new OrderedSet ( ) ] ,
@@ -84,22 +84,11 @@ const getAtomicBlockChunk = (entityId: number): Object => {
84
84
} ;
85
85
} ;
86
86
87
- const joinChunks = ( A : Object , B : Object ) : Object => {
87
+ export const joinChunks = ( A : Object , B : Object ) : Object => {
88
88
return {
89
89
text : A . text + B . text ,
90
90
inlines : A . inlines . concat ( B . inlines ) ,
91
91
entities : A . entities . concat ( B . entities ) ,
92
92
blocks : A . blocks . concat ( B . blocks ) ,
93
93
} ;
94
94
}
95
-
96
- module . exports = {
97
- createTextChunk,
98
- getWhitespaceChunk,
99
- getSoftNewlineChunk,
100
- getEmptyChunk,
101
- getBlockDividerChunk,
102
- getFirstBlockChunk,
103
- getAtomicBlockChunk,
104
- joinChunks,
105
- } ;
0 commit comments