@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/hocuspocus.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Y3 from 'yjs';
|
|
2
2
|
import { Awareness } from 'y-protocols/awareness';
|
|
3
3
|
import { HocuspocusProvider } from '@hocuspocus/provider';
|
|
4
|
-
import { writeOoxmlPackage, readOoxmlPart, validateExternalTarget, relsPartNameFor } from '@docx-editor.dev/core/store';
|
|
4
|
+
import { 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
|
|
|
@@ -585,14 +585,30 @@ function materialize(doc, cache, changed = null) {
|
|
|
585
585
|
defaults: new Map(doc.getMap("ctDefaults")),
|
|
586
586
|
overrides: new Map(doc.getMap("ctOverrides"))
|
|
587
587
|
};
|
|
588
|
-
return {
|
|
588
|
+
return withMirroredOverrides({
|
|
589
589
|
parts,
|
|
590
590
|
partBytes,
|
|
591
591
|
relationships,
|
|
592
592
|
externalTargets,
|
|
593
593
|
contentTypes,
|
|
594
594
|
mainDocumentPart: main
|
|
595
|
-
};
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
function withMirroredOverrides(pkg) {
|
|
598
|
+
const bytes = contentTypesPartBytes(pkg);
|
|
599
|
+
if (!bytes) return pkg;
|
|
600
|
+
const declared = new Set(
|
|
601
|
+
[...new TextDecoder().decode(bytes.bytes).matchAll(/PartName\s*=\s*["']([^"']+)["']/gi)].map(
|
|
602
|
+
(m) => m[1].toLowerCase()
|
|
603
|
+
)
|
|
604
|
+
);
|
|
605
|
+
let next = pkg;
|
|
606
|
+
for (const name of [...pkg.parts.keys(), ...pkg.partBytes.keys()]) {
|
|
607
|
+
const type = pkg.contentTypes.overrides.get(name.toLowerCase());
|
|
608
|
+
if (type && !declared.has(name.toLowerCase()))
|
|
609
|
+
next = withContentTypeOverride(next, name, type, { forceOverride: true });
|
|
610
|
+
}
|
|
611
|
+
return next;
|
|
596
612
|
}
|
|
597
613
|
function materializeBytes(doc) {
|
|
598
614
|
return writeOoxmlPackage(materialize(doc));
|