@arbidocs/coedit 0.4.96 → 0.4.97
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 +18 -2
- package/dist/encoding.cjs.map +1 -1
- package/dist/encoding.js +19 -3
- package/dist/encoding.js.map +1 -1
- package/dist/hocuspocus.cjs +18 -2
- package/dist/hocuspocus.cjs.map +1 -1
- package/dist/hocuspocus.js +19 -3
- package/dist/hocuspocus.js.map +1 -1
- package/dist/index.cjs +18 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -3
- package/dist/index.js.map +1 -1
- package/dist/server.cjs +18 -2
- package/dist/server.cjs.map +1 -1
- package/dist/server.js +19 -3
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Awareness } from 'y-protocols/awareness';
|
|
2
2
|
import { createServerAutomationHost } from '@docx-editor.dev/core/automation';
|
|
3
3
|
import * as Y3 from 'yjs';
|
|
4
|
-
import { readOoxmlPackage, writeOoxmlPackage, readOoxmlPart, validateExternalTarget, relsPartNameFor } from '@docx-editor.dev/core/store';
|
|
4
|
+
import { readOoxmlPackage, writeOoxmlPackage, readOoxmlPart, validateExternalTarget, relsPartNameFor, contentTypesPartBytes, withContentTypeOverride } from '@docx-editor.dev/core/store';
|
|
5
5
|
import { createCollaborationStatusTracker, safeParticipantColor } from '@docx-editor.dev/core/collaboration';
|
|
6
6
|
import { historyGroupOfJournal } from '@docx-editor.dev/core/collaboration/replication';
|
|
7
7
|
|
|
@@ -657,14 +657,30 @@ function materialize(doc, cache, changed = null) {
|
|
|
657
657
|
defaults: new Map(doc.getMap("ctDefaults")),
|
|
658
658
|
overrides: new Map(doc.getMap("ctOverrides"))
|
|
659
659
|
};
|
|
660
|
-
return {
|
|
660
|
+
return withMirroredOverrides({
|
|
661
661
|
parts,
|
|
662
662
|
partBytes,
|
|
663
663
|
relationships,
|
|
664
664
|
externalTargets,
|
|
665
665
|
contentTypes,
|
|
666
666
|
mainDocumentPart: main
|
|
667
|
-
};
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
function withMirroredOverrides(pkg) {
|
|
670
|
+
const bytes = contentTypesPartBytes(pkg);
|
|
671
|
+
if (!bytes) return pkg;
|
|
672
|
+
const declared = new Set(
|
|
673
|
+
[...new TextDecoder().decode(bytes.bytes).matchAll(/PartName\s*=\s*["']([^"']+)["']/gi)].map(
|
|
674
|
+
(m) => m[1].toLowerCase()
|
|
675
|
+
)
|
|
676
|
+
);
|
|
677
|
+
let next = pkg;
|
|
678
|
+
for (const name of [...pkg.parts.keys(), ...pkg.partBytes.keys()]) {
|
|
679
|
+
const type = pkg.contentTypes.overrides.get(name.toLowerCase());
|
|
680
|
+
if (type && !declared.has(name.toLowerCase()))
|
|
681
|
+
next = withContentTypeOverride(next, name, type, { forceOverride: true });
|
|
682
|
+
}
|
|
683
|
+
return next;
|
|
668
684
|
}
|
|
669
685
|
function materializeBytes(doc) {
|
|
670
686
|
return writeOoxmlPackage(materialize(doc));
|