This repository was archived by the owner on Oct 11, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +26
-16
lines changed Expand file tree Collapse file tree 3 files changed +26
-16
lines changed Original file line number Diff line number Diff line change 76
76
"postcss-loader" : " ^1.1.1" ,
77
77
"prettier" : " ^1.7.0" ,
78
78
"prismjs" : " ^1.6.0" ,
79
- "react" : " ^15.4.1 " ,
79
+ "react" : " 16.2.x " ,
80
80
"react-addons-pure-render-mixin" : " ^15.4.1" ,
81
81
"react-addons-test-utils" : " ^15.4.1" ,
82
- "react-dom" : " ^15.4.1 " ,
82
+ "react-dom" : " 16.2.0 " ,
83
83
"react-github-corner" : " ^2.0.0" ,
84
84
"react-github-fork-ribbon" : " ^0.4.4" ,
85
85
"react-test-renderer" : " ^16.2.0" ,
Original file line number Diff line number Diff line change @@ -7,16 +7,27 @@ const changeCurrentBlockType = (
7
7
blockMetadata = { }
8
8
) => {
9
9
const currentContent = editorState . getCurrentContent ( ) ;
10
- const selection = editorState . getSelection ( ) ;
10
+ let selection = editorState . getSelection ( ) ;
11
11
const key = selection . getStartKey ( ) ;
12
12
const blockMap = currentContent . getBlockMap ( ) ;
13
13
const block = blockMap . get ( key ) ;
14
14
const data = block . getData ( ) . merge ( blockMetadata ) ;
15
15
const newBlock = block . merge ( { type, data, text : text } ) ;
16
+
17
+ const lastOffset = text . length ;
18
+
19
+ if ( selection . getFocusOffset ( ) > lastOffset ) {
20
+ selection = selection . merge ( {
21
+ anchorOffset : lastOffset ,
22
+ focusOffset : lastOffset ,
23
+ } ) ;
24
+ }
25
+
16
26
const newContentState = currentContent . merge ( {
17
27
blockMap : blockMap . set ( key , newBlock ) ,
18
28
selectionAfter : selection ,
19
29
} ) ;
30
+
20
31
return EditorState . push ( editorState , newContentState , "change-block-type" ) ;
21
32
} ;
22
33
Original file line number Diff line number Diff line change @@ -5273,14 +5273,14 @@ react-deep-force-update@^1.0.0:
5273
5273
version "1.1.1"
5274
5274
resolved "https://registry.yarnpkg.com/react-deep-force-update/-/react-deep-force-update-1.1.1.tgz#bcd31478027b64b3339f108921ab520b4313dc2c"
5275
5275
5276
- react-dom@^15.4.1 :
5277
- version "15.6.1 "
5278
- resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.6.1 .tgz#2cb0ed4191038e53c209eb3a79a23e2a4cf99470 "
5276
+ react-dom@16.2.0 :
5277
+ version "16.2.0 "
5278
+ resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.2.0 .tgz#69003178601c0ca19b709b33a83369fe6124c044 "
5279
5279
dependencies :
5280
- fbjs "^0.8.9 "
5280
+ fbjs "^0.8.16 "
5281
5281
loose-envify "^1.1.0"
5282
- object-assign "^4.1.0 "
5283
- prop-types "^15.5.10 "
5282
+ object-assign "^4.1.1 "
5283
+ prop-types "^15.6.0 "
5284
5284
5285
5285
react-github-corner@^2.0.0 :
5286
5286
version "2.0.0"
@@ -5326,15 +5326,14 @@ react@*:
5326
5326
object-assign "^4.1.0"
5327
5327
prop-types "^15.5.10"
5328
5328
5329
- react@^15.4.1 :
5330
- version "15.6.2 "
5331
- resolved "https://registry.yarnpkg.com/react/-/react-15.6.2. tgz#dba0434ab439cfe82f108f0f511663908179aa72 "
5329
+ react@16.2.x :
5330
+ version "16.2.0 "
5331
+ resolved "https://registry.yarnpkg.com/react/-/react-16.2.0. tgz#a31bd2dab89bff65d42134fa187f24d054c273ba "
5332
5332
dependencies :
5333
- create-react-class "^15.6.0"
5334
- fbjs "^0.8.9"
5333
+ fbjs "^0.8.16"
5335
5334
loose-envify "^1.1.0"
5336
- object-assign "^4.1.0 "
5337
- prop-types "^15.5.10 "
5335
+ object-assign "^4.1.1 "
5336
+ prop-types "^15.6.0 "
5338
5337
5339
5338
read-pkg-up@^1.0.1 :
5340
5339
version "1.0.1"
You can’t perform that action at this time.
0 commit comments