Skip to content

Commit a0058b7

Browse files
committed
refactored: added mime type configurations
1 parent 378a3ca commit a0058b7

4 files changed

Lines changed: 30 additions & 17 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ducjs/src/types/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import type {
3939
GRID_TYPE,
4040
IMAGE_MIME_TYPES,
4141
MIME_TYPES,
42+
SUPPORTED_DATA_TYPES,
4243
SNAP_MARKER_SHAPE,
4344
SNAP_MODE,
4445
SNAP_OVERRIDE_BEHAVIOR,

packages/ducjs/src/utils/constants.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,15 @@ export const MIME_TYPES = {
5555
binary: "application/octet-stream",
5656
pdf: "application/pdf",
5757
zip: "application/zip",
58-
// image
58+
xls: "application/vnd.ms-excel",
59+
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
60+
doc: "application/msword",
61+
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
62+
csv: "text/csv",
63+
markdown: "text/markdown",
64+
step: "model/step",
65+
stp: "application/step",
66+
stl: "model/stl",
5967
...IMAGE_MIME_TYPES,
6068
} as const;
6169

@@ -73,6 +81,23 @@ export const EXPORT_DATA_TYPES = {
7381
ducClipboardWithAPI: "duc-api/clipboard",
7482
} as const;
7583

84+
export const SUPPORTED_DATA_TYPES = [
85+
MIME_TYPES.duc,
86+
MIME_TYPES.ducfig,
87+
MIME_TYPES.pdf,
88+
MIME_TYPES.xls,
89+
MIME_TYPES.xlsx,
90+
MIME_TYPES.doc,
91+
MIME_TYPES.docx,
92+
MIME_TYPES.json,
93+
MIME_TYPES.csv,
94+
MIME_TYPES.markdown,
95+
MIME_TYPES.step,
96+
MIME_TYPES.stp,
97+
MIME_TYPES.stl,
98+
...Object.values(IMAGE_MIME_TYPES),
99+
]
100+
76101

77102
export const VERSIONS = {
78103
excalidraw: 2,

packages/ducpdf/src/duc2pdf/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ path = "src/lib.rs"
2121
crate-type = ["cdylib", "rlib"]
2222

2323
[dependencies]
24-
duc = "1"
25-
# duc = { path = "../../../ducrs" }
24+
# duc = "1"
25+
duc = { path = "../../../ducrs" }
2626
hipdf = { version = "1.3.2", features = ["wasm_js"] }
2727
svg2pdf = "0.13.0"
2828
wasm-bindgen = "0.2.92"

0 commit comments

Comments
 (0)