Skip to content

Commit ef2fc3a

Browse files
committed
Fix header import overriding default
1 parent bddad27 commit ef2fc3a

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

packages/super-editor/src/core/super-converter/v2/importer/docxImporter.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,8 @@ const importHeadersFooters = (docx, converter, editor) => {
440440
const { rId, referenceFile, currentFileName } = getHeaderFooterSectionData(header, docx);
441441

442442
const sectPrHeader = allSectPrElements.find((el) => el.name === 'w:headerReference' && el.attributes['r:id'] === rId);
443-
const sectionType = sectPrHeader?.attributes['w:type'];
443+
let sectionType = sectPrHeader?.attributes['w:type'];
444+
if (converter.headerIds[sectionType]) sectionType = null;
444445
const nodeListHandler = defaultNodeListHandler();
445446
const schema = nodeListHandler.handler({
446447
nodes: referenceFile.elements[0].elements,
@@ -454,7 +455,7 @@ const importHeadersFooters = (docx, converter, editor) => {
454455
if (!converter.headerIds.ids) converter.headerIds.ids = [];
455456
converter.headerIds.ids.push(rId);
456457
converter.headers[rId] = { type: 'doc', content: [...schema] };
457-
converter.headerIds[sectionType] = rId;
458+
sectionType && (converter.headerIds[sectionType] = rId);
458459
});
459460

460461
footers.forEach((footer) => {

0 commit comments

Comments
 (0)