Add refreshLineNumbers function to tln.ts

This commit is contained in:
2026-02-01 03:51:09 +01:00
parent 5b5371d3a8
commit 81a7a4fac8

View File

@@ -73,6 +73,13 @@ export const appendLineNumbers = (ta: HTMLTextAreaElement) => {
}
};
export const refreshLineNumbers = (ta: HTMLTextAreaElement) => {
if (!ta || !ta.classList.contains("tln-active")) return;
const wrapper = ta.previousSibling;
if (!wrapper || !(wrapper as HTMLElement).classList?.contains("tln-wrapper")) return;
updateLineNumbers(ta, wrapper as HTMLElement);
};
export const removeLineNumbers = (ta: HTMLTextAreaElement) => {
if (!ta || !ta.classList.contains("tln-active")) return;
ta.classList.remove("tln-active");