nodebb-plugin-katex2 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/static/js/render.js +13 -1
package/package.json
CHANGED
package/static/js/render.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
// === Debounce таймеры ===
|
|
17
17
|
let renderTimer = null;
|
|
18
|
-
const RENDER_DELAY =
|
|
18
|
+
const RENDER_DELAY = 150; // Задержка перед рендерингом (мс)
|
|
19
19
|
|
|
20
20
|
// === Регулярное выражение для быстрой проверки ===
|
|
21
21
|
const MATH_PATTERN = /\$\$|\\\[|\\\(/;
|
|
@@ -37,6 +37,18 @@
|
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Проверка полной загрузки KaTeX
|
|
42
|
+
*/
|
|
43
|
+
function isKatexReady() {
|
|
44
|
+
return (
|
|
45
|
+
typeof window.katex !== "undefined" &&
|
|
46
|
+
typeof window.katex.render === "function" &&
|
|
47
|
+
typeof window.renderMathInElement === "function" &&
|
|
48
|
+
typeof window.katex.__parse !== "undefined" // внутренняя проверка
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
40
52
|
/**
|
|
41
53
|
* Проверка наличия формул в элементе
|
|
42
54
|
* @param {HTMLElement} element
|