@tarojs/plugin-platform-harmony-ets 4.0.0-beta.70 → 4.0.0-beta.71

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/runtime.js CHANGED
@@ -659,8 +659,20 @@ const setClipboardData = function (options) {
659
659
  }
660
660
  return new Promise((resolve, reject) => {
661
661
  const systemPasteboard = pasteboard.getSystemPasteboard();
662
- const pasteData = pasteboard.createPlainTextData(data);
663
- systemPasteboard.setPasteData(pasteData, (error, data) => {
662
+ const pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, data);
663
+ try {
664
+ systemPasteboard.setDataSync(pasteData);
665
+ promptAction.showToast({
666
+ message: '内容已复制',
667
+ duration: 1500,
668
+ bottom: '50%',
669
+ showMode: 1 // 设置弹窗显示模式,显示在应用之上。
670
+ });
671
+ return handle.success({
672
+ data,
673
+ }, { resolve, reject });
674
+ }
675
+ catch (error) {
664
676
  if (error) {
665
677
  console.error('Failed to set PasteData. Cause: ' + JSON.stringify(error));
666
678
  res = {
@@ -669,18 +681,7 @@ const setClipboardData = function (options) {
669
681
  };
670
682
  callAsyncFail(reject, res, options);
671
683
  }
672
- else {
673
- promptAction.showToast({
674
- message: '内容已复制',
675
- duration: 1500,
676
- bottom: '50%',
677
- showMode: 1 // 设置弹窗显示模式,显示在应用之上。
678
- });
679
- return handle.success({
680
- data,
681
- }, { resolve, reject });
682
- }
683
- });
684
+ }
684
685
  });
685
686
  };
686
687
  /**
@@ -691,7 +692,7 @@ const getClipboardData = function (options) {
691
692
  const handle = new MethodHandler({ name: 'getClipboardData', success, fail, complete });
692
693
  return new Promise((resolve, reject) => {
693
694
  const systemPasteboard = pasteboard.getSystemPasteboard();
694
- systemPasteboard.getPasteData((error, pasteData) => {
695
+ systemPasteboard.getData((error, pasteData) => {
695
696
  if (error) {
696
697
  console.error('Failed to obtain PasteData. Cause: ' + JSON.stringify(error));
697
698
  return handle.fail({