I use the following code to display an Ace editor and highlight a text range.
JS:
let markers = [];
markers.push({startRow: 6, startCol: 5, endRow: 7, endCol: 6, className: 'replacement_marker', type: 'text' });
React render() :
return (
<div>
<AceEditor
mode="java"
theme="github"
name="UNIQUE_ID_OF_DIV"
value={this.state.value}
markers={markers}
/>
</div>
);
CSS :
.replacement_marker {
position: absolute;
background-color: #FFFF00;
}
With this code, editor highlights the whole line 6 and 7 without limiting the highlight to column 5 - 6.
What is the correct way to highlight just a part of the line without highlighting the whole line?
In my case, this was due to a bad custom CSS overriding the left and width values of the marker layer.
.ace_marker-layer {
> div:not(.ace_selection){
width: 100% !important;
border-radius: unset !important;
left: 0 !important;
}
}