@ones-editor/editor 0.0.7-beta.59 → 0.0.7-beta.60
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
|
@@ -23365,9 +23365,9 @@ var __publicField = (obj, key, value) => {
|
|
|
23365
23365
|
}
|
|
23366
23366
|
assert(logger$2T, isTextKindBlock(editor, block), "not a text block");
|
|
23367
23367
|
if (isEmptyTextBlock(editor, block)) {
|
|
23368
|
-
const isTitleBlock2 = containerId === "root" && editor.getBlockByIndex(containerId, 0) === block;
|
|
23369
23368
|
const blockIndex2 = getBlockIndex(block);
|
|
23370
23369
|
let lastBlock22;
|
|
23370
|
+
let whetherDeleteTitle = false;
|
|
23371
23371
|
for (let i = 0; i < blocks.length; i++) {
|
|
23372
23372
|
if (i === 0) {
|
|
23373
23373
|
const currentBlock = editor.getBlockByIndex(containerId, blockIndex2);
|
|
@@ -23375,6 +23375,9 @@ var __publicField = (obj, key, value) => {
|
|
|
23375
23375
|
editor.insertTextToBlock(block, 0, (_a = blocks[i].text) != null ? _a : []);
|
|
23376
23376
|
continue;
|
|
23377
23377
|
}
|
|
23378
|
+
if (isTitleBlock$2(currentBlock)) {
|
|
23379
|
+
whetherDeleteTitle = true;
|
|
23380
|
+
}
|
|
23378
23381
|
}
|
|
23379
23382
|
const newBlock2 = editor.insertBlock(containerId, blockIndex2 + i, blocks[i], void 0, { noFocus: true });
|
|
23380
23383
|
if (i === blocks.length - 1) {
|
|
@@ -23384,7 +23387,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23384
23387
|
if (lastBlock22) {
|
|
23385
23388
|
editor.selection.selectBlock(lastBlock22, getBlockTextLength$4(editor, lastBlock22));
|
|
23386
23389
|
}
|
|
23387
|
-
if (
|
|
23390
|
+
if (whetherDeleteTitle) {
|
|
23388
23391
|
editor.deleteBlock(block);
|
|
23389
23392
|
}
|
|
23390
23393
|
return;
|
|
@@ -47440,6 +47443,10 @@ $$${mathData.mathjaxText}$$
|
|
|
47440
47443
|
}
|
|
47441
47444
|
}
|
|
47442
47445
|
if (!isContainer(elem)) {
|
|
47446
|
+
const table = getBlockTable(block);
|
|
47447
|
+
if (table.contains(elem)) {
|
|
47448
|
+
return null;
|
|
47449
|
+
}
|
|
47443
47450
|
const startPos2 = new EditorSimpleBlockPosition(block, 0, "home");
|
|
47444
47451
|
const endPos = new EditorSimpleBlockPosition(block, getBlockTextLength$1(), "end");
|
|
47445
47452
|
return new EditorSimpleSelectionRange(editor, { anchor: startPos2, focus: endPos });
|
|
@@ -49459,7 +49466,7 @@ ${codeText}
|
|
|
49459
49466
|
}
|
|
49460
49467
|
const placeholder = "";
|
|
49461
49468
|
function hasAttributes(text2) {
|
|
49462
|
-
for (let i =
|
|
49469
|
+
for (let i = 0; i < text2.length; i++) {
|
|
49463
49470
|
const op = text2[i];
|
|
49464
49471
|
if (op.attributes && Object.keys(op.attributes).length) {
|
|
49465
49472
|
return true;
|
|
@@ -53809,6 +53816,7 @@ ${codeText}
|
|
|
53809
53816
|
constructor(editor) {
|
|
53810
53817
|
__publicField(this, "button");
|
|
53811
53818
|
__publicField(this, "lastUndoAction", null);
|
|
53819
|
+
__publicField(this, "lastPos", null);
|
|
53812
53820
|
__publicField(this, "event", null);
|
|
53813
53821
|
__publicField(this, "handlePasteSpecial", (doc2) => {
|
|
53814
53822
|
this.editor.undoManager.runInGroup(() => {
|
|
@@ -53830,6 +53838,7 @@ ${codeText}
|
|
|
53830
53838
|
async handleBeforePaste(editor, event) {
|
|
53831
53839
|
logger$P.debug("before paste");
|
|
53832
53840
|
this.lastUndoAction = editor.undoManager.lastAction();
|
|
53841
|
+
this.lastPos = editor.selection.range.start;
|
|
53833
53842
|
return false;
|
|
53834
53843
|
}
|
|
53835
53844
|
async handleAfterPaste(editor, event, docs) {
|
|
@@ -53842,6 +53851,12 @@ ${codeText}
|
|
|
53842
53851
|
if (!isTextKindBlock(editor, block)) {
|
|
53843
53852
|
return false;
|
|
53844
53853
|
}
|
|
53854
|
+
if (this.lastPos && isSimpleBlockPosition(this.lastPos)) {
|
|
53855
|
+
const oldStartBlock = editor.getBlockById(this.lastPos.blockId);
|
|
53856
|
+
if (isTitleBlock$2(oldStartBlock)) {
|
|
53857
|
+
return false;
|
|
53858
|
+
}
|
|
53859
|
+
}
|
|
53845
53860
|
this.button.clearCheckedState();
|
|
53846
53861
|
this.button.show(docs);
|
|
53847
53862
|
this.event = event;
|