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
6 changes: 5 additions & 1 deletion examples/vue-fields-example/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ const addField = (field) => {
}

const exportDocx = () => {
superdoc.value?.export();
superdoc.value?.export({ isFinalDoc: true });

// Or use superdoc.value?.export({ isFinalDoc: true });
// If you want to fully remove all fields and replace them with their values

};

const onDragStart = (event) => {
Expand Down
9 changes: 5 additions & 4 deletions packages/superdoc/src/core/SuperDoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -567,11 +567,12 @@ export class SuperDoc extends EventEmitter {
commentsType,
exportedName,
additionalFiles = [],
additionalFileNames = []
additionalFileNames = [],
isFinalDoc = false,
} = {}) {
// Get the docx files first
const baseFileName = exportedName ? cleanName(exportedName) : cleanName(this.config.title);
const docxFiles = await this.exportEditorsToDOCX({ commentsType });
const docxFiles = await this.exportEditorsToDOCX({ commentsType, isFinalDoc });
const blobsToZip = [...additionalFiles];
const filenames = [...additionalFileNames];

Expand All @@ -592,7 +593,7 @@ export class SuperDoc extends EventEmitter {
}
};

async exportEditorsToDOCX({ commentsType } = {}) {
async exportEditorsToDOCX({ commentsType, isFinalDoc } = {}) {
const comments = [];
if (commentsType !== 'clean') {
comments.push(...this.commentsStore?.translateCommentsForExport());
Expand All @@ -602,7 +603,7 @@ export class SuperDoc extends EventEmitter {
this.superdocStore.documents.forEach((doc) => {
const editor = doc.getEditor();
if (editor) {
docxPromises.push(editor.exportDocx({ comments, commentsType }));
docxPromises.push(editor.exportDocx({ isFinalDoc, comments, commentsType }));
}
});
return await Promise.all(docxPromises);
Expand Down
Loading