@ones-editor/editor 3.0.0 → 3.0.1-beta.10

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
@@ -8948,8 +8948,8 @@ div.editor-root.compact.no-heading-collapse.no-block-menu > .editor-content {
8948
8948
  display: none;
8949
8949
  }
8950
8950
  .error-info-bar[data-type=error] .content {
8951
- background-color: #FFEAE8;
8952
- color: #EB3723;
8951
+ background: rgba(0, 36, 90, 0.0392156863);
8952
+ color: #575859;
8953
8953
  }
8954
8954
  .error-info-bar[data-type=warning] .content {
8955
8955
  background-color: #ff9800;
@@ -29187,7 +29187,15 @@ var __publicField = (obj, key, value) => {
29187
29187
  if (Math.abs(this.mouseDownEvent.x - event.x) < 3 && Math.abs(this.mouseDownEvent.y - event.y) < 3) {
29188
29188
  return;
29189
29189
  }
29190
- const range = getBlockRangeFromPoint(this.editor, event.x, event.y, true);
29190
+ const lastBlock2 = getLastChildBlock(this.editor.rootContainer);
29191
+ const rect = lastBlock2.getBoundingClientRect();
29192
+ let range;
29193
+ if (event.y > rect.bottom) {
29194
+ const length = getBlockTextLength$6(this.editor, lastBlock2);
29195
+ range = createBlockSimpleRange(this.editor, lastBlock2, length, length);
29196
+ } else {
29197
+ range = getBlockRangeFromPoint(this.editor, event.x, event.y, true);
29198
+ }
29191
29199
  if (!range) {
29192
29200
  return;
29193
29201
  }
@@ -53238,59 +53246,57 @@ ${codeText}
53238
53246
  async handleBeforePasteDoc(editor, doc2) {
53239
53247
  const groupIds = /* @__PURE__ */ new Map();
53240
53248
  const startIds = /* @__PURE__ */ new Map();
53241
- Object.values(doc2.blocks).forEach((blocks) => {
53242
- blocks.forEach((block, index2) => {
53243
- if (block.type === "list") {
53244
- if (index2 === 0) {
53245
- const startBlock = editor.selection.startBlock;
53246
- if (isListBlock(startBlock)) {
53247
- const { start, groupId: groupId2, level, type } = getListBlockProperties(startBlock);
53248
- const newType = getListType(block);
53249
+ doc2.blocks.root.forEach((block, index2) => {
53250
+ if (block.type === "list") {
53251
+ if (index2 === 0) {
53252
+ const startBlock = editor.selection.startBlock;
53253
+ if (isListBlock(startBlock)) {
53254
+ const { start, groupId: groupId2, level, type } = getListBlockProperties(startBlock);
53255
+ const newType = getListType(block);
53256
+ const oldGroupId = block.groupId;
53257
+ block.groupId = groupId2;
53258
+ block.start = start;
53259
+ block.level = level;
53260
+ const data2 = makeListBlockTypeData(type);
53261
+ Object.assign(block, data2);
53262
+ if (level === block.level && type === newType) {
53263
+ groupIds.set(oldGroupId, groupId2);
53264
+ startIds.set(groupId2, start);
53265
+ }
53266
+ this.fixStartByList = new FixStartByWillDeletedList(editor, startBlock);
53267
+ return;
53268
+ }
53269
+ const preBlock = getPrevBlock(startBlock);
53270
+ if (preBlock && isListBlock(preBlock)) {
53271
+ const { start, groupId: groupId2, level, type } = getListBlockProperties(preBlock);
53272
+ const newType = getListType(block);
53273
+ if (level === block.level && type === newType) {
53249
53274
  const oldGroupId = block.groupId;
53250
53275
  block.groupId = groupId2;
53251
- block.start = start;
53276
+ block.start = start + 1;
53252
53277
  block.level = level;
53253
- const data2 = makeListBlockTypeData(type);
53254
- Object.assign(block, data2);
53255
- if (level === block.level && type === newType) {
53256
- groupIds.set(oldGroupId, groupId2);
53257
- startIds.set(groupId2, start);
53258
- }
53259
- this.fixStartByList = new FixStartByWillDeletedList(editor, startBlock);
53278
+ groupIds.set(oldGroupId, groupId2);
53279
+ startIds.set(groupId2, start + 1);
53280
+ this.fixStartByList = new FixStartByWillDeletedList(editor, preBlock);
53260
53281
  return;
53261
53282
  }
53262
- const preBlock = getPrevBlock(startBlock);
53263
- if (preBlock && isListBlock(preBlock)) {
53264
- const { start, groupId: groupId2, level, type } = getListBlockProperties(preBlock);
53265
- const newType = getListType(block);
53266
- if (level === block.level && type === newType) {
53267
- const oldGroupId = block.groupId;
53268
- block.groupId = groupId2;
53269
- block.start = start + 1;
53270
- block.level = level;
53271
- groupIds.set(oldGroupId, groupId2);
53272
- startIds.set(groupId2, start + 1);
53273
- this.fixStartByList = new FixStartByWillDeletedList(editor, preBlock);
53274
- return;
53275
- }
53276
- }
53277
- }
53278
- const groupId = groupIds.get(block.groupId);
53279
- if (!groupId) {
53280
- const newGroupId = genId();
53281
- groupIds.set(block.groupId, newGroupId);
53282
- block.groupId = newGroupId;
53283
- block.start = 1;
53284
- startIds.set(newGroupId, 1);
53285
- } else {
53286
- const start = startIds.get(groupId);
53287
- assert(logger$21, start, "start is null");
53288
- block.start = start + 1;
53289
- block.groupId = groupId;
53290
- startIds.set(groupId, start + 1);
53291
53283
  }
53292
53284
  }
53293
- });
53285
+ const groupId = groupIds.get(block.groupId);
53286
+ if (!groupId) {
53287
+ const newGroupId = genId();
53288
+ groupIds.set(block.groupId, newGroupId);
53289
+ block.groupId = newGroupId;
53290
+ block.start = 1;
53291
+ startIds.set(newGroupId, 1);
53292
+ } else {
53293
+ const start = startIds.get(groupId);
53294
+ assert(logger$21, start, "start is null");
53295
+ block.start = start + 1;
53296
+ block.groupId = groupId;
53297
+ startIds.set(groupId, start + 1);
53298
+ }
53299
+ }
53294
53300
  });
53295
53301
  return false;
53296
53302
  }
@@ -67323,6 +67329,7 @@ ${codeText}
67323
67329
  });
67324
67330
  editor.addListener("blur", this.removePlaceholder);
67325
67331
  editor.addListener("focus", this.applyPlaceholder);
67332
+ editor.blockHooks.push(this);
67326
67333
  }
67327
67334
  destroy(editor) {
67328
67335
  editor.removeListener("selectionChanged", this.handleSelectionChange);
@@ -67407,6 +67414,11 @@ ${codeText}
67407
67414
  handleUpdateCompositionText(editor) {
67408
67415
  this.applyPlaceholder(editor);
67409
67416
  }
67417
+ update(editor, path, container, blockElement, blockData) {
67418
+ if (path.length === 1 && this.isDocumentTitleBlock(path[0].containerId, path[0].blockIndex)) {
67419
+ blockElement.setAttribute("data-document-title", "");
67420
+ }
67421
+ }
67410
67422
  removePlaceholder(editor) {
67411
67423
  removeAllPlaceholders(editor);
67412
67424
  }
@@ -92546,7 +92558,7 @@ ${data2.plantumlText}
92546
92558
  },
92547
92559
  error: {
92548
92560
  retry: "\u91CD\u8BD5",
92549
- network: "\u670D\u52A1\u8FDE\u63A5\u5F02\u5E38\uFF0C\u6B63\u5728\u5C1D\u8BD5\u91CD\u8FDE\u3002\u4E3A\u907F\u514D\u5185\u5BB9\u65E0\u6CD5\u540C\u6B65\uFF0C\u5DF2\u6682\u65F6\u7981\u7528\u7F16\u8F91\u3002\u8BF7\u5728\u670D\u52A1\u8FDE\u63A5\u540E\u7EE7\u7EED\u3002",
92561
+ network: "\u670D\u52A1\u65AD\u5F00\uFF0C\u6B63\u5728\u91CD\u8FDE\u2026 \u4E3A\u9632\u6B62\u5185\u5BB9\u4E22\u5931\uFF0C\u5F53\u524D\u5DF2\u6682\u505C\u7F16\u8F91\u3002",
92550
92562
  networkPopup: "\u670D\u52A1\u8FDE\u63A5\u5F02\u5E38\uFF0C\u6B63\u5728\u5C1D\u8BD5\u91CD\u8FDE...",
92551
92563
  uploadResourceError: "\u6570\u636E\u4FDD\u5B58\u5F02\u5E38",
92552
92564
  uploadResourceErrorMessage: "\u8D44\u6E90\u4FDD\u5B58\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",
@@ -92576,7 +92588,7 @@ ${data2.plantumlText}
92576
92588
  },
92577
92589
  error: {
92578
92590
  retry: "\u91CD\u8A66",
92579
- network: "\u670D\u52D9\u9023\u63A5\u7570\u5E38\uFF0C\u6B63\u5728\u5617\u8A66\u91CD\u9023\u3002\u70BA\u907F\u514D\u5167\u5BB9\u7121\u6CD5\u540C\u6B65\uFF0C\u5DF2\u66AB\u6642\u7981\u7528\u7DE8\u8F2F\u3002\u8ACB\u5728\u670D\u52D9\u9023\u63A5\u5F8C\u7E7C\u7E8C\u3002",
92591
+ network: "\u670D\u52D9\u4E2D\u65B7\uFF0C\u6B63\u5728\u91CD\u65B0\u9023\u63A5\u2026 \u70BA\u9632\u6B62\u5167\u5BB9\u907A\u5931\uFF0C\u7576\u524D\u5DF2\u66AB\u505C\u7DE8\u8F2F\u3002",
92580
92592
  networkPopup: "\u670D\u52D9\u9023\u63A5\u7570\u5E38\uFF0C\u6B63\u5728\u5617\u8A66\u91CD\u9023...",
92581
92593
  uploadResourceError: "\u6578\u64DA\u4FDD\u5B58\u7570\u5E38",
92582
92594
  uploadResourceErrorMessage: "\u8CC7\u6E90\u4FDD\u5B58\u5931\u6557\uFF0C\u8ACB\u7A0D\u5F8C\u91CD\u8A66\u3002",
@@ -92606,7 +92618,7 @@ ${data2.plantumlText}
92606
92618
  },
92607
92619
  error: {
92608
92620
  retry: "Try again",
92609
- network: "Service connection lost, trying to reconnect. Editing is temporarily disabled to prevent unsynced content. Please continue once the connection is restored.",
92621
+ network: "Connection lost. Reconnecting\u2026 To prevent data loss, editing has been temporarily disabled.",
92610
92622
  networkPopup: "Service connection lost, trying to reconnect...",
92611
92623
  uploadResourceError: "Unable to save data",
92612
92624
  uploadResourceErrorMessage: "Resource upload failed, please retry later.",
@@ -92636,7 +92648,7 @@ ${data2.plantumlText}
92636
92648
  },
92637
92649
  error: {
92638
92650
  retry: "\u518D\u8A66\u884C",
92639
- network: "\u30B5\u30FC\u30D3\u30B9\u3078\u306E\u63A5\u7D9A\u304C\u5207\u65AD\u3055\u308C\u307E\u3057\u305F\u3002\u7DE8\u96C6\u3059\u308B\u5185\u5BB9\u306E\u540C\u671F\u304C\u5931\u6557\u3057\u306A\u3044\u3088\u3046\u306B\u3001\u7DE8\u96C6\u6A5F\u80FD\u304C\u4E00\u6642\u5229\u7528\u3067\u304D\u306A\u3044\u72B6\u614B\u306B\u306A\u3063\u3066\u3044\u307E\u3059\u3002\u30B5\u30FC\u30D3\u30B9\u3078\u306E\u63A5\u7D9A\u304C\u56DE\u5FA9\u3059\u308B\u307E\u3067\u304A\u5F85\u3061\u304F\u3060\u3055\u3044\u3002",
92651
+ network: "\u63A5\u7D9A\u304C\u5207\u65AD\u3055\u308C\u307E\u3057\u305F\u3002\u518D\u63A5\u7D9A\u4E2D\u3067\u3059\u2026 \u7DE8\u96C6\u5185\u5BB9\u304C\u5931\u308F\u308C\u306A\u3044\u3088\u3046\u3001\u7DE8\u96C6\u306F\u4E00\u6642\u306B\u3054\u5229\u7528\u3044\u305F\u3060\u3051\u307E\u305B\u3093\u3002",
92640
92652
  networkPopup: "\u30B5\u30FC\u30D3\u30B9\u3078\u306E\u63A5\u7D9A\u304C\u5207\u65AD\u3055\u308C\u307E\u3057\u305F\u3002\u518D\u63A5\u7D9A\u3092\u8A66\u307F\u3066\u3044\u307E\u3059...",
92641
92653
  uploadResourceError: "\u30C7\u30FC\u30BF\u3092\u4FDD\u5B58\u3067\u304D\u307E\u305B\u3093",
92642
92654
  uploadResourceErrorMessage: "\u30EA\u30BD\u30FC\u30B9\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002\u3057\u3070\u3089\u304F\u3057\u3066\u304B\u3089\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",
@@ -92787,6 +92799,7 @@ ${data2.plantumlText}
92787
92799
  this.handleError(new Error("offline"));
92788
92800
  });
92789
92801
  __publicField(this, "_handleOnline", () => {
92802
+ console.log(`[${new Date().toLocaleString()}] wiz-editor online`);
92790
92803
  this._offlineFlag = false;
92791
92804
  this.autoHide();
92792
92805
  });
@@ -92821,6 +92834,7 @@ ${data2.plantumlText}
92821
92834
  this.handleError(error2);
92822
92835
  });
92823
92836
  __publicField(this, "onReauthRecovered", (auth) => {
92837
+ console.log(`[${new Date().toLocaleString()}] wiz-editor onReauthRecovered`);
92824
92838
  logger$7.debug("---------auth recovered");
92825
92839
  });
92826
92840
  __publicField(this, "onUnknownError", (error2) => {
@@ -92858,6 +92872,7 @@ ${data2.plantumlText}
92858
92872
  __publicField(this, "onReady", () => {
92859
92873
  var _a;
92860
92874
  logger$7.debug("---------ready");
92875
+ console.log(`[${new Date().toLocaleString()}] wiz-editor onReady`);
92861
92876
  this._connectionFlag = false;
92862
92877
  if (this.bar.visible()) {
92863
92878
  this.autoHide();
@@ -93766,7 +93781,7 @@ ${JSON.stringify(error2, null, 2)}`);
93766
93781
  return;
93767
93782
  }
93768
93783
  }
93769
- if (block.type === "text" || block.textOnly === true) {
93784
+ if (block.type === "text" || block.type === "code-line" || block.textOnly === true) {
93770
93785
  const blockObj = await getBlockObject(block, md5HexFunc, getTextsByBox);
93771
93786
  await dbg.addTextBlock(blockObj);
93772
93787
  return;
@@ -95949,7 +95964,7 @@ ${JSON.stringify(error2, null, 2)}`);
95949
95964
  }
95950
95965
  }
95951
95966
  });
95952
- editor.version = "3.0.0";
95967
+ editor.version = "3.0.1-beta.10";
95953
95968
  return editor;
95954
95969
  }
95955
95970
  function isDoc(doc2) {
@@ -96083,7 +96098,7 @@ ${JSON.stringify(error2, null, 2)}`);
96083
96098
  OnesEditorDropTarget.register(editor);
96084
96099
  OnesEditorTocProvider.register(editor);
96085
96100
  OnesEditorExclusiveBlock.register(editor);
96086
- editor.version = "3.0.0";
96101
+ editor.version = "3.0.1-beta.10";
96087
96102
  return editor;
96088
96103
  }
96089
96104
  async function showDocVersions(editor, options, serverUrl) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "3.0.0",
3
+ "version": "3.0.1-beta.10",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "dependencies": {