File tree Expand file tree Collapse file tree
packages/super-editor/src/core Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -77,16 +77,20 @@ class DocxZipper {
7777 }
7878
7979 getFileExtension ( fileName ) {
80- return fileName . split ( '.' ) . pop ( ) ;
80+ const fileSplit = fileName . split ( '.' ) ;
81+ if ( fileSplit . length < 2 ) return null ;
82+ return fileSplit [ fileSplit . length - 1 ] ;
8183 }
8284
8385 /**
8486 * Update [Content_Types].xml with extensions of new Image annotations
8587 */
8688 async updateContentTypes ( docx , media , fromJson ) {
87- const newMediaTypes = Object . keys ( media ) . map ( ( name ) => {
88- return this . getFileExtension ( name ) ;
89- } ) ;
89+ const newMediaTypes = Object . keys ( media )
90+ . map ( ( name ) => {
91+ return this . getFileExtension ( name ) ;
92+ } )
93+ . filter ( Boolean ) ;
9094
9195 const contentTypesPath = '[Content_Types].xml' ;
9296 let contentTypesXml ;
Original file line number Diff line number Diff line change @@ -226,10 +226,9 @@ function generateParagraphProperties(node) {
226226 if ( lineSpaceBefore >= 0 ) attributes [ 'w:before' ] = pixelsToTwips ( lineSpaceBefore ) ;
227227 if ( lineSpaceAfter >= 0 ) attributes [ 'w:after' ] = pixelsToTwips ( lineSpaceAfter ) ;
228228
229- if ( lineRule === 'exact' ) {
230- if ( lineHeight ) attributes [ 'w:line' ] = ptToTwips ( parseFloat ( lineHeight ) ) ;
231- } else {
232- if ( lineHeight ) attributes [ 'w:line' ] = linesToTwips ( lineHeight ) ;
229+ if ( lineHeight && ! Number . isNaN ( parseFloat ( lineHeight ) ) ) {
230+ if ( lineRule === 'exact' ) attributes [ 'w:line' ] = ptToTwips ( parseFloat ( lineHeight ) ) ;
231+ else attributes [ 'w:line' ] = linesToTwips ( lineHeight ) ;
233232 }
234233
235234 attributes [ 'w:lineRule' ] = lineRule || 'auto' ;
@@ -1838,7 +1837,6 @@ function translateImageNode(params, imageSize) {
18381837 }
18391838
18401839 const imageUrl = `media/${ imageName } _${ attrs . hash } .${ type } ` ;
1841-
18421840 imageId = addNewImageRelationship ( params , imageUrl ) ;
18431841 params . media [ `${ imageName } _${ attrs . hash } .${ type } ` ] = src ;
18441842 }
You can’t perform that action at this time.
0 commit comments