Display AI suggestions using different color

This commit is contained in:
Simon Rozman 2025-04-24 14:46:23 +02:00
parent 5cbac62de3
commit 9bc8dfbdfc
2 changed files with 21 additions and 0 deletions

View File

@ -378,6 +378,11 @@ class BesService {
this.ctx.strokeStyle = styles.color
this.ctx.fillStyle = styles.color
amplitude = -1
} else if (ruleId === 'BESANA_178' /*PR_VNAP_POPRAVEK_UI*/) {
const styles = window.getComputedStyle(this.highlightAI)
this.ctx.strokeStyle = styles.color
this.ctx.fillStyle = styles.color
amplitude = 1
} else {
const styles = window.getComputedStyle(this.highlightGrammar)
this.ctx.strokeStyle = styles.color
@ -982,12 +987,16 @@ class BesService {
this.highlightSpelling = document.createElement('div')
this.highlightSpelling.classList.add('bes-highlight-placeholder')
this.highlightSpelling.classList.add('bes-highlight-spelling')
this.highlightAI = document.createElement('div')
this.highlightAI.classList.add('bes-highlight-placeholder')
this.highlightAI.classList.add('bes-highlight-ai')
this.highlightGrammar = document.createElement('div')
this.highlightGrammar.classList.add('bes-highlight-placeholder')
this.highlightGrammar.classList.add('bes-highlight-grammar')
this.correctionPanel.appendChild(this.scrollPanel)
this.correctionPanel.appendChild(this.highlightSpelling)
this.correctionPanel.appendChild(this.highlightAI)
this.correctionPanel.appendChild(this.highlightGrammar)
this.scrollPanel.appendChild(this.canvasPanel)
this.textElement.parentElement.insertBefore(
@ -1083,6 +1092,8 @@ class BesService {
el.classList.add(
match.match.rule.id.startsWith('MORFOLOGIK_RULE')
? 'bes-highlight-spelling'
: match.match.rule.id === 'BESANA_178' /*PR_VNAP_POPRAVEK_UI*/
? 'bes-highlight-ai'
: 'bes-highlight-grammar'
)
el.style.left = `${rect.x + canvasPanelRect.x + window.scrollX}px`

View File

@ -9,6 +9,11 @@
background: hsla(211, 100%, 60%, 0.3);
}
.bes-highlight-ai {
color: hsl(108, 100%, 35%);
background: hsla(108, 100%, 35%, 0.3);
}
.bes-highlight-grammar {
color: hsl(27, 100%, 45%);
background: hsla(27, 100%, 45%, 0.3);
@ -20,6 +25,11 @@
background: hsla(211, 100%, 55%, 0.3);
}
.bes-highlight-ai {
color: hsl(108, 100%, 40%);
background: hsla(108, 100%, 40%, 0.3);
}
.bes-highlight-grammar {
color: hsl(27, 100%, 65%);
background: hsla(27, 100%, 65%, 0.3);