summaryrefslogtreecommitdiff
path: root/src/web
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-02-25 16:30:18 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-02-25 16:30:18 +0900
commit0c33053fcfb2e178be1df1001e7194405c6ca870 (patch)
treec4d17f00e3f3979e57f04ec7eb03f4a5a9d02262 /src/web
parent[Client] Fix bug (diff)
downloadmisskey-0c33053fcfb2e178be1df1001e7194405c6ca870.tar.gz
misskey-0c33053fcfb2e178be1df1001e7194405c6ca870.tar.bz2
misskey-0c33053fcfb2e178be1df1001e7194405c6ca870.zip
[Client] Implement copy file url to clipboard
Diffstat (limited to 'src/web')
-rw-r--r--src/web/app/common/scripts/copy-to-clipboard.js13
-rw-r--r--src/web/app/desktop/tags/drive/file-contextmenu.tag10
2 files changed, 22 insertions, 1 deletions
diff --git a/src/web/app/common/scripts/copy-to-clipboard.js b/src/web/app/common/scripts/copy-to-clipboard.js
new file mode 100644
index 0000000000..2e67024c85
--- /dev/null
+++ b/src/web/app/common/scripts/copy-to-clipboard.js
@@ -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;
+};
diff --git a/src/web/app/desktop/tags/drive/file-contextmenu.tag b/src/web/app/desktop/tags/drive/file-contextmenu.tag
index 29f1befc44..17376adb86 100644
--- a/src/web/app/desktop/tags/drive/file-contextmenu.tag
+++ b/src/web/app/desktop/tags/drive/file-contextmenu.tag
@@ -35,10 +35,13 @@
</ul>
</mk-contextmenu>
<script>
+ const copyToClipboard = require('../../../common/scripts/copy-to-clipboard');
+
this.mixin('api');
this.mixin('i');
this.mixin('update-avatar');
this.mixin('update-banner');
+ this.mixin('dialog');
this.mixin('input-dialog');
this.mixin('NotImplementedException');
@@ -68,7 +71,12 @@
};
this.copyUrl = () => {
- this.NotImplementedException();
+ copyToClipboard(this.file.url);
+ this.refs.ctx.close();
+ this.dialog('<i class="fa fa-check"></i>コピー完了',
+ 'ファイルのURLをクリップボードにコピーしました', [{
+ text: 'わー'
+ }]);
};
this.download = () => {