@ones-editor/editor 1.1.18-beta.11 → 1.1.18-beta.13
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({
|
|
@@ -27108,16 +27109,16 @@ ${codeText}
|
|
|
27108
27109
|
}
|
|
27109
27110
|
this.afterRange = range;
|
|
27110
27111
|
}
|
|
27111
|
-
|
|
27112
|
+
hasDocContainerId(editor, id) {
|
|
27112
27113
|
const blocks = editor.doc.findContainerBlocks(id);
|
|
27113
27114
|
return !!blocks;
|
|
27114
27115
|
}
|
|
27115
|
-
|
|
27116
|
+
findDocBlockById(editor, id) {
|
|
27116
27117
|
const blocks = editor.doc.findContainerBlocks(this.containerId);
|
|
27117
27118
|
if (!blocks) {
|
|
27118
|
-
return
|
|
27119
|
+
return void 0;
|
|
27119
27120
|
}
|
|
27120
|
-
return blocks.
|
|
27121
|
+
return blocks.find((item) => item.id === id);
|
|
27121
27122
|
}
|
|
27122
27123
|
checkBlockData(editor, blockData) {
|
|
27123
27124
|
if (Array.isArray(blockData.children)) {
|
|
@@ -27144,46 +27145,36 @@ ${codeText}
|
|
|
27144
27145
|
this.blockIndex = blockIndex;
|
|
27145
27146
|
}
|
|
27146
27147
|
deleteBlock(editor, newRange) {
|
|
27147
|
-
if (!this.
|
|
27148
|
+
if (!this.hasDocContainerId(editor, this.containerId)) {
|
|
27148
27149
|
logger$2G.warn(`container (${this.containerId}) not found, deleted by others?`);
|
|
27149
27150
|
return false;
|
|
27150
27151
|
}
|
|
27151
|
-
if (!this.findBlockById(editor, this.blockData.id)) {
|
|
27152
|
-
logger$2G.warn(`block (${this.blockData.id}) not found, deleted by others?`);
|
|
27153
|
-
return false;
|
|
27154
|
-
}
|
|
27155
27152
|
const container = editor.getContainerById(this.containerId);
|
|
27156
27153
|
if (!container)
|
|
27157
27154
|
return false;
|
|
27158
|
-
const block = editor.
|
|
27155
|
+
const block = editor.findBlockById(this.blockData.id);
|
|
27159
27156
|
if (!block)
|
|
27160
27157
|
return false;
|
|
27161
|
-
|
|
27162
|
-
assert(logger$2G, this.blockIndex === getBlockIndex(block), "invalid block index");
|
|
27163
|
-
editorDeleteBlockWithoutChildren(editor, block, fromDocRange(editor, newRange));
|
|
27164
|
-
} catch (error2) {
|
|
27165
|
-
logger$2G.warn(error2.message);
|
|
27166
|
-
editor.selection.selectBlock(block, 0);
|
|
27167
|
-
}
|
|
27158
|
+
editorDeleteBlockWithoutChildren(editor, block, fromDocRange(editor, newRange));
|
|
27168
27159
|
return true;
|
|
27169
27160
|
}
|
|
27170
27161
|
insertBlock(editor, newRange) {
|
|
27171
|
-
if (!this.
|
|
27162
|
+
if (!this.hasDocContainerId(editor, this.containerId)) {
|
|
27172
27163
|
logger$2G.warn(`container (${this.containerId}) not found, deleted by others?`);
|
|
27173
27164
|
return false;
|
|
27174
27165
|
}
|
|
27175
27166
|
if (!this.checkBlockData(editor, this.blockData)) {
|
|
27176
27167
|
return false;
|
|
27177
27168
|
}
|
|
27178
|
-
|
|
27179
|
-
|
|
27180
|
-
|
|
27181
|
-
|
|
27182
|
-
|
|
27183
|
-
|
|
27184
|
-
|
|
27185
|
-
editor.selection.selectBlock(block, 0);
|
|
27169
|
+
if (!editor.findBlockByIndex(this.containerId, Math.max(0, this.blockIndex - 1))) {
|
|
27170
|
+
logger$2G.warn(`block (${Math.max(0, this.blockIndex - 1)}) not found, deleted by others?`);
|
|
27171
|
+
return false;
|
|
27172
|
+
}
|
|
27173
|
+
if (editor.findBlockById(this.blockData.id)) {
|
|
27174
|
+
logger$2G.warn(`block (${this.blockData.id}) already exists, inserted by others?`);
|
|
27175
|
+
return false;
|
|
27186
27176
|
}
|
|
27177
|
+
editorInsertBlock(editor, this.containerId, this.blockIndex, cloneDeep__default.default(this.blockData), newRange);
|
|
27187
27178
|
return true;
|
|
27188
27179
|
}
|
|
27189
27180
|
}
|
|
@@ -27215,20 +27206,24 @@ ${codeText}
|
|
|
27215
27206
|
}
|
|
27216
27207
|
undo(editor) {
|
|
27217
27208
|
let ret = false;
|
|
27218
|
-
this.actions.concat().reverse()
|
|
27209
|
+
for (const action of this.actions.concat().reverse()) {
|
|
27219
27210
|
if (action.undo(editor)) {
|
|
27220
27211
|
ret = true;
|
|
27212
|
+
} else {
|
|
27213
|
+
break;
|
|
27221
27214
|
}
|
|
27222
|
-
}
|
|
27215
|
+
}
|
|
27223
27216
|
return ret;
|
|
27224
27217
|
}
|
|
27225
27218
|
redo(editor) {
|
|
27226
27219
|
let ret = false;
|
|
27227
|
-
this.actions
|
|
27220
|
+
for (const action of this.actions) {
|
|
27228
27221
|
if (action.redo(editor)) {
|
|
27229
27222
|
ret = true;
|
|
27223
|
+
} else {
|
|
27224
|
+
break;
|
|
27230
27225
|
}
|
|
27231
|
-
}
|
|
27226
|
+
}
|
|
27232
27227
|
return ret;
|
|
27233
27228
|
}
|
|
27234
27229
|
setAfterRange(range) {
|
|
@@ -27354,11 +27349,11 @@ ${codeText}
|
|
|
27354
27349
|
};
|
|
27355
27350
|
}
|
|
27356
27351
|
undo(editor) {
|
|
27357
|
-
if (!this.
|
|
27352
|
+
if (!this.hasDocContainerId(editor, this.containerId)) {
|
|
27358
27353
|
logger$2E.warn(`container (${this.containerId}) not found, deleted by others?`);
|
|
27359
27354
|
return false;
|
|
27360
27355
|
}
|
|
27361
|
-
if (!this.
|
|
27356
|
+
if (!this.findDocBlockById(editor, this.blockId)) {
|
|
27362
27357
|
logger$2E.warn(`block (${this.blockId}) not found, deleted by others?`);
|
|
27363
27358
|
return false;
|
|
27364
27359
|
}
|
|
@@ -27372,11 +27367,11 @@ ${codeText}
|
|
|
27372
27367
|
return true;
|
|
27373
27368
|
}
|
|
27374
27369
|
redo(editor) {
|
|
27375
|
-
if (!this.
|
|
27370
|
+
if (!this.hasDocContainerId(editor, this.containerId)) {
|
|
27376
27371
|
logger$2E.warn(`container (${this.containerId}) not found, deleted by others?`);
|
|
27377
27372
|
return false;
|
|
27378
27373
|
}
|
|
27379
|
-
if (!this.
|
|
27374
|
+
if (!this.findDocBlockById(editor, this.blockId)) {
|
|
27380
27375
|
logger$2E.warn(`block (${this.blockId}) not found, deleted by others?`);
|
|
27381
27376
|
return false;
|
|
27382
27377
|
}
|
|
@@ -27429,7 +27424,7 @@ ${codeText}
|
|
|
27429
27424
|
this.blocks = blocks;
|
|
27430
27425
|
}
|
|
27431
27426
|
deleteChildContainer(editor) {
|
|
27432
|
-
if (!this.
|
|
27427
|
+
if (!this.hasDocContainerId(editor, this.containerId)) {
|
|
27433
27428
|
logger$2D.warn(`container (${this.containerId}) not found, deleted by others?`);
|
|
27434
27429
|
return false;
|
|
27435
27430
|
}
|
|
@@ -27437,7 +27432,7 @@ ${codeText}
|
|
|
27437
27432
|
return true;
|
|
27438
27433
|
}
|
|
27439
27434
|
insertChildContainer(editor) {
|
|
27440
|
-
if (this.
|
|
27435
|
+
if (this.hasDocContainerId(editor, this.containerId)) {
|
|
27441
27436
|
logger$2D.warn(`container (${this.containerId}) already exists`);
|
|
27442
27437
|
return false;
|
|
27443
27438
|
}
|
|
@@ -70531,12 +70526,8 @@ ${codeText}
|
|
|
70531
70526
|
}
|
|
70532
70527
|
if (!this.filterMemoed || ((_a = v.extra) == null ? void 0 : _a.memo)) {
|
|
70533
70528
|
hasItems = true;
|
|
70534
|
-
|
|
70535
|
-
|
|
70536
|
-
if (i === index2 + 1) {
|
|
70537
|
-
name = "Previous version";
|
|
70538
|
-
id = "prev-version";
|
|
70539
|
-
}
|
|
70529
|
+
const name = getVersionName(v);
|
|
70530
|
+
const id = `${v.version}`;
|
|
70540
70531
|
const item = {
|
|
70541
70532
|
id,
|
|
70542
70533
|
name,
|
|
@@ -77067,7 +77058,7 @@ ${data.flowchartText}
|
|
|
77067
77058
|
}
|
|
77068
77059
|
}
|
|
77069
77060
|
});
|
|
77070
|
-
editor.version = "1.1.18-beta.
|
|
77061
|
+
editor.version = "1.1.18-beta.13";
|
|
77071
77062
|
if (Logger$2.level === LogLevel.DEBUG) {
|
|
77072
77063
|
window.setReauthFail = (fail) => {
|
|
77073
77064
|
window.isReauthError = fail;
|
|
@@ -77155,7 +77146,7 @@ ${data.flowchartText}
|
|
|
77155
77146
|
});
|
|
77156
77147
|
editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
|
|
77157
77148
|
OnesEditorToolbar.register(editor);
|
|
77158
|
-
editor.version = "1.1.18-beta.
|
|
77149
|
+
editor.version = "1.1.18-beta.13";
|
|
77159
77150
|
return editor;
|
|
77160
77151
|
}
|
|
77161
77152
|
async function showDocVersions(editor, options, serverUrl) {
|