mirror of
https://github.com/wallabag/wallabag.git
synced 2025-07-02 16:38:38 +00:00
Extract Clipboard controller
This commit is contained in:
parent
ffeca7f94d
commit
9da9e6b004
4 changed files with 20 additions and 11 deletions
16
assets/controllers/clipboard_controller.js
Normal file
16
assets/controllers/clipboard_controller.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
import { Controller } from '@hotwired/stimulus';
|
||||
import ClipboardJS from 'clipboard';
|
||||
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
this.clipboard = new ClipboardJS(this.element);
|
||||
|
||||
this.clipboard.on('success', (e) => {
|
||||
e.clearSelection();
|
||||
});
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
this.clipboard.destroy();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue