Skip to content

Commit 0ba68eb

Browse files
committed
downgrade diffDom
1 parent 373ee66 commit 0ba68eb

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,6 @@
7676
},
7777
"dependencies": {
7878
"dayjs": "^1.11.10",
79-
"diff-dom": "^5.2.0"
79+
"diff-dom": "5.1.4"
8080
}
8181
}

src/config.ts

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -61,22 +61,28 @@ export const defaultConfig: DataTableConfiguration = {
6161
tableRender: false,
6262
diffDomOptions: {
6363
valueDiffing: false,
64-
preDiffApply(info) {
65-
console.trace("Pre-diff apply", info)
66-
// Prevent removal of class attributes that contain specific patterns
67-
// This fixes the GitHub Pages issue where classes like "class history" get stripped
68-
if (info.diff.action === "removeAttribute" && info.diff.name === "class") {
69-
// Only prevent removal if the class value contains patterns that might be problematic
70-
const classValue = info.diff.oldValue || ""
71-
if (classValue.includes("class ") || classValue.includes(" class") ||
72-
classValue.includes("history") || classValue.includes("math") ||
73-
classValue.startsWith("datatable-")) {
74-
console.trace("Skipping class removal", info)
75-
return true // Skip this diff to prevent problematic class removal
76-
}
77-
}
78-
return false
79-
}
64+
// preDiffApply(info) {
65+
// // Prevent removal of class attributes that contain datatable classes
66+
// if (info.diff.action === "removeAttribute" && info.diff.name === "class") {
67+
// const classValue = info.diff.oldValue || ""
68+
// if (classValue.startsWith("datatable-") || classValue.includes(" datatable-")) {
69+
// return true // Skip this diff to prevent datatable class removal
70+
// }
71+
// }
72+
// // Prevent modification of class attributes that would remove datatable classes
73+
// if (info.diff.action === "modifyAttribute" && info.diff.name === "class") {
74+
// const oldValue = info.diff.oldValue || ""
75+
// const newValue = info.diff.newValue || ""
76+
77+
// const oldHasDatatableClass = oldValue.includes("datatable-")
78+
// const newHasDatatableClass = newValue.includes("datatable-")
79+
80+
// if (oldHasDatatableClass && !newHasDatatableClass) {
81+
// return true // Skip this diff to prevent datatable class removal
82+
// }
83+
// }
84+
// return false
85+
// }
8086
},
8187

8288
// Customise the display text

0 commit comments

Comments
 (0)