|
|
@ -8,7 +8,7 @@ BI.ClipBoard = BI.inherit(BI.BasicButton, { |
|
|
|
_defaultConfig: function () { |
|
|
|
_defaultConfig: function () { |
|
|
|
return BI.extend(BI.ClipBoard.superclass._defaultConfig.apply(this, arguments), { |
|
|
|
return BI.extend(BI.ClipBoard.superclass._defaultConfig.apply(this, arguments), { |
|
|
|
extraCls: "bi-clipboard", |
|
|
|
extraCls: "bi-clipboard", |
|
|
|
text: "", |
|
|
|
copy: BI.emptyFn, |
|
|
|
afterCopy: BI.emptyFn |
|
|
|
afterCopy: BI.emptyFn |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
@ -19,18 +19,27 @@ BI.ClipBoard = BI.inherit(BI.BasicButton, { |
|
|
|
|
|
|
|
|
|
|
|
mounted: function () { |
|
|
|
mounted: function () { |
|
|
|
var self = this, o = this.options; |
|
|
|
var self = this, o = this.options; |
|
|
|
this.clipboard = new Clipboard(this.element[0], { |
|
|
|
if (window.Clipboard) { |
|
|
|
text: function () { |
|
|
|
this.clipboard = new Clipboard(this.element[0], { |
|
|
|
return BI.isFunction(o.text) ? o.text() : o.text; |
|
|
|
text: function () { |
|
|
|
} |
|
|
|
return BI.isFunction(o.copy) ? o.copy() : o.copy; |
|
|
|
}); |
|
|
|
} |
|
|
|
this.clipboard.on("success", function (e) { |
|
|
|
}); |
|
|
|
o.afterCopy(); |
|
|
|
this.clipboard.on("success", function (e) { |
|
|
|
}) |
|
|
|
o.afterCopy(); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.element.zclip({ |
|
|
|
|
|
|
|
path: BI.resourceURL + "/ZeroClipboard.swf", |
|
|
|
|
|
|
|
copy: o.copy, |
|
|
|
|
|
|
|
beforeCopy: o.beforeCopy, |
|
|
|
|
|
|
|
afterCopy: o.afterCopy |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
destroyed: function () { |
|
|
|
destroyed: function () { |
|
|
|
this.clipboard.destroy(); |
|
|
|
this.clipboard && this.clipboard.destroy(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|