epfl-elements 5.2.7 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/icons/icons.svg +1 -1
- package/dist/js/reader.js +7 -7
- package/dist/js/reader.min.js +2 -2
- package/dist/js/reader.min.js.map +1 -1
- package/dist/js/vendors.js +177 -241
- package/dist/js/vendors.min.js +1 -1
- package/dist/js/vendors.min.js.LICENSE.txt +1 -1
- package/dist/package.json +2 -2
- package/package.json +2 -2
package/dist/js/vendors.js
CHANGED
|
@@ -11729,7 +11729,7 @@ if (Tablesaw.mustard) {
|
|
|
11729
11729
|
})(typeof window !== "undefined" ? window : this);
|
|
11730
11730
|
|
|
11731
11731
|
/*!
|
|
11732
|
-
* clipboard.js v2.0.
|
|
11732
|
+
* clipboard.js v2.0.11
|
|
11733
11733
|
* https://clipboardjs.com/
|
|
11734
11734
|
*
|
|
11735
11735
|
* Licensed MIT © Zeno Rocha
|
|
@@ -11747,7 +11747,7 @@ if (Tablesaw.mustard) {
|
|
|
11747
11747
|
return /******/ (function() { // webpackBootstrap
|
|
11748
11748
|
/******/ var __webpack_modules__ = ({
|
|
11749
11749
|
|
|
11750
|
-
/***/
|
|
11750
|
+
/***/ 686:
|
|
11751
11751
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
11752
11752
|
|
|
11753
11753
|
"use strict";
|
|
@@ -11766,264 +11766,170 @@ var listen_default = /*#__PURE__*/__webpack_require__.n(listen);
|
|
|
11766
11766
|
// EXTERNAL MODULE: ./node_modules/select/src/select.js
|
|
11767
11767
|
var src_select = __webpack_require__(817);
|
|
11768
11768
|
var select_default = /*#__PURE__*/__webpack_require__.n(src_select);
|
|
11769
|
-
;// CONCATENATED MODULE: ./src/
|
|
11770
|
-
|
|
11769
|
+
;// CONCATENATED MODULE: ./src/common/command.js
|
|
11770
|
+
/**
|
|
11771
|
+
* Executes a given operation type.
|
|
11772
|
+
* @param {String} type
|
|
11773
|
+
* @return {Boolean}
|
|
11774
|
+
*/
|
|
11775
|
+
function command(type) {
|
|
11776
|
+
try {
|
|
11777
|
+
return document.execCommand(type);
|
|
11778
|
+
} catch (err) {
|
|
11779
|
+
return false;
|
|
11780
|
+
}
|
|
11781
|
+
}
|
|
11782
|
+
;// CONCATENATED MODULE: ./src/actions/cut.js
|
|
11771
11783
|
|
|
11772
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
11773
11784
|
|
|
11774
|
-
|
|
11775
|
-
|
|
11776
|
-
|
|
11785
|
+
/**
|
|
11786
|
+
* Cut action wrapper.
|
|
11787
|
+
* @param {String|HTMLElement} target
|
|
11788
|
+
* @return {String}
|
|
11789
|
+
*/
|
|
11777
11790
|
|
|
11791
|
+
var ClipboardActionCut = function ClipboardActionCut(target) {
|
|
11792
|
+
var selectedText = select_default()(target);
|
|
11793
|
+
command('cut');
|
|
11794
|
+
return selectedText;
|
|
11795
|
+
};
|
|
11778
11796
|
|
|
11797
|
+
/* harmony default export */ var actions_cut = (ClipboardActionCut);
|
|
11798
|
+
;// CONCATENATED MODULE: ./src/common/create-fake-element.js
|
|
11779
11799
|
/**
|
|
11780
|
-
*
|
|
11781
|
-
*
|
|
11800
|
+
* Creates a fake textarea element with a value.
|
|
11801
|
+
* @param {String} value
|
|
11802
|
+
* @return {HTMLElement}
|
|
11782
11803
|
*/
|
|
11804
|
+
function createFakeElement(value) {
|
|
11805
|
+
var isRTL = document.documentElement.getAttribute('dir') === 'rtl';
|
|
11806
|
+
var fakeElement = document.createElement('textarea'); // Prevent zooming on iOS
|
|
11783
11807
|
|
|
11784
|
-
|
|
11785
|
-
/**
|
|
11786
|
-
* @param {Object} options
|
|
11787
|
-
*/
|
|
11788
|
-
function ClipboardAction(options) {
|
|
11789
|
-
_classCallCheck(this, ClipboardAction);
|
|
11790
|
-
|
|
11791
|
-
this.resolveOptions(options);
|
|
11792
|
-
this.initSelection();
|
|
11793
|
-
}
|
|
11794
|
-
/**
|
|
11795
|
-
* Defines base properties passed from constructor.
|
|
11796
|
-
* @param {Object} options
|
|
11797
|
-
*/
|
|
11808
|
+
fakeElement.style.fontSize = '12pt'; // Reset box model
|
|
11798
11809
|
|
|
11810
|
+
fakeElement.style.border = '0';
|
|
11811
|
+
fakeElement.style.padding = '0';
|
|
11812
|
+
fakeElement.style.margin = '0'; // Move element out of screen horizontally
|
|
11799
11813
|
|
|
11800
|
-
|
|
11801
|
-
|
|
11802
|
-
value: function resolveOptions() {
|
|
11803
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
11804
|
-
this.action = options.action;
|
|
11805
|
-
this.container = options.container;
|
|
11806
|
-
this.emitter = options.emitter;
|
|
11807
|
-
this.target = options.target;
|
|
11808
|
-
this.text = options.text;
|
|
11809
|
-
this.trigger = options.trigger;
|
|
11810
|
-
this.selectedText = '';
|
|
11811
|
-
}
|
|
11812
|
-
/**
|
|
11813
|
-
* Decides which selection strategy is going to be applied based
|
|
11814
|
-
* on the existence of `text` and `target` properties.
|
|
11815
|
-
*/
|
|
11814
|
+
fakeElement.style.position = 'absolute';
|
|
11815
|
+
fakeElement.style[isRTL ? 'right' : 'left'] = '-9999px'; // Move element to the same position vertically
|
|
11816
11816
|
|
|
11817
|
-
|
|
11818
|
-
|
|
11819
|
-
|
|
11820
|
-
|
|
11821
|
-
|
|
11822
|
-
|
|
11823
|
-
|
|
11824
|
-
}
|
|
11825
|
-
}
|
|
11826
|
-
/**
|
|
11827
|
-
* Creates a fake textarea element, sets its value from `text` property,
|
|
11828
|
-
*/
|
|
11817
|
+
var yPosition = window.pageYOffset || document.documentElement.scrollTop;
|
|
11818
|
+
fakeElement.style.top = "".concat(yPosition, "px");
|
|
11819
|
+
fakeElement.setAttribute('readonly', '');
|
|
11820
|
+
fakeElement.value = value;
|
|
11821
|
+
return fakeElement;
|
|
11822
|
+
}
|
|
11823
|
+
;// CONCATENATED MODULE: ./src/actions/copy.js
|
|
11829
11824
|
|
|
11830
|
-
}, {
|
|
11831
|
-
key: "createFakeElement",
|
|
11832
|
-
value: function createFakeElement() {
|
|
11833
|
-
var isRTL = document.documentElement.getAttribute('dir') === 'rtl';
|
|
11834
|
-
this.fakeElem = document.createElement('textarea'); // Prevent zooming on iOS
|
|
11835
11825
|
|
|
11836
|
-
this.fakeElem.style.fontSize = '12pt'; // Reset box model
|
|
11837
11826
|
|
|
11838
|
-
|
|
11839
|
-
|
|
11840
|
-
|
|
11827
|
+
/**
|
|
11828
|
+
* Create fake copy action wrapper using a fake element.
|
|
11829
|
+
* @param {String} target
|
|
11830
|
+
* @param {Object} options
|
|
11831
|
+
* @return {String}
|
|
11832
|
+
*/
|
|
11841
11833
|
|
|
11842
|
-
|
|
11843
|
-
|
|
11834
|
+
var fakeCopyAction = function fakeCopyAction(value, options) {
|
|
11835
|
+
var fakeElement = createFakeElement(value);
|
|
11836
|
+
options.container.appendChild(fakeElement);
|
|
11837
|
+
var selectedText = select_default()(fakeElement);
|
|
11838
|
+
command('copy');
|
|
11839
|
+
fakeElement.remove();
|
|
11840
|
+
return selectedText;
|
|
11841
|
+
};
|
|
11842
|
+
/**
|
|
11843
|
+
* Copy action wrapper.
|
|
11844
|
+
* @param {String|HTMLElement} target
|
|
11845
|
+
* @param {Object} options
|
|
11846
|
+
* @return {String}
|
|
11847
|
+
*/
|
|
11844
11848
|
|
|
11845
|
-
var yPosition = window.pageYOffset || document.documentElement.scrollTop;
|
|
11846
|
-
this.fakeElem.style.top = "".concat(yPosition, "px");
|
|
11847
|
-
this.fakeElem.setAttribute('readonly', '');
|
|
11848
|
-
this.fakeElem.value = this.text;
|
|
11849
|
-
return this.fakeElem;
|
|
11850
|
-
}
|
|
11851
|
-
/**
|
|
11852
|
-
* Get's the value of fakeElem,
|
|
11853
|
-
* and makes a selection on it.
|
|
11854
|
-
*/
|
|
11855
11849
|
|
|
11856
|
-
|
|
11857
|
-
|
|
11858
|
-
|
|
11859
|
-
|
|
11850
|
+
var ClipboardActionCopy = function ClipboardActionCopy(target) {
|
|
11851
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
11852
|
+
container: document.body
|
|
11853
|
+
};
|
|
11854
|
+
var selectedText = '';
|
|
11860
11855
|
|
|
11861
|
-
|
|
11856
|
+
if (typeof target === 'string') {
|
|
11857
|
+
selectedText = fakeCopyAction(target, options);
|
|
11858
|
+
} else if (target instanceof HTMLInputElement && !['text', 'search', 'url', 'tel', 'password'].includes(target === null || target === void 0 ? void 0 : target.type)) {
|
|
11859
|
+
// If input type doesn't support `setSelectionRange`. Simulate it. https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange
|
|
11860
|
+
selectedText = fakeCopyAction(target.value, options);
|
|
11861
|
+
} else {
|
|
11862
|
+
selectedText = select_default()(target);
|
|
11863
|
+
command('copy');
|
|
11864
|
+
}
|
|
11862
11865
|
|
|
11863
|
-
|
|
11864
|
-
|
|
11865
|
-
};
|
|
11866
|
+
return selectedText;
|
|
11867
|
+
};
|
|
11866
11868
|
|
|
11867
|
-
|
|
11868
|
-
|
|
11869
|
-
|
|
11870
|
-
this.copyText();
|
|
11871
|
-
this.removeFake();
|
|
11872
|
-
}
|
|
11873
|
-
/**
|
|
11874
|
-
* Only removes the fake element after another click event, that way
|
|
11875
|
-
* a user can hit `Ctrl+C` to copy because selection still exists.
|
|
11876
|
-
*/
|
|
11869
|
+
/* harmony default export */ var actions_copy = (ClipboardActionCopy);
|
|
11870
|
+
;// CONCATENATED MODULE: ./src/actions/default.js
|
|
11871
|
+
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); }
|
|
11877
11872
|
|
|
11878
|
-
}, {
|
|
11879
|
-
key: "removeFake",
|
|
11880
|
-
value: function removeFake() {
|
|
11881
|
-
if (this.fakeHandler) {
|
|
11882
|
-
this.container.removeEventListener('click', this.fakeHandlerCallback);
|
|
11883
|
-
this.fakeHandler = null;
|
|
11884
|
-
this.fakeHandlerCallback = null;
|
|
11885
|
-
}
|
|
11886
11873
|
|
|
11887
|
-
if (this.fakeElem) {
|
|
11888
|
-
this.container.removeChild(this.fakeElem);
|
|
11889
|
-
this.fakeElem = null;
|
|
11890
|
-
}
|
|
11891
|
-
}
|
|
11892
|
-
/**
|
|
11893
|
-
* Selects the content from element passed on `target` property.
|
|
11894
|
-
*/
|
|
11895
11874
|
|
|
11896
|
-
|
|
11897
|
-
|
|
11898
|
-
|
|
11899
|
-
|
|
11900
|
-
|
|
11901
|
-
}
|
|
11902
|
-
/**
|
|
11903
|
-
* Executes the copy operation based on the current selection.
|
|
11904
|
-
*/
|
|
11875
|
+
/**
|
|
11876
|
+
* Inner function which performs selection from either `text` or `target`
|
|
11877
|
+
* properties and then executes copy or cut operations.
|
|
11878
|
+
* @param {Object} options
|
|
11879
|
+
*/
|
|
11905
11880
|
|
|
11906
|
-
|
|
11907
|
-
|
|
11908
|
-
|
|
11909
|
-
|
|
11881
|
+
var ClipboardActionDefault = function ClipboardActionDefault() {
|
|
11882
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
11883
|
+
// Defines base properties passed from constructor.
|
|
11884
|
+
var _options$action = options.action,
|
|
11885
|
+
action = _options$action === void 0 ? 'copy' : _options$action,
|
|
11886
|
+
container = options.container,
|
|
11887
|
+
target = options.target,
|
|
11888
|
+
text = options.text; // Sets the `action` to be performed which can be either 'copy' or 'cut'.
|
|
11910
11889
|
|
|
11911
|
-
|
|
11912
|
-
|
|
11913
|
-
|
|
11914
|
-
succeeded = false;
|
|
11915
|
-
}
|
|
11890
|
+
if (action !== 'copy' && action !== 'cut') {
|
|
11891
|
+
throw new Error('Invalid "action" value, use either "copy" or "cut"');
|
|
11892
|
+
} // Sets the `target` property using an element that will be have its content copied.
|
|
11916
11893
|
|
|
11917
|
-
this.handleResult(succeeded);
|
|
11918
|
-
}
|
|
11919
|
-
/**
|
|
11920
|
-
* Fires an event based on the copy operation result.
|
|
11921
|
-
* @param {Boolean} succeeded
|
|
11922
|
-
*/
|
|
11923
11894
|
|
|
11924
|
-
|
|
11925
|
-
|
|
11926
|
-
|
|
11927
|
-
|
|
11928
|
-
action: this.action,
|
|
11929
|
-
text: this.selectedText,
|
|
11930
|
-
trigger: this.trigger,
|
|
11931
|
-
clearSelection: this.clearSelection.bind(this)
|
|
11932
|
-
});
|
|
11933
|
-
}
|
|
11934
|
-
/**
|
|
11935
|
-
* Moves focus away from `target` and back to the trigger, removes current selection.
|
|
11936
|
-
*/
|
|
11937
|
-
|
|
11938
|
-
}, {
|
|
11939
|
-
key: "clearSelection",
|
|
11940
|
-
value: function clearSelection() {
|
|
11941
|
-
if (this.trigger) {
|
|
11942
|
-
this.trigger.focus();
|
|
11895
|
+
if (target !== undefined) {
|
|
11896
|
+
if (target && _typeof(target) === 'object' && target.nodeType === 1) {
|
|
11897
|
+
if (action === 'copy' && target.hasAttribute('disabled')) {
|
|
11898
|
+
throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
|
|
11943
11899
|
}
|
|
11944
11900
|
|
|
11945
|
-
|
|
11946
|
-
|
|
11947
|
-
}
|
|
11948
|
-
/**
|
|
11949
|
-
* Sets the `action` to be performed which can be either 'copy' or 'cut'.
|
|
11950
|
-
* @param {String} action
|
|
11951
|
-
*/
|
|
11952
|
-
|
|
11953
|
-
}, {
|
|
11954
|
-
key: "destroy",
|
|
11955
|
-
|
|
11956
|
-
/**
|
|
11957
|
-
* Destroy lifecycle.
|
|
11958
|
-
*/
|
|
11959
|
-
value: function destroy() {
|
|
11960
|
-
this.removeFake();
|
|
11961
|
-
}
|
|
11962
|
-
}, {
|
|
11963
|
-
key: "action",
|
|
11964
|
-
set: function set() {
|
|
11965
|
-
var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
|
|
11966
|
-
this._action = action;
|
|
11967
|
-
|
|
11968
|
-
if (this._action !== 'copy' && this._action !== 'cut') {
|
|
11969
|
-
throw new Error('Invalid "action" value, use either "copy" or "cut"');
|
|
11901
|
+
if (action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
|
|
11902
|
+
throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
|
|
11970
11903
|
}
|
|
11904
|
+
} else {
|
|
11905
|
+
throw new Error('Invalid "target" value, use a valid Element');
|
|
11971
11906
|
}
|
|
11972
|
-
|
|
11973
|
-
* Gets the `action` property.
|
|
11974
|
-
* @return {String}
|
|
11975
|
-
*/
|
|
11976
|
-
,
|
|
11977
|
-
get: function get() {
|
|
11978
|
-
return this._action;
|
|
11979
|
-
}
|
|
11980
|
-
/**
|
|
11981
|
-
* Sets the `target` property using an element
|
|
11982
|
-
* that will be have its content copied.
|
|
11983
|
-
* @param {Element} target
|
|
11984
|
-
*/
|
|
11907
|
+
} // Define selection strategy based on `text` property.
|
|
11985
11908
|
|
|
11986
|
-
}, {
|
|
11987
|
-
key: "target",
|
|
11988
|
-
set: function set(target) {
|
|
11989
|
-
if (target !== undefined) {
|
|
11990
|
-
if (target && _typeof(target) === 'object' && target.nodeType === 1) {
|
|
11991
|
-
if (this.action === 'copy' && target.hasAttribute('disabled')) {
|
|
11992
|
-
throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
|
|
11993
|
-
}
|
|
11994
11909
|
|
|
11995
|
-
|
|
11996
|
-
|
|
11997
|
-
|
|
11910
|
+
if (text) {
|
|
11911
|
+
return actions_copy(text, {
|
|
11912
|
+
container: container
|
|
11913
|
+
});
|
|
11914
|
+
} // Defines which selection strategy based on `target` property.
|
|
11998
11915
|
|
|
11999
|
-
this._target = target;
|
|
12000
|
-
} else {
|
|
12001
|
-
throw new Error('Invalid "target" value, use a valid Element');
|
|
12002
|
-
}
|
|
12003
|
-
}
|
|
12004
|
-
}
|
|
12005
|
-
/**
|
|
12006
|
-
* Gets the `target` property.
|
|
12007
|
-
* @return {String|HTMLElement}
|
|
12008
|
-
*/
|
|
12009
|
-
,
|
|
12010
|
-
get: function get() {
|
|
12011
|
-
return this._target;
|
|
12012
|
-
}
|
|
12013
|
-
}]);
|
|
12014
11916
|
|
|
12015
|
-
|
|
12016
|
-
|
|
11917
|
+
if (target) {
|
|
11918
|
+
return action === 'cut' ? actions_cut(target) : actions_copy(target, {
|
|
11919
|
+
container: container
|
|
11920
|
+
});
|
|
11921
|
+
}
|
|
11922
|
+
};
|
|
12017
11923
|
|
|
12018
|
-
/* harmony default export */ var
|
|
11924
|
+
/* harmony default export */ var actions_default = (ClipboardActionDefault);
|
|
12019
11925
|
;// CONCATENATED MODULE: ./src/clipboard.js
|
|
12020
11926
|
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); }
|
|
12021
11927
|
|
|
12022
|
-
function
|
|
11928
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12023
11929
|
|
|
12024
|
-
function
|
|
11930
|
+
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); } }
|
|
12025
11931
|
|
|
12026
|
-
function
|
|
11932
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
12027
11933
|
|
|
12028
11934
|
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); }
|
|
12029
11935
|
|
|
@@ -12042,6 +11948,8 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
12042
11948
|
|
|
12043
11949
|
|
|
12044
11950
|
|
|
11951
|
+
|
|
11952
|
+
|
|
12045
11953
|
/**
|
|
12046
11954
|
* Helper function to retrieve attribute value.
|
|
12047
11955
|
* @param {String} suffix
|
|
@@ -12075,7 +11983,7 @@ var Clipboard = /*#__PURE__*/function (_Emitter) {
|
|
|
12075
11983
|
function Clipboard(trigger, options) {
|
|
12076
11984
|
var _this;
|
|
12077
11985
|
|
|
12078
|
-
|
|
11986
|
+
_classCallCheck(this, Clipboard);
|
|
12079
11987
|
|
|
12080
11988
|
_this = _super.call(this);
|
|
12081
11989
|
|
|
@@ -12092,7 +12000,7 @@ var Clipboard = /*#__PURE__*/function (_Emitter) {
|
|
|
12092
12000
|
*/
|
|
12093
12001
|
|
|
12094
12002
|
|
|
12095
|
-
|
|
12003
|
+
_createClass(Clipboard, [{
|
|
12096
12004
|
key: "resolveOptions",
|
|
12097
12005
|
value: function resolveOptions() {
|
|
12098
12006
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -12124,18 +12032,25 @@ var Clipboard = /*#__PURE__*/function (_Emitter) {
|
|
|
12124
12032
|
key: "onClick",
|
|
12125
12033
|
value: function onClick(e) {
|
|
12126
12034
|
var trigger = e.delegateTarget || e.currentTarget;
|
|
12127
|
-
|
|
12128
|
-
|
|
12129
|
-
|
|
12130
|
-
}
|
|
12131
|
-
|
|
12132
|
-
this.clipboardAction = new clipboard_action({
|
|
12133
|
-
action: this.action(trigger),
|
|
12134
|
-
target: this.target(trigger),
|
|
12135
|
-
text: this.text(trigger),
|
|
12035
|
+
var action = this.action(trigger) || 'copy';
|
|
12036
|
+
var text = actions_default({
|
|
12037
|
+
action: action,
|
|
12136
12038
|
container: this.container,
|
|
12039
|
+
target: this.target(trigger),
|
|
12040
|
+
text: this.text(trigger)
|
|
12041
|
+
}); // Fires an event based on the copy operation result.
|
|
12042
|
+
|
|
12043
|
+
this.emit(text ? 'success' : 'error', {
|
|
12044
|
+
action: action,
|
|
12045
|
+
text: text,
|
|
12137
12046
|
trigger: trigger,
|
|
12138
|
-
|
|
12047
|
+
clearSelection: function clearSelection() {
|
|
12048
|
+
if (trigger) {
|
|
12049
|
+
trigger.focus();
|
|
12050
|
+
}
|
|
12051
|
+
|
|
12052
|
+
window.getSelection().removeAllRanges();
|
|
12053
|
+
}
|
|
12139
12054
|
});
|
|
12140
12055
|
}
|
|
12141
12056
|
/**
|
|
@@ -12163,9 +12078,10 @@ var Clipboard = /*#__PURE__*/function (_Emitter) {
|
|
|
12163
12078
|
}
|
|
12164
12079
|
}
|
|
12165
12080
|
/**
|
|
12166
|
-
*
|
|
12167
|
-
*
|
|
12168
|
-
* @param {
|
|
12081
|
+
* Allow fire programmatically a copy action
|
|
12082
|
+
* @param {String|HTMLElement} target
|
|
12083
|
+
* @param {Object} options
|
|
12084
|
+
* @returns Text copied.
|
|
12169
12085
|
*/
|
|
12170
12086
|
|
|
12171
12087
|
}, {
|
|
@@ -12186,13 +12102,33 @@ var Clipboard = /*#__PURE__*/function (_Emitter) {
|
|
|
12186
12102
|
key: "destroy",
|
|
12187
12103
|
value: function destroy() {
|
|
12188
12104
|
this.listener.destroy();
|
|
12189
|
-
|
|
12190
|
-
if (this.clipboardAction) {
|
|
12191
|
-
this.clipboardAction.destroy();
|
|
12192
|
-
this.clipboardAction = null;
|
|
12193
|
-
}
|
|
12194
12105
|
}
|
|
12195
12106
|
}], [{
|
|
12107
|
+
key: "copy",
|
|
12108
|
+
value: function copy(target) {
|
|
12109
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
12110
|
+
container: document.body
|
|
12111
|
+
};
|
|
12112
|
+
return actions_copy(target, options);
|
|
12113
|
+
}
|
|
12114
|
+
/**
|
|
12115
|
+
* Allow fire programmatically a cut action
|
|
12116
|
+
* @param {String|HTMLElement} target
|
|
12117
|
+
* @returns Text cutted.
|
|
12118
|
+
*/
|
|
12119
|
+
|
|
12120
|
+
}, {
|
|
12121
|
+
key: "cut",
|
|
12122
|
+
value: function cut(target) {
|
|
12123
|
+
return actions_cut(target);
|
|
12124
|
+
}
|
|
12125
|
+
/**
|
|
12126
|
+
* Returns the support of the given action, or all actions if no action is
|
|
12127
|
+
* given.
|
|
12128
|
+
* @param {String} [action]
|
|
12129
|
+
*/
|
|
12130
|
+
|
|
12131
|
+
}, {
|
|
12196
12132
|
key: "isSupported",
|
|
12197
12133
|
value: function isSupported() {
|
|
12198
12134
|
var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
|
|
@@ -12678,7 +12614,7 @@ module.exports.TinyEmitter = E;
|
|
|
12678
12614
|
/******/ // module exports must be returned from runtime so entry inlining is disabled
|
|
12679
12615
|
/******/ // startup
|
|
12680
12616
|
/******/ // Load entry module and return exports
|
|
12681
|
-
/******/ return __webpack_require__(
|
|
12617
|
+
/******/ return __webpack_require__(686);
|
|
12682
12618
|
/******/ })()
|
|
12683
12619
|
.default;
|
|
12684
12620
|
});
|