@ones-editor/editor 1.1.18-beta.13 → 1.1.18-beta.14

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
@@ -43407,7 +43407,8 @@ ${codeText}
43407
43407
  let prevBlock = getPrevBlock(block);
43408
43408
  while (prevBlock) {
43409
43409
  if (!isListBlock(prevBlock)) {
43410
- return null;
43410
+ prevBlock = getPrevBlock(prevBlock);
43411
+ continue;
43411
43412
  }
43412
43413
  const { level: testLevel, groupId: testGroupId, type: testType } = getListBlockProperties(prevBlock);
43413
43414
  if (testLevel < level) {
@@ -44214,8 +44215,10 @@ ${codeText}
44214
44215
  }
44215
44216
  const newBlock = editor.insertBlock(getContainerId(container), blockIndex, newBlockData, createBlockSimpleDocRange(newBlockData.id, 0));
44216
44217
  editor.deleteBlock(draggedBlock);
44217
- const fixStart2 = new FixStartByList(editor, newBlock);
44218
- fixStart2.fix();
44218
+ if (groupId !== oldData.groupId) {
44219
+ const fixStart2 = new FixStartByList(editor, newBlock);
44220
+ fixStart2.fix();
44221
+ }
44219
44222
  fixStart1 == null ? void 0 : fixStart1.fix();
44220
44223
  return true;
44221
44224
  }
@@ -45098,6 +45101,7 @@ ${codeText}
45098
45101
  }
45099
45102
  class ListBlockInputHandler {
45100
45103
  constructor(editor) {
45104
+ __publicField(this, "fixStartByList", null);
45101
45105
  this.editor = editor;
45102
45106
  }
45103
45107
  handleBeforeKeyDown(editor, event) {
@@ -45139,6 +45143,66 @@ ${codeText}
45139
45143
  }
45140
45144
  return this.editor.undoManager.runInGroup(() => handleTab$2(this.editor));
45141
45145
  }
45146
+ getPreListBlock(editor) {
45147
+ const startBlock = editor.selection.startBlock;
45148
+ if (isListBlock(startBlock)) {
45149
+ return startBlock;
45150
+ }
45151
+ const preBlock = getPrevBlock(startBlock);
45152
+ if (preBlock && isListBlock(preBlock)) {
45153
+ return preBlock;
45154
+ }
45155
+ return null;
45156
+ }
45157
+ async handleBeforePasteDoc(editor, doc2) {
45158
+ const preBlock = this.getPreListBlock(editor);
45159
+ const preBlockData = preBlock ? editor.getBlockData(preBlock) : null;
45160
+ if (preBlock) {
45161
+ this.fixStartByList = new FixStartByWillDeletedList(editor, preBlock);
45162
+ }
45163
+ const groupIds = /* @__PURE__ */ new Map();
45164
+ const getGroupId = (id) => {
45165
+ if (groupIds.has(id)) {
45166
+ return groupIds.get(id);
45167
+ }
45168
+ return id;
45169
+ };
45170
+ Object.values(doc2.blocks).forEach((blocks) => {
45171
+ blocks.forEach((block, index2) => {
45172
+ var _a;
45173
+ if (block.type === "list") {
45174
+ const preDocBlock = (_a = blocks[index2 - 1]) != null ? _a : preBlockData;
45175
+ let needReset = !preDocBlock || preDocBlock.type !== "list" || preDocBlock.level !== block.level;
45176
+ if (needReset && index2 !== 0) {
45177
+ needReset = getGroupId(preDocBlock.groupId) !== block.groupId;
45178
+ }
45179
+ if (needReset) {
45180
+ block.start = 1;
45181
+ const newGroupId = genId();
45182
+ groupIds.set(newGroupId, block.groupId);
45183
+ block.groupId = newGroupId;
45184
+ } else {
45185
+ if (index2 === 0 && isListBlock(editor.selection.startBlock)) {
45186
+ block.start = preDocBlock.start;
45187
+ } else {
45188
+ block.start = preDocBlock.start + 1;
45189
+ }
45190
+ block.groupId = preDocBlock.groupId;
45191
+ }
45192
+ }
45193
+ });
45194
+ });
45195
+ return false;
45196
+ }
45197
+ async handleAfterPaste(editor) {
45198
+ editor.undoManager.runInGroup(() => {
45199
+ if (this.fixStartByList) {
45200
+ this.fixStartByList.fix();
45201
+ this.fixStartByList = null;
45202
+ }
45203
+ });
45204
+ return false;
45205
+ }
45142
45206
  }
45143
45207
  class ListClearSelectionHandler {
45144
45208
  constructor(editor) {
@@ -77058,7 +77122,7 @@ ${data.flowchartText}
77058
77122
  }
77059
77123
  }
77060
77124
  });
77061
- editor.version = "1.1.18-beta.13";
77125
+ editor.version = "1.1.18-beta.14";
77062
77126
  if (Logger$2.level === LogLevel.DEBUG) {
77063
77127
  window.setReauthFail = (fail) => {
77064
77128
  window.isReauthError = fail;
@@ -77146,7 +77210,7 @@ ${data.flowchartText}
77146
77210
  });
77147
77211
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
77148
77212
  OnesEditorToolbar.register(editor);
77149
- editor.version = "1.1.18-beta.13";
77213
+ editor.version = "1.1.18-beta.14";
77150
77214
  return editor;
77151
77215
  }
77152
77216
  async function showDocVersions(editor, options, serverUrl) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "1.1.18-beta.13",
3
+ "version": "1.1.18-beta.14",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",