mirror of
https://github.com/MisskeyIO/misskey
synced 2024-12-12 13:48:23 +09:00
[Client] Implement copy file url to clipboard
This commit is contained in:
parent
dd9ff67628
commit
0c33053fcf
13
src/web/app/common/scripts/copy-to-clipboard.js
Normal file
13
src/web/app/common/scripts/copy-to-clipboard.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
/**
|
||||||
|
* Clipboardに値をコピー(TODO: 文字列以外も対応)
|
||||||
|
*/
|
||||||
|
module.exports = val => {
|
||||||
|
const form = document.createElement('textarea');
|
||||||
|
form.textContent = val;
|
||||||
|
document.body.appendChild(form);
|
||||||
|
form.select();
|
||||||
|
const result = document.execCommand('copy');
|
||||||
|
document.body.removeChild(form);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
};
|
@ -35,10 +35,13 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</mk-contextmenu>
|
</mk-contextmenu>
|
||||||
<script>
|
<script>
|
||||||
|
const copyToClipboard = require('../../../common/scripts/copy-to-clipboard');
|
||||||
|
|
||||||
this.mixin('api');
|
this.mixin('api');
|
||||||
this.mixin('i');
|
this.mixin('i');
|
||||||
this.mixin('update-avatar');
|
this.mixin('update-avatar');
|
||||||
this.mixin('update-banner');
|
this.mixin('update-banner');
|
||||||
|
this.mixin('dialog');
|
||||||
this.mixin('input-dialog');
|
this.mixin('input-dialog');
|
||||||
this.mixin('NotImplementedException');
|
this.mixin('NotImplementedException');
|
||||||
|
|
||||||
@ -68,7 +71,12 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.copyUrl = () => {
|
this.copyUrl = () => {
|
||||||
this.NotImplementedException();
|
copyToClipboard(this.file.url);
|
||||||
|
this.refs.ctx.close();
|
||||||
|
this.dialog('<i class="fa fa-check"></i>コピー完了',
|
||||||
|
'ファイルのURLをクリップボードにコピーしました', [{
|
||||||
|
text: 'わー'
|
||||||
|
}]);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.download = () => {
|
this.download = () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user