fix: prevent decimal style application on table headers and text nodes containing long alphabetical strings
This commit is contained in:
parent
f269b1455d
commit
3b9eaf1d92
@ -30,7 +30,8 @@ function processNode(textNode) {
|
||||
|
||||
// Skip unsafe parents
|
||||
const tagName = parent.tagName;
|
||||
if (['SCRIPT', 'STYLE', 'TEXTAREA', 'INPUT', 'OPTION', 'TITLE'].includes(tagName)) return;
|
||||
if (['SCRIPT', 'STYLE', 'TEXTAREA', 'INPUT', 'OPTION', 'TITLE', 'TH'].includes(tagName)) return;
|
||||
if (parent.closest && parent.closest('th')) return;
|
||||
if (parent.isContentEditable) return;
|
||||
if (parent.closest && parent.closest('[contenteditable="true"]')) return;
|
||||
if (parent.classList.contains('o_decimal')) return; // Already wrapped
|
||||
@ -38,6 +39,9 @@ function processNode(textNode) {
|
||||
const text = textNode.nodeValue;
|
||||
if (!text || text.length < 3) return;
|
||||
|
||||
// Skip if it contains alphabetical words of length 4 or more (non-numeric labels/descriptions)
|
||||
if (/[a-zA-Z]{4,}/.test(text)) return;
|
||||
|
||||
// Get the correct decimal point from Odoo localization
|
||||
const decimalPoint = localization.decimalPoint || '.';
|
||||
// Escape special regex characters (like dot)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user