Small clarifications on the devbuild of the plugin:
- Previously, the "paste" action was triggered twice, once by Monaco itself, and the second time by my incorrect interpretation of the logic of these triggers, roughly speaking, I told Monaco to perform the paste, when it already knew about it and did it;
- Now
addKeyEvents
(__keyHandler
), i.e. the function for working with hotkeys registers the keypress loader in the editor window, not the application (previouslywindow
was specified, nowthis.containerEl
) - in fact, this should isolate "listening" to keybinds outside the code editor;
2.1) Accordingly, I also changed the unloading of all these listeners;
2.2) a condition was added to the listener that further isolates keystrokes:
if (this.getViewType() !== 'codeview') return;
2.3) force vanilla paste now uses the built-in trigger (action) for pasting from Monaco itself, instead of a custom function— now it seems that pasting with this feature should be at the native level, the code now looks like this:
if (this.plugin.settings.code_editor_settings.force_vanilla_paste)
this.monacoEditor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyV,
() => this.monacoEditor.trigger('', 'editor.action.clipboardPasteAction', null));