mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-21 02:29:23 +00:00
docs(user-menu) simpolify copy url to current file
parent
608fad131f
commit
8d383bdb2c
1 changed files with 3 additions and 23 deletions
|
|
@ -21,35 +21,15 @@ module.exports = {
|
|||
## Copy URL to current file
|
||||
|
||||
```js
|
||||
const {
|
||||
clipboard = {writeText}
|
||||
} = navigator;
|
||||
|
||||
export default {
|
||||
'F6 - Copy URL to Current File': async ({DOM}) => {
|
||||
const {path} = DOM.CurrentInfo;
|
||||
const url = `${window.location.href}${path}`;
|
||||
|
||||
await clipboard.writeText(url);
|
||||
const {default: clipboard} = await import('https://cdn.skypack.dev/@cloudcmd/clipboard');
|
||||
|
||||
await clipboard.writeText(url);
|
||||
}
|
||||
}
|
||||
|
||||
async function writeText(value) {
|
||||
const el = document.createElement('textarea');
|
||||
|
||||
el.value = value;
|
||||
|
||||
document.body.appendChild(el);
|
||||
el.select();
|
||||
|
||||
const is = document.execCommand('copy');
|
||||
document.body.removeChild(el);
|
||||
|
||||
if (is)
|
||||
return;
|
||||
|
||||
return Promise.reject();
|
||||
}
|
||||
```
|
||||
|
||||
## Convert flac to mp3
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue