From c6c7917d855873b54cc65732057bc73ab86a5a92 Mon Sep 17 00:00:00 2001 From: Wolfgang Ginolas Date: Wed, 25 Feb 2026 14:31:45 +0100 Subject: [PATCH 1/2] Add logging to the Office document parser It can be enabled with localStorage.CryptPad_dev = "1" (in the correct iframe) --- sdkjs/common/HistoryCommon.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/sdkjs/common/HistoryCommon.js b/sdkjs/common/HistoryCommon.js index 776364dd31..e637122f38 100644 --- a/sdkjs/common/HistoryCommon.js +++ b/sdkjs/common/HistoryCommon.js @@ -4866,6 +4866,29 @@ this.Class = Class; this.Reverted = false; + + // CryptPad: Add parser debug logging + if (localStorage.CryptPad_dev != "1") { + return; + } + if (this.Load) { + const origLoad = this.Load; + this.Load = function () { + const properties = {}; + const keys = Object.keys(this); + for (let i = 0; i < keys.length; i++) { + const p = keys[i]; + const firstChar = p.charAt(0); + if (firstChar.toUpperCase() === firstChar + && p !== "Class" + && typeof this[p] !== "function") { + properties[p] = ""+this[p]; + } + } + console.log("Load", this.constructor.name, Class.constructor.name, Class.Id, properties); + return Reflect.apply(origLoad, this, arguments); + }; + } } CChangesBase.prototype.Type = window['AscDFH'].historyitem_Unknown_Unknown; CChangesBase.prototype.GetType = function() From d02252e71f276d63b5512ab0a508acbeeb54135d Mon Sep 17 00:00:00 2001 From: Wolfgang Ginolas Date: Mon, 2 Mar 2026 14:03:38 +0100 Subject: [PATCH 2/2] Improve patch logging --- sdkjs/common/HistoryCommon.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sdkjs/common/HistoryCommon.js b/sdkjs/common/HistoryCommon.js index e637122f38..0bb3ebda28 100644 --- a/sdkjs/common/HistoryCommon.js +++ b/sdkjs/common/HistoryCommon.js @@ -4882,7 +4882,13 @@ if (firstChar.toUpperCase() === firstChar && p !== "Class" && typeof this[p] !== "function") { - properties[p] = ""+this[p]; + let pStr; + try { + pStr = JSON.stringify(this[p]); + } catch(e) { + pStr = ""+this[p]; + } + properties[p] = pStr; } } console.log("Load", this.constructor.name, Class.constructor.name, Class.Id, properties);