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

Disable minimap

Open SoftTimur opened this issue 9 years ago • 6 comments

I have a code to create an editor in an AngularJS directive:

function newMonacoeditorEditor(iElement, monacoeditorOptions) {
    var editor = monaco.editor.create(iElement[0], {
        language: monacoeditorOptions.language,
        lineNumbers: monacoeditorOptions.lineNumbers
    });
    console.log("newMonacoeditorEditor")
    return editor
}

I would like to know how to always disable the minimap?

Thank you

SoftTimur avatar Aug 10 '17 23:08 SoftTimur

e.g.

monaco.editor.create(document.getElementById("container"), {
	value: "function hello() {\n\talert('Hello world!');\n}",
	language: "javascript",
 	minimap: {
		enabled: false
	}
});

alexdima avatar Aug 11 '17 09:08 alexdima

It works, thank you very much @alexandrudima

SoftTimur avatar Aug 11 '17 17:08 SoftTimur

How does one disable minimap once the editor has been created?

David-Carty avatar Jul 15 '18 11:07 David-Carty

@David-Carty You can use the updateOptions API for that.

editor = monaco.editor.create(document.getElementById("container"), {
    value: "function hello() {\n\talert('Hello world!');\n}",
    language: "javascript",
    minimap: {
        enabled: true
    }
});

setTimeout(() => {
    alert("Disabling")
    editor.updateOptions({
        minimap: {
            enabled: false
        }
    })
}, 3000);

rcjsuen avatar Jul 15 '18 12:07 rcjsuen

Thank you. Is there anyway of detecting if the minimap is enabled as I want to create a toggle?

David-Carty avatar Jul 15 '18 14:07 David-Carty

@David-Carty You can track the minimap enablement on your side in a variable.

alexdima avatar Aug 07 '18 09:08 alexdima