[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/js/ -> clipboard.js (source)

   1  /*!
   2   * clipboard.js v2.0.10
   3   * https://clipboardjs.com/
   4   *
   5   * Licensed MIT © Zeno Rocha
   6   */
   7  (function webpackUniversalModuleDefinition(root, factory) {
   8      if(typeof exports === 'object' && typeof module === 'object')
   9          module.exports = factory();
  10      else if(typeof define === 'function' && define.amd)
  11          define([], factory);
  12      else if(typeof exports === 'object')
  13          exports["ClipboardJS"] = factory();
  14      else
  15          root["ClipboardJS"] = factory();
  16  })(this, function() {
  17  return /******/ (function() { // webpackBootstrap
  18  /******/     var __webpack_modules__ = ({
  19  
  20  /***/ 686:
  21  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  22  
  23  "use strict";
  24  
  25  // EXPORTS
  26  __webpack_require__.d(__webpack_exports__, {
  27    "default": function() { return /* binding */ clipboard; }
  28  });
  29  
  30  // EXTERNAL MODULE: ./node_modules/tiny-emitter/index.js
  31  var tiny_emitter = __webpack_require__(279);
  32  var tiny_emitter_default = /*#__PURE__*/__webpack_require__.n(tiny_emitter);
  33  // EXTERNAL MODULE: ./node_modules/good-listener/src/listen.js
  34  var listen = __webpack_require__(370);
  35  var listen_default = /*#__PURE__*/__webpack_require__.n(listen);
  36  // EXTERNAL MODULE: ./node_modules/select/src/select.js
  37  var src_select = __webpack_require__(817);
  38  var select_default = /*#__PURE__*/__webpack_require__.n(src_select);
  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
 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); }
 127  
 128  
 129  
 130  /**
 131   * Inner function which performs selection from either `text` or `target`
 132   * properties and then executes copy or cut operations.
 133   * @param {Object} options
 134   */
 135  
 136  var ClipboardActionDefault = function ClipboardActionDefault() {
 137    var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
 138    // Defines base properties passed from constructor.
 139    var _options$action = options.action,
 140        action = _options$action === void 0 ? 'copy' : _options$action,
 141        container = options.container,
 142        target = options.target,
 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      });
 176    }
 177  };
 178  
 179  /* harmony default export */ var actions_default = (ClipboardActionDefault);
 180  ;// CONCATENATED MODULE: ./src/clipboard.js
 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); }
 182  
 183  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 184  
 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); } }
 186  
 187  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
 188  
 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); }
 190  
 191  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
 192  
 193  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
 194  
 195  function _possibleConstructorReturn(self, call) { if (call && (clipboard_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
 196  
 197  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
 198  
 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; } }
 200  
 201  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
 202  
 203  
 204  
 205  
 206  
 207  
 208  /**
 209   * Helper function to retrieve attribute value.
 210   * @param {String} suffix
 211   * @param {Element} element
 212   */
 213  
 214  function getAttributeValue(suffix, element) {
 215    var attribute = "data-clipboard-".concat(suffix);
 216  
 217    if (!element.hasAttribute(attribute)) {
 218      return;
 219    }
 220  
 221    return element.getAttribute(attribute);
 222  }
 223  /**
 224   * Base class which takes one or more elements, adds event listeners to them,
 225   * and instantiates a new `ClipboardAction` on each click.
 226   */
 227  
 228  
 229  var Clipboard = /*#__PURE__*/function (_Emitter) {
 230    _inherits(Clipboard, _Emitter);
 231  
 232    var _super = _createSuper(Clipboard);
 233  
 234    /**
 235     * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
 236     * @param {Object} options
 237     */
 238    function Clipboard(trigger, options) {
 239      var _this;
 240  
 241      _classCallCheck(this, Clipboard);
 242  
 243      _this = _super.call(this);
 244  
 245      _this.resolveOptions(options);
 246  
 247      _this.listenClick(trigger);
 248  
 249      return _this;
 250    }
 251    /**
 252     * Defines if attributes would be resolved using internal setter functions
 253     * or custom functions that were passed in the constructor.
 254     * @param {Object} options
 255     */
 256  
 257  
 258    _createClass(Clipboard, [{
 259      key: "resolveOptions",
 260      value: function resolveOptions() {
 261        var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
 262        this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
 263        this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
 264        this.text = typeof options.text === 'function' ? options.text : this.defaultText;
 265        this.container = clipboard_typeof(options.container) === 'object' ? options.container : document.body;
 266      }
 267      /**
 268       * Adds a click event listener to the passed trigger.
 269       * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
 270       */
 271  
 272    }, {
 273      key: "listenClick",
 274      value: function listenClick(trigger) {
 275        var _this2 = this;
 276  
 277        this.listener = listen_default()(trigger, 'click', function (e) {
 278          return _this2.onClick(e);
 279        });
 280      }
 281      /**
 282       * Defines a new `ClipboardAction` on each click event.
 283       * @param {Event} e
 284       */
 285  
 286    }, {
 287      key: "onClick",
 288      value: function onClick(e) {
 289        var trigger = e.delegateTarget || e.currentTarget;
 290        var action = this.action(trigger) || 'copy';
 291        var text = actions_default({
 292          action: action,
 293          container: this.container,
 294          target: this.target(trigger),
 295          text: this.text(trigger)
 296        }); // Fires an event based on the copy operation result.
 297  
 298        this.emit(text ? 'success' : 'error', {
 299          action: action,
 300          text: text,
 301          trigger: trigger,
 302          clearSelection: function clearSelection() {
 303            if (trigger) {
 304              trigger.focus();
 305            }
 306  
 307            document.activeElement.blur();
 308            window.getSelection().removeAllRanges();
 309          }
 310        });
 311      }
 312      /**
 313       * Default `action` lookup function.
 314       * @param {Element} trigger
 315       */
 316  
 317    }, {
 318      key: "defaultAction",
 319      value: function defaultAction(trigger) {
 320        return getAttributeValue('action', trigger);
 321      }
 322      /**
 323       * Default `target` lookup function.
 324       * @param {Element} trigger
 325       */
 326  
 327    }, {
 328      key: "defaultTarget",
 329      value: function defaultTarget(trigger) {
 330        var selector = getAttributeValue('target', trigger);
 331  
 332        if (selector) {
 333          return document.querySelector(selector);
 334        }
 335      }
 336      /**
 337       * Allow fire programmatically a copy action
 338       * @param {String|HTMLElement} target
 339       * @param {Object} options
 340       * @returns Text copied.
 341       */
 342  
 343    }, {
 344      key: "defaultText",
 345  
 346      /**
 347       * Default `text` lookup function.
 348       * @param {Element} trigger
 349       */
 350      value: function defaultText(trigger) {
 351        return getAttributeValue('text', trigger);
 352      }
 353      /**
 354       * Destroy lifecycle.
 355       */
 356  
 357    }, {
 358      key: "destroy",
 359      value: function destroy() {
 360        this.listener.destroy();
 361      }
 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    }, {
 388      key: "isSupported",
 389      value: function isSupported() {
 390        var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
 391        var actions = typeof action === 'string' ? [action] : action;
 392        var support = !!document.queryCommandSupported;
 393        actions.forEach(function (action) {
 394          support = support && !!document.queryCommandSupported(action);
 395        });
 396        return support;
 397      }
 398    }]);
 399  
 400    return Clipboard;
 401  }((tiny_emitter_default()));
 402  
 403  /* harmony default export */ var clipboard = (Clipboard);
 404  
 405  /***/ }),
 406  
 407  /***/ 828:
 408  /***/ (function(module) {
 409  
 410  var DOCUMENT_NODE_TYPE = 9;
 411  
 412  /**
 413   * A polyfill for Element.matches()
 414   */
 415  if (typeof Element !== 'undefined' && !Element.prototype.matches) {
 416      var proto = Element.prototype;
 417  
 418      proto.matches = proto.matchesSelector ||
 419                      proto.mozMatchesSelector ||
 420                      proto.msMatchesSelector ||
 421                      proto.oMatchesSelector ||
 422                      proto.webkitMatchesSelector;
 423  }
 424  
 425  /**
 426   * Finds the closest parent that matches a selector.
 427   *
 428   * @param {Element} element
 429   * @param {String} selector
 430   * @return {Function}
 431   */
 432  function closest (element, selector) {
 433      while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
 434          if (typeof element.matches === 'function' &&
 435              element.matches(selector)) {
 436            return element;
 437          }
 438          element = element.parentNode;
 439      }
 440  }
 441  
 442  module.exports = closest;
 443  
 444  
 445  /***/ }),
 446  
 447  /***/ 438:
 448  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
 449  
 450  var closest = __webpack_require__(828);
 451  
 452  /**
 453   * Delegates event to a selector.
 454   *
 455   * @param {Element} element
 456   * @param {String} selector
 457   * @param {String} type
 458   * @param {Function} callback
 459   * @param {Boolean} useCapture
 460   * @return {Object}
 461   */
 462  function _delegate(element, selector, type, callback, useCapture) {
 463      var listenerFn = listener.apply(this, arguments);
 464  
 465      element.addEventListener(type, listenerFn, useCapture);
 466  
 467      return {
 468          destroy: function() {
 469              element.removeEventListener(type, listenerFn, useCapture);
 470          }
 471      }
 472  }
 473  
 474  /**
 475   * Delegates event to a selector.
 476   *
 477   * @param {Element|String|Array} [elements]
 478   * @param {String} selector
 479   * @param {String} type
 480   * @param {Function} callback
 481   * @param {Boolean} useCapture
 482   * @return {Object}
 483   */
 484  function delegate(elements, selector, type, callback, useCapture) {
 485      // Handle the regular Element usage
 486      if (typeof elements.addEventListener === 'function') {
 487          return _delegate.apply(null, arguments);
 488      }
 489  
 490      // Handle Element-less usage, it defaults to global delegation
 491      if (typeof type === 'function') {
 492          // Use `document` as the first parameter, then apply arguments
 493          // This is a short way to .unshift `arguments` without running into deoptimizations
 494          return _delegate.bind(null, document).apply(null, arguments);
 495      }
 496  
 497      // Handle Selector-based usage
 498      if (typeof elements === 'string') {
 499          elements = document.querySelectorAll(elements);
 500      }
 501  
 502      // Handle Array-like based usage
 503      return Array.prototype.map.call(elements, function (element) {
 504          return _delegate(element, selector, type, callback, useCapture);
 505      });
 506  }
 507  
 508  /**
 509   * Finds closest match and invokes callback.
 510   *
 511   * @param {Element} element
 512   * @param {String} selector
 513   * @param {String} type
 514   * @param {Function} callback
 515   * @return {Function}
 516   */
 517  function listener(element, selector, type, callback) {
 518      return function(e) {
 519          e.delegateTarget = closest(e.target, selector);
 520  
 521          if (e.delegateTarget) {
 522              callback.call(element, e);
 523          }
 524      }
 525  }
 526  
 527  module.exports = delegate;
 528  
 529  
 530  /***/ }),
 531  
 532  /***/ 879:
 533  /***/ (function(__unused_webpack_module, exports) {
 534  
 535  /**
 536   * Check if argument is a HTML element.
 537   *
 538   * @param {Object} value
 539   * @return {Boolean}
 540   */
 541  exports.node = function(value) {
 542      return value !== undefined
 543          && value instanceof HTMLElement
 544          && value.nodeType === 1;
 545  };
 546  
 547  /**
 548   * Check if argument is a list of HTML elements.
 549   *
 550   * @param {Object} value
 551   * @return {Boolean}
 552   */
 553  exports.nodeList = function(value) {
 554      var type = Object.prototype.toString.call(value);
 555  
 556      return value !== undefined
 557          && (type === '[object NodeList]' || type === '[object HTMLCollection]')
 558          && ('length' in value)
 559          && (value.length === 0 || exports.node(value[0]));
 560  };
 561  
 562  /**
 563   * Check if argument is a string.
 564   *
 565   * @param {Object} value
 566   * @return {Boolean}
 567   */
 568  exports.string = function(value) {
 569      return typeof value === 'string'
 570          || value instanceof String;
 571  };
 572  
 573  /**
 574   * Check if argument is a function.
 575   *
 576   * @param {Object} value
 577   * @return {Boolean}
 578   */
 579  exports.fn = function(value) {
 580      var type = Object.prototype.toString.call(value);
 581  
 582      return type === '[object Function]';
 583  };
 584  
 585  
 586  /***/ }),
 587  
 588  /***/ 370:
 589  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
 590  
 591  var is = __webpack_require__(879);
 592  var delegate = __webpack_require__(438);
 593  
 594  /**
 595   * Validates all params and calls the right
 596   * listener function based on its target type.
 597   *
 598   * @param {String|HTMLElement|HTMLCollection|NodeList} target
 599   * @param {String} type
 600   * @param {Function} callback
 601   * @return {Object}
 602   */
 603  function listen(target, type, callback) {
 604      if (!target && !type && !callback) {
 605          throw new Error('Missing required arguments');
 606      }
 607  
 608      if (!is.string(type)) {
 609          throw new TypeError('Second argument must be a String');
 610      }
 611  
 612      if (!is.fn(callback)) {
 613          throw new TypeError('Third argument must be a Function');
 614      }
 615  
 616      if (is.node(target)) {
 617          return listenNode(target, type, callback);
 618      }
 619      else if (is.nodeList(target)) {
 620          return listenNodeList(target, type, callback);
 621      }
 622      else if (is.string(target)) {
 623          return listenSelector(target, type, callback);
 624      }
 625      else {
 626          throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
 627      }
 628  }
 629  
 630  /**
 631   * Adds an event listener to a HTML element
 632   * and returns a remove listener function.
 633   *
 634   * @param {HTMLElement} node
 635   * @param {String} type
 636   * @param {Function} callback
 637   * @return {Object}
 638   */
 639  function listenNode(node, type, callback) {
 640      node.addEventListener(type, callback);
 641  
 642      return {
 643          destroy: function() {
 644              node.removeEventListener(type, callback);
 645          }
 646      }
 647  }
 648  
 649  /**
 650   * Add an event listener to a list of HTML elements
 651   * and returns a remove listener function.
 652   *
 653   * @param {NodeList|HTMLCollection} nodeList
 654   * @param {String} type
 655   * @param {Function} callback
 656   * @return {Object}
 657   */
 658  function listenNodeList(nodeList, type, callback) {
 659      Array.prototype.forEach.call(nodeList, function(node) {
 660          node.addEventListener(type, callback);
 661      });
 662  
 663      return {
 664          destroy: function() {
 665              Array.prototype.forEach.call(nodeList, function(node) {
 666                  node.removeEventListener(type, callback);
 667              });
 668          }
 669      }
 670  }
 671  
 672  /**
 673   * Add an event listener to a selector
 674   * and returns a remove listener function.
 675   *
 676   * @param {String} selector
 677   * @param {String} type
 678   * @param {Function} callback
 679   * @return {Object}
 680   */
 681  function listenSelector(selector, type, callback) {
 682      return delegate(document.body, selector, type, callback);
 683  }
 684  
 685  module.exports = listen;
 686  
 687  
 688  /***/ }),
 689  
 690  /***/ 817:
 691  /***/ (function(module) {
 692  
 693  function select(element) {
 694      var selectedText;
 695  
 696      if (element.nodeName === 'SELECT') {
 697          element.focus();
 698  
 699          selectedText = element.value;
 700      }
 701      else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
 702          var isReadOnly = element.hasAttribute('readonly');
 703  
 704          if (!isReadOnly) {
 705              element.setAttribute('readonly', '');
 706          }
 707  
 708          element.select();
 709          element.setSelectionRange(0, element.value.length);
 710  
 711          if (!isReadOnly) {
 712              element.removeAttribute('readonly');
 713          }
 714  
 715          selectedText = element.value;
 716      }
 717      else {
 718          if (element.hasAttribute('contenteditable')) {
 719              element.focus();
 720          }
 721  
 722          var selection = window.getSelection();
 723          var range = document.createRange();
 724  
 725          range.selectNodeContents(element);
 726          selection.removeAllRanges();
 727          selection.addRange(range);
 728  
 729          selectedText = selection.toString();
 730      }
 731  
 732      return selectedText;
 733  }
 734  
 735  module.exports = select;
 736  
 737  
 738  /***/ }),
 739  
 740  /***/ 279:
 741  /***/ (function(module) {
 742  
 743  function E () {
 744    // Keep this empty so it's easier to inherit from
 745    // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
 746  }
 747  
 748  E.prototype = {
 749    on: function (name, callback, ctx) {
 750      var e = this.e || (this.e = {});
 751  
 752      (e[name] || (e[name] = [])).push({
 753        fn: callback,
 754        ctx: ctx
 755      });
 756  
 757      return this;
 758    },
 759  
 760    once: function (name, callback, ctx) {
 761      var self = this;
 762      function listener () {
 763        self.off(name, listener);
 764        callback.apply(ctx, arguments);
 765      };
 766  
 767      listener._ = callback
 768      return this.on(name, listener, ctx);
 769    },
 770  
 771    emit: function (name) {
 772      var data = [].slice.call(arguments, 1);
 773      var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
 774      var i = 0;
 775      var len = evtArr.length;
 776  
 777      for (i; i < len; i++) {
 778        evtArr[i].fn.apply(evtArr[i].ctx, data);
 779      }
 780  
 781      return this;
 782    },
 783  
 784    off: function (name, callback) {
 785      var e = this.e || (this.e = {});
 786      var evts = e[name];
 787      var liveEvents = [];
 788  
 789      if (evts && callback) {
 790        for (var i = 0, len = evts.length; i < len; i++) {
 791          if (evts[i].fn !== callback && evts[i].fn._ !== callback)
 792            liveEvents.push(evts[i]);
 793        }
 794      }
 795  
 796      // Remove event from queue to prevent memory leak
 797      // Suggested by https://github.com/lazd
 798      // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
 799  
 800      (liveEvents.length)
 801        ? e[name] = liveEvents
 802        : delete e[name];
 803  
 804      return this;
 805    }
 806  };
 807  
 808  module.exports = E;
 809  module.exports.TinyEmitter = E;
 810  
 811  
 812  /***/ })
 813  
 814  /******/     });
 815  /************************************************************************/
 816  /******/     // The module cache
 817  /******/     var __webpack_module_cache__ = {};
 818  /******/     
 819  /******/     // The require function
 820  /******/ 	function __webpack_require__(moduleId) {
 821  /******/         // Check if module is in cache
 822  /******/         if(__webpack_module_cache__[moduleId]) {
 823  /******/             return __webpack_module_cache__[moduleId].exports;
 824  /******/         }
 825  /******/         // Create a new module (and put it into the cache)
 826  /******/         var module = __webpack_module_cache__[moduleId] = {
 827  /******/             // no module.id needed
 828  /******/             // no module.loaded needed
 829  /******/             exports: {}
 830  /******/         };
 831  /******/     
 832  /******/         // Execute the module function
 833  /******/         __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
 834  /******/     
 835  /******/         // Return the exports of the module
 836  /******/         return module.exports;
 837  /******/     }
 838  /******/     
 839  /************************************************************************/
 840  /******/     /* webpack/runtime/compat get default export */
 841  /******/     !function() {
 842  /******/         // getDefaultExport function for compatibility with non-harmony modules
 843  /******/         __webpack_require__.n = function(module) {
 844  /******/             var getter = module && module.__esModule ?
 845  /******/                 function() { return module['default']; } :
 846  /******/                 function() { return module; };
 847  /******/             __webpack_require__.d(getter, { a: getter });
 848  /******/             return getter;
 849  /******/         };
 850  /******/     }();
 851  /******/     
 852  /******/     /* webpack/runtime/define property getters */
 853  /******/     !function() {
 854  /******/         // define getter functions for harmony exports
 855  /******/         __webpack_require__.d = function(exports, definition) {
 856  /******/             for(var key in definition) {
 857  /******/                 if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
 858  /******/                     Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
 859  /******/                 }
 860  /******/             }
 861  /******/         };
 862  /******/     }();
 863  /******/     
 864  /******/     /* webpack/runtime/hasOwnProperty shorthand */
 865  /******/     !function() {
 866  /******/         __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
 867  /******/     }();
 868  /******/     
 869  /************************************************************************/
 870  /******/     // module exports must be returned from runtime so entry inlining is disabled
 871  /******/     // startup
 872  /******/     // Load entry module and return exports
 873  /******/     return __webpack_require__(686);
 874  /******/ })()
 875  .default;
 876  });


Generated: Sun May 22 01:00:03 2022 Cross-referenced by PHPXref 0.7.1