@ones-editor/editor 1.1.3-bate.1 → 1.1.3-bate.3

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
@@ -5411,9 +5411,15 @@ div.editor-root div.editor-content div[data-type=editor-container] div[data-embe
5411
5411
  }
5412
5412
  :root .iframe-embed-auth-error-tips {
5413
5413
  width: 100%;
5414
- height: 80px;
5415
- background-color: #7084a4;
5414
+ height: 40px;
5415
+ line-height: 40px;
5416
+ background-color: #f7f8fa;
5416
5417
  text-align: center;
5418
+ color: #bebfc2;
5419
+ }
5420
+ :root .iframe-embed-auth-error-tips span {
5421
+ cursor: pointer;
5422
+ color: #0064ff;
5417
5423
  }.editor-content .editing {
5418
5424
  background-color: rgba(205, 205, 205, 0.2509803922);
5419
5425
  }
@@ -34019,6 +34025,11 @@ ${codeText}
34019
34025
  this.url = url;
34020
34026
  this.reauthFunc = reauthFunc;
34021
34027
  this.retryCount = 0;
34028
+ window.addEventListener("offline", () => {
34029
+ var _a;
34030
+ this.token = "fake";
34031
+ (_a = this.connection) == null ? void 0 : _a.close();
34032
+ });
34022
34033
  }
34023
34034
  getBaseURL() {
34024
34035
  const parsedURL = new URL(this.url);
@@ -34039,9 +34050,8 @@ ${codeText}
34039
34050
  },
34040
34051
  credentials: "include"
34041
34052
  });
34042
- if (ret.status !== 200) {
34043
- throw new Error("http auth error");
34044
- }
34053
+ if (ret.status !== 200)
34054
+ ;
34045
34055
  if (!this.enabled) {
34046
34056
  return {
34047
34057
  read: "",
@@ -34114,6 +34124,7 @@ ${codeText}
34114
34124
  Connection.apply(this.connection, [this.ws]);
34115
34125
  }
34116
34126
  async handleAuthError() {
34127
+ console.log("handleAuthError");
34117
34128
  if (this.reauthFunc) {
34118
34129
  if (this.retryCount === 5) {
34119
34130
  logger$2n.warn("retry auth times exceed 5, broadcast auth error");
@@ -34286,6 +34297,12 @@ ${codeText}
34286
34297
  });
34287
34298
  assert(logger$2m, !this.doc, "This websocket has opened a doc.");
34288
34299
  await this.connection.init(this.auth);
34300
+ window.addEventListener("online", async () => {
34301
+ await this.connection.init({
34302
+ ...this.auth,
34303
+ token: "fake"
34304
+ });
34305
+ });
34289
34306
  const doc2 = this.connection.get(this.auth.appId, this.auth.docId);
34290
34307
  this.doc = doc2;
34291
34308
  await fetchDoc(doc2);
@@ -65440,7 +65457,18 @@ ${codeText}
65440
65457
  const fixedToolbar = createElement("div", ["iframe-embed-auth-error-tips"], container);
65441
65458
  fixedToolbar.innerHTML = i18n$1.t("authError.tips");
65442
65459
  fixedToolbar.addEventListener("click", (event) => {
65443
- event.currentTarget;
65460
+ const target = event.target;
65461
+ if (target instanceof HTMLSpanElement) {
65462
+ const id = target.id;
65463
+ switch (id) {
65464
+ case "retry":
65465
+ this.reAuth();
65466
+ break;
65467
+ case "exit":
65468
+ this.exit();
65469
+ break;
65470
+ }
65471
+ }
65444
65472
  });
65445
65473
  }
65446
65474
  });
@@ -65453,6 +65481,9 @@ ${codeText}
65453
65481
  }
65454
65482
  exit() {
65455
65483
  var _a;
65484
+ if (this.currentBlock) {
65485
+ enablePageScroll(this.currentBlock.id);
65486
+ }
65456
65487
  this.unRegister();
65457
65488
  (_a = this.onIframeExitEdit) == null ? void 0 : _a.call(this);
65458
65489
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "1.1.3-bate.1",
3
+ "version": "1.1.3-bate.3",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",