How to use the monaco-editor/esm/vs/editor/editor.api.js.KeyMod function in monaco-editor

To help you get started, we’ve selected a few monaco-editor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github notable / notable / src / renderer / utils / monaco.ts View on Github external
'editor.action.moveLinesDownAction': cmd => {
      cmd._kbOpts.primary = cmd._kbOpts.linux.primary = monaco.KeyMod.WinCtrl | monaco.KeyMod.Alt | monaco.KeyCode.DownArrow;
      cmd._kbOpts.mac = {};
      cmd._kbOpts.mac.primary = monaco.KeyMod.CtrlCmd | monaco.KeyMod.WinCtrl | monaco.KeyCode.DownArrow;
    },
github notable / notable / src / renderer / utils / monaco.ts View on Github external
'editor.action.moveLinesUpAction': cmd => {
      cmd._kbOpts.primary = cmd._kbOpts.linux.primary = monaco.KeyMod.WinCtrl | monaco.KeyMod.Alt | monaco.KeyCode.UpArrow;
      cmd._kbOpts.mac = {};
      cmd._kbOpts.mac.primary = monaco.KeyMod.CtrlCmd | monaco.KeyMod.WinCtrl | monaco.KeyCode.UpArrow;
    }
github notable / notable / src / renderer / utils / monaco.ts View on Github external
wrappingIndent: 'same'
  } as monaco.editor.IEditorOptions,

  modelOptions: {
    insertSpaces: true,
    tabSize: 2,
    trimAutoWhitespace: true
  } as monaco.editor.ITextModelUpdateOptions,

  keybindings: {

    'cursorTop': {
      options: {
        kbOpts: {
          kbExpr: EditorContextKeys.editorTextFocus,
          primary: monaco.KeyMod.CtrlCmd | monaco.KeyCode.Home,
          mac: { primary: monaco.KeyMod.CtrlCmd | monaco.KeyCode.UpArrow },
          weight: 0
        }
      },
      handler ( accessor, editor: MonacoEditor ) {
        const position0 = {
          lineNumber: 0,
          column: 0
        };
        editor.restoreViewState ({
          contributionsState: {},
          cursorState: [{
            inSelectionMode: false,
            selectionStart: position0,
            position: position0
          }],
github rubyapi / rubyapi / app / javascript / controllers / repl / repl_controller.js View on Github external
this.editor = monaco.editor.create(this.editorContainerTarget, {
      value: "puts \"Hello from #{RUBY_ENGINE} #{RUBY_VERSION} 👋\"",
      language: 'ruby',
      minimap: {
        enabled: false
      },
      automaticLayout: true,
      fontSize: '16px',
      scrollBeyondLastLine: false,
      hideCursorInOverviewRuler: true,
      renderLineHighlight: 'none',
      renderLineHighlightOnlyWhenFocus: false,
      overviewRulerBorder: false,
    })

    this.editor.addCommand(monaco.KeyMod.chord(monaco.KeyMod.CtrlCmd | monaco.KeyCode.Enter), () => {
      this.execute()
    })
  }
github notable / notable / src / renderer / utils / monaco.ts View on Github external
kbExpr: EditorContextKeys.editorTextFocus,
          primary: monaco.KeyMod.Alt | monaco.KeyCode.Enter,
          weight: 100
        }
      },
      handler ( accessor, editor: MonacoEditor ) {
        Todo.toggleTodo ( editor );
      }
    },

    'editor.toggleTodoDone': {
      options: {
        precondition: EditorContextKeys.writable,
        kbOpts: {
          kbExpr: EditorContextKeys.editorTextFocus,
          primary: monaco.KeyMod.Alt | monaco.KeyCode.KEY_D,
          weight: 100
        }
      },
      handler ( accessor, editor: MonacoEditor ) {
        Todo.toggleTodoDone ( editor );
      }
    }

  } as { [command: string]: { options: any, handler: Function } | undefined },

  keybindingsPatched: {

    'actions.find': false,
    'actions.findWithSelection': false,
    'cancelSelection': false,
    'closeFindWidget': false,
github notable / notable / src / renderer / utils / monaco.ts View on Github external
} as monaco.editor.IEditorOptions,

  modelOptions: {
    insertSpaces: true,
    tabSize: 2,
    trimAutoWhitespace: true
  } as monaco.editor.ITextModelUpdateOptions,

  keybindings: {

    'cursorTop': {
      options: {
        kbOpts: {
          kbExpr: EditorContextKeys.editorTextFocus,
          primary: monaco.KeyMod.CtrlCmd | monaco.KeyCode.Home,
          mac: { primary: monaco.KeyMod.CtrlCmd | monaco.KeyCode.UpArrow },
          weight: 0
        }
      },
      handler ( accessor, editor: MonacoEditor ) {
        const position0 = {
          lineNumber: 0,
          column: 0
        };
        editor.restoreViewState ({
          contributionsState: {},
          cursorState: [{
            inSelectionMode: false,
            selectionStart: position0,
            position: position0
          }],
          viewState: {