如何解决我如何获得摩纳哥编辑器动作键绑定标签
我是usig monaco编辑,我的问题是如何获取InternalEditorAction键绑定标签文本。 就像在上下文菜单中一样:
在monaco playground中获得动作
var editor = monaco.editor.create(document.getElementById("container"),{
value: [
'','class Example {','\tprivate m:number;','','\tpublic met(): string {','\t\treturn "Hello world!";','\t}','}'
].join('\n'),language: "typescript"
});
editor.addAction({
// An unique identifier of the contributed action.
id: 'my-unique-id',// A label of the action that will be presented to the user.
label: 'My Label!!!',// An optional array of keybindings for the action.
keybindings: [
monaco.KeyMod.CtrlCmd | monaco.KeyCode.F10,],// A precondition for this action.
precondition: null,// A rule to evaluate on top of the precondition in order to dispatch the keybindings.
keybindingContext: null,contextMenuGroupId: 'navigation',contextMenuOrder: 1.5,// Method that will be executed when the action is triggered.
// @param editor The editor instance is passed in as a convinience
run: function (ed) {
const actions = ed.getActions();
console.log(actions[0])
return null;
}
});
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。