main
 1import ApplicationController from './application_controller';
 2
 3export default class extends ApplicationController {
 4  static targets = ['source'];
 5
 6  connect() {
 7    if (document.queryCommandSupported('copy')) {
 8      this.element.classList.add('clipboard--supported');
 9    }
10  }
11
12  copy(event) {
13    event.preventDefault();
14    this.sourceTarget.select();
15    document.execCommand('copy');
16  }
17}