@ones-editor/editor 1.1.18-beta.12 → 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
@@ -23084,7 +23084,8 @@ var __publicField = (obj, key, value) => {
23084
23084
  }
23085
23085
  animateScrollTo(target, {
23086
23086
  elementToScroll: getScrollContainer$1(target),
23087
- disableHorizontal: true
23087
+ disableHorizontal: true,
23088
+ verticalOffset: options == null ? void 0 : options.verticalOffset
23088
23089
  });
23089
23090
  } else if (target.scrollIntoView) {
23090
23091
  target.scrollIntoView({
@@ -43406,7 +43407,8 @@ ${codeText}
43406
43407
  let prevBlock = getPrevBlock(block);
43407
43408
  while (prevBlock) {
43408
43409
  if (!isListBlock(prevBlock)) {
43409
- return null;
43410
+ prevBlock = getPrevBlock(prevBlock);
43411
+ continue;
43410
43412
  }
43411
43413
  const { level: testLevel, groupId: testGroupId, type: testType } = getListBlockProperties(prevBlock);
43412
43414
  if (testLevel < level) {
@@ -44213,8 +44215,10 @@ ${codeText}
44213
44215
  }
44214
44216
  const newBlock = editor.insertBlock(getContainerId(container), blockIndex, newBlockData, createBlockSimpleDocRange(newBlockData.id, 0));
44215
44217
  editor.deleteBlock(draggedBlock);
44216
- const fixStart2 = new FixStartByList(editor, newBlock);
44217
- fixStart2.fix();
44218
+ if (groupId !== oldData.groupId) {
44219
+ const fixStart2 = new FixStartByList(editor, newBlock);
44220
+ fixStart2.fix();
44221
+ }
44218
44222
  fixStart1 == null ? void 0 : fixStart1.fix();
44219
44223
  return true;
44220
44224
  }
@@ -45097,6 +45101,7 @@ ${codeText}
45097
45101
  }
45098
45102
  class ListBlockInputHandler {
45099
45103
  constructor(editor) {
45104
+ __publicField(this, "fixStartByList", null);
45100
45105
  this.editor = editor;
45101
45106
  }
45102
45107
  handleBeforeKeyDown(editor, event) {
@@ -45138,6 +45143,66 @@ ${codeText}
45138
45143
  }
45139
45144
  return this.editor.undoManager.runInGroup(() => handleTab$2(this.editor));
45140
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
+ }
45141
45206
  }
45142
45207
  class ListClearSelectionHandler {
45143
45208
  constructor(editor) {
@@ -77057,7 +77122,7 @@ ${data.flowchartText}
77057
77122
  }
77058
77123
  }
77059
77124
  });
77060
- editor.version = "1.1.18-beta.12";
77125
+ editor.version = "1.1.18-beta.14";
77061
77126
  if (Logger$2.level === LogLevel.DEBUG) {
77062
77127
  window.setReauthFail = (fail) => {
77063
77128
  window.isReauthError = fail;
@@ -77145,7 +77210,7 @@ ${data.flowchartText}
77145
77210
  });
77146
77211
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
77147
77212
  OnesEditorToolbar.register(editor);
77148
- editor.version = "1.1.18-beta.12";
77213
+ editor.version = "1.1.18-beta.14";
77149
77214
  return editor;
77150
77215
  }
77151
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.12",
3
+ "version": "1.1.18-beta.14",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",