@ones-editor/editor 1.1.8-beta.6 → 1.1.8-beta.7

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/index.js CHANGED
@@ -7970,48 +7970,48 @@ var __publicField = (obj, key, value) => {
7970
7970
  }
7971
7971
  return false;
7972
7972
  }
7973
- async function setClipboardData(items) {
7973
+ async function execCommandCopy(items) {
7974
7974
  var _a;
7975
- try {
7976
- if (navigator.clipboard) {
7977
- const clipboardData = {};
7978
- items.forEach((item) => {
7979
- clipboardData[item.type] = item.data;
7980
- });
7981
- const clipboardItems = new ClipboardItem(clipboardData);
7982
- await navigator.clipboard.write([clipboardItems]);
7983
- alert(`\u590D\u5236\u6210\u529F, navigator.clipboard, window.clipboardData: ${typeof window.clipboardData}`);
7975
+ if (document.queryCommandSupported && document.queryCommandSupported("copy")) {
7976
+ let text2 = (_a = items.find((item) => item.type === "text/plain")) == null ? void 0 : _a.data;
7977
+ if (text2 instanceof Blob) {
7978
+ text2 = await text2.text();
7979
+ }
7980
+ const textarea2 = document.createElement("textarea");
7981
+ textarea2.textContent = text2 != null ? text2 : "";
7982
+ textarea2.style.position = "fixed";
7983
+ textarea2.style.opacity = "0";
7984
+ document.body.appendChild(textarea2);
7985
+ textarea2.select();
7986
+ try {
7987
+ document.execCommand("copy");
7988
+ document.body.removeChild(textarea2);
7989
+ alert(`\u590D\u5236\u6210\u529F, document.execCommand('copy')\uFF0Cwindow.clipboardData: ${typeof window.clipboardData}`);
7984
7990
  return true;
7991
+ } catch (ex) {
7992
+ logger$47.error(ex);
7993
+ document.body.removeChild(textarea2);
7994
+ alert(`\u590D\u5236\u5931\u8D25, document.execCommand('copy')${ex}\uFF0C window.clipboardData: ${typeof window.clipboardData}`);
7995
+ return false;
7985
7996
  }
7986
- if (document.queryCommandSupported && document.queryCommandSupported("copy")) {
7987
- let text2 = (_a = items.find((item) => item.type === "text/plain")) == null ? void 0 : _a.data;
7988
- if (text2 instanceof Blob) {
7989
- text2 = await text2.text();
7990
- }
7991
- const textarea2 = document.createElement("textarea");
7992
- textarea2.textContent = text2 != null ? text2 : "";
7993
- textarea2.style.position = "fixed";
7994
- textarea2.style.opacity = "0";
7995
- document.body.appendChild(textarea2);
7996
- textarea2.select();
7997
- try {
7998
- document.execCommand("copy");
7999
- document.body.removeChild(textarea2);
8000
- alert(`\u590D\u5236\u6210\u529F, document.execCommand('copy')\uFF0Cwindow.clipboardData: ${typeof window.clipboardData}`);
8001
- return true;
8002
- } catch (ex) {
8003
- logger$47.error(ex);
8004
- document.body.removeChild(textarea2);
8005
- alert(`\u590D\u5236\u5931\u8D25, document.execCommand('copy')${ex}\uFF0C window.clipboardData: ${typeof window.clipboardData}`);
8006
- return false;
8007
- }
8008
- }
8009
- alert(`\u590D\u5236\u5931\u8D25, \u4E0D\u652F\u6301 navigator.clipboard \u548C document.execCommand('copy'), window.clipboardData: ${typeof window.clipboardData}`);
8010
- return false;
7997
+ }
7998
+ alert(`\u590D\u5236\u5931\u8D25, \u4E0D\u652F\u6301 navigator.clipboard \u548C document.execCommand('copy'), window.clipboardData: ${typeof window.clipboardData}`);
7999
+ return false;
8000
+ }
8001
+ async function setClipboardData(items) {
8002
+ try {
8003
+ const clipboardData = {};
8004
+ items.forEach((item) => {
8005
+ clipboardData[item.type] = item.data;
8006
+ });
8007
+ const clipboardItems = new ClipboardItem(clipboardData);
8008
+ await navigator.clipboard.write([clipboardItems]);
8009
+ alert(`\u590D\u5236\u6210\u529F, navigator.clipboard, window.clipboardData: ${typeof window.clipboardData}`);
8010
+ return true;
8011
8011
  } catch (err) {
8012
8012
  logger$47.error(err);
8013
8013
  alert(`\u590D\u5236\u5931\u8D25, \u4E0D\u652F\u6301 navigator.clipboard \u548C document.execCommand('copy')${err}, window.clipboardData: ${typeof window.clipboardData}`);
8014
- return false;
8014
+ return await execCommandCopy(items);
8015
8015
  }
8016
8016
  }
8017
8017
  function selectFile(accept, options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "1.1.8-beta.6",
3
+ "version": "1.1.8-beta.7",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",