@fiduswriter/editor 0.1.80 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dialogs/citation.js +1 -1
- package/dist/dialogs/citation.js.map +1 -1
- package/dist/dialogs/index.d.ts +1 -0
- package/dist/dialogs/index.d.ts.map +1 -1
- package/dist/dialogs/index.js +1 -0
- package/dist/dialogs/index.js.map +1 -1
- package/dist/dialogs/pdf_export.d.ts +24 -0
- package/dist/dialogs/pdf_export.d.ts.map +1 -0
- package/dist/dialogs/pdf_export.js +55 -0
- package/dist/dialogs/pdf_export.js.map +1 -0
- package/dist/dialogs/templates.d.ts +1 -0
- package/dist/dialogs/templates.d.ts.map +1 -1
- package/dist/dialogs/templates.js +26 -0
- package/dist/dialogs/templates.js.map +1 -1
- package/dist/documents/access_rights/index.js +1 -1
- package/dist/documents/access_rights/index.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/menus/headerbar/model.d.ts.map +1 -1
- package/dist/menus/headerbar/model.js +34 -1
- package/dist/menus/headerbar/model.js.map +1 -1
- package/dist/no_collab_save/index.d.ts.map +1 -1
- package/dist/no_collab_save/index.js +4 -1
- package/dist/no_collab_save/index.js.map +1 -1
- package/locale/en/messages.json +14 -0
- package/locale/en_US/messages.json +14 -0
- package/package.json +4 -4
- package/src/dialogs/citation.ts +1 -1
- package/src/dialogs/index.ts +1 -0
- package/src/dialogs/pdf_export.ts +97 -0
- package/src/dialogs/templates.ts +27 -0
- package/src/documents/access_rights/index.ts +1 -1
- package/src/index.ts +1 -1
- package/src/menus/headerbar/model.ts +60 -1
- package/src/no_collab_save/index.ts +4 -1
|
@@ -10,7 +10,7 @@ import {DocumentAccessRightsDialog} from "../../documents/access_rights/index.js
|
|
|
10
10
|
import {RequestAccessDialog} from "../../documents/access_rights/request_access_dialog.js"
|
|
11
11
|
import {SaveCopy, SaveRevision} from "../../exporter/native/index.js"
|
|
12
12
|
import {ExportFidusFile} from "../../exporter/native/file.js"
|
|
13
|
-
import {LanguageDialog, RevisionDialog} from "../../dialogs/index.js"
|
|
13
|
+
import {LanguageDialog, PdfExportDialog, RevisionDialog} from "../../dialogs/index.js"
|
|
14
14
|
import {E2EEKeyManager} from "fwtoolkit/e2ee/key-manager"
|
|
15
15
|
import {PassphraseManager} from "fwtoolkit/e2ee/passphrase-manager"
|
|
16
16
|
import {changePasswordDialog} from "fwtoolkit/e2ee/password-dialog"
|
|
@@ -645,6 +645,65 @@ export const headerbarModel = () => ({
|
|
|
645
645
|
})
|
|
646
646
|
}
|
|
647
647
|
},
|
|
648
|
+
{
|
|
649
|
+
title: gettext("PDF"),
|
|
650
|
+
type: "action",
|
|
651
|
+
tooltip: gettext(
|
|
652
|
+
"Export the document directly to a PDF file."
|
|
653
|
+
),
|
|
654
|
+
order: 1,
|
|
655
|
+
action: (editor: Editor) => {
|
|
656
|
+
import(
|
|
657
|
+
"@fiduswriter/document/exporter/pdf/index"
|
|
658
|
+
).then(async ({PdfExporter}) => {
|
|
659
|
+
const db = getDB(editor)
|
|
660
|
+
const dialog = new PdfExportDialog()
|
|
661
|
+
const options = await dialog.init()
|
|
662
|
+
if (!options) {
|
|
663
|
+
return
|
|
664
|
+
}
|
|
665
|
+
const doc = getExportDoc(
|
|
666
|
+
editor,
|
|
667
|
+
options.resolveTrackChanges
|
|
668
|
+
? {changes: "acceptAllNoInsertions"}
|
|
669
|
+
: undefined
|
|
670
|
+
)
|
|
671
|
+
let fidusFile: Uint8Array | undefined
|
|
672
|
+
if (options.embedFidusFile) {
|
|
673
|
+
const exporter = new ExportFidusFile(
|
|
674
|
+
editor.app,
|
|
675
|
+
doc,
|
|
676
|
+
db.bibDB,
|
|
677
|
+
db.imageDB,
|
|
678
|
+
true,
|
|
679
|
+
editor.docInfo.token,
|
|
680
|
+
false
|
|
681
|
+
)
|
|
682
|
+
const blob = await exporter.init()
|
|
683
|
+
fidusFile = new Uint8Array(
|
|
684
|
+
await blob.arrayBuffer()
|
|
685
|
+
)
|
|
686
|
+
}
|
|
687
|
+
const pdfExporter = new PdfExporter(
|
|
688
|
+
doc,
|
|
689
|
+
db.bibDB,
|
|
690
|
+
db.imageDB,
|
|
691
|
+
editor.app.csl,
|
|
692
|
+
editor.docInfo.updated as Date,
|
|
693
|
+
getDocumentTemplate(editor).documentStyles,
|
|
694
|
+
exportProgress(doc),
|
|
695
|
+
{
|
|
696
|
+
version: editor.app.settings
|
|
697
|
+
.VERSION as string | undefined,
|
|
698
|
+
fidusFile,
|
|
699
|
+
printOptions: options.printOptions
|
|
700
|
+
}
|
|
701
|
+
)
|
|
702
|
+
pdfExporter.init()
|
|
703
|
+
})
|
|
704
|
+
},
|
|
705
|
+
disabled: (editor: Editor) => editor.app.isOffline()
|
|
706
|
+
},
|
|
648
707
|
{
|
|
649
708
|
title: gettext("Epub"),
|
|
650
709
|
type: "action",
|
|
@@ -94,7 +94,10 @@ export class NoCollabSave {
|
|
|
94
94
|
let payload: Record<string, unknown> = {
|
|
95
95
|
id: this.editor.docInfo.id,
|
|
96
96
|
content: doc.content,
|
|
97
|
-
comments
|
|
97
|
+
// Send the plain comments data, not the ModComments instance —
|
|
98
|
+
// serializing the instance hits a circular structure (editor ->
|
|
99
|
+
// app -> bibDB -> app) and breaks JSON.stringify.
|
|
100
|
+
comments: (this.editor.mod.comments as any)?.store?.comments,
|
|
98
101
|
bibliography: this.editor.mod.db?.bibDB.db,
|
|
99
102
|
title: doc.title,
|
|
100
103
|
version: this.editor.docInfo.version,
|