@ai-matrx/office 0.8.18 → 0.8.19
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/CHANGELOG.md +5 -0
- package/dist/univer-collab.cjs +23 -0
- package/dist/univer-collab.cjs.map +1 -1
- package/dist/univer-collab.js +23 -0
- package/dist/univer-collab.js.map +1 -1
- package/package.json +3 -3
package/dist/univer-collab.js
CHANGED
|
@@ -1054,9 +1054,32 @@ function asLoadedDocsSnapshot(snapshot) {
|
|
|
1054
1054
|
model.dispose();
|
|
1055
1055
|
}
|
|
1056
1056
|
}
|
|
1057
|
+
var isEmptyDeep = (v) => v == null || v === "" || (Array.isArray(v) ? v.every(isEmptyDeep) : typeof v === "object" ? Object.values(v).every(isEmptyDeep) : false);
|
|
1058
|
+
function canonicalResources(resources) {
|
|
1059
|
+
if (!Array.isArray(resources)) return [];
|
|
1060
|
+
const out = [];
|
|
1061
|
+
for (const r of resources) {
|
|
1062
|
+
if (!r || typeof r.name !== "string") continue;
|
|
1063
|
+
let data = r.data;
|
|
1064
|
+
if (typeof data === "string" && data !== "") {
|
|
1065
|
+
try {
|
|
1066
|
+
data = JSON.parse(data);
|
|
1067
|
+
} catch {
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
if (isEmptyDeep(data)) continue;
|
|
1071
|
+
out.push({ name: r.name, data: sortDeep(data) });
|
|
1072
|
+
}
|
|
1073
|
+
return out.sort((a, b) => a.name.localeCompare(b.name));
|
|
1074
|
+
}
|
|
1057
1075
|
function canonicalDocsSnapshot(snapshot) {
|
|
1058
1076
|
const s = asLoadedDocsSnapshot(snapshot);
|
|
1059
1077
|
delete s.id;
|
|
1078
|
+
s.resources = canonicalResources(s.resources);
|
|
1079
|
+
if (s.settings && typeof s.settings === "object") {
|
|
1080
|
+
s.settings = { ...s.settings };
|
|
1081
|
+
delete s.settings.zoomRatio;
|
|
1082
|
+
}
|
|
1060
1083
|
for (const k of DOC_LOCAL_KEYS) delete s[k];
|
|
1061
1084
|
s.body = canonicalBody(s.body);
|
|
1062
1085
|
for (const seg of ["headers", "footers", "notes"]) {
|