@arbidocs/coedit 0.4.98 → 0.4.100
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/encoding.cjs +25 -5
- package/dist/encoding.cjs.map +1 -1
- package/dist/encoding.js +25 -5
- package/dist/encoding.js.map +1 -1
- package/dist/hocuspocus.cjs +25 -5
- package/dist/hocuspocus.cjs.map +1 -1
- package/dist/hocuspocus.js +25 -5
- package/dist/hocuspocus.js.map +1 -1
- package/dist/index.cjs +25 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +25 -5
- package/dist/index.js.map +1 -1
- package/dist/server.cjs +25 -5
- package/dist/server.cjs.map +1 -1
- package/dist/server.js +25 -5
- package/dist/server.js.map +1 -1
- package/dist/template.cjs +54 -0
- package/dist/template.cjs.map +1 -1
- package/dist/template.d.cts +17 -1
- package/dist/template.d.ts +17 -1
- package/dist/template.js +54 -1
- package/dist/template.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -592,19 +592,39 @@ function materialize(doc, cache, changed = null) {
|
|
|
592
592
|
mainDocumentPart: main
|
|
593
593
|
});
|
|
594
594
|
}
|
|
595
|
+
var MEDIA_TYPES = {
|
|
596
|
+
png: "image/png",
|
|
597
|
+
jpg: "image/jpeg",
|
|
598
|
+
jpeg: "image/jpeg",
|
|
599
|
+
gif: "image/gif",
|
|
600
|
+
bmp: "image/bmp",
|
|
601
|
+
tif: "image/tiff",
|
|
602
|
+
tiff: "image/tiff",
|
|
603
|
+
webp: "image/webp",
|
|
604
|
+
svg: "image/svg+xml",
|
|
605
|
+
emf: "image/x-emf",
|
|
606
|
+
wmf: "image/x-wmf"
|
|
607
|
+
};
|
|
595
608
|
function withMirroredOverrides(pkg) {
|
|
596
609
|
const bytes = contentTypesPartBytes(pkg);
|
|
597
610
|
if (!bytes) return pkg;
|
|
611
|
+
const xml = new TextDecoder().decode(bytes.bytes);
|
|
598
612
|
const declared = new Set(
|
|
599
|
-
[...
|
|
600
|
-
|
|
601
|
-
|
|
613
|
+
[...xml.matchAll(/PartName\s*=\s*["']([^"']+)["']/gi)].map((m) => m[1].toLowerCase())
|
|
614
|
+
);
|
|
615
|
+
const defaults = new Set(
|
|
616
|
+
[...xml.matchAll(/Extension\s*=\s*["']([^"']+)["']/gi)].map((m) => m[1].toLowerCase())
|
|
602
617
|
);
|
|
603
618
|
let next = pkg;
|
|
604
619
|
for (const name of [...pkg.parts.keys(), ...pkg.partBytes.keys()]) {
|
|
605
|
-
const
|
|
606
|
-
if (
|
|
620
|
+
const key = name.toLowerCase();
|
|
621
|
+
if (declared.has(key) || key === bytes.storageKey.toLowerCase()) continue;
|
|
622
|
+
const extension = key.slice(key.lastIndexOf(".") + 1);
|
|
623
|
+
const type = pkg.contentTypes.overrides.get(key) ?? (defaults.has(extension) ? void 0 : MEDIA_TYPES[extension]);
|
|
624
|
+
if (type) {
|
|
607
625
|
next = withContentTypeOverride(next, name, type, { forceOverride: true });
|
|
626
|
+
declared.add(key);
|
|
627
|
+
}
|
|
608
628
|
}
|
|
609
629
|
return next;
|
|
610
630
|
}
|