12 lines
468 B
TypeScript
12 lines
468 B
TypeScript
/** حذف برچسبهای انتخاب UI (#one, #two) از محتوای سلول جدول. */
|
|||
|
|
export function sanitizeTableCellContent(html: string): string {
|
||
|
|
return html.replace(/#(?:one|two)\b/gi, "").trim();
|
||
|
|
}
|
||
|
|
|
||
|
|
/** تشخیص variant جدول از متن خام (قبل از sanitize). */
|
||
|
|
export function detectTableVariant(text: string): "one" | "two" {
|
||
|
|
if (/#two\b/i.test(text)) return "two";
|
||
|
|
if (/#one\b/i.test(text)) return "one";
|
||
|
|
return "one";
|
||
|
|
}
|