@ones-editor/editor 1.1.10-beta.15 → 1.1.10-beta.18
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
|
@@ -7995,7 +7995,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7995
7995
|
if (text2 instanceof Blob) {
|
|
7996
7996
|
text2 = await readBlob(text2);
|
|
7997
7997
|
}
|
|
7998
|
-
textarea2.textContent =
|
|
7998
|
+
textarea2.textContent = "hello \u5F02\u6B65";
|
|
7999
7999
|
textarea2.style.position = "fixed";
|
|
8000
8000
|
textarea2.style.opacity = "0";
|
|
8001
8001
|
document.body.appendChild(textarea2);
|
|
@@ -8004,6 +8004,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8004
8004
|
document.body.removeChild(textarea2);
|
|
8005
8005
|
return true;
|
|
8006
8006
|
} catch (ex) {
|
|
8007
|
+
alert("\u590D\u5236\u5931\u8D25");
|
|
8007
8008
|
logger$49.error(ex);
|
|
8008
8009
|
document.body.removeChild(textarea2);
|
|
8009
8010
|
return false;
|
|
@@ -8011,19 +8012,35 @@ var __publicField = (obj, key, value) => {
|
|
|
8011
8012
|
}
|
|
8012
8013
|
return false;
|
|
8013
8014
|
}
|
|
8014
|
-
async
|
|
8015
|
-
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8022
|
-
|
|
8023
|
-
|
|
8024
|
-
|
|
8025
|
-
|
|
8015
|
+
const copyTextToClipboard = async (text2) => {
|
|
8016
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
8017
|
+
if (document.queryCommandSupported && document.queryCommandSupported("copy")) {
|
|
8018
|
+
const textarea2 = document.createElement("textarea");
|
|
8019
|
+
textarea2.textContent = text2;
|
|
8020
|
+
textarea2.style.position = "fixed";
|
|
8021
|
+
document.body.appendChild(textarea2);
|
|
8022
|
+
textarea2.select();
|
|
8023
|
+
try {
|
|
8024
|
+
document.execCommand("copy");
|
|
8025
|
+
} catch (ex) {
|
|
8026
|
+
logger$49.error("Cannot copy text to clipboard");
|
|
8027
|
+
return false;
|
|
8028
|
+
} finally {
|
|
8029
|
+
document.body.removeChild(textarea2);
|
|
8030
|
+
}
|
|
8031
|
+
}
|
|
8032
|
+
return true;
|
|
8033
|
+
};
|
|
8034
|
+
window.indexTs = 0;
|
|
8035
|
+
function setClipboardData(items) {
|
|
8036
|
+
if (window.indexTs % 2) {
|
|
8037
|
+
setTimeout(() => {
|
|
8038
|
+
execCommandCopy(items);
|
|
8039
|
+
}, 10);
|
|
8040
|
+
} else {
|
|
8041
|
+
copyTextToClipboard("hello world");
|
|
8026
8042
|
}
|
|
8043
|
+
window.indexTs += 1;
|
|
8027
8044
|
}
|
|
8028
8045
|
function selectFile(accept, options) {
|
|
8029
8046
|
return new Promise((resolve, reject) => {
|
|
@@ -26166,7 +26183,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26166
26183
|
}
|
|
26167
26184
|
editorCopyDoc(editor, doc2);
|
|
26168
26185
|
}
|
|
26169
|
-
|
|
26186
|
+
function editorCopyBlock(editor, block) {
|
|
26170
26187
|
if (!window.isSecureContext) {
|
|
26171
26188
|
throw new Error("Can't copy block in insecure context.");
|
|
26172
26189
|
}
|
|
@@ -34300,9 +34317,6 @@ ${codeText}
|
|
|
34300
34317
|
__publicField(this, "reAuth", async () => {
|
|
34301
34318
|
if (this.connection && this.reauthFunc) {
|
|
34302
34319
|
const newAuth = await this.reauthFunc();
|
|
34303
|
-
if (window.isReauthError) {
|
|
34304
|
-
throw new Error("reauth error");
|
|
34305
|
-
}
|
|
34306
34320
|
await this.auth(newAuth);
|
|
34307
34321
|
const pingOptions = this.pingOptions;
|
|
34308
34322
|
this.connection._initializeHandshake = function handshake() {
|
|
@@ -34372,9 +34386,6 @@ ${codeText}
|
|
|
34372
34386
|
const thatWs = this.ws;
|
|
34373
34387
|
const pingOptions = this.pingOptions;
|
|
34374
34388
|
this.connection._initializeHandshake = function handshake() {
|
|
34375
|
-
if (window.isTokenExpired) {
|
|
34376
|
-
auth.token = "aaabbbccc";
|
|
34377
|
-
}
|
|
34378
34389
|
this.send({ a: "hs", id: this.id, auth, options: { ping: pingOptions } });
|
|
34379
34390
|
if (this._ping == null) {
|
|
34380
34391
|
this._ping = window.setInterval(() => {
|
|
@@ -35573,13 +35584,7 @@ ${codeText}
|
|
|
35573
35584
|
__publicField(this, "disableLogout");
|
|
35574
35585
|
__publicField(this, "destroyed", false);
|
|
35575
35586
|
__publicField(this, "handleNothingPending", () => {
|
|
35576
|
-
|
|
35577
|
-
setTimeout(() => {
|
|
35578
|
-
this.setStatus("clean");
|
|
35579
|
-
}, 30 * 1e3);
|
|
35580
|
-
} else {
|
|
35581
|
-
this.setStatus("clean");
|
|
35582
|
-
}
|
|
35587
|
+
this.setStatus("clean");
|
|
35583
35588
|
});
|
|
35584
35589
|
__publicField(this, "handleCreate", () => {
|
|
35585
35590
|
this.handleReload("doc created");
|
|
@@ -49914,21 +49919,18 @@ $$${mathData.mathjaxText}$$
|
|
|
49914
49919
|
if (parentBlock !== block) {
|
|
49915
49920
|
selectCodeBlock(editor, block, { focusToEditor: true });
|
|
49916
49921
|
}
|
|
49917
|
-
editorCopyBlock(editor, block)
|
|
49918
|
-
|
|
49919
|
-
|
|
49920
|
-
|
|
49921
|
-
|
|
49922
|
+
editorCopyBlock(editor, block);
|
|
49923
|
+
const { onCodeCopyComplete } = editor.getComponentOptions("code") || {};
|
|
49924
|
+
if (onCodeCopyComplete) {
|
|
49925
|
+
onCodeCopyComplete();
|
|
49926
|
+
return;
|
|
49927
|
+
}
|
|
49928
|
+
const rect = button2.getBoundingClientRect();
|
|
49929
|
+
showToast(i18n$1.t("code.copySuccess"), {
|
|
49930
|
+
position: {
|
|
49931
|
+
x: rect.x + rect.width / 2,
|
|
49932
|
+
y: rect.bottom + 30
|
|
49922
49933
|
}
|
|
49923
|
-
const rect = button2.getBoundingClientRect();
|
|
49924
|
-
showToast(i18n$1.t("code.copySuccess"), {
|
|
49925
|
-
position: {
|
|
49926
|
-
x: rect.x + rect.width / 2,
|
|
49927
|
-
y: rect.bottom + 30
|
|
49928
|
-
}
|
|
49929
|
-
});
|
|
49930
|
-
}).catch((err) => {
|
|
49931
|
-
logger$1b.error(err.message);
|
|
49932
49934
|
});
|
|
49933
49935
|
return;
|
|
49934
49936
|
}
|
|
@@ -54902,15 +54904,14 @@ ${codeText}
|
|
|
54902
54904
|
const [imageClipboardData, imageClipboardOriginData] = clipboardData;
|
|
54903
54905
|
if (imageClipboardData) {
|
|
54904
54906
|
const items = Object.entries(imageClipboardData).map(([key, value]) => ({ type: key, data: value }));
|
|
54905
|
-
setClipboardData(items)
|
|
54906
|
-
|
|
54907
|
-
|
|
54908
|
-
|
|
54909
|
-
|
|
54910
|
-
|
|
54911
|
-
}
|
|
54907
|
+
setClipboardData(items);
|
|
54908
|
+
if (event) {
|
|
54909
|
+
const clipboardData2 = event.clipboardData;
|
|
54910
|
+
if (clipboardData2) {
|
|
54911
|
+
clipboardData2.setData("text/plain", imageClipboardOriginData["text/plain"]);
|
|
54912
|
+
clipboardData2.setData("text/html", imageClipboardOriginData["text/html"]);
|
|
54912
54913
|
}
|
|
54913
|
-
}
|
|
54914
|
+
}
|
|
54914
54915
|
return true;
|
|
54915
54916
|
}
|
|
54916
54917
|
return void 0;
|
|
@@ -75723,7 +75724,7 @@ ${data.flowchartText}
|
|
|
75723
75724
|
}
|
|
75724
75725
|
}
|
|
75725
75726
|
});
|
|
75726
|
-
editor.version = "1.1.10-beta.
|
|
75727
|
+
editor.version = "1.1.10-beta.18";
|
|
75727
75728
|
return editor;
|
|
75728
75729
|
}
|
|
75729
75730
|
function isDoc(doc2) {
|
|
@@ -75796,7 +75797,7 @@ ${data.flowchartText}
|
|
|
75796
75797
|
});
|
|
75797
75798
|
editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
|
|
75798
75799
|
OnesEditorToolbar.register(editor);
|
|
75799
|
-
editor.version = "1.1.10-beta.
|
|
75800
|
+
editor.version = "1.1.10-beta.18";
|
|
75800
75801
|
return editor;
|
|
75801
75802
|
}
|
|
75802
75803
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -75946,6 +75947,7 @@ ${data.flowchartText}
|
|
|
75946
75947
|
exports2.converterIntercept = converterIntercept;
|
|
75947
75948
|
exports2.copyBlockAttributes = copyBlockAttributes;
|
|
75948
75949
|
exports2.copyResourcesFromDoc = copyResourcesFromDoc;
|
|
75950
|
+
exports2.copyTextToClipboard = copyTextToClipboard;
|
|
75949
75951
|
exports2.createBlockAnchor = createBlockAnchor;
|
|
75950
75952
|
exports2.createBlockCaretAnchor = createBlockCaretAnchor;
|
|
75951
75953
|
exports2.createBlockContentElement = createBlockContentElement;
|