mirror of
https://github.com/youfoundjk/TeXcore.git
synced 2026-07-22 07:33:31 +00:00
fix(tikz): prevent uncaught null reference errors in tikzjax-load-finished event
This commit is contained in:
parent
efa8d8f94a
commit
ff059cdf28
1 changed files with 8 additions and 0 deletions
|
|
@ -136,6 +136,14 @@ export class TikzRenderer {
|
|||
console.warn("Latex Referencer: Could not find original trigger in tikzjax.js for patching.");
|
||||
}
|
||||
|
||||
// Patch tikzjax-load-finished dispatchEvent calls to use optional chaining to prevent uncaught null reference errors
|
||||
if (jsText.includes('.dispatchEvent(new CustomEvent("tikzjax-load-finished"')) {
|
||||
jsText = jsText.replaceAll('.dispatchEvent(new CustomEvent("tikzjax-load-finished"', '?.dispatchEvent(new CustomEvent("tikzjax-load-finished"');
|
||||
}
|
||||
if (jsText.includes(".dispatchEvent(new CustomEvent('tikzjax-load-finished'")) {
|
||||
jsText = jsText.replaceAll(".dispatchEvent(new CustomEvent('tikzjax-load-finished'", "?.dispatchEvent(new CustomEvent('tikzjax-load-finished'");
|
||||
}
|
||||
|
||||
this.tikzjaxJs = jsText;
|
||||
|
||||
if (await adapter.exists(`${pluginDir}/tikzjax.css`)) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue