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