mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-17 16:38:18 +00:00
feature: cloudcmd: user-menu: runFromCDN
This commit is contained in:
parent
406429aec8
commit
7787bfc22e
1 changed files with 18 additions and 8 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
const RENAME_FILE = 'Rename file';
|
const RENAME_FILE = 'Rename file';
|
||||||
const CDN = 'https://cdn.jsdelivr.net/gh/cloudcmd/user-menu@1.2.4';
|
const CDN = 'https://cdn.jsdelivr.net';
|
||||||
|
const CDN_GH = `${CDN}/gh/cloudcmd/user-menu@1.2.4`;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
'__settings': {
|
'__settings': {
|
||||||
|
|
@ -10,13 +11,7 @@ export default {
|
||||||
await DOM.renameCurrent();
|
await DOM.renameCurrent();
|
||||||
},
|
},
|
||||||
|
|
||||||
'F6 - Copy URL to current file': async ({DOM}) => {
|
'F6 - Copy URL to current file': runFromCDN('copy-url-to-current-file'),
|
||||||
const {copyURLToCurrentFile} = await import(`${CDN}/menu/copy-url-to-current-file.js`);
|
|
||||||
|
|
||||||
await copyURLToCurrentFile({
|
|
||||||
DOM,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
'R - cd /': async ({CloudCmd}) => {
|
'R - cd /': async ({CloudCmd}) => {
|
||||||
await CloudCmd.changeDir('/');
|
await CloudCmd.changeDir('/');
|
||||||
|
|
@ -156,3 +151,18 @@ function compare(a, b) {
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const MAP = {
|
||||||
|
'copy-url-to-current-file': 'copyURLToCurrentFile',
|
||||||
|
};
|
||||||
|
|
||||||
|
function runFromCDN(name) {
|
||||||
|
return async (...a) => {
|
||||||
|
const fnName = MAP[name];
|
||||||
|
const {
|
||||||
|
[fnName]: fn,
|
||||||
|
} = await import(`${CDN_GH}/menu/${name}.js`);
|
||||||
|
|
||||||
|
await fn(...a);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue