Add refreshLineNumbers function to tln.ts
This commit is contained in:
@@ -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) => {
|
export const removeLineNumbers = (ta: HTMLTextAreaElement) => {
|
||||||
if (!ta || !ta.classList.contains("tln-active")) return;
|
if (!ta || !ta.classList.contains("tln-active")) return;
|
||||||
ta.classList.remove("tln-active");
|
ta.classList.remove("tln-active");
|
||||||
|
|||||||
Reference in New Issue
Block a user