Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions packages/super-editor/src/core/DocxZipper.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,20 @@ class DocxZipper {
}

getFileExtension(fileName) {
return fileName.split('.').pop();
const fileSplit = fileName.split('.');
if (fileSplit.length < 2) return null;
return fileSplit[fileSplit.length - 1];
}

/**
* Update [Content_Types].xml with extensions of new Image annotations
*/
async updateContentTypes(docx, media, fromJson) {
const newMediaTypes = Object.keys(media).map((name) => {
return this.getFileExtension(name);
});
const newMediaTypes = Object.keys(media)
.map((name) => {
return this.getFileExtension(name);
})
.filter(Boolean);

const contentTypesPath = '[Content_Types].xml';
let contentTypesXml;
Expand Down
8 changes: 3 additions & 5 deletions packages/super-editor/src/core/super-converter/exporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,9 @@ function generateParagraphProperties(node) {
if (lineSpaceBefore >= 0) attributes['w:before'] = pixelsToTwips(lineSpaceBefore);
if (lineSpaceAfter >= 0) attributes['w:after'] = pixelsToTwips(lineSpaceAfter);

if (lineRule === 'exact') {
if (lineHeight) attributes['w:line'] = ptToTwips(parseFloat(lineHeight));
} else {
if (lineHeight) attributes['w:line'] = linesToTwips(lineHeight);
if (lineHeight && !Number.isNaN(parseFloat(lineHeight))) {
if (lineRule === 'exact') attributes['w:line'] = ptToTwips(parseFloat(lineHeight));
else attributes['w:line'] = linesToTwips(lineHeight);
}

attributes['w:lineRule'] = lineRule || 'auto';
Expand Down Expand Up @@ -1838,7 +1837,6 @@ function translateImageNode(params, imageSize) {
}

const imageUrl = `media/${imageName}_${attrs.hash}.${type}`;

imageId = addNewImageRelationship(params, imageUrl);
params.media[`${imageName}_${attrs.hash}.${type}`] = src;
}
Expand Down
Loading