Skip to content

Commit

Permalink
Fix comment editor colors
Browse files Browse the repository at this point in the history
  • Loading branch information
ejunga committed Dec 3, 2025
1 parent f6a54dc commit 7840543
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions tdx-enhanced.js
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,21 @@
}
}

function ckeinjectCustomCss(event) {
// var editor = event.editor
try {
if (!(event.document.$.getElementById("tdxuserscript-style"))) {
var style = event.document.$.createElement('style');
style.id = "tdxuserscript-style"
style.innerHTML = customStyles
event.document.$.getElementsByTagName('head')[0].appendChild(style);
event.document.$.querySelectorAll("div, span").forEach((element) => {
element.style.color = "var(--txt-1)"
})
}
} catch(error) {}
}

//setup observer to watch report/table changes/refreshes
let observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
Expand Down Expand Up @@ -1211,6 +1226,10 @@
updateHeading(t)
}

for (const instance in CKEDITOR.instances) {
ckeinjectCustomCss(CKEDITOR.instances[instance]);
}

//search whole document, frames may reset when reopened
// let frames = document.querySelectorAll("iframe:not(.customEmbed)")
// if (frames) {
Expand Down Expand Up @@ -1299,7 +1318,7 @@
style.setProperty("--filter-invert",filters.invert)
style.setProperty("--filter-saturate",filters.saturate)
style.setProperty("--filter-sepia",filters.sepia)
}
}

/*
function toggleColorMode() {
Expand Down Expand Up @@ -1343,17 +1362,11 @@

try {
CKEDITOR.on('instanceReady', function(event) {
var style = event.editor.document.$.createElement('style');
style.innerHTML = customStyles
editor.document.$.getElementsByTagName('head')[0].appendChild(style);
editor.document.$.querySelectorAll("*:not(a)").forEach((element) => {
element.style.color = "var(--txt-1)"
})
ckeinjectCustomCss(event)
})
} catch (error) {

}

async function injectToolbar() {
let iconBar = document.querySelector("#globalSearchBar")

Expand Down

0 comments on commit 7840543

Please sign in to comment.