wp/wp-includes/js/clipboard.js
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
     1 /*!
     1 /*!
     2  * clipboard.js v2.0.8
     2  * clipboard.js v2.0.10
     3  * https://clipboardjs.com/
     3  * https://clipboardjs.com/
     4  *
     4  *
     5  * Licensed MIT © Zeno Rocha
     5  * Licensed MIT © Zeno Rocha
     6  */
     6  */
     7 (function webpackUniversalModuleDefinition(root, factory) {
     7 (function webpackUniversalModuleDefinition(root, factory) {
    15 		root["ClipboardJS"] = factory();
    15 		root["ClipboardJS"] = factory();
    16 })(this, function() {
    16 })(this, function() {
    17 return /******/ (function() { // webpackBootstrap
    17 return /******/ (function() { // webpackBootstrap
    18 /******/ 	var __webpack_modules__ = ({
    18 /******/ 	var __webpack_modules__ = ({
    19 
    19 
    20 /***/ 134:
    20 /***/ 686:
    21 /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
    21 /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
    22 
    22 
    23 "use strict";
    23 "use strict";
    24 
    24 
    25 // EXPORTS
    25 // EXPORTS
    34 var listen = __webpack_require__(370);
    34 var listen = __webpack_require__(370);
    35 var listen_default = /*#__PURE__*/__webpack_require__.n(listen);
    35 var listen_default = /*#__PURE__*/__webpack_require__.n(listen);
    36 // EXTERNAL MODULE: ./node_modules/select/src/select.js
    36 // EXTERNAL MODULE: ./node_modules/select/src/select.js
    37 var src_select = __webpack_require__(817);
    37 var src_select = __webpack_require__(817);
    38 var select_default = /*#__PURE__*/__webpack_require__.n(src_select);
    38 var select_default = /*#__PURE__*/__webpack_require__.n(src_select);
    39 ;// CONCATENATED MODULE: ./src/clipboard-action.js
    39 ;// CONCATENATED MODULE: ./src/common/command.js
       
    40 /**
       
    41  * Executes a given operation type.
       
    42  * @param {String} type
       
    43  * @return {Boolean}
       
    44  */
       
    45 function command(type) {
       
    46   try {
       
    47     return document.execCommand(type);
       
    48   } catch (err) {
       
    49     return false;
       
    50   }
       
    51 }
       
    52 ;// CONCATENATED MODULE: ./src/actions/cut.js
       
    53 
       
    54 
       
    55 /**
       
    56  * Cut action wrapper.
       
    57  * @param {String|HTMLElement} target
       
    58  * @return {String}
       
    59  */
       
    60 
       
    61 var ClipboardActionCut = function ClipboardActionCut(target) {
       
    62   var selectedText = select_default()(target);
       
    63   command('cut');
       
    64   return selectedText;
       
    65 };
       
    66 
       
    67 /* harmony default export */ var actions_cut = (ClipboardActionCut);
       
    68 ;// CONCATENATED MODULE: ./src/common/create-fake-element.js
       
    69 /**
       
    70  * Creates a fake textarea element with a value.
       
    71  * @param {String} value
       
    72  * @return {HTMLElement}
       
    73  */
       
    74 function createFakeElement(value) {
       
    75   var isRTL = document.documentElement.getAttribute('dir') === 'rtl';
       
    76   var fakeElement = document.createElement('textarea'); // Prevent zooming on iOS
       
    77 
       
    78   fakeElement.style.fontSize = '12pt'; // Reset box model
       
    79 
       
    80   fakeElement.style.border = '0';
       
    81   fakeElement.style.padding = '0';
       
    82   fakeElement.style.margin = '0'; // Move element out of screen horizontally
       
    83 
       
    84   fakeElement.style.position = 'absolute';
       
    85   fakeElement.style[isRTL ? 'right' : 'left'] = '-9999px'; // Move element to the same position vertically
       
    86 
       
    87   var yPosition = window.pageYOffset || document.documentElement.scrollTop;
       
    88   fakeElement.style.top = "".concat(yPosition, "px");
       
    89   fakeElement.setAttribute('readonly', '');
       
    90   fakeElement.value = value;
       
    91   return fakeElement;
       
    92 }
       
    93 ;// CONCATENATED MODULE: ./src/actions/copy.js
       
    94 
       
    95 
       
    96 
       
    97 /**
       
    98  * Copy action wrapper.
       
    99  * @param {String|HTMLElement} target
       
   100  * @param {Object} options
       
   101  * @return {String}
       
   102  */
       
   103 
       
   104 var ClipboardActionCopy = function ClipboardActionCopy(target) {
       
   105   var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
       
   106     container: document.body
       
   107   };
       
   108   var selectedText = '';
       
   109 
       
   110   if (typeof target === 'string') {
       
   111     var fakeElement = createFakeElement(target);
       
   112     options.container.appendChild(fakeElement);
       
   113     selectedText = select_default()(fakeElement);
       
   114     command('copy');
       
   115     fakeElement.remove();
       
   116   } else {
       
   117     selectedText = select_default()(target);
       
   118     command('copy');
       
   119   }
       
   120 
       
   121   return selectedText;
       
   122 };
       
   123 
       
   124 /* harmony default export */ var actions_copy = (ClipboardActionCopy);
       
   125 ;// CONCATENATED MODULE: ./src/actions/default.js
    40 function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
   126 function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
    41 
   127 
    42 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
   128 
    43 
   129 
    44 function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
   130 /**
    45 
   131  * Inner function which performs selection from either `text` or `target`
    46 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
       
    47 
       
    48 
       
    49 /**
       
    50  * Inner class which performs selection from either `text` or `target`
       
    51  * properties and then executes copy or cut operations.
   132  * properties and then executes copy or cut operations.
    52  */
   133  * @param {Object} options
    53 
   134  */
    54 var ClipboardAction = /*#__PURE__*/function () {
   135 
    55   /**
   136 var ClipboardActionDefault = function ClipboardActionDefault() {
    56    * @param {Object} options
   137   var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    57    */
   138   // Defines base properties passed from constructor.
    58   function ClipboardAction(options) {
   139   var _options$action = options.action,
    59     _classCallCheck(this, ClipboardAction);
   140       action = _options$action === void 0 ? 'copy' : _options$action,
    60 
   141       container = options.container,
    61     this.resolveOptions(options);
   142       target = options.target,
    62     this.initSelection();
   143       text = options.text; // Sets the `action` to be performed which can be either 'copy' or 'cut'.
       
   144 
       
   145   if (action !== 'copy' && action !== 'cut') {
       
   146     throw new Error('Invalid "action" value, use either "copy" or "cut"');
       
   147   } // Sets the `target` property using an element that will be have its content copied.
       
   148 
       
   149 
       
   150   if (target !== undefined) {
       
   151     if (target && _typeof(target) === 'object' && target.nodeType === 1) {
       
   152       if (action === 'copy' && target.hasAttribute('disabled')) {
       
   153         throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
       
   154       }
       
   155 
       
   156       if (action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
       
   157         throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
       
   158       }
       
   159     } else {
       
   160       throw new Error('Invalid "target" value, use a valid Element');
       
   161     }
       
   162   } // Define selection strategy based on `text` property.
       
   163 
       
   164 
       
   165   if (text) {
       
   166     return actions_copy(text, {
       
   167       container: container
       
   168     });
       
   169   } // Defines which selection strategy based on `target` property.
       
   170 
       
   171 
       
   172   if (target) {
       
   173     return action === 'cut' ? actions_cut(target) : actions_copy(target, {
       
   174       container: container
       
   175     });
    63   }
   176   }
    64   /**
   177 };
    65    * Defines base properties passed from constructor.
   178 
    66    * @param {Object} options
   179 /* harmony default export */ var actions_default = (ClipboardActionDefault);
    67    */
       
    68 
       
    69 
       
    70   _createClass(ClipboardAction, [{
       
    71     key: "resolveOptions",
       
    72     value: function resolveOptions() {
       
    73       var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
       
    74       this.action = options.action;
       
    75       this.container = options.container;
       
    76       this.emitter = options.emitter;
       
    77       this.target = options.target;
       
    78       this.text = options.text;
       
    79       this.trigger = options.trigger;
       
    80       this.selectedText = '';
       
    81     }
       
    82     /**
       
    83      * Decides which selection strategy is going to be applied based
       
    84      * on the existence of `text` and `target` properties.
       
    85      */
       
    86 
       
    87   }, {
       
    88     key: "initSelection",
       
    89     value: function initSelection() {
       
    90       if (this.text) {
       
    91         this.selectFake();
       
    92       } else if (this.target) {
       
    93         this.selectTarget();
       
    94       }
       
    95     }
       
    96     /**
       
    97      * Creates a fake textarea element, sets its value from `text` property,
       
    98      */
       
    99 
       
   100   }, {
       
   101     key: "createFakeElement",
       
   102     value: function createFakeElement() {
       
   103       var isRTL = document.documentElement.getAttribute('dir') === 'rtl';
       
   104       this.fakeElem = document.createElement('textarea'); // Prevent zooming on iOS
       
   105 
       
   106       this.fakeElem.style.fontSize = '12pt'; // Reset box model
       
   107 
       
   108       this.fakeElem.style.border = '0';
       
   109       this.fakeElem.style.padding = '0';
       
   110       this.fakeElem.style.margin = '0'; // Move element out of screen horizontally
       
   111 
       
   112       this.fakeElem.style.position = 'absolute';
       
   113       this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px'; // Move element to the same position vertically
       
   114 
       
   115       var yPosition = window.pageYOffset || document.documentElement.scrollTop;
       
   116       this.fakeElem.style.top = "".concat(yPosition, "px");
       
   117       this.fakeElem.setAttribute('readonly', '');
       
   118       this.fakeElem.value = this.text;
       
   119       return this.fakeElem;
       
   120     }
       
   121     /**
       
   122      * Get's the value of fakeElem,
       
   123      * and makes a selection on it.
       
   124      */
       
   125 
       
   126   }, {
       
   127     key: "selectFake",
       
   128     value: function selectFake() {
       
   129       var _this = this;
       
   130 
       
   131       var fakeElem = this.createFakeElement();
       
   132 
       
   133       this.fakeHandlerCallback = function () {
       
   134         return _this.removeFake();
       
   135       };
       
   136 
       
   137       this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
       
   138       this.container.appendChild(fakeElem);
       
   139       this.selectedText = select_default()(fakeElem);
       
   140       this.copyText();
       
   141       this.removeFake();
       
   142     }
       
   143     /**
       
   144      * Only removes the fake element after another click event, that way
       
   145      * a user can hit `Ctrl+C` to copy because selection still exists.
       
   146      */
       
   147 
       
   148   }, {
       
   149     key: "removeFake",
       
   150     value: function removeFake() {
       
   151       if (this.fakeHandler) {
       
   152         this.container.removeEventListener('click', this.fakeHandlerCallback);
       
   153         this.fakeHandler = null;
       
   154         this.fakeHandlerCallback = null;
       
   155       }
       
   156 
       
   157       if (this.fakeElem) {
       
   158         this.container.removeChild(this.fakeElem);
       
   159         this.fakeElem = null;
       
   160       }
       
   161     }
       
   162     /**
       
   163      * Selects the content from element passed on `target` property.
       
   164      */
       
   165 
       
   166   }, {
       
   167     key: "selectTarget",
       
   168     value: function selectTarget() {
       
   169       this.selectedText = select_default()(this.target);
       
   170       this.copyText();
       
   171     }
       
   172     /**
       
   173      * Executes the copy operation based on the current selection.
       
   174      */
       
   175 
       
   176   }, {
       
   177     key: "copyText",
       
   178     value: function copyText() {
       
   179       var succeeded;
       
   180 
       
   181       try {
       
   182         succeeded = document.execCommand(this.action);
       
   183       } catch (err) {
       
   184         succeeded = false;
       
   185       }
       
   186 
       
   187       this.handleResult(succeeded);
       
   188     }
       
   189     /**
       
   190      * Fires an event based on the copy operation result.
       
   191      * @param {Boolean} succeeded
       
   192      */
       
   193 
       
   194   }, {
       
   195     key: "handleResult",
       
   196     value: function handleResult(succeeded) {
       
   197       this.emitter.emit(succeeded ? 'success' : 'error', {
       
   198         action: this.action,
       
   199         text: this.selectedText,
       
   200         trigger: this.trigger,
       
   201         clearSelection: this.clearSelection.bind(this)
       
   202       });
       
   203     }
       
   204     /**
       
   205      * Moves focus away from `target` and back to the trigger, removes current selection.
       
   206      */
       
   207 
       
   208   }, {
       
   209     key: "clearSelection",
       
   210     value: function clearSelection() {
       
   211       if (this.trigger) {
       
   212         this.trigger.focus();
       
   213       }
       
   214 
       
   215       document.activeElement.blur();
       
   216       window.getSelection().removeAllRanges();
       
   217     }
       
   218     /**
       
   219      * Sets the `action` to be performed which can be either 'copy' or 'cut'.
       
   220      * @param {String} action
       
   221      */
       
   222 
       
   223   }, {
       
   224     key: "destroy",
       
   225 
       
   226     /**
       
   227      * Destroy lifecycle.
       
   228      */
       
   229     value: function destroy() {
       
   230       this.removeFake();
       
   231     }
       
   232   }, {
       
   233     key: "action",
       
   234     set: function set() {
       
   235       var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
       
   236       this._action = action;
       
   237 
       
   238       if (this._action !== 'copy' && this._action !== 'cut') {
       
   239         throw new Error('Invalid "action" value, use either "copy" or "cut"');
       
   240       }
       
   241     }
       
   242     /**
       
   243      * Gets the `action` property.
       
   244      * @return {String}
       
   245      */
       
   246     ,
       
   247     get: function get() {
       
   248       return this._action;
       
   249     }
       
   250     /**
       
   251      * Sets the `target` property using an element
       
   252      * that will be have its content copied.
       
   253      * @param {Element} target
       
   254      */
       
   255 
       
   256   }, {
       
   257     key: "target",
       
   258     set: function set(target) {
       
   259       if (target !== undefined) {
       
   260         if (target && _typeof(target) === 'object' && target.nodeType === 1) {
       
   261           if (this.action === 'copy' && target.hasAttribute('disabled')) {
       
   262             throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
       
   263           }
       
   264 
       
   265           if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
       
   266             throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
       
   267           }
       
   268 
       
   269           this._target = target;
       
   270         } else {
       
   271           throw new Error('Invalid "target" value, use a valid Element');
       
   272         }
       
   273       }
       
   274     }
       
   275     /**
       
   276      * Gets the `target` property.
       
   277      * @return {String|HTMLElement}
       
   278      */
       
   279     ,
       
   280     get: function get() {
       
   281       return this._target;
       
   282     }
       
   283   }]);
       
   284 
       
   285   return ClipboardAction;
       
   286 }();
       
   287 
       
   288 /* harmony default export */ var clipboard_action = (ClipboardAction);
       
   289 ;// CONCATENATED MODULE: ./src/clipboard.js
   180 ;// CONCATENATED MODULE: ./src/clipboard.js
   290 function clipboard_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { clipboard_typeof = function _typeof(obj) { return typeof obj; }; } else { clipboard_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return clipboard_typeof(obj); }
   181 function clipboard_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { clipboard_typeof = function _typeof(obj) { return typeof obj; }; } else { clipboard_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return clipboard_typeof(obj); }
   291 
   182 
   292 function clipboard_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
   183 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
   293 
   184 
   294 function clipboard_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
   185 function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
   295 
   186 
   296 function clipboard_createClass(Constructor, protoProps, staticProps) { if (protoProps) clipboard_defineProperties(Constructor.prototype, protoProps); if (staticProps) clipboard_defineProperties(Constructor, staticProps); return Constructor; }
   187 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
   297 
   188 
   298 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
   189 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
   299 
   190 
   300 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
   191 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
   301 
   192 
   306 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
   197 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
   307 
   198 
   308 function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
   199 function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
   309 
   200 
   310 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
   201 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
       
   202 
       
   203 
   311 
   204 
   312 
   205 
   313 
   206 
   314 
   207 
   315 /**
   208 /**
   343    * @param {Object} options
   236    * @param {Object} options
   344    */
   237    */
   345   function Clipboard(trigger, options) {
   238   function Clipboard(trigger, options) {
   346     var _this;
   239     var _this;
   347 
   240 
   348     clipboard_classCallCheck(this, Clipboard);
   241     _classCallCheck(this, Clipboard);
   349 
   242 
   350     _this = _super.call(this);
   243     _this = _super.call(this);
   351 
   244 
   352     _this.resolveOptions(options);
   245     _this.resolveOptions(options);
   353 
   246 
   360    * or custom functions that were passed in the constructor.
   253    * or custom functions that were passed in the constructor.
   361    * @param {Object} options
   254    * @param {Object} options
   362    */
   255    */
   363 
   256 
   364 
   257 
   365   clipboard_createClass(Clipboard, [{
   258   _createClass(Clipboard, [{
   366     key: "resolveOptions",
   259     key: "resolveOptions",
   367     value: function resolveOptions() {
   260     value: function resolveOptions() {
   368       var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
   261       var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
   369       this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
   262       this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
   370       this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
   263       this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
   392 
   285 
   393   }, {
   286   }, {
   394     key: "onClick",
   287     key: "onClick",
   395     value: function onClick(e) {
   288     value: function onClick(e) {
   396       var trigger = e.delegateTarget || e.currentTarget;
   289       var trigger = e.delegateTarget || e.currentTarget;
   397 
   290       var action = this.action(trigger) || 'copy';
   398       if (this.clipboardAction) {
   291       var text = actions_default({
   399         this.clipboardAction = null;
   292         action: action,
   400       }
   293         container: this.container,
   401 
       
   402       this.clipboardAction = new clipboard_action({
       
   403         action: this.action(trigger),
       
   404         target: this.target(trigger),
   294         target: this.target(trigger),
   405         text: this.text(trigger),
   295         text: this.text(trigger)
   406         container: this.container,
   296       }); // Fires an event based on the copy operation result.
       
   297 
       
   298       this.emit(text ? 'success' : 'error', {
       
   299         action: action,
       
   300         text: text,
   407         trigger: trigger,
   301         trigger: trigger,
   408         emitter: this
   302         clearSelection: function clearSelection() {
       
   303           if (trigger) {
       
   304             trigger.focus();
       
   305           }
       
   306 
       
   307           document.activeElement.blur();
       
   308           window.getSelection().removeAllRanges();
       
   309         }
   409       });
   310       });
   410     }
   311     }
   411     /**
   312     /**
   412      * Default `action` lookup function.
   313      * Default `action` lookup function.
   413      * @param {Element} trigger
   314      * @param {Element} trigger
   431       if (selector) {
   332       if (selector) {
   432         return document.querySelector(selector);
   333         return document.querySelector(selector);
   433       }
   334       }
   434     }
   335     }
   435     /**
   336     /**
   436      * Returns the support of the given action, or all actions if no action is
   337      * Allow fire programmatically a copy action
   437      * given.
   338      * @param {String|HTMLElement} target
   438      * @param {String} [action]
   339      * @param {Object} options
       
   340      * @returns Text copied.
   439      */
   341      */
   440 
   342 
   441   }, {
   343   }, {
   442     key: "defaultText",
   344     key: "defaultText",
   443 
   345 
   454 
   356 
   455   }, {
   357   }, {
   456     key: "destroy",
   358     key: "destroy",
   457     value: function destroy() {
   359     value: function destroy() {
   458       this.listener.destroy();
   360       this.listener.destroy();
   459 
       
   460       if (this.clipboardAction) {
       
   461         this.clipboardAction.destroy();
       
   462         this.clipboardAction = null;
       
   463       }
       
   464     }
   361     }
   465   }], [{
   362   }], [{
       
   363     key: "copy",
       
   364     value: function copy(target) {
       
   365       var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
       
   366         container: document.body
       
   367       };
       
   368       return actions_copy(target, options);
       
   369     }
       
   370     /**
       
   371      * Allow fire programmatically a cut action
       
   372      * @param {String|HTMLElement} target
       
   373      * @returns Text cutted.
       
   374      */
       
   375 
       
   376   }, {
       
   377     key: "cut",
       
   378     value: function cut(target) {
       
   379       return actions_cut(target);
       
   380     }
       
   381     /**
       
   382      * Returns the support of the given action, or all actions if no action is
       
   383      * given.
       
   384      * @param {String} [action]
       
   385      */
       
   386 
       
   387   }, {
   466     key: "isSupported",
   388     key: "isSupported",
   467     value: function isSupported() {
   389     value: function isSupported() {
   468       var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
   390       var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
   469       var actions = typeof action === 'string' ? [action] : action;
   391       var actions = typeof action === 'string' ? [action] : action;
   470       var support = !!document.queryCommandSupported;
   392       var support = !!document.queryCommandSupported;
   946 /******/ 	
   868 /******/ 	
   947 /************************************************************************/
   869 /************************************************************************/
   948 /******/ 	// module exports must be returned from runtime so entry inlining is disabled
   870 /******/ 	// module exports must be returned from runtime so entry inlining is disabled
   949 /******/ 	// startup
   871 /******/ 	// startup
   950 /******/ 	// Load entry module and return exports
   872 /******/ 	// Load entry module and return exports
   951 /******/ 	return __webpack_require__(134);
   873 /******/ 	return __webpack_require__(686);
   952 /******/ })()
   874 /******/ })()
   953 .default;
   875 .default;
   954 });
   876 });