File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -26,24 +26,26 @@ export function makeChanges(
2626 right : string [ ] ,
2727 { userId, head } : Init ,
2828) {
29+ // 改行文字が入るのを防ぐ
30+ const right_ = right . flatMap ( ( text ) => text . split ( "\n" ) ) ;
2931 // 本文の差分
30- const changes : Change [ ] = [ ...diffToChanges ( left , right , { userId } ) ] ;
32+ const changes : Change [ ] = [ ...diffToChanges ( left , right_ , { userId } ) ] ;
3133
3234 // titleの差分を入れる
3335 // 空ページの場合もタイトル変更commitを入れる
34- if ( left [ 0 ] . text !== right [ 0 ] || ! head . persistent ) {
35- changes . push ( { title : right [ 0 ] } ) ;
36+ if ( left [ 0 ] . text !== right_ [ 0 ] || ! head . persistent ) {
37+ changes . push ( { title : right_ [ 0 ] } ) ;
3638 }
3739
3840 // descriptionsの差分を入れる
3941 const leftDescriptions = left . slice ( 1 , 6 ) . map ( ( line ) => line . text ) ;
40- const rightDescriptions = right . slice ( 1 , 6 ) ;
42+ const rightDescriptions = right_ . slice ( 1 , 6 ) ;
4143 if ( leftDescriptions . join ( "" ) !== rightDescriptions . join ( "" ) ) {
4244 changes . push ( { descriptions : rightDescriptions } ) ;
4345 }
4446
4547 // リンクと画像の差分を入れる
46- const [ linksLc , image ] = findLinksAndImage ( right . join ( "\n" ) ) ;
48+ const [ linksLc , image ] = findLinksAndImage ( right_ . join ( "\n" ) ) ;
4749 if (
4850 head . linksLc . length !== linksLc . length ||
4951 ! head . linksLc . every ( ( link ) => linksLc . includes ( link ) )
You can’t perform that action at this time.
0 commit comments