@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/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/dist/index.js +36 -36
- package/package.json +1 -1
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
|
|
7973
|
+
async function execCommandCopy(items) {
|
|
7974
7974
|
var _a;
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
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
|
-
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
|
|
7991
|
-
|
|
7992
|
-
|
|
7993
|
-
|
|
7994
|
-
|
|
7995
|
-
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
|
|
7999
|
-
|
|
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
|
|
8014
|
+
return await execCommandCopy(items);
|
|
8015
8015
|
}
|
|
8016
8016
|
}
|
|
8017
8017
|
function selectFile(accept, options) {
|