profile
viewpoint

Ask questionsRemoving the tooltip on the read-only editor that says 'cannot edit in read-only editor'

Hi, I tried to remove the tooltip that says 'cannot edit in a read-only editor using CSS. But, it seems that the CSS although applied is not working.

Given below is the screenshot of the issue that I am facing:

image

Below given is the editor options that I am setting

value: this.configOriginal, language: 'json', theme: this.theme, scrollBeyondLastLine: false, contextmenu: false, readOnly: true, cursorWidth: 0,

And given below is the CSS that I am trying to use to hide the tooltip: .monaco-alert { display: none !important; visibility: hidden !important; }

Can anyone please help me solve this? I have been struggling with this since a long time.

Thank you so much.

microsoft/monaco-editor

Answer questions brijeshb42

@rakhtar92 for your requirement, you can do this -

const editor = /* your editor instance */;
const messageContribution = editor.getContribution('editor.contrib.messageController');
const diposable = editor.onDidAttemptReadOnlyEdit(() => {
  messageContribution.closeMessage();
});

This will hide the tootltip immediately. There isn't even a flicker for a moment when closing the tooltip.

useful!

Related questions

Monarch: How do you add "@keywords" key to "language object"? (undocumented) hot 3
Error: Cannot find module 'monaco-editor/esm/vs/editor/contrib/gotoSymbol/goToCommands' hot 2
Monaco paste event hot 1
Registering/Providing custom Commands/CodeActions hot 1
How to get the line count including line wraps hot 1
Error: Cannot find module 'monaco-editor/esm/vs/editor/contrib/goToDefinition/goToDefinitionCommands' hot 1
TypeScript declaration preview from extra lib results in error hot 1
Editor props/extends the actual width of the parent that is a flexbox item hot 1
Problem with insane.js while using monaco-editor@0.18.0 hot 1
Change the language of an existing editor hot 1
javascript/typescript typedefs lost when webworker times out hot 1
Can't scroll in firefox hot 1
How to add simple custom language support? hot 1
monaco-editor polute the global variables, making incompatible with other JS libraries, such as CodeMirror, RequireJS, SeaJS, etc. hot 1
Highlight merge conflicts in monaco like in VSCode hot 1
Github User Rank List