File tree Expand file tree Collapse file tree 8 files changed +16
-13
lines changed
react-native-markdown-renderer Expand file tree Collapse file tree 8 files changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,7 @@ const routes = {
96
96
97
97
if ( token . content === name ) {
98
98
const newToken = new Token ( name , '' , token . nesting ) ;
99
+
99
100
newToken . content = token . content ;
100
101
block . children = md . utils . arrayReplaceAt ( block . children , j , [ newToken ] ) ;
101
102
}
Original file line number Diff line number Diff line change @@ -51,7 +51,6 @@ export default class Markdown extends Component {
51
51
let invalidProps = [ ] ;
52
52
const prop = props [ propName ] ;
53
53
54
-
55
54
if ( ! prop ) {
56
55
return ;
57
56
}
Original file line number Diff line number Diff line change @@ -3,5 +3,6 @@ export default class Token {
3
3
this . type = type ;
4
4
this . nesting = nesting ;
5
5
this . children = children ;
6
+ this . block = false ;
6
7
}
7
8
}
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export function cleanupTokens(tokens) {
15
15
if ( token . type === 'link' && token . nesting === 1 ) {
16
16
stack . push ( token ) ;
17
17
} else if ( stack . length > 0 && token . type === 'link' && token . nesting === - 1 ) {
18
- if ( stack . some ( stackToken => ! getIsTextType ( stackToken . type ) ) ) {
18
+ if ( stack . some ( stackToken => stackToken . block ) ) {
19
19
stack [ 0 ] . type = 'blocklink' ;
20
20
token . type = 'blocklink' ;
21
21
}
Original file line number Diff line number Diff line change 1
- import getIsTextType from './getIsTextType' ;
1
+ // import getIsTextType from './getIsTextType';
2
2
import Token from './Token' ;
3
- import getIsInlineTextType from './getIsInlineTextType' ;
3
+ // import getIsInlineTextType from './getIsInlineTextType';
4
4
5
5
export default function groupTextTokens ( tokens ) {
6
6
const result = [ ] ;
7
7
8
8
let hasGroup = false ;
9
9
tokens . forEach ( ( token , index ) => {
10
- if ( getIsTextType ( token . type ) && ! hasGroup ) {
10
+ if ( ! token . block && ! hasGroup ) {
11
11
hasGroup = true ;
12
12
result . push ( new Token ( 'textgroup' , 1 ) ) ;
13
13
result . push ( token ) ;
14
- } else if ( getIsTextType ( token . type ) && ! getIsInlineTextType ( token . type ) && hasGroup ) {
14
+ } else if ( ! token . block && hasGroup ) {
15
15
hasGroup = false ;
16
16
result . push ( token ) ;
17
17
result . push ( new Token ( 'textgroup' , - 1 ) ) ;
18
- } else if ( ! getIsTextType ( token . type ) && hasGroup ) {
18
+ } else if ( token . block && hasGroup ) {
19
19
hasGroup = false ;
20
20
result . push ( new Token ( 'textgroup' , - 1 ) ) ;
21
21
result . push ( token ) ;
Original file line number Diff line number Diff line change @@ -3,5 +3,7 @@ export default class Token {
3
3
this . type = type ;
4
4
this . nesting = nesting ;
5
5
this . children = children ;
6
+ this . block = false ;
7
+
6
8
}
7
9
}
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export function cleanupTokens(tokens) {
15
15
if ( token . type === 'link' && token . nesting === 1 ) {
16
16
stack . push ( token ) ;
17
17
} else if ( stack . length > 0 && token . type === 'link' && token . nesting === - 1 ) {
18
- if ( stack . some ( stackToken => ! getIsTextType ( stackToken . type ) ) ) {
18
+ if ( stack . some ( stackToken => stackToken . block ) ) {
19
19
stack [ 0 ] . type = 'blocklink' ;
20
20
token . type = 'blocklink' ;
21
21
}
Original file line number Diff line number Diff line change 1
- import getIsTextType from './getIsTextType' ;
1
+ // import getIsTextType from './getIsTextType';
2
2
import Token from './Token' ;
3
- import getIsInlineTextType from './getIsInlineTextType' ;
3
+ // import getIsInlineTextType from './getIsInlineTextType';
4
4
5
5
export default function groupTextTokens ( tokens ) {
6
6
const result = [ ] ;
7
7
8
8
let hasGroup = false ;
9
9
tokens . forEach ( ( token , index ) => {
10
- if ( getIsTextType ( token . type ) && ! hasGroup ) {
10
+ if ( ! token . block && ! hasGroup ) {
11
11
hasGroup = true ;
12
12
result . push ( new Token ( 'textgroup' , 1 ) ) ;
13
13
result . push ( token ) ;
14
- } else if ( getIsTextType ( token . type ) && ! getIsInlineTextType ( token . type ) && hasGroup ) {
14
+ } else if ( ! token . block && hasGroup ) {
15
15
hasGroup = false ;
16
16
result . push ( token ) ;
17
17
result . push ( new Token ( 'textgroup' , - 1 ) ) ;
18
- } else if ( ! getIsTextType ( token . type ) && hasGroup ) {
18
+ } else if ( token . block && hasGroup ) {
19
19
hasGroup = false ;
20
20
result . push ( new Token ( 'textgroup' , - 1 ) ) ;
21
21
result . push ( token ) ;
You can’t perform that action at this time.
0 commit comments