@fiduswriter/frontend 0.1.58 → 0.1.60
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/css/editor/editor.css +1 -1
- package/dist/documents/overview/actions.d.ts +1 -0
- package/dist/documents/overview/actions.d.ts.map +1 -1
- package/dist/documents/overview/actions.js +47 -1
- package/dist/documents/overview/actions.js.map +1 -1
- package/dist/documents/overview/menu.d.ts.map +1 -1
- package/dist/documents/overview/menu.js +12 -0
- package/dist/documents/overview/menu.js.map +1 -1
- package/dist/static/img/fidus_face.avif +0 -0
- package/dist/user/profile/index.d.ts.map +1 -1
- package/dist/user/profile/index.js +3 -1
- package/dist/user/profile/index.js.map +1 -1
- package/dist/user/profile/templates.d.ts.map +1 -1
- package/dist/user/profile/templates.js +5 -0
- package/dist/user/profile/templates.js.map +1 -1
- package/package.json +304 -303
- package/src/documents/overview/actions.ts +86 -0
- package/src/documents/overview/menu.ts +15 -0
- package/src/user/profile/index.ts +3 -1
- package/src/user/profile/templates.ts +5 -0
|
@@ -22,6 +22,7 @@ import {documentDialogTemplate, importDocumentTemplate} from "./templates.js"
|
|
|
22
22
|
import {
|
|
23
23
|
HtmlExportDialog,
|
|
24
24
|
EpubExportDialog,
|
|
25
|
+
PdfExportDialog,
|
|
25
26
|
TemplateExportDialog
|
|
26
27
|
} from "@fiduswriter/editor/dialogs/index"
|
|
27
28
|
import {Node as PMNode} from "prosemirror-model"
|
|
@@ -1070,6 +1071,91 @@ export class DocumentOverviewActions {
|
|
|
1070
1071
|
})
|
|
1071
1072
|
}
|
|
1072
1073
|
|
|
1074
|
+
async downloadPdfFiles(ids: number[]): Promise<void> {
|
|
1075
|
+
const dialog = new PdfExportDialog()
|
|
1076
|
+
const options = await dialog.init()
|
|
1077
|
+
if (!options) {
|
|
1078
|
+
return
|
|
1079
|
+
}
|
|
1080
|
+
import("../tools.js").then(({getMissingDocumentListData}) => {
|
|
1081
|
+
getMissingDocumentListData(
|
|
1082
|
+
ids,
|
|
1083
|
+
this.documentOverview.documentList as any,
|
|
1084
|
+
this.documentOverview.schema,
|
|
1085
|
+
this.documentOverview.app.apiConnectors.document
|
|
1086
|
+
).then(async () => {
|
|
1087
|
+
for (const id of ids) {
|
|
1088
|
+
const found = this.documentOverview.documentList.find(entry => entry.id === id)
|
|
1089
|
+
if (!found) {
|
|
1090
|
+
continue
|
|
1091
|
+
}
|
|
1092
|
+
const doc = options.resolveTrackChanges
|
|
1093
|
+
? resolveDocTrackedChanges(
|
|
1094
|
+
found as Record<string, unknown>,
|
|
1095
|
+
this.documentOverview.schema
|
|
1096
|
+
)
|
|
1097
|
+
: found
|
|
1098
|
+
const progressCallback = exportProgressCallback(doc!)
|
|
1099
|
+
let fidusFile: Uint8Array | undefined
|
|
1100
|
+
if (options.embedFidusFile && !doc!.e2ee) {
|
|
1101
|
+
// Encrypted documents are skipped: their source can
|
|
1102
|
+
// only be assembled with the document owner's key.
|
|
1103
|
+
const blob = (await new ExportFidusFile(
|
|
1104
|
+
this.documentOverview.app,
|
|
1105
|
+
doc as any,
|
|
1106
|
+
{db: doc!.bibliography as any},
|
|
1107
|
+
{db: doc!.images as any},
|
|
1108
|
+
true,
|
|
1109
|
+
undefined,
|
|
1110
|
+
false
|
|
1111
|
+
)) as unknown as Blob
|
|
1112
|
+
fidusFile = new Uint8Array(await blob.arrayBuffer())
|
|
1113
|
+
}
|
|
1114
|
+
await import("@fiduswriter/document/exporter/pdf/index").then(
|
|
1115
|
+
({PdfExporter}) => {
|
|
1116
|
+
const exporter = new PdfExporter(
|
|
1117
|
+
doc as any,
|
|
1118
|
+
{db: doc!.bibliography as any},
|
|
1119
|
+
{db: doc!.images as any},
|
|
1120
|
+
this.documentOverview.app.csl as any,
|
|
1121
|
+
new Date((doc!.updated as number) * 1000),
|
|
1122
|
+
this.documentOverview.documentStyles,
|
|
1123
|
+
progressCallback as any,
|
|
1124
|
+
{
|
|
1125
|
+
version: (
|
|
1126
|
+
this.documentOverview.app.settings as {
|
|
1127
|
+
VERSION?: string
|
|
1128
|
+
}
|
|
1129
|
+
).VERSION,
|
|
1130
|
+
userName:
|
|
1131
|
+
this.documentOverview.app.user?.name ||
|
|
1132
|
+
this.documentOverview.app.user
|
|
1133
|
+
?.username ||
|
|
1134
|
+
undefined,
|
|
1135
|
+
fidusFile,
|
|
1136
|
+
pdfA: options.pdfA,
|
|
1137
|
+
pdfUa: options.pdfUa,
|
|
1138
|
+
embedSourceHtml:
|
|
1139
|
+
options.embedSourceHtml || undefined,
|
|
1140
|
+
figurePageFloats:
|
|
1141
|
+
options.figurePageFloats,
|
|
1142
|
+
tablePageFloats: options.tablePageFloats,
|
|
1143
|
+
printOptions: options.printOptions,
|
|
1144
|
+
printEngine: (
|
|
1145
|
+
this.documentOverview.app.settings as {
|
|
1146
|
+
PRINT_ENGINE?: string
|
|
1147
|
+
}
|
|
1148
|
+
).PRINT_ENGINE
|
|
1149
|
+
}
|
|
1150
|
+
)
|
|
1151
|
+
return exporter.init()
|
|
1152
|
+
}
|
|
1153
|
+
)
|
|
1154
|
+
}
|
|
1155
|
+
})
|
|
1156
|
+
})
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1073
1159
|
settingsDocumentDialog(docId: number): void {
|
|
1074
1160
|
const doc = this.documentOverview.documentList.find(entry => entry.id === docId)
|
|
1075
1161
|
if (!doc || !this.dialogParts.length) {
|
|
@@ -136,6 +136,21 @@ export const bulkMenuModel = (): MenuModel => ({
|
|
|
136
136
|
!overview.getSelected().length || overview.app.isOffline(),
|
|
137
137
|
order: 3
|
|
138
138
|
},
|
|
139
|
+
{
|
|
140
|
+
title: gettext("Export selected as PDF"),
|
|
141
|
+
tooltip: gettext(
|
|
142
|
+
"Export the documents that have been selected as PDF files."
|
|
143
|
+
),
|
|
144
|
+
action: overview => {
|
|
145
|
+
const ids = overview.getSelected()
|
|
146
|
+
if (ids.length) {
|
|
147
|
+
overview.mod.actions!.downloadPdfFiles(ids)
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
disabled: overview =>
|
|
151
|
+
!overview.getSelected().length || overview.app.isOffline(),
|
|
152
|
+
order: 4
|
|
153
|
+
},
|
|
139
154
|
{
|
|
140
155
|
title: gettext("Export selected as HTML"),
|
|
141
156
|
tooltip: gettext(
|
|
@@ -352,6 +352,7 @@ export class Profile {
|
|
|
352
352
|
const newLang = (this.dom.querySelector("#language") as HTMLSelectElement).value
|
|
353
353
|
const inlineReferences = (this.dom.querySelector("#inline-references") as HTMLInputElement).checked
|
|
354
354
|
const inlineMath = (this.dom.querySelector("#inline-math") as HTMLInputElement).checked
|
|
355
|
+
const grammarCheckContinuous = (this.dom.querySelector("#grammar-check-continuous") as HTMLInputElement).checked
|
|
355
356
|
return this.app.apiConnectors.userProfile.save({
|
|
356
357
|
username: (this.dom.querySelector("#username") as HTMLInputElement).value,
|
|
357
358
|
first_name: (this.dom.querySelector("#first_name") as HTMLInputElement).value,
|
|
@@ -362,7 +363,8 @@ export class Profile {
|
|
|
362
363
|
.then(() =>
|
|
363
364
|
this.app.apiConnectors.userProfile.updatePreferences({
|
|
364
365
|
inline_references: inlineReferences,
|
|
365
|
-
inline_math: inlineMath
|
|
366
|
+
inline_math: inlineMath,
|
|
367
|
+
grammar_check_continuous: grammarCheckContinuous
|
|
366
368
|
})
|
|
367
369
|
)
|
|
368
370
|
.catch(() => addAlert("error", gettext("Could not save preferences")))
|
|
@@ -240,6 +240,11 @@ export const profileContents = (
|
|
|
240
240
|
${gettext("Enable inline math typing ($)")}
|
|
241
241
|
</label>
|
|
242
242
|
<p class="inline-editor-hint">${gettext("Type $ in the editor followed by LaTeX math to insert an equation inline, e.g. $x^2. Press Enter or Tab to confirm.")}</p>
|
|
243
|
+
<label class="checkable-label">
|
|
244
|
+
<input type="checkbox" id="grammar-check-continuous" ${user.preferences?.grammar_check_continuous ? "checked" : ""} />
|
|
245
|
+
${gettext("Continuous spell and grammar checking")}
|
|
246
|
+
</label>
|
|
247
|
+
<p class="inline-editor-hint">${gettext("Check spelling and grammar while typing with the built-in LingoTweaker checker. It runs entirely in your browser; no external server is needed.")}</p>
|
|
243
248
|
|
|
244
249
|
</div>
|
|
245
250
|
</div>
|