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

How can i custom margin like vscode?

Open cctv1005s opened this issue 8 years ago • 3 comments

I am sorry to ask question here, but there is no relevant question or answer in stackoverflow.

as you see, when you open user setting in vscode, mouse hovering the setting, there is a pen you can click and do sth.

How can i realize the feature using Monaco editor, Is there any api for this?

I tried to read the code of vscode of this page, but it's to complex for me to realize a small feature.

image

Thanks for your time!

cctv1005s avatar Jul 25 '18 15:07 cctv1005s

HI , You can refer this sample glyph margin

-Thanks

yln99517 avatar Jul 30 '18 04:07 yln99517

@yln99517 Thank you.

But in this sample, i can only set the className of margin. Is there any option to set a dom margin?

cctv1005s avatar Jul 30 '18 10:07 cctv1005s

@cctv1005s I use Like this

var decorations = editor.deltaDecorations([], [
	{
		range: new monaco.Range(3,1,3,1),
		options: {
			isWholeLine: true,
			className: 'myContentClass',
			glyphMarginClassName: 'fas fa-file-alt'
		}
	}
]);

And with font-awesome , It can show a lot of type of icons.

Or use this way. https://stackoverflow.com/questions/946403/insert-image-after-each-list-item Hope help to you.

Bear1110 avatar Dec 26 '18 08:12 Bear1110