monaco-react icon indicating copy to clipboard operation
monaco-react copied to clipboard

editor.decorations not working as expected

Open aleksandrenko opened this issue 4 years ago • 4 comments

When trying to add decorations after the end of a line. The content is missing. There is a dom element with a class name but no text/content, The same example works in the monaco editor and in other react-monaco editors.

To Reproduce Add onMount handler like this:

function onMount(editor, monaco) {
  // it works in monaco, but does not work here :/ the text is missing
  editor.deltaDecorations([], [{
    range: new monaco.Range(1, 1, 1, 50),
    options: {
      afterContentClassName: 'clr-monaco-end-of-line-hint',
        after: {
          content: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - deltaDecoration",
        },
      }}
  ]);
}

Expected behavior There showd be a text "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - deltaDecoration" in the first line. And the text is not editable.

Environment (please complete the following information):

Browser: Chrome

aleksandrenko avatar Oct 03 '21 10:10 aleksandrenko

Can deltaDecorations be passed as props to the component?

iddan avatar Oct 28 '21 08:10 iddan

Solved?

miltone92 avatar Nov 15 '21 17:11 miltone92

not working here. Anyone got a minimal example to highlight ranges?

NilsBaumgartner1994 avatar Apr 03 '23 15:04 NilsBaumgartner1994

still nothing?

NilsBaumgartner1994 avatar Apr 25 '23 10:04 NilsBaumgartner1994