@bendyline/docblocks-react 2.7.7 → 2.7.8
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/THIRD_PARTY_NOTICES.txt +205 -35
- package/dist/{AiDiagrams-7KBAOXPB.js → AiDiagrams-2IKKSBAU.js} +5 -3
- package/dist/{AiEditorAssistant-4B2PFFOT.js → AiEditorAssistant-ANYGVG7P.js} +46 -6
- package/dist/AiImagePanel-OXWEFOBC.js +314 -0
- package/dist/{AiStudyDialog-JPVFFZBB.js → AiStudyDialog-T3FY74HY.js} +2 -2
- package/dist/{AudioExportDialog-EICCBSSE.js → AudioExportDialog-CBMSLQBS.js} +1 -1
- package/dist/DocumentConflictDialog-4R4QMKBT.js +217 -0
- package/dist/{ExportDialog-EYDGTJ3S.js → ExportDialog-FNFD53SY.js} +2 -2
- package/dist/{ExportToolbarControls-2XY2CKGH.js → ExportToolbarControls-ZOYH4I36.js} +108 -71
- package/dist/{GitUI-F3CNBURE.js → GitUI-3FANM7I3.js} +88 -155
- package/dist/{KeyboardShortcutsDialog-HVKDFP5Z.js → KeyboardShortcutsDialog-7XJTDIX2.js} +1 -1
- package/dist/{PresentationMaker-VYQKNL3L.js → PresentationMaker-COLTVMTS.js} +3 -3
- package/dist/{QuickOpenDialog-3QEX7RZG.js → QuickOpenDialog-U2FWCEPA.js} +1 -1
- package/dist/{Settings-CfhY489G.d.ts → Settings-ButIB78y.d.ts} +20 -4
- package/dist/{ShareDialog-PF7D7ORP.js → ShareDialog-WOWHI6YI.js} +1 -1
- package/dist/{SpeechToolbarControl-E6OSJGHL.js → SpeechToolbarControl-BZW6IVZM.js} +1 -1
- package/dist/{TextFromNarration-ME6FAYWO.js → TextFromNarration-6BYTUKVZ.js} +2 -2
- package/dist/chunk-27E2OON2.js +90 -0
- package/dist/{chunk-5O5YTOXG.js → chunk-5YMULR6A.js} +13 -1
- package/dist/{chunk-5OIHB3SR.js → chunk-A7BK6QFL.js} +362 -25
- package/dist/{chunk-T2PA7QEF.js → chunk-BGA5UVKL.js} +58 -17
- package/dist/{chunk-N7AKLJPY.js → chunk-CXLXGFG2.js} +16 -8
- package/dist/{chunk-7CSBRAMT.js → chunk-F7TR5EKX.js} +8 -6
- package/dist/chunk-HIKMOKBQ.js +37 -0
- package/dist/chunk-OW6JWRAA.js +66 -0
- package/dist/{chunk-BNKIPCXO.js → chunk-QXBV3G6T.js} +5 -3
- package/dist/{chunk-7HBKKXRV.js → chunk-TN7BY5N3.js} +722 -281
- package/dist/{chunk-VJPGZCFS.js → chunk-UYJCL6OW.js} +4 -2
- package/dist/{chunk-G63YXKBC.js → chunk-WDNE5TI3.js} +13 -2
- package/dist/{chunk-KBUHWZCF.js → chunk-YX275NPE.js} +1 -1
- package/dist/editor.js +3 -3
- package/dist/export/index.d.ts +16 -162
- package/dist/export/index.js +6 -4
- package/dist/image-save-D18dJrUr.d.ts +182 -0
- package/dist/index.d.ts +15 -11
- package/dist/index.js +1154 -964
- package/dist/{run-export-SPNNH32M.js → run-export-C3PLLWLS.js} +2 -2
- package/dist/settings/index.d.ts +1 -1
- package/dist/settings/index.js +3 -2
- package/package.json +8 -8
- package/src/styles/docblocks.css +302 -10
- package/dist/DocumentConflictDialog-DZ2BV2IH.js +0 -111
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// src/Git/GitDiffView.tsx
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
import {
|
|
4
|
+
detectLanguageFromFileName,
|
|
5
|
+
useMonacoLoader
|
|
6
|
+
} from "@bendyline/squisq-editor-react";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
function languageFor(fileName) {
|
|
9
|
+
const detected = detectLanguageFromFileName(fileName);
|
|
10
|
+
if (detected) return detected;
|
|
11
|
+
return fileName.toLowerCase().endsWith(".md") ? "markdown" : "plaintext";
|
|
12
|
+
}
|
|
13
|
+
function GitDiffView({
|
|
14
|
+
original,
|
|
15
|
+
modified,
|
|
16
|
+
fileName,
|
|
17
|
+
language: languageOverride,
|
|
18
|
+
theme,
|
|
19
|
+
layout = "auto",
|
|
20
|
+
changesOnly = false,
|
|
21
|
+
labels
|
|
22
|
+
}) {
|
|
23
|
+
const language = languageOverride ?? languageFor(fileName);
|
|
24
|
+
const loader = useMonacoLoader(language);
|
|
25
|
+
const monaco = loader.ready ? loader.monaco : null;
|
|
26
|
+
const hostRef = useRef(null);
|
|
27
|
+
const editorRef = useRef(null);
|
|
28
|
+
const modelsRef = useRef(null);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
const host = hostRef.current;
|
|
31
|
+
if (!monaco || !host) return;
|
|
32
|
+
const originalModel = monaco.editor.createModel("", "plaintext");
|
|
33
|
+
const modifiedModel = monaco.editor.createModel("", "plaintext");
|
|
34
|
+
const editor = monaco.editor.createDiffEditor(host, {
|
|
35
|
+
readOnly: true,
|
|
36
|
+
automaticLayout: true,
|
|
37
|
+
minimap: { enabled: false },
|
|
38
|
+
wordWrap: "on",
|
|
39
|
+
scrollBeyondLastLine: false,
|
|
40
|
+
renderOverviewRuler: false
|
|
41
|
+
});
|
|
42
|
+
editor.setModel({ original: originalModel, modified: modifiedModel });
|
|
43
|
+
editorRef.current = editor;
|
|
44
|
+
modelsRef.current = { original: originalModel, modified: modifiedModel };
|
|
45
|
+
return () => {
|
|
46
|
+
editorRef.current = null;
|
|
47
|
+
modelsRef.current = null;
|
|
48
|
+
editor.dispose();
|
|
49
|
+
originalModel.dispose();
|
|
50
|
+
modifiedModel.dispose();
|
|
51
|
+
};
|
|
52
|
+
}, [monaco]);
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (!monaco) return;
|
|
55
|
+
const models = modelsRef.current;
|
|
56
|
+
if (!models) return;
|
|
57
|
+
if (models.original.getValue() !== original) models.original.setValue(original);
|
|
58
|
+
if (models.modified.getValue() !== modified) models.modified.setValue(modified);
|
|
59
|
+
monaco.editor.setModelLanguage(models.original, language);
|
|
60
|
+
monaco.editor.setModelLanguage(models.modified, language);
|
|
61
|
+
}, [monaco, original, modified, language]);
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
editorRef.current?.updateOptions({
|
|
64
|
+
renderSideBySide: layout !== "inline",
|
|
65
|
+
useInlineViewWhenSpaceIsLimited: layout === "auto",
|
|
66
|
+
hideUnchangedRegions: { enabled: changesOnly },
|
|
67
|
+
// Inline turns wrapping off for the hidden original side, and Monaco
|
|
68
|
+
// (0.50) never turns it back on; side by side would show it clipped.
|
|
69
|
+
wordWrapOverride2: "inherit"
|
|
70
|
+
});
|
|
71
|
+
}, [monaco, layout, changesOnly]);
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (!monaco) return;
|
|
74
|
+
monaco.editor.setTheme(theme === "dark" ? "vs-dark" : "vs");
|
|
75
|
+
}, [monaco, theme]);
|
|
76
|
+
if (!monaco) {
|
|
77
|
+
return /* @__PURE__ */ jsx("div", { className: "db-git-diff-loading", children: "Loading diff\u2026" });
|
|
78
|
+
}
|
|
79
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
80
|
+
labels && /* @__PURE__ */ jsxs("div", { className: "db-git-diff-labels", children: [
|
|
81
|
+
/* @__PURE__ */ jsx("span", { children: labels.original }),
|
|
82
|
+
/* @__PURE__ */ jsx("span", { children: labels.modified })
|
|
83
|
+
] }),
|
|
84
|
+
/* @__PURE__ */ jsx("div", { ref: hostRef, className: "db-git-diff-host" })
|
|
85
|
+
] });
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export {
|
|
89
|
+
GitDiffView
|
|
90
|
+
};
|
|
@@ -12,6 +12,18 @@ function buildExportFilename(selectedFile, options) {
|
|
|
12
12
|
return base + FORMAT_EXTENSIONS[options.format];
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
// src/Export/export-errors.ts
|
|
16
|
+
var PdfReplacementsError = class extends Error {
|
|
17
|
+
constructor(replacements) {
|
|
18
|
+
super(
|
|
19
|
+
"PDF was not saved because its fonts cannot draw all of this document\u2019s text. Save it with the replacements, or export as Word, HTML, or EPUB to keep every character. " + replacements.join(" ")
|
|
20
|
+
);
|
|
21
|
+
this.name = "PdfReplacementsError";
|
|
22
|
+
this.replacements = replacements;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
15
26
|
export {
|
|
16
|
-
buildExportFilename
|
|
27
|
+
buildExportFilename,
|
|
28
|
+
PdfReplacementsError
|
|
17
29
|
};
|