Skip to content

Commit

Permalink
Try applying Mermaid styles programmatically
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinEtchells committed Oct 7, 2024
1 parent c352003 commit babbcb7
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions django_app/frontend/src/js/chats.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,32 @@ document.addEventListener("chat-response-end", (evt) => {
// And add to chat history
document.querySelector("chat-history").addChat(sessionId, sessionTitle);
});

// Mermaid Test - applying blocked styles directly in JavaScript
/*
window.setTimeout(() => {
let styledElements = document.querySelectorAll(".mermaid [style]");
styledElements.forEach((element) => {
const style = element.getAttribute("style");
//element.removeAttribute("style");
style.split(";").forEach((styleRule) => {
if (styleRule.trim() !== "") {
const [property, value] = styleRule.split(":");
//const camelCaseProperty = property
// .trim()
// .replace(/-([a-z])/g, (g) => g[1].toUpperCase());
//element.style[camelCaseProperty] = value.trim();
try {
element.setAttribute(
property.trim(),
value.replace("!important", "").trim()
);
} catch (err) {
console.log(err);
}
console.log(element);
}
});
});
}, 1000);
*/

0 comments on commit babbcb7

Please sign in to comment.