globalseo
Advanced tools
Comparing version 2.1.51 to 2.1.52
{ | ||
"name": "globalseo", | ||
"version": "2.1.51", | ||
"version": "2.1.52", | ||
"description": "Translate your React.js or Next.js app with AI", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,6 +5,12 @@ const { getGlobalseoOptions, shouldTranslateInlineText, CONTEXT_LIMIT, MAX_WORDS_LENGTH_FOR_CONTEXT, OLD_EXCLUDE_CLASS, MERGE_PREFIX } = require("../configs"); | ||
function isIgnoredTagInContext(tagName) { | ||
return tagName && ["HTML", "HEAD", "SCRIPT", "STYLE", "SVG", "PATH", "CIRCLE", "TEXTAREA", "INPUT", "SELECT", "OPTION", "NOSCRIPT"].includes(tagName.toUpperCase()) | ||
} | ||
function collectAllTextContentInsideNode(node, shouldExclude = false) { | ||
const globalseoOptions = getGlobalseoOptions(); | ||
const textNodes = []; | ||
if (isIgnoredTagInContext(node.tagName)) { | ||
return textNodes | ||
} | ||
node.childNodes.forEach((child) => { | ||
@@ -26,2 +32,5 @@ if (shouldExclude && child && child.className && typeof child.className == "string" && (child.className.includes(OLD_EXCLUDE_CLASS) || child.className.includes("globalseo-exclude"))) return; | ||
// if script tag or style tag skip | ||
if (isIgnoredTagInContext(child.tagName)) return; | ||
if (child.nodeType === Node.TEXT_NODE && child.textContent.trim()) { | ||
@@ -28,0 +37,0 @@ textNodes.push(child); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
486730
3072