@fiduswriter/editor 0.2.4 → 0.2.5
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/README.md +4 -4
- package/css/e2ee.css +1 -1
- package/dist/dialogs/html_export.d.ts +12 -0
- package/dist/dialogs/html_export.d.ts.map +1 -0
- package/dist/dialogs/html_export.js +42 -0
- package/dist/dialogs/html_export.js.map +1 -0
- 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/templates.d.ts +1 -0
- package/dist/dialogs/templates.d.ts.map +1 -1
- package/dist/dialogs/templates.js +9 -0
- package/dist/dialogs/templates.js.map +1 -1
- package/dist/menus/headerbar/model.d.ts.map +1 -1
- package/dist/menus/headerbar/model.js +8 -3
- package/dist/menus/headerbar/model.js.map +1 -1
- package/dist/menus/toolbar/model.d.ts +7 -7
- package/dist/menus/toolbar/model.d.ts.map +1 -1
- package/locale/en/messages.json +574 -571
- package/locale/en_US/messages.json +574 -571
- package/package.json +4 -2
- package/src/dialogs/html_export.ts +58 -0
- package/src/dialogs/index.ts +1 -0
- package/src/dialogs/templates.ts +12 -0
- package/src/menus/headerbar/model.ts +14 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiduswriter/editor",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "Fidus Writer browser editor",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fiduswriter",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
},
|
|
92
92
|
"dependencies": {
|
|
93
93
|
"@fiduswriter/bibliography-manager": "^0.1.31",
|
|
94
|
-
"@fiduswriter/document": "^0.3.
|
|
94
|
+
"@fiduswriter/document": "^0.3.3",
|
|
95
95
|
"@fiduswriter/image-manager": "^0.1.23",
|
|
96
96
|
"@fortawesome/fontawesome-free": "^7.2.0",
|
|
97
97
|
"cropperjs": "^1.6.2",
|
|
@@ -130,6 +130,8 @@
|
|
|
130
130
|
},
|
|
131
131
|
"devDependencies": {
|
|
132
132
|
"@eslint/js": "^10.0.1",
|
|
133
|
+
"@fontsource/jetbrains-mono": "^5.3.0",
|
|
134
|
+
"@fontsource/source-sans-pro": "^5.3.0",
|
|
133
135
|
"@swc/core": "^1.16.1",
|
|
134
136
|
"@swc/jest": "^0.2.39",
|
|
135
137
|
"@types/jest": "^30.0.0",
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {Dialog} from "fwtoolkit"
|
|
2
|
+
import {htmlExportDialogTemplate} from "./templates.js"
|
|
3
|
+
|
|
4
|
+
export interface HtmlExportDialogResult {
|
|
5
|
+
/** Render `equation`/`figure_equation` nodes as SVG images (MathJax)
|
|
6
|
+
instead of MathML. */
|
|
7
|
+
svgMath: boolean
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export class HtmlExportDialog {
|
|
11
|
+
dialog: Dialog | false
|
|
12
|
+
|
|
13
|
+
constructor() {
|
|
14
|
+
this.dialog = false
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
init(): Promise<HtmlExportDialogResult | false> {
|
|
18
|
+
const buttons: Array<Record<string, unknown>> = []
|
|
19
|
+
const dialogDonePromise = new Promise<HtmlExportDialogResult | false>(
|
|
20
|
+
resolve => {
|
|
21
|
+
buttons.push({
|
|
22
|
+
text: gettext("Export"),
|
|
23
|
+
classes: "fw-dark",
|
|
24
|
+
click: () => {
|
|
25
|
+
const dialogEl = (this.dialog as Dialog).dialogEl
|
|
26
|
+
const svgMath = (
|
|
27
|
+
dialogEl.querySelector(
|
|
28
|
+
".html-svg-math"
|
|
29
|
+
) as HTMLInputElement
|
|
30
|
+
)?.checked
|
|
31
|
+
;(this.dialog as Dialog).close()
|
|
32
|
+
return resolve({svgMath: !!svgMath})
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
buttons.push({
|
|
37
|
+
type: "cancel" as const,
|
|
38
|
+
click: () => {
|
|
39
|
+
;(this.dialog as Dialog).close()
|
|
40
|
+
resolve(false)
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
this.dialog = new Dialog({
|
|
47
|
+
title: gettext("HTML export options"),
|
|
48
|
+
body: htmlExportDialogTemplate(),
|
|
49
|
+
height: 220,
|
|
50
|
+
width: 420,
|
|
51
|
+
buttons,
|
|
52
|
+
restoreActiveElement: false
|
|
53
|
+
})
|
|
54
|
+
this.dialog.open()
|
|
55
|
+
|
|
56
|
+
return dialogDonePromise
|
|
57
|
+
}
|
|
58
|
+
}
|
package/src/dialogs/index.ts
CHANGED
|
@@ -7,5 +7,6 @@ export {LinkDialog} from "./link.js"
|
|
|
7
7
|
export {TableDialog, TableConfigurationDialog} from "./table.js"
|
|
8
8
|
export {RevisionDialog} from "./revision.js"
|
|
9
9
|
export {PdfExportDialog} from "./pdf_export.js"
|
|
10
|
+
export {HtmlExportDialog} from "./html_export.js"
|
|
10
11
|
export {OrderedListStartDialog} from "./ordered_list.js"
|
|
11
12
|
export {CodeBlockDialog} from "./code_block.js"
|
package/src/dialogs/templates.ts
CHANGED
|
@@ -120,6 +120,18 @@ export const pdfExportDialogTemplate = (): string => `
|
|
|
120
120
|
</p>
|
|
121
121
|
`
|
|
122
122
|
|
|
123
|
+
export const htmlExportDialogTemplate = (): string => `
|
|
124
|
+
<p>
|
|
125
|
+
<label>
|
|
126
|
+
<input type="checkbox" class="html-svg-math">
|
|
127
|
+
${gettext("Render formulas as SVG images instead of MathML")}
|
|
128
|
+
</label>
|
|
129
|
+
</p>
|
|
130
|
+
<p class="formula-note">${gettext(
|
|
131
|
+
"SVG renders consistently across browsers and is used in PDF export; MathML keeps formulas as text that can be searched and copied, but only newer browsers support it."
|
|
132
|
+
)}</p>
|
|
133
|
+
`
|
|
134
|
+
|
|
123
135
|
export const tableInsertTemplate = (): string => `
|
|
124
136
|
<table class="insert-table-selection">
|
|
125
137
|
<tr>
|
|
@@ -10,7 +10,12 @@ 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 {
|
|
13
|
+
import {
|
|
14
|
+
LanguageDialog,
|
|
15
|
+
PdfExportDialog,
|
|
16
|
+
RevisionDialog,
|
|
17
|
+
HtmlExportDialog
|
|
18
|
+
} from "../../dialogs/index.js"
|
|
14
19
|
import {E2EEKeyManager} from "fwtoolkit/e2ee/key-manager"
|
|
15
20
|
import {PassphraseManager} from "fwtoolkit/e2ee/passphrase-manager"
|
|
16
21
|
import {changePasswordDialog} from "fwtoolkit/e2ee/password-dialog"
|
|
@@ -627,8 +632,13 @@ export const headerbarModel = () => ({
|
|
|
627
632
|
action: (editor: Editor) => {
|
|
628
633
|
import(
|
|
629
634
|
"@fiduswriter/document/exporter/html/index"
|
|
630
|
-
).then(({HTMLExporter}) => {
|
|
635
|
+
).then(async ({HTMLExporter}) => {
|
|
631
636
|
const db = getDB(editor)
|
|
637
|
+
const dialog = new HtmlExportDialog()
|
|
638
|
+
const options = await dialog.init()
|
|
639
|
+
if (!options) {
|
|
640
|
+
return
|
|
641
|
+
}
|
|
632
642
|
const doc = getExportDoc(editor, {
|
|
633
643
|
changes: "acceptAllNoInsertions"
|
|
634
644
|
})
|
|
@@ -638,7 +648,8 @@ export const headerbarModel = () => ({
|
|
|
638
648
|
db.imageDB,
|
|
639
649
|
editor.app.csl,
|
|
640
650
|
editor.docInfo.updated as Date,
|
|
641
|
-
getDocumentTemplate(editor).documentStyles
|
|
651
|
+
getDocumentTemplate(editor).documentStyles,
|
|
652
|
+
options.svgMath ? {mathOutput: "svg"} : {}
|
|
642
653
|
)
|
|
643
654
|
exporter.progressCallback = exportProgress(doc)
|
|
644
655
|
exporter.init()
|