mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-18 00:47:01 +00:00
44 lines
755 B
JavaScript
44 lines
755 B
JavaScript
import * as Events from '#dom/events';
|
|
|
|
const {CloudCmd} = globalThis;
|
|
|
|
CloudCmd.EditNamesVim = {
|
|
init,
|
|
show,
|
|
hide,
|
|
};
|
|
const {Key} = CloudCmd;
|
|
|
|
const ConfigView = {
|
|
bindKeys: false,
|
|
beforeClose: () => {
|
|
Events.rmKey(listener);
|
|
CloudCmd.EditNames.isChanged();
|
|
},
|
|
};
|
|
|
|
export async function init() {
|
|
await CloudCmd.EditNames();
|
|
}
|
|
|
|
export function show() {
|
|
Events.addKey(listener);
|
|
|
|
CloudCmd.EditNames
|
|
.show(ConfigView)
|
|
.getEditor()
|
|
.setKeyMap('vim');
|
|
}
|
|
|
|
export function hide() {
|
|
CloudCmd.Edit.hide();
|
|
}
|
|
|
|
function listener(event) {
|
|
const {keyCode, shiftKey} = event;
|
|
|
|
if (shiftKey && keyCode === Key.ESC) {
|
|
event.preventDefault();
|
|
hide();
|
|
}
|
|
}
|