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