monaco-editor

Disable Cut and Copy in context menu in Monaco editor

两盒软妹~` 提交于 2021-02-16 18:53:06
问题 I am using monaco-editor, i see that cut and copy is added in the context menu in later versions. i want to remove these two options from context menu. Please let me know how can i achieve it? 回答1: Hide individual items with CSS I tried this code in the browser and it worked. // Hide from cut on .context-view li.action-item:nth-child(n + 9) { display: none !important; } // Show command palette .context-view li.action-item:last-child { display: flex !important; } Disable the entire menu with

How do I remove options from the contextmenu for monaco-editor?

爱⌒轻易说出口 提交于 2021-02-10 15:08:05
问题 I'm currently looking to find a way to remove or hide the "Go to Definition" and "Go to References" options that display when a JS file is opened in monaco-editor as part of their built-in support, in favor of including custom options to go to definition and find references. I believe there's no public API to accomplish this, and my attempts to hide the options with CSS have been unsuccessful, so any pointers or help would be appreciated, thanks. 来源: https://stackoverflow.com/questions

Disable $schema JSON autocompletion with Monaco

百般思念 提交于 2021-01-29 10:36:07
问题 I'm using the Monaco editor to build a JSON editing UI. It seems if you use any Monaco setup for JSON (e.g. their home page demo, if you set it to JSON: https://microsoft.github.io/monaco-editor) then autocompletion (ctrl-space) always shows a $schema option. I'm sure this is useful if you're intending to use JSON schemas, but I'm not. I want to implement my own autocompletion, so I don't want to disable it entirely, but I want to remove $schema from the options. Adding a completionProvider

How to hide the “Command Palette” item from the list of actions in Monaco Editor

本小妞迷上赌 提交于 2021-01-05 04:34:48
问题 I have been looking everywhere, Monaco docs, github, SO but there seems to be no examples as to how to hide and disable the "command palette" command from the context menu: Any advice? 回答1: Oh well, I had no choice but to hack my way into the DOM in order to remove the "Command Palette". It's very far from ideal and it also doesn't really disable the F1 shortcut but it's only thing I have for now: private onContextMenu() { const menuItems = document.querySelector(".monaco-menu .actions

How to hide the “Command Palette” item from the list of actions in Monaco Editor

天大地大妈咪最大 提交于 2021-01-05 04:31:31
问题 I have been looking everywhere, Monaco docs, github, SO but there seems to be no examples as to how to hide and disable the "command palette" command from the context menu: Any advice? 回答1: Oh well, I had no choice but to hack my way into the DOM in order to remove the "Command Palette". It's very far from ideal and it also doesn't really disable the F1 shortcut but it's only thing I have for now: private onContextMenu() { const menuItems = document.querySelector(".monaco-menu .actions

How to hide the “Command Palette” item from the list of actions in Monaco Editor

为君一笑 提交于 2021-01-05 04:26:01
问题 I have been looking everywhere, Monaco docs, github, SO but there seems to be no examples as to how to hide and disable the "command palette" command from the context menu: Any advice? 回答1: Oh well, I had no choice but to hack my way into the DOM in order to remove the "Command Palette". It's very far from ideal and it also doesn't really disable the F1 shortcut but it's only thing I have for now: private onContextMenu() { const menuItems = document.querySelector(".monaco-menu .actions

How to run the Monaco editor from a CDN like cdnjs?

混江龙づ霸主 提交于 2021-01-02 08:02:55
问题 I am struggling a bit to find a minimal runnable example that just runs from the CDN, as opposed to the existing in-tree examples which mostly use local servers. 回答1: After Googling a bit I found https://jsfiddle.net/developit/bwgkr6uq/ which just works with unpkg.com, and so I mostly just adapted it to cdnjs, here is a single working HTML file: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>monaco editor</title> <link rel="stylesheet" data-name="vs/editor/editor.main"

Monaco Editor get source code index of caret

。_饼干妹妹 提交于 2020-12-12 08:57:36
问题 Is there a way to get the caret position as index in the source code string? I know I can get the position, which will give me an object, containing the line and column, but is there a way to either get or convert line + column to string char index? For example if I have: using System; using System.Data; and I place the caret to be just before ".Data", I know how to get the line + col coordinate (line 1, col 13), but how to get the char array index (should be something like 25)? 回答1: You can