add selectedText

This commit is contained in:
jykim
2016-07-22 18:28:50 +09:00
parent 60b6887100
commit 2af446daa6
3 changed files with 28 additions and 34 deletions

9
dist/clipboard.js vendored
View File

@@ -283,12 +283,12 @@ module.exports = select;
},{}],7:[function(require,module,exports){
function E () {
// Keep this empty so it's easier to inherit from
// Keep this empty so it's easier to inherit from
// (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
}
E.prototype = {
on: function (name, callback, ctx) {
on: function (name, callback, ctx) {
var e = this.e || (this.e = {});
(e[name] || (e[name] = [])).push({
@@ -407,7 +407,6 @@ module.exports = E;
/**
* @param {Object} options
*/
function ClipboardAction(options) {
_classCallCheck(this, ClipboardAction);
@@ -493,7 +492,7 @@ module.exports = E;
};
ClipboardAction.prototype.copyText = function copyText() {
var succeeded = undefined;
var succeeded = void 0;
try {
succeeded = document.execCommand(this.action);
@@ -515,6 +514,7 @@ module.exports = E;
} else {
this.emitter.emit('error', {
action: this.action,
text: this.selectedText,
trigger: this.trigger,
clearSelection: this.clearSelection.bind(this)
});
@@ -642,7 +642,6 @@ module.exports = E;
* @param {String|HTMLElement|HTMLCollection|NodeList} trigger
* @param {Object} options
*/
function Clipboard(trigger, options) {
_classCallCheck(this, Clipboard);

File diff suppressed because one or more lines are too long

View File

@@ -130,6 +130,7 @@ class ClipboardAction {
else {
this.emitter.emit('error', {
action: this.action,
text: this.selectedText,
trigger: this.trigger,
clearSelection: this.clearSelection.bind(this)
});