Skip to content

Commit

Permalink
Merge pull request #38 from tilde-nlp/fix/adding-seo-elements
Browse files Browse the repository at this point in the history
Fix/adding seo elements
  • Loading branch information
alexattt authored Oct 17, 2024
2 parents d0e690a + 24b0b6d commit d28ade0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 38 deletions.
2 changes: 1 addition & 1 deletion src/js/lib/AsyncTranslator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ class AsyncTranslator {
translatableItem: element,
type: element.type,
attributeName: null,
description: null,
description: element.type === TranslatableItemType.ELEMENT ? null : element.startMarker.parentElement.tagName,
text: this.minimizeText(element.html),
tagName: element.startMarker.parentElement.tagName
}
Expand Down
4 changes: 3 additions & 1 deletion src/js/lib/DOMTranslation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -976,8 +976,10 @@ class DOMTranslation {
}
}
for (const range of translationRanges) {
const isSeo = TranslationElementCandidates.get(range.startMarker.parentElement.tagName)?.type === TranslatableItemType.ELEMENT_SEO;

range.visibleInCurrentView = DOMExtensions.elementIsVisible(range.startMarker, this.registredIframes)
range.type = TranslatableItemType.ELEMENT
range.type = isSeo ? TranslatableItemType.ELEMENT_SEO : TranslatableItemType.ELEMENT
range.html = this.cropAndMinifyTranslationRange(range, translatableElements, range.startMarker, range.startMarker, range.endMarker)
}

Expand Down
36 changes: 0 additions & 36 deletions src/js/lib/TranslationElementCandidates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,5 @@ export const TranslationElementCandidates = new Map<string, IElementCandidate>([
{
type: TranslatableItemType.ELEMENT_SEO
}
],
[
'H1',
{
type: TranslatableItemType.ELEMENT_SEO
}
],
[
'H2',
{
type: TranslatableItemType.ELEMENT_SEO
}
],
[
'H3',
{
type: TranslatableItemType.ELEMENT_SEO
}
],
[
'H4',
{
type: TranslatableItemType.ELEMENT_SEO
}
],
[
'H5',
{
type: TranslatableItemType.ELEMENT_SEO
}
],
[
'H6',
{
type: TranslatableItemType.ELEMENT_SEO
}
]
])

0 comments on commit d28ade0

Please sign in to comment.