Browse Source

复制到粘贴板IE8兼容

es6
guy 7 years ago
parent
commit
007613a643
  1. 1852
      bi/case.js
  2. 2
      demo/js/case/demo.clipboard.js
  3. 1852
      docs/case.js
  4. 2
      docs/demo.js
  5. BIN
      docs/resource/ZeroClipboard.swf
  6. 1827
      src/case/clipboard/clipboard.js
  7. 29
      src/case/clipboard/index.js

1852
bi/case.js

File diff suppressed because it is too large Load Diff

2
demo/js/case/demo.clipboard.js

@ -15,7 +15,7 @@ Demo.Func = BI.inherit(BI.Widget, {
width: 100,
height: 100,
cls: 'layout-bg1',
text: function () {
copy: function () {
return editor.getValue();
},

1852
docs/case.js

File diff suppressed because it is too large Load Diff

2
docs/demo.js

@ -1750,7 +1750,7 @@ BI.shortcut("demo.calendar", Demo.Func);Demo.Func = BI.inherit(BI.Widget, {
width: 100,
height: 100,
cls: 'layout-bg1',
text: function () {
copy: function () {
return editor.getValue();
},

BIN
docs/resource/ZeroClipboard.swf

Binary file not shown.

1827
src/case/clipboard/clipboard.js

File diff suppressed because it is too large Load Diff

29
src/case/clipboard/index.js

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

Loading…
Cancel
Save