@arbidocs/coedit 0.4.99 → 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/package.json +1 -1
package/dist/server.cjs
CHANGED
|
@@ -688,19 +688,39 @@ function materialize(doc, cache, changed = null) {
|
|
|
688
688
|
mainDocumentPart: main
|
|
689
689
|
});
|
|
690
690
|
}
|
|
691
|
+
var MEDIA_TYPES = {
|
|
692
|
+
png: "image/png",
|
|
693
|
+
jpg: "image/jpeg",
|
|
694
|
+
jpeg: "image/jpeg",
|
|
695
|
+
gif: "image/gif",
|
|
696
|
+
bmp: "image/bmp",
|
|
697
|
+
tif: "image/tiff",
|
|
698
|
+
tiff: "image/tiff",
|
|
699
|
+
webp: "image/webp",
|
|
700
|
+
svg: "image/svg+xml",
|
|
701
|
+
emf: "image/x-emf",
|
|
702
|
+
wmf: "image/x-wmf"
|
|
703
|
+
};
|
|
691
704
|
function withMirroredOverrides(pkg) {
|
|
692
705
|
const bytes = store.contentTypesPartBytes(pkg);
|
|
693
706
|
if (!bytes) return pkg;
|
|
707
|
+
const xml = new TextDecoder().decode(bytes.bytes);
|
|
694
708
|
const declared = new Set(
|
|
695
|
-
[...
|
|
696
|
-
|
|
697
|
-
|
|
709
|
+
[...xml.matchAll(/PartName\s*=\s*["']([^"']+)["']/gi)].map((m) => m[1].toLowerCase())
|
|
710
|
+
);
|
|
711
|
+
const defaults = new Set(
|
|
712
|
+
[...xml.matchAll(/Extension\s*=\s*["']([^"']+)["']/gi)].map((m) => m[1].toLowerCase())
|
|
698
713
|
);
|
|
699
714
|
let next = pkg;
|
|
700
715
|
for (const name of [...pkg.parts.keys(), ...pkg.partBytes.keys()]) {
|
|
701
|
-
const
|
|
702
|
-
if (
|
|
716
|
+
const key = name.toLowerCase();
|
|
717
|
+
if (declared.has(key) || key === bytes.storageKey.toLowerCase()) continue;
|
|
718
|
+
const extension = key.slice(key.lastIndexOf(".") + 1);
|
|
719
|
+
const type = pkg.contentTypes.overrides.get(key) ?? (defaults.has(extension) ? void 0 : MEDIA_TYPES[extension]);
|
|
720
|
+
if (type) {
|
|
703
721
|
next = store.withContentTypeOverride(next, name, type, { forceOverride: true });
|
|
722
|
+
declared.add(key);
|
|
723
|
+
}
|
|
704
724
|
}
|
|
705
725
|
return next;
|
|
706
726
|
}
|