fix highlither

pull/1/head
yann300 6 years ago
parent c440ecfdd5
commit df84052555
  1. 3
      src/app/editor/SourceHighlighters.js
  2. 10
      src/app/editor/sourceHighlighter.js

@ -19,10 +19,9 @@ class SourceHighlighters extends EditorApi {
this.highlighters = {}
}
highlight (lineColumnPos, filePath, hexColor) {
highlight (position, filePath, hexColor) {
const { from } = this.currentRequest
try {
const position = JSON.parse(lineColumnPos)
if (!this.highlighters[from]) this.highlighters[from] = new SourceHighlighter()
this.highlighters[from].currentSourceLocation(null)
this.highlighters[from].currentSourceLocationFromfileName(position, filePath, hexColor)

@ -42,20 +42,24 @@ class SourceHighlighter {
this._deps.fileManager.switchFile(this.source)
}
const backgoundClass = style || 'alert-info'
const css = csjs`
.highlightcode {
position:absolute;
z-index:20;
background-color: ${style || 'var(--info)'};
}
.highlightcode_fullLine {
position:absolute;
z-index:20;
opacity: 0.5;
background-color: ${style || 'var(--info)'};
}
.customBackgroundColor {
background-color: ${style || 'var(--info)'};
}
`
this.statementMarker = this._deps.editor.addMarker(lineColumnPos, this.source, css.highlightcode + ' ' + backgoundClass)
this.statementMarker = this._deps.editor.addMarker(lineColumnPos, this.source, css.highlightcode.className + ' ' + css.customBackgroundColor.className)
this._deps.editor.scrollToLine(lineColumnPos.start.line, true, true, function () {})
if (lineColumnPos.start.line === lineColumnPos.end.line) {
@ -68,7 +72,7 @@ class SourceHighlighter {
line: lineColumnPos.start.line + 1,
column: 0
}
}, this.source, css.highlightcode_fullLine)
}, this.source, css.highlightcode_fullLine.className)
}
}
}

Loading…
Cancel
Save