Decoration for selection not working


#1

I’m using the basic example for decorations, .i.e.

var range = editor.getSelectedBufferRange();
var marker = editor.markBufferRange(range, {invalidate: 'never'});
console.log(marker);
var decoration = editor.decorateMarker(marker, {type: 'line', class: 'my-section'});

where my-section is simply

.my-section {
  background-color: deepskyblue;
}

After selecting some text and triggering the above, even though the marker is created, nothing happens (silently). Is there anything obvious I’m missing?

Also, is it possible to change the font size individually for a decoration?

Thank you!


#2

Have you checked in the DOM using the Elements view in the Developer Tools to see if my-section shows up somewhere and where?

Not to my knowledge. Decorations are layers behind or on top of the text or blocks underneath the text. They don’t modify the text itself.