@embedpdf/viewer-chrome 3.0.0-next.15 → 3.0.0-next.16
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/{annotation-fonts-BqoLZ4Mp.js → annotation-fonts-DWjVOTP0.js} +2 -2
- package/dist/{annotation-fonts-BqoLZ4Mp.js.map → annotation-fonts-DWjVOTP0.js.map} +1 -1
- package/dist/{annotation-fonts-Dt0IQXhz.cjs → annotation-fonts-dpfVkhnq.cjs} +2 -2
- package/dist/{annotation-fonts-Dt0IQXhz.cjs.map → annotation-fonts-dpfVkhnq.cjs.map} +1 -1
- package/dist/{annotation-style-Bzvvp8-N.cjs → annotation-style-B3XKAyZ-.cjs} +3 -3
- package/dist/{annotation-style-Bzvvp8-N.cjs.map → annotation-style-B3XKAyZ-.cjs.map} +1 -1
- package/dist/{annotation-style--rPIZsuP.js → annotation-style-CXF3X47Z.js} +3 -3
- package/dist/{annotation-style--rPIZsuP.js.map → annotation-style-CXF3X47Z.js.map} +1 -1
- package/dist/{ar-DnEj5vbP.cjs → ar-B132r9bo.cjs} +93 -1
- package/dist/ar-B132r9bo.cjs.map +1 -0
- package/dist/{ar-D9XKAmDx.js → ar-BLWFJoA_.js} +93 -1
- package/dist/ar-BLWFJoA_.js.map +1 -0
- package/dist/attachments-panel-Cxln8xos.cjs +217 -0
- package/dist/attachments-panel-Cxln8xos.cjs.map +1 -0
- package/dist/attachments-panel-H1ucRbwo.js +217 -0
- package/dist/attachments-panel-H1ucRbwo.js.map +1 -0
- package/dist/chrome.cjs +21 -0
- package/dist/chrome.cjs.map +1 -1
- package/dist/chrome.js +21 -0
- package/dist/chrome.js.map +1 -1
- package/dist/{commands-BmgxhJ8B.js → commands-BkgLP3Om.js} +418 -23
- package/dist/commands-BkgLP3Om.js.map +1 -0
- package/dist/{commands-CYt4SFUX.cjs → commands-DL1gjZt7.cjs} +433 -20
- package/dist/commands-DL1gjZt7.cjs.map +1 -0
- package/dist/commands.cjs +2 -1
- package/dist/commands.d.cts +3 -1
- package/dist/commands.d.ts +3 -1
- package/dist/commands.js +2 -2
- package/dist/{comments-panel-pEcQg4Vs.cjs → comments-panel-BsnWedTh.cjs} +2 -2
- package/dist/{comments-panel-pEcQg4Vs.cjs.map → comments-panel-BsnWedTh.cjs.map} +1 -1
- package/dist/{comments-panel-MUVgLCBI.js → comments-panel-D7Eadws9.js} +2 -2
- package/dist/{comments-panel-MUVgLCBI.js.map → comments-panel-D7Eadws9.js.map} +1 -1
- package/dist/{de-Dv6zvbnd.cjs → de-7_MvFWzN.cjs} +93 -1
- package/dist/de-7_MvFWzN.cjs.map +1 -0
- package/dist/{de-Bdr4aWzm.js → de-BUhwc9-x.js} +93 -1
- package/dist/de-BUhwc9-x.js.map +1 -0
- package/dist/{dialog-B5GBisKv.js → dialog-BIb373cg.js} +3 -3
- package/dist/dialog-BIb373cg.js.map +1 -0
- package/dist/{dialog-t8F13BL_.cjs → dialog-CngKTnAM.cjs} +3 -3
- package/dist/dialog-CngKTnAM.cjs.map +1 -0
- package/dist/{es-BP09DR9w.cjs → es-DgYj-1L3.cjs} +93 -1
- package/dist/es-DgYj-1L3.cjs.map +1 -0
- package/dist/{es-BSXz5tBv.js → es-DoXTqFoO.js} +93 -1
- package/dist/es-DoXTqFoO.js.map +1 -0
- package/dist/{form-design-panel-vWWU9uB-.js → form-design-panel-CgV_5YWC.js} +3 -3
- package/dist/{form-design-panel-vWWU9uB-.js.map → form-design-panel-CgV_5YWC.js.map} +1 -1
- package/dist/{form-design-panel-B5MXTZ96.cjs → form-design-panel-D0FdmWXW.cjs} +3 -3
- package/dist/{form-design-panel-B5MXTZ96.cjs.map → form-design-panel-D0FdmWXW.cjs.map} +1 -1
- package/dist/{fr-Ckn3K9v1.js → fr-B-8NDhBA.js} +93 -1
- package/dist/fr-B-8NDhBA.js.map +1 -0
- package/dist/{fr-BBQQn7tJ.cjs → fr-C856dmQJ.cjs} +93 -1
- package/dist/fr-C856dmQJ.cjs.map +1 -0
- package/dist/{he-DRsG7bH7.cjs → he-BFTeNc4t.cjs} +93 -1
- package/dist/he-BFTeNc4t.cjs.map +1 -0
- package/dist/{he-wdGU5PkU.js → he-Dlh0fNXM.js} +93 -1
- package/dist/he-Dlh0fNXM.js.map +1 -0
- package/dist/{icons-x0Tc05bs.cjs → icons-1UfLUZ_y.cjs} +20 -1
- package/dist/icons-1UfLUZ_y.cjs.map +1 -0
- package/dist/{icons-BrK5iVL8.js → icons-7dB0Y1ct.js} +20 -1
- package/dist/icons-7dB0Y1ct.js.map +1 -0
- package/dist/index.cjs +740 -171
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -2
- package/dist/index.d.ts +16 -2
- package/dist/index.js +727 -170
- package/dist/index.js.map +1 -1
- package/dist/{it-BuP4o0xQ.cjs → it-Bef-2Yxq.cjs} +93 -1
- package/dist/it-Bef-2Yxq.cjs.map +1 -0
- package/dist/{it-Us-VmvIu.js → it-BkirG7ol.js} +93 -1
- package/dist/it-BkirG7ol.js.map +1 -0
- package/dist/{ja-Cizj0-5O.js → ja-CGEjCE-s.js} +93 -1
- package/dist/ja-CGEjCE-s.js.map +1 -0
- package/dist/{ja-DovEd6ts.cjs → ja-DNw2zqSD.cjs} +93 -1
- package/dist/ja-DNw2zqSD.cjs.map +1 -0
- package/dist/{ko-DlrXliE1.js → ko-CTkl5vMh.js} +93 -1
- package/dist/ko-CTkl5vMh.js.map +1 -0
- package/dist/{ko-B-qJEol2.cjs → ko-YHzeBqP6.cjs} +93 -1
- package/dist/ko-YHzeBqP6.cjs.map +1 -0
- package/dist/{link-editor-CSjqPnj1.cjs → link-editor-CAS7MZM2.cjs} +2 -2
- package/dist/{link-editor-CSjqPnj1.cjs.map → link-editor-CAS7MZM2.cjs.map} +1 -1
- package/dist/{link-editor-SxM1nnJU.js → link-editor-CkwtqRvb.js} +2 -2
- package/dist/{link-editor-SxM1nnJU.js.map → link-editor-CkwtqRvb.js.map} +1 -1
- package/dist/{measurement-Bs61XWbJ.js → measurement-CQdbnIrn.js} +2 -2
- package/dist/{measurement-Bs61XWbJ.js.map → measurement-CQdbnIrn.js.map} +1 -1
- package/dist/{measurement-CcCsHPOX.cjs → measurement-Cxv1Ahxx.cjs} +2 -2
- package/dist/{measurement-CcCsHPOX.cjs.map → measurement-Cxv1Ahxx.cjs.map} +1 -1
- package/dist/{nl-D3KZDDiJ.cjs → nl-BjkbaLq3.cjs} +93 -1
- package/dist/nl-BjkbaLq3.cjs.map +1 -0
- package/dist/{nl-0aF7M_0h.js → nl-Dya4sR8_.js} +93 -1
- package/dist/nl-Dya4sR8_.js.map +1 -0
- package/dist/outline-panel-BpGtBdj0.cjs +707 -0
- package/dist/outline-panel-BpGtBdj0.cjs.map +1 -0
- package/dist/outline-panel-DO5_REYw.js +707 -0
- package/dist/outline-panel-DO5_REYw.js.map +1 -0
- package/dist/outline-properties-BCa2cc0t.js +330 -0
- package/dist/outline-properties-BCa2cc0t.js.map +1 -0
- package/dist/outline-properties-DT3FIxCw.cjs +330 -0
- package/dist/outline-properties-DT3FIxCw.cjs.map +1 -0
- package/dist/{pl-DSFhAUqx.cjs → pl-CKKdVnpZ.cjs} +93 -1
- package/dist/pl-CKKdVnpZ.cjs.map +1 -0
- package/dist/{pl-BW--AaCI.js → pl-DA9b5NVg.js} +93 -1
- package/dist/pl-DA9b5NVg.js.map +1 -0
- package/dist/print-dialog-BqIrHCBh.cjs +276 -0
- package/dist/print-dialog-BqIrHCBh.cjs.map +1 -0
- package/dist/print-dialog-DvcI2m2_.js +276 -0
- package/dist/print-dialog-DvcI2m2_.js.map +1 -0
- package/dist/{pt-C5S-8MC5.cjs → pt-DLcszlzi.cjs} +93 -1
- package/dist/pt-DLcszlzi.cjs.map +1 -0
- package/dist/{pt-DIhpU5pT.js → pt-Nm8yyjbX.js} +93 -1
- package/dist/pt-Nm8yyjbX.js.map +1 -0
- package/dist/{redact-confirm-CX_SY2ZN.cjs → redact-confirm-C6EiK8yN.cjs} +2 -2
- package/dist/{redact-confirm-CX_SY2ZN.cjs.map → redact-confirm-C6EiK8yN.cjs.map} +1 -1
- package/dist/{redact-confirm-B6j36TPw.js → redact-confirm-CKuv9iN_.js} +2 -2
- package/dist/{redact-confirm-B6j36TPw.js.map → redact-confirm-CKuv9iN_.js.map} +1 -1
- package/dist/{redaction-panel-IJDshSJI.js → redaction-panel-CgNZ-pQk.js} +2 -2
- package/dist/{redaction-panel-IJDshSJI.js.map → redaction-panel-CgNZ-pQk.js.map} +1 -1
- package/dist/{redaction-panel-BmoIl-Ll.cjs → redaction-panel-ZhX0dlMi.cjs} +2 -2
- package/dist/{redaction-panel-BmoIl-Ll.cjs.map → redaction-panel-ZhX0dlMi.cjs.map} +1 -1
- package/dist/{search-panel-HfIhJm1M.js → search-panel-BE4xzWlm.js} +4 -4
- package/dist/{search-panel-HfIhJm1M.js.map → search-panel-BE4xzWlm.js.map} +1 -1
- package/dist/{search-panel-s9IoiOtv.cjs → search-panel-wcbTNG1z.cjs} +4 -4
- package/dist/{search-panel-s9IoiOtv.cjs.map → search-panel-wcbTNG1z.cjs.map} +1 -1
- package/dist/{sheet-BDsa_Sup.cjs → sheet-DTBFiwde.cjs} +30 -11
- package/dist/sheet-DTBFiwde.cjs.map +1 -0
- package/dist/{sheet-R6XDgyEf.js → sheet-DyjKfAq0.js} +25 -12
- package/dist/sheet-DyjKfAq0.js.map +1 -0
- package/dist/{sign-dialog-CgnR7akj.cjs → sign-dialog-D5WGx-Yn.cjs} +2 -2
- package/dist/{sign-dialog-CgnR7akj.cjs.map → sign-dialog-D5WGx-Yn.cjs.map} +1 -1
- package/dist/{sign-dialog-GDqCoQhA.js → sign-dialog-DerNe8qT.js} +2 -2
- package/dist/{sign-dialog-GDqCoQhA.js.map → sign-dialog-DerNe8qT.js.map} +1 -1
- package/dist/{signature-inspector-DyO313Qf.cjs → signature-inspector-Bz6TAfZM.cjs} +4 -10
- package/dist/signature-inspector-Bz6TAfZM.cjs.map +1 -0
- package/dist/{signature-inspector-okFz8do6.js → signature-inspector-CsGr9EBk.js} +4 -10
- package/dist/signature-inspector-CsGr9EBk.js.map +1 -0
- package/dist/{signature-maker-BoYa8vgA.cjs → signature-maker-D_YfBXLn.cjs} +3 -3
- package/dist/{signature-maker-BoYa8vgA.cjs.map → signature-maker-D_YfBXLn.cjs.map} +1 -1
- package/dist/{signature-maker-BhCmYyHD.js → signature-maker-Dnth4rV4.js} +3 -3
- package/dist/{signature-maker-BhCmYyHD.js.map → signature-maker-Dnth4rV4.js.map} +1 -1
- package/dist/{signatures-panel-B56PC6d9.cjs → signatures-panel-Ci_LaI1C.cjs} +4 -10
- package/dist/signatures-panel-Ci_LaI1C.cjs.map +1 -0
- package/dist/{signatures-panel-CgnFfhFm.js → signatures-panel-DZ9ywrjz.js} +4 -10
- package/dist/signatures-panel-DZ9ywrjz.js.map +1 -0
- package/dist/{stamps-panel-CDO0FPyK.js → stamps-panel-BrczStaz.js} +4 -10
- package/dist/stamps-panel-BrczStaz.js.map +1 -0
- package/dist/{stamps-panel-B9NYGayn.cjs → stamps-panel-Cv9nJBwx.cjs} +4 -10
- package/dist/stamps-panel-Cv9nJBwx.cjs.map +1 -0
- package/dist/theme-Be0OZokZ.js +97 -0
- package/dist/theme-Be0OZokZ.js.map +1 -0
- package/dist/theme-FR26JI3r.cjs +126 -0
- package/dist/theme-FR26JI3r.cjs.map +1 -0
- package/dist/{toolbar-z9od3tKl.js → toolbar-DF361xWY.js} +7 -6
- package/dist/toolbar-DF361xWY.js.map +1 -0
- package/dist/{toolbar-CJu2wKTU.cjs → toolbar-ddvpsvTb.cjs} +7 -6
- package/dist/toolbar-ddvpsvTb.cjs.map +1 -0
- package/dist/{zh-cn-CxkUUBct.js → zh-cn-BMPPkLpL.js} +93 -1
- package/dist/zh-cn-BMPPkLpL.js.map +1 -0
- package/dist/{zh-cn-3tmMeHqv.cjs → zh-cn-CZOO3p4H.cjs} +93 -1
- package/dist/zh-cn-CZOO3p4H.cjs.map +1 -0
- package/package.json +4 -4
- package/src/styles.css +8 -0
- package/dist/ar-D9XKAmDx.js.map +0 -1
- package/dist/ar-DnEj5vbP.cjs.map +0 -1
- package/dist/commands-BmgxhJ8B.js.map +0 -1
- package/dist/commands-CYt4SFUX.cjs.map +0 -1
- package/dist/de-Bdr4aWzm.js.map +0 -1
- package/dist/de-Dv6zvbnd.cjs.map +0 -1
- package/dist/dialog-B5GBisKv.js.map +0 -1
- package/dist/dialog-t8F13BL_.cjs.map +0 -1
- package/dist/es-BP09DR9w.cjs.map +0 -1
- package/dist/es-BSXz5tBv.js.map +0 -1
- package/dist/fr-BBQQn7tJ.cjs.map +0 -1
- package/dist/fr-Ckn3K9v1.js.map +0 -1
- package/dist/he-DRsG7bH7.cjs.map +0 -1
- package/dist/he-wdGU5PkU.js.map +0 -1
- package/dist/icons-BrK5iVL8.js.map +0 -1
- package/dist/icons-x0Tc05bs.cjs.map +0 -1
- package/dist/it-BuP4o0xQ.cjs.map +0 -1
- package/dist/it-Us-VmvIu.js.map +0 -1
- package/dist/ja-Cizj0-5O.js.map +0 -1
- package/dist/ja-DovEd6ts.cjs.map +0 -1
- package/dist/ko-B-qJEol2.cjs.map +0 -1
- package/dist/ko-DlrXliE1.js.map +0 -1
- package/dist/nl-0aF7M_0h.js.map +0 -1
- package/dist/nl-D3KZDDiJ.cjs.map +0 -1
- package/dist/pl-BW--AaCI.js.map +0 -1
- package/dist/pl-DSFhAUqx.cjs.map +0 -1
- package/dist/pt-C5S-8MC5.cjs.map +0 -1
- package/dist/pt-DIhpU5pT.js.map +0 -1
- package/dist/sheet-BDsa_Sup.cjs.map +0 -1
- package/dist/sheet-R6XDgyEf.js.map +0 -1
- package/dist/signature-inspector-DyO313Qf.cjs.map +0 -1
- package/dist/signature-inspector-okFz8do6.js.map +0 -1
- package/dist/signatures-panel-B56PC6d9.cjs.map +0 -1
- package/dist/signatures-panel-CgnFfhFm.js.map +0 -1
- package/dist/stamps-panel-B9NYGayn.cjs.map +0 -1
- package/dist/stamps-panel-CDO0FPyK.js.map +0 -1
- package/dist/toolbar-CJu2wKTU.cjs.map +0 -1
- package/dist/toolbar-z9od3tKl.js.map +0 -1
- package/dist/zh-cn-3tmMeHqv.cjs.map +0 -1
- package/dist/zh-cn-CxkUUBct.js.map +0 -1
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
let _embedpdf_react_runtime = require("@embedpdf/react/runtime");
|
|
2
2
|
let _embedpdf_react_stage = require("@embedpdf/react/stage");
|
|
3
|
+
let _embedpdf_react_page_edit = require("@embedpdf/react/page-edit");
|
|
4
|
+
let _embedpdf_react_outline = require("@embedpdf/react/outline");
|
|
5
|
+
let _embedpdf_react_attachment = require("@embedpdf/react/attachment");
|
|
3
6
|
let _embedpdf_react_interaction = require("@embedpdf/react/interaction");
|
|
4
7
|
let _embedpdf_react_selection = require("@embedpdf/react/selection");
|
|
5
8
|
let _embedpdf_react_annotation = require("@embedpdf/react/annotation");
|
|
6
9
|
let _embedpdf_react_stamp = require("@embedpdf/react/stamp");
|
|
7
10
|
let _embedpdf_react_measurement = require("@embedpdf/react/measurement");
|
|
8
11
|
let _embedpdf_react_redaction = require("@embedpdf/react/redaction");
|
|
9
|
-
let _embedpdf_react_actions = require("@embedpdf/react/actions");
|
|
10
12
|
let _embedpdf_react_form = require("@embedpdf/react/form");
|
|
11
13
|
let _embedpdf_react_signature = require("@embedpdf/react/signature");
|
|
12
14
|
let _embedpdf_react_link = require("@embedpdf/react/link");
|
|
@@ -16,6 +18,122 @@ let _embedpdf_react_history = require("@embedpdf/react/history");
|
|
|
16
18
|
let _embedpdf_react_shell = require("@embedpdf/react/shell");
|
|
17
19
|
let _embedpdf_core_ui = require("@embedpdf/core-ui");
|
|
18
20
|
let _embedpdf_web = require("@embedpdf/web");
|
|
21
|
+
//#region src/config/attachments.ts
|
|
22
|
+
/**
|
|
23
|
+
* The attachment commands, for the attachments panel (its header, each file's menu) and the
|
|
24
|
+
* strip over a selected file attachment annotation. The panel's commands act on the selected
|
|
25
|
+
* file (`attachment.getSelected()`); the panel selects a file before it opens that file's menu.
|
|
26
|
+
* Adding and deleting need `doc.attachments.modify` (a page's file: the annotation plugin's
|
|
27
|
+
* `canDelete()`) and the `attachments.adding` feature. Saving takes a file out of the document,
|
|
28
|
+
* so it goes with `documents.download` and needs `doc.download`: `readOnly` keeps it.
|
|
29
|
+
*/
|
|
30
|
+
/** The attachments panel's id in the layout. */
|
|
31
|
+
const ATTACHMENTS_PANEL = "attachments";
|
|
32
|
+
/** The menu of a file in the attachments panel: the commands below, for that file. */
|
|
33
|
+
const ATTACHMENT_ITEM_MENU = "attachment-item";
|
|
34
|
+
const attachmentOf = (commandContext) => commandContext.tryGet(_embedpdf_react_attachment.AttachmentToken);
|
|
35
|
+
/** The first selected file. */
|
|
36
|
+
const selectedOf$2 = (commandContext) => attachmentOf(commandContext)?.getSelected()[0] ?? null;
|
|
37
|
+
/** Save a file as the browser saves a download, under its cleaned name. */
|
|
38
|
+
async function saveAttachedFile(attachment, file) {
|
|
39
|
+
const { bytes, name, mimeType } = await attachment.download(file);
|
|
40
|
+
(0, _embedpdf_web.saveFile)(bytes, name, mimeType ?? void 0);
|
|
41
|
+
}
|
|
42
|
+
/** The one file attachment annotation selected on the pages, or null. */
|
|
43
|
+
const selectedAnnotationFile = (commandContext) => {
|
|
44
|
+
const selection = commandContext.tryGet(_embedpdf_react_annotation.AnnotationToken)?.selection.list() ?? [];
|
|
45
|
+
const [only] = selection;
|
|
46
|
+
if (selection.length !== 1 || only?.subtype !== "file-attachment") return null;
|
|
47
|
+
const key = (0, _embedpdf_react_annotation.annotationKey)(only.ref);
|
|
48
|
+
return (attachmentOf(commandContext)?.list() ?? []).find((file) => file.home.kind === "page" && (0, _embedpdf_react_annotation.annotationKey)(file.home.ref) === key) ?? null;
|
|
49
|
+
};
|
|
50
|
+
/** Saving: the right to take files out, and the feature on. */
|
|
51
|
+
const SAVES = {
|
|
52
|
+
categories: ["documents.download"],
|
|
53
|
+
allowed: (commandContext) => attachmentOf(commandContext)?.canDownload() ?? true,
|
|
54
|
+
notAllowedKey: "commands.notAllowed.doc-download"
|
|
55
|
+
};
|
|
56
|
+
/** Adding and deleting: the right to, and the feature on. */
|
|
57
|
+
const EDITS$1 = {
|
|
58
|
+
categories: ["attachments.adding"],
|
|
59
|
+
allowed: (commandContext) => attachmentOf(commandContext)?.canAdd() ?? true,
|
|
60
|
+
notAllowedKey: "commands.notAllowed.doc-attachments-modify"
|
|
61
|
+
};
|
|
62
|
+
const attachmentCommands = [
|
|
63
|
+
{
|
|
64
|
+
id: "attachment:add",
|
|
65
|
+
labelKey: "commands.attachment.add",
|
|
66
|
+
icon: "plus",
|
|
67
|
+
...EDITS$1,
|
|
68
|
+
run: async (commandContext) => {
|
|
69
|
+
const attachment = attachmentOf(commandContext);
|
|
70
|
+
if (!attachment) return;
|
|
71
|
+
const files = commandContext.args?.files ?? [await (0, _embedpdf_web.pickFile)()].filter((file) => file !== null);
|
|
72
|
+
if (files.length === 0) return;
|
|
73
|
+
commandContext.tryGet(_embedpdf_react_shell.ShellToken)?.open(ATTACHMENTS_PANEL);
|
|
74
|
+
await attachment.add(files.map((data) => ({ data })));
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: "attachment:save",
|
|
79
|
+
labelKey: "commands.attachment.save",
|
|
80
|
+
icon: "download",
|
|
81
|
+
...SAVES,
|
|
82
|
+
enabled: (commandContext) => selectedOf$2(commandContext) !== null,
|
|
83
|
+
run: async (commandContext) => {
|
|
84
|
+
const attachment = attachmentOf(commandContext);
|
|
85
|
+
const file = selectedOf$2(commandContext);
|
|
86
|
+
if (attachment && file) await saveAttachedFile(attachment, file);
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: "attachment:go-to",
|
|
91
|
+
labelKey: "commands.attachment.goTo",
|
|
92
|
+
visible: (commandContext) => selectedOf$2(commandContext)?.home.kind === "page",
|
|
93
|
+
run: (commandContext) => {
|
|
94
|
+
const file = selectedOf$2(commandContext);
|
|
95
|
+
if (file) attachmentOf(commandContext)?.reveal(file);
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: "attachment:delete",
|
|
100
|
+
labelKey: "commands.attachment.delete",
|
|
101
|
+
icon: "trash",
|
|
102
|
+
...EDITS$1,
|
|
103
|
+
allowed: (commandContext) => {
|
|
104
|
+
const attachment = attachmentOf(commandContext);
|
|
105
|
+
const file = selectedOf$2(commandContext);
|
|
106
|
+
if (!attachment) return true;
|
|
107
|
+
return file ? attachment.canRemove(file) : attachment.canAdd();
|
|
108
|
+
},
|
|
109
|
+
enabled: (commandContext) => selectedOf$2(commandContext) !== null,
|
|
110
|
+
run: async (commandContext) => {
|
|
111
|
+
const attachment = attachmentOf(commandContext);
|
|
112
|
+
const file = selectedOf$2(commandContext);
|
|
113
|
+
if (attachment && file) await attachment.remove(file);
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
id: "menu:attachment-item",
|
|
118
|
+
labelKey: "commands.attachment.more",
|
|
119
|
+
icon: "dots",
|
|
120
|
+
menu: ATTACHMENT_ITEM_MENU,
|
|
121
|
+
categories: ["attachments"]
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
id: "annotation:save-file",
|
|
125
|
+
labelKey: "commands.annotate.saveFile",
|
|
126
|
+
icon: "download",
|
|
127
|
+
...SAVES,
|
|
128
|
+
visible: (commandContext) => selectedAnnotationFile(commandContext) !== null,
|
|
129
|
+
run: async (commandContext) => {
|
|
130
|
+
const attachment = attachmentOf(commandContext);
|
|
131
|
+
const file = selectedAnnotationFile(commandContext);
|
|
132
|
+
if (attachment && file) await saveAttachedFile(attachment, file);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
];
|
|
136
|
+
//#endregion
|
|
19
137
|
//#region src/config/modes.ts
|
|
20
138
|
/** The exclusivity tag every mode surface opens with. */
|
|
21
139
|
const MODE_TAG = "mode";
|
|
@@ -59,9 +177,9 @@ function modeCommandsFor(specs, isTaken) {
|
|
|
59
177
|
//#endregion
|
|
60
178
|
//#region src/config/open-files.ts
|
|
61
179
|
const OPEN_COMMAND_ID = "document:open";
|
|
62
|
-
const PDF_TYPE = "application/pdf";
|
|
180
|
+
const PDF_TYPE$1 = "application/pdf";
|
|
63
181
|
/** Whether a file is a PDF, by its type or, where the system gives it none, its name. */
|
|
64
|
-
const isPdfFile = (file) => file.type === PDF_TYPE || /\.pdf$/i.test(file.name);
|
|
182
|
+
const isPdfFile = (file) => file.type === PDF_TYPE$1 || /\.pdf$/i.test(file.name);
|
|
65
183
|
/**
|
|
66
184
|
* Whether a drag may bring a PDF: it carries files, and one of them is a PDF or of a type the
|
|
67
185
|
* browser doesn't know. Text, links and anything dragged inside the page carry no files; where
|
|
@@ -70,14 +188,14 @@ const isPdfFile = (file) => file.type === PDF_TYPE || /\.pdf$/i.test(file.name);
|
|
|
70
188
|
function mayCarryPdf(transfer) {
|
|
71
189
|
if (!transfer || !Array.from(transfer.types).includes("Files")) return false;
|
|
72
190
|
const files = Array.from(transfer.items ?? []).filter((item) => item.kind === "file");
|
|
73
|
-
return files.length === 0 || files.some((item) => item.type === PDF_TYPE || item.type === "");
|
|
191
|
+
return files.length === 0 || files.some((item) => item.type === PDF_TYPE$1 || item.type === "");
|
|
74
192
|
}
|
|
75
193
|
const givenFilesOf = (args) => {
|
|
76
194
|
const files = args?.files;
|
|
77
195
|
return Array.isArray(files) ? files : null;
|
|
78
196
|
};
|
|
79
197
|
/** The file the user picks in the file dialog, as a list: empty when they close it. */
|
|
80
|
-
const pickedFiles = () => (0, _embedpdf_web.pickFile)({ accept: `.pdf,${PDF_TYPE}` }).then((file) => file ? [file] : []);
|
|
198
|
+
const pickedFiles = () => (0, _embedpdf_web.pickFile)({ accept: `.pdf,${PDF_TYPE$1}` }).then((file) => file ? [file] : []);
|
|
81
199
|
/**
|
|
82
200
|
* Open each file as a new tab, the first one shown. Its tab is there at once, named like a `src`
|
|
83
201
|
* file's (its name without `.pdf`), while the file is read; one that can't be opened says why
|
|
@@ -106,6 +224,289 @@ const openFileCommand = {
|
|
|
106
224
|
}
|
|
107
225
|
};
|
|
108
226
|
//#endregion
|
|
227
|
+
//#region src/config/outline.ts
|
|
228
|
+
/** The outline panel's id in the layout. */
|
|
229
|
+
const OUTLINE_PANEL = "outline";
|
|
230
|
+
/**
|
|
231
|
+
* A request to rename an item in its row: the selected one, once it isn't the item `after`
|
|
232
|
+
* names (an add selects the item it makes). The panel takes the request and closes it.
|
|
233
|
+
*/
|
|
234
|
+
const OUTLINE_RENAME = "outline-rename";
|
|
235
|
+
/** The dialog that edits one item's title, look, target and open state (`props.item`). */
|
|
236
|
+
const OUTLINE_PROPERTIES_DIALOG = "outline-properties";
|
|
237
|
+
/** The menu of a row of the outline: the commands below, for that row. */
|
|
238
|
+
const OUTLINE_ITEM_MENU = "outline-item";
|
|
239
|
+
const outlineOf = (commandContext) => commandContext.tryGet(_embedpdf_react_outline.OutlineToken);
|
|
240
|
+
/** The first selected item, as the outline holds it. */
|
|
241
|
+
const selectedOf$1 = (commandContext) => {
|
|
242
|
+
const outline = outlineOf(commandContext);
|
|
243
|
+
const [ref] = outline?.getSelected() ?? [];
|
|
244
|
+
return ref ? outline?.get(ref) ?? null : null;
|
|
245
|
+
};
|
|
246
|
+
const hasSelection$1 = (commandContext) => selectedOf$1(commandContext) !== null;
|
|
247
|
+
/** What a command that changes the outline needs: the right to, and the feature on. */
|
|
248
|
+
const EDITS = {
|
|
249
|
+
categories: ["outline.editing"],
|
|
250
|
+
allowed: (commandContext) => outlineOf(commandContext)?.canEdit() ?? true,
|
|
251
|
+
notAllowedKey: "commands.notAllowed.doc-outline-modify"
|
|
252
|
+
};
|
|
253
|
+
/**
|
|
254
|
+
* Add an item and rename it in its row, as Acrobat's New Bookmark does: it goes to where the
|
|
255
|
+
* view is, after the selected item, or at the end of the outline when none is selected.
|
|
256
|
+
*/
|
|
257
|
+
async function addItem(commandContext, input) {
|
|
258
|
+
const outline = outlineOf(commandContext);
|
|
259
|
+
if (!outline) return;
|
|
260
|
+
const shell = commandContext.tryGet(_embedpdf_react_shell.ShellToken);
|
|
261
|
+
const selected = selectedOf$1(commandContext);
|
|
262
|
+
shell?.open(OUTLINE_PANEL);
|
|
263
|
+
shell?.open(OUTLINE_RENAME, { props: { after: selected?.ref.objectNumber ?? null } });
|
|
264
|
+
try {
|
|
265
|
+
await outline.create(input(selected), { select: true });
|
|
266
|
+
} catch (error) {
|
|
267
|
+
shell?.close(OUTLINE_RENAME);
|
|
268
|
+
throw error;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
const outlineCommands = [
|
|
272
|
+
{
|
|
273
|
+
id: "outline:add",
|
|
274
|
+
labelKey: "commands.outline.add",
|
|
275
|
+
icon: "plus",
|
|
276
|
+
shortcut: "Mod+B",
|
|
277
|
+
...EDITS,
|
|
278
|
+
run: (commandContext) => addItem(commandContext, (selected) => selected ? {
|
|
279
|
+
parent: selected.parent,
|
|
280
|
+
position: { after: selected.ref }
|
|
281
|
+
} : {})
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
id: "outline:add-child",
|
|
285
|
+
labelKey: "commands.outline.addChild",
|
|
286
|
+
...EDITS,
|
|
287
|
+
enabled: hasSelection$1,
|
|
288
|
+
run: (commandContext) => addItem(commandContext, (selected) => selected ? { parent: selected.ref } : {})
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
id: "outline:rename",
|
|
292
|
+
labelKey: "commands.outline.rename",
|
|
293
|
+
...EDITS,
|
|
294
|
+
enabled: hasSelection$1,
|
|
295
|
+
run: (commandContext) => {
|
|
296
|
+
const selected = selectedOf$1(commandContext);
|
|
297
|
+
if (!selected) return;
|
|
298
|
+
commandContext.tryGet(_embedpdf_react_shell.ShellToken)?.open(OUTLINE_RENAME, { props: { item: selected.ref.objectNumber } });
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
id: "outline:set-destination",
|
|
303
|
+
labelKey: "commands.outline.setDestination",
|
|
304
|
+
...EDITS,
|
|
305
|
+
enabled: (commandContext) => hasSelection$1(commandContext) && outlineOf(commandContext)?.getCurrentViewTarget() != null,
|
|
306
|
+
run: async (commandContext) => {
|
|
307
|
+
const outline = outlineOf(commandContext);
|
|
308
|
+
const selected = selectedOf$1(commandContext);
|
|
309
|
+
const target = outline?.getCurrentViewTarget() ?? null;
|
|
310
|
+
if (outline && selected && target) await outline.update(selected.ref, { target });
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
id: "outline:properties",
|
|
315
|
+
labelKey: "commands.outline.properties",
|
|
316
|
+
...EDITS,
|
|
317
|
+
enabled: hasSelection$1,
|
|
318
|
+
run: (commandContext) => {
|
|
319
|
+
const selected = selectedOf$1(commandContext);
|
|
320
|
+
if (!selected) return;
|
|
321
|
+
commandContext.tryGet(_embedpdf_react_shell.ShellToken)?.open(OUTLINE_PROPERTIES_DIALOG, {
|
|
322
|
+
exclusive: "modal",
|
|
323
|
+
props: { item: selected.ref.objectNumber }
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
id: "outline:delete",
|
|
329
|
+
labelKey: "commands.outline.delete",
|
|
330
|
+
icon: "trash",
|
|
331
|
+
...EDITS,
|
|
332
|
+
enabled: hasSelection$1,
|
|
333
|
+
run: async (commandContext) => {
|
|
334
|
+
const outline = outlineOf(commandContext);
|
|
335
|
+
const selected = outline?.getSelected() ?? [];
|
|
336
|
+
if (outline && selected.length > 0) await outline.delete(selected);
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
id: "menu:outline-item",
|
|
341
|
+
labelKey: "commands.outline.more",
|
|
342
|
+
icon: "dots",
|
|
343
|
+
menu: OUTLINE_ITEM_MENU,
|
|
344
|
+
...EDITS
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
id: "outline:expand-all",
|
|
348
|
+
labelKey: "commands.outline.expandAll",
|
|
349
|
+
icon: "chevronsDown",
|
|
350
|
+
categories: ["outline"],
|
|
351
|
+
run: (commandContext) => outlineOf(commandContext)?.expandAll()
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
id: "outline:collapse-all",
|
|
355
|
+
labelKey: "commands.outline.collapseAll",
|
|
356
|
+
icon: "chevronsUp",
|
|
357
|
+
categories: ["outline"],
|
|
358
|
+
run: (commandContext) => outlineOf(commandContext)?.collapseAll()
|
|
359
|
+
}
|
|
360
|
+
];
|
|
361
|
+
//#endregion
|
|
362
|
+
//#region src/config/page-commands.ts
|
|
363
|
+
/** The menu of a page: the commands below, for that page and the others selected with it. */
|
|
364
|
+
const PAGE_MENU = "page";
|
|
365
|
+
const PDF_TYPE = "application/pdf";
|
|
366
|
+
const pageEditOf = (commandContext) => commandContext.tryGet(_embedpdf_react_page_edit.PageEditToken);
|
|
367
|
+
const selectedOf = (commandContext) => pageEditOf(commandContext)?.getSelected() ?? [];
|
|
368
|
+
const hasSelection = (commandContext) => selectedOf(commandContext).length > 0;
|
|
369
|
+
/** The document's pages, in display order. */
|
|
370
|
+
const pagesOf = (commandContext) => commandContext.tryGet(_embedpdf_react_runtime.DocumentsToken)?.listPages(commandContext.documentId ?? void 0) ?? [];
|
|
371
|
+
const argsOf = (commandContext) => commandContext.args ?? {};
|
|
372
|
+
/** What a command that changes the pages needs: the right to, and the feature on. */
|
|
373
|
+
const PAGE_EDITS = {
|
|
374
|
+
categories: ["pages"],
|
|
375
|
+
allowed: (commandContext) => pageEditOf(commandContext)?.canEdit() ?? true,
|
|
376
|
+
notAllowedKey: "commands.notAllowed.doc-pages-assemble"
|
|
377
|
+
};
|
|
378
|
+
/**
|
|
379
|
+
* Where new pages go: where the caller says, else after the selected page that comes last, else
|
|
380
|
+
* at the end.
|
|
381
|
+
*/
|
|
382
|
+
function insertPositionOf(commandContext) {
|
|
383
|
+
const given = argsOf(commandContext).position;
|
|
384
|
+
if (given) return given;
|
|
385
|
+
const selected = new Set(selectedOf(commandContext).map((ref) => ref.objectNumber));
|
|
386
|
+
const last = pagesOf(commandContext).filter((page) => selected.has(page.ref.objectNumber)).pop();
|
|
387
|
+
return last ? { after: last.ref } : "end";
|
|
388
|
+
}
|
|
389
|
+
/** The PDFs the caller passed, else the one the user picks: empty when they close the dialog. */
|
|
390
|
+
async function filesToInsert(commandContext) {
|
|
391
|
+
const given = argsOf(commandContext).files;
|
|
392
|
+
if (given) return given.filter(isPdfFile);
|
|
393
|
+
const picked = await (0, _embedpdf_web.pickFile)({ accept: `.pdf,${PDF_TYPE}` });
|
|
394
|
+
return picked ? [picked] : [];
|
|
395
|
+
}
|
|
396
|
+
/** The name of a copy of some of the document's pages: the document's own name, then `-pages`. */
|
|
397
|
+
function extractNameOf(commandContext) {
|
|
398
|
+
const id = commandContext.documentId ?? void 0;
|
|
399
|
+
return `${commandContext.tryGet(_embedpdf_react_runtime.DocumentsToken)?.get(id)?.name?.replace(/\.pdf$/i, "") || "document"}-pages.pdf`;
|
|
400
|
+
}
|
|
401
|
+
const rotate = (id, labelKey, icon, delta) => ({
|
|
402
|
+
id,
|
|
403
|
+
labelKey,
|
|
404
|
+
icon,
|
|
405
|
+
...PAGE_EDITS,
|
|
406
|
+
enabled: hasSelection,
|
|
407
|
+
run: async (commandContext) => {
|
|
408
|
+
const selected = selectedOf(commandContext);
|
|
409
|
+
if (selected.length > 0) await pageEditOf(commandContext)?.rotateBy(selected, delta);
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
const pageCommands = [
|
|
413
|
+
rotate("page:rotate-clockwise", "commands.pages.rotateClockwise", "pageRotateClockwise", 90),
|
|
414
|
+
rotate("page:rotate-counterclockwise", "commands.pages.rotateCounterclockwise", "pageRotateCounterClockwise", -90),
|
|
415
|
+
{
|
|
416
|
+
id: "page:delete",
|
|
417
|
+
labelKey: "commands.pages.delete",
|
|
418
|
+
icon: "trash",
|
|
419
|
+
...PAGE_EDITS,
|
|
420
|
+
enabled: (commandContext) => {
|
|
421
|
+
const count = selectedOf(commandContext).length;
|
|
422
|
+
return count > 0 && count < pagesOf(commandContext).length;
|
|
423
|
+
},
|
|
424
|
+
run: async (commandContext) => {
|
|
425
|
+
const selected = selectedOf(commandContext);
|
|
426
|
+
if (selected.length > 0) await pageEditOf(commandContext)?.delete(selected);
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
id: "page:duplicate",
|
|
431
|
+
labelKey: "commands.pages.duplicate",
|
|
432
|
+
icon: "copy",
|
|
433
|
+
categories: PAGE_EDITS.categories,
|
|
434
|
+
allowed: (commandContext) => {
|
|
435
|
+
const pageEdit = pageEditOf(commandContext);
|
|
436
|
+
return pageEdit ? pageEdit.canEdit() && pageEdit.canExtract() : true;
|
|
437
|
+
},
|
|
438
|
+
enabled: hasSelection,
|
|
439
|
+
run: async (commandContext) => {
|
|
440
|
+
const pageEdit = pageEditOf(commandContext);
|
|
441
|
+
const selected = selectedOf(commandContext);
|
|
442
|
+
if (!pageEdit || selected.length === 0) return;
|
|
443
|
+
const { pages } = await pageEdit.duplicate(selected);
|
|
444
|
+
pageEdit.select(pages);
|
|
445
|
+
}
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
id: "page:insert-blank",
|
|
449
|
+
labelKey: "commands.pages.insertBlank",
|
|
450
|
+
icon: "filePlus",
|
|
451
|
+
...PAGE_EDITS,
|
|
452
|
+
run: async (commandContext) => {
|
|
453
|
+
const pageEdit = pageEditOf(commandContext);
|
|
454
|
+
if (!pageEdit) return;
|
|
455
|
+
const { pages } = await pageEdit.insertBlank({ position: insertPositionOf(commandContext) });
|
|
456
|
+
pageEdit.select(pages);
|
|
457
|
+
}
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
id: "page:insert-file",
|
|
461
|
+
labelKey: "commands.pages.insertFile",
|
|
462
|
+
icon: "fileImport",
|
|
463
|
+
...PAGE_EDITS,
|
|
464
|
+
run: async (commandContext) => {
|
|
465
|
+
const pageEdit = pageEditOf(commandContext);
|
|
466
|
+
if (!pageEdit) return;
|
|
467
|
+
let position = insertPositionOf(commandContext);
|
|
468
|
+
const files = await filesToInsert(commandContext);
|
|
469
|
+
const inserted = [];
|
|
470
|
+
for (const file of files) {
|
|
471
|
+
const { pages } = await pageEdit.insertFromBytes(new Uint8Array(await file.arrayBuffer()), { position });
|
|
472
|
+
inserted.push(...pages);
|
|
473
|
+
const last = pages[pages.length - 1];
|
|
474
|
+
if (last) position = { after: last };
|
|
475
|
+
}
|
|
476
|
+
if (inserted.length > 0) pageEdit.select(inserted);
|
|
477
|
+
}
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
id: "page:extract",
|
|
481
|
+
labelKey: "commands.pages.extract",
|
|
482
|
+
icon: "fileExport",
|
|
483
|
+
categories: ["documents.download"],
|
|
484
|
+
allowed: (commandContext) => pageEditOf(commandContext)?.canExtract() ?? true,
|
|
485
|
+
notAllowedKey: "commands.notAllowed.doc-download",
|
|
486
|
+
enabled: hasSelection,
|
|
487
|
+
run: async (commandContext) => {
|
|
488
|
+
const selected = selectedOf(commandContext);
|
|
489
|
+
const pageEdit = pageEditOf(commandContext);
|
|
490
|
+
if (!pageEdit || selected.length === 0) return;
|
|
491
|
+
(0, _embedpdf_web.saveFile)(await pageEdit.extract(selected), extractNameOf(commandContext), PDF_TYPE);
|
|
492
|
+
}
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
id: "page:select-all",
|
|
496
|
+
labelKey: "commands.pages.selectAll",
|
|
497
|
+
categories: PAGE_EDITS.categories,
|
|
498
|
+
enabled: (commandContext) => selectedOf(commandContext).length < pagesOf(commandContext).length,
|
|
499
|
+
run: (commandContext) => pageEditOf(commandContext)?.select(pagesOf(commandContext).map((page) => page.ref))
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
id: "menu:page",
|
|
503
|
+
labelKey: "commands.pages.more",
|
|
504
|
+
icon: "dots",
|
|
505
|
+
menu: PAGE_MENU,
|
|
506
|
+
...PAGE_EDITS
|
|
507
|
+
}
|
|
508
|
+
];
|
|
509
|
+
//#endregion
|
|
109
510
|
//#region src/config/commands.ts
|
|
110
511
|
/**
|
|
111
512
|
* The command vocabulary — the semantic layer. Every command is a pure value:
|
|
@@ -136,6 +537,8 @@ const GO_TO_PAGE_DIALOG = "go-to-page";
|
|
|
136
537
|
const SHORTCUTS_DIALOG = "shortcuts";
|
|
137
538
|
/** The confirmation before marked areas are removed for good (ui/redact-confirm.tsx). */
|
|
138
539
|
const REDACT_CONFIRM_DIALOG = "redact-confirm";
|
|
540
|
+
/** The Print dialog: which pages, and whether annotations print (ui/print-dialog.tsx). */
|
|
541
|
+
const PRINT_DIALOG = "print";
|
|
139
542
|
/** The form designer's sidebar (ui/form-design-panel.tsx), which `form:design` opens. */
|
|
140
543
|
const FORM_DESIGN_PANEL = "form-design";
|
|
141
544
|
/** Form design's resting tool, the form plugin's: widgets select, move and resize there. */
|
|
@@ -419,6 +822,9 @@ const defaultCommands = [
|
|
|
419
822
|
icon: "viewSettings",
|
|
420
823
|
menu: "view"
|
|
421
824
|
},
|
|
825
|
+
...outlineCommands,
|
|
826
|
+
...attachmentCommands,
|
|
827
|
+
...pageCommands,
|
|
422
828
|
openFileCommand,
|
|
423
829
|
{
|
|
424
830
|
id: "document:download",
|
|
@@ -432,15 +838,7 @@ const defaultCommands = [
|
|
|
432
838
|
const id = commandContext.documentId ?? void 0;
|
|
433
839
|
const documents = commandContext.tryGet(_embedpdf_react_runtime.DocumentsToken);
|
|
434
840
|
if (!documents) return;
|
|
435
|
-
documents.download(id).then((bytes) =>
|
|
436
|
-
const blob = new Blob([bytes], { type: "application/pdf" });
|
|
437
|
-
const url = URL.createObjectURL(blob);
|
|
438
|
-
const anchor = document.createElement("a");
|
|
439
|
-
anchor.href = url;
|
|
440
|
-
anchor.download = "document.pdf";
|
|
441
|
-
anchor.click();
|
|
442
|
-
URL.revokeObjectURL(url);
|
|
443
|
-
}).catch((error) => console.warn("[snippet-react] download failed", error));
|
|
841
|
+
documents.download(id).then((bytes) => (0, _embedpdf_web.saveFile)(bytes, "document.pdf", "application/pdf")).catch((error) => console.warn("[snippet-react] download failed", error));
|
|
444
842
|
},
|
|
445
843
|
enabled: (commandContext) => commandContext.documentId != null
|
|
446
844
|
},
|
|
@@ -452,11 +850,8 @@ const defaultCommands = [
|
|
|
452
850
|
categories: ["documents.print"],
|
|
453
851
|
allowed: (commandContext) => commandContext.tryGet(_embedpdf_react_runtime.DocumentsToken)?.canPrint() ?? true,
|
|
454
852
|
notAllowedKey: "commands.notAllowed.doc-print",
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
if (actions) actions.runDocumentVerb("print", () => window.print());
|
|
458
|
-
else window.print();
|
|
459
|
-
}
|
|
853
|
+
modal: PRINT_DIALOG,
|
|
854
|
+
enabled: (commandContext) => commandContext.documentId != null
|
|
460
855
|
},
|
|
461
856
|
{
|
|
462
857
|
id: "view:fullscreen",
|
|
@@ -978,6 +1373,24 @@ Object.defineProperty(exports, "OPEN_COMMAND_ID", {
|
|
|
978
1373
|
return OPEN_COMMAND_ID;
|
|
979
1374
|
}
|
|
980
1375
|
});
|
|
1376
|
+
Object.defineProperty(exports, "OUTLINE_PROPERTIES_DIALOG", {
|
|
1377
|
+
enumerable: true,
|
|
1378
|
+
get: function() {
|
|
1379
|
+
return OUTLINE_PROPERTIES_DIALOG;
|
|
1380
|
+
}
|
|
1381
|
+
});
|
|
1382
|
+
Object.defineProperty(exports, "OUTLINE_RENAME", {
|
|
1383
|
+
enumerable: true,
|
|
1384
|
+
get: function() {
|
|
1385
|
+
return OUTLINE_RENAME;
|
|
1386
|
+
}
|
|
1387
|
+
});
|
|
1388
|
+
Object.defineProperty(exports, "PRINT_DIALOG", {
|
|
1389
|
+
enumerable: true,
|
|
1390
|
+
get: function() {
|
|
1391
|
+
return PRINT_DIALOG;
|
|
1392
|
+
}
|
|
1393
|
+
});
|
|
981
1394
|
Object.defineProperty(exports, "REDACT_CONFIRM_DIALOG", {
|
|
982
1395
|
enumerable: true,
|
|
983
1396
|
get: function() {
|
|
@@ -1057,4 +1470,4 @@ Object.defineProperty(exports, "toolCommandsFor", {
|
|
|
1057
1470
|
}
|
|
1058
1471
|
});
|
|
1059
1472
|
|
|
1060
|
-
//# sourceMappingURL=commands-
|
|
1473
|
+
//# sourceMappingURL=commands-DL1gjZt7.cjs.map
|