@ones-editor/editor 0.0.7-beta.41 → 0.0.7-beta.43
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/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/dist/index.js +50 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9350,6 +9350,12 @@ var __publicField = (obj, key, value) => {
|
|
|
9350
9350
|
constructor(editor, rootContainer) {
|
|
9351
9351
|
__publicField(this, "resizeObserver");
|
|
9352
9352
|
__publicField(this, "handleContextMenu", (event) => {
|
|
9353
|
+
if (clientType.isSafari) {
|
|
9354
|
+
const sel = document.getSelection();
|
|
9355
|
+
if (sel && !sel.isCollapsed) {
|
|
9356
|
+
sel.collapseToStart();
|
|
9357
|
+
}
|
|
9358
|
+
}
|
|
9353
9359
|
});
|
|
9354
9360
|
__publicField(this, "handleResize", () => {
|
|
9355
9361
|
try {
|
|
@@ -9431,7 +9437,6 @@ var __publicField = (obj, key, value) => {
|
|
|
9431
9437
|
this.editor.selectionHandler.handleMouseDown(event, { autoScroll: true });
|
|
9432
9438
|
}
|
|
9433
9439
|
if (!clientType.isMobileSafari) {
|
|
9434
|
-
event.preventDefault();
|
|
9435
9440
|
this.editor.input.focus();
|
|
9436
9441
|
}
|
|
9437
9442
|
if (event.button === 2) {
|
|
@@ -23285,7 +23290,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23285
23290
|
const containerId = getContainerId(container);
|
|
23286
23291
|
editor.doc.beginBatchUpdate();
|
|
23287
23292
|
editor.undoManager.runInGroup(() => {
|
|
23288
|
-
var _a, _b, _c;
|
|
23293
|
+
var _a, _b, _c, _d;
|
|
23289
23294
|
const childContainers = [];
|
|
23290
23295
|
Object.entries(doc2.blocks).forEach(([containerId2, blocks2]) => {
|
|
23291
23296
|
if (containerId2 === "root")
|
|
@@ -23315,12 +23320,19 @@ var __publicField = (obj, key, value) => {
|
|
|
23315
23320
|
const isTitleBlock2 = containerId === "root" && editor.getBlockByIndex(containerId, 0) === block;
|
|
23316
23321
|
const blockIndex2 = getBlockIndex(block);
|
|
23317
23322
|
let lastBlock22;
|
|
23318
|
-
blocks.
|
|
23319
|
-
|
|
23320
|
-
|
|
23323
|
+
for (let i = 0; i < blocks.length; i++) {
|
|
23324
|
+
if (i === 0) {
|
|
23325
|
+
const currentBlock = editor.getBlockByIndex(containerId, blockIndex2);
|
|
23326
|
+
if (currentBlock && isTextKindBlock(editor, currentBlock) && isEmptyTextBlock(editor, currentBlock) && blocks[i].type === "text") {
|
|
23327
|
+
editor.insertTextToBlock(block, 0, (_a = blocks[i].text) != null ? _a : []);
|
|
23328
|
+
continue;
|
|
23329
|
+
}
|
|
23330
|
+
}
|
|
23331
|
+
const newBlock2 = editor.insertBlock(containerId, blockIndex2 + i, blocks[i], void 0, { noFocus: true });
|
|
23332
|
+
if (i === blocks.length - 1) {
|
|
23321
23333
|
lastBlock22 = newBlock2;
|
|
23322
23334
|
}
|
|
23323
|
-
}
|
|
23335
|
+
}
|
|
23324
23336
|
if (lastBlock22) {
|
|
23325
23337
|
editor.selection.selectBlock(lastBlock22, getBlockTextLength$4(editor, lastBlock22));
|
|
23326
23338
|
}
|
|
@@ -23332,7 +23344,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23332
23344
|
if (blocks.length === 1) {
|
|
23333
23345
|
const newBlock2 = blocks[0];
|
|
23334
23346
|
if (isTextKindBlockType(editor, newBlock2.type)) {
|
|
23335
|
-
editor.insertTextToBlock(block, offset, (
|
|
23347
|
+
editor.insertTextToBlock(block, offset, (_b = newBlock2.text) != null ? _b : []);
|
|
23336
23348
|
return;
|
|
23337
23349
|
}
|
|
23338
23350
|
editor.breakTextBlock(block, offset);
|
|
@@ -23355,7 +23367,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23355
23367
|
if (!atTextEnd) {
|
|
23356
23368
|
editor.selection.selectBlock(newBlock, 0);
|
|
23357
23369
|
if (isTextKindBlockType(editor, lastBlock2.type)) {
|
|
23358
|
-
editor.insertTextToBlock(newBlock, 0, (
|
|
23370
|
+
editor.insertTextToBlock(newBlock, 0, (_c = lastBlock2.text) != null ? _c : []);
|
|
23359
23371
|
} else {
|
|
23360
23372
|
editor.insertBlock(containerId, breakIndex, lastBlock2);
|
|
23361
23373
|
}
|
|
@@ -23370,7 +23382,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23370
23382
|
editor.insertBlock(containerId, breakIndex, firstBlock);
|
|
23371
23383
|
insertOtherBlockIndex += 1;
|
|
23372
23384
|
} else {
|
|
23373
|
-
editor.insertTextToBlock(block, offset, (
|
|
23385
|
+
editor.insertTextToBlock(block, offset, (_d = firstBlock.text) != null ? _d : []);
|
|
23374
23386
|
}
|
|
23375
23387
|
} else {
|
|
23376
23388
|
editor.insertBlock(containerId, breakIndex, firstBlock);
|
|
@@ -37579,9 +37591,6 @@ var __publicField = (obj, key, value) => {
|
|
|
37579
37591
|
this._rows.push(new DocTableRow(this.colCount));
|
|
37580
37592
|
}
|
|
37581
37593
|
this.fillGrid();
|
|
37582
|
-
if (tableData.colsWidth) {
|
|
37583
|
-
assert(logger$22, this.colCount === tableData.colsWidth.length, "invalid col count");
|
|
37584
|
-
}
|
|
37585
37594
|
}
|
|
37586
37595
|
get rowCount() {
|
|
37587
37596
|
return this._data.rows;
|
|
@@ -47306,14 +47315,14 @@ $$${mathData.mathjaxText}$$
|
|
|
47306
47315
|
return lines2.join("\n");
|
|
47307
47316
|
};
|
|
47308
47317
|
const lines = [];
|
|
47309
|
-
lines.push(
|
|
47318
|
+
lines.push('<table style="border-collapse: collapse;">');
|
|
47310
47319
|
for (let row = 0; row < grid.rowCount; row++) {
|
|
47311
47320
|
let rowText = "<tr>";
|
|
47312
47321
|
for (let col = 0; col < grid.colCount; col++) {
|
|
47313
47322
|
const cell = grid.getCell({ row, col });
|
|
47314
47323
|
if (!cell.virtual) {
|
|
47315
47324
|
const cellText = getContainerHtml(cell.containerId);
|
|
47316
|
-
rowText += `<td colSpan="${cell.colSpan}" rowSpan="${cell.rowSpan}">${cellText}</td>`;
|
|
47325
|
+
rowText += `<td colSpan="${cell.colSpan}" rowSpan="${cell.rowSpan}" style="border: 1px solid rgb(171, 171, 171); min-width: 20px">${cellText}</td>`;
|
|
47317
47326
|
}
|
|
47318
47327
|
}
|
|
47319
47328
|
rowText += "</tr>";
|
|
@@ -50923,10 +50932,10 @@ ${codeText}
|
|
|
50923
50932
|
const blockType = getBlockType(block);
|
|
50924
50933
|
const isListBlock2 = blockType === "list";
|
|
50925
50934
|
const isUnorderedList = isListBlock2 && ordered === false && !checkbox2;
|
|
50926
|
-
const
|
|
50935
|
+
const isOrderedList2 = isListBlock2 && ordered;
|
|
50927
50936
|
const isCheckList = isListBlock2 && !!checkbox2;
|
|
50928
50937
|
this.createItem("unordered-list", UnorderedIcon, parent, isUnorderedList);
|
|
50929
|
-
this.createItem("ordered-list", OrderedIcon, parent,
|
|
50938
|
+
this.createItem("ordered-list", OrderedIcon, parent, isOrderedList2);
|
|
50930
50939
|
this.createItem("check-list", CheckboxIcon, parent, isCheckList);
|
|
50931
50940
|
});
|
|
50932
50941
|
__publicField(this, "handleClick", (editor, event) => {
|
|
@@ -55020,6 +55029,29 @@ ${codeText}
|
|
|
55020
55029
|
}
|
|
55021
55030
|
});
|
|
55022
55031
|
}
|
|
55032
|
+
function isOrderedList(elem) {
|
|
55033
|
+
const startEl = elem.querySelector('[style="mso-list:Ignore"]');
|
|
55034
|
+
if (startEl) {
|
|
55035
|
+
const startValue = startEl.innerText;
|
|
55036
|
+
return startValue && startValue.trim() !== "-";
|
|
55037
|
+
}
|
|
55038
|
+
return true;
|
|
55039
|
+
}
|
|
55040
|
+
function getListStart(elem) {
|
|
55041
|
+
var _a;
|
|
55042
|
+
const orderedList = isOrderedList(elem);
|
|
55043
|
+
if (!orderedList) {
|
|
55044
|
+
return 1;
|
|
55045
|
+
}
|
|
55046
|
+
const startEl = elem.querySelector('[style="mso-list:Ignore"]');
|
|
55047
|
+
if (startEl) {
|
|
55048
|
+
const startValue = startEl.innerText;
|
|
55049
|
+
if (startValue) {
|
|
55050
|
+
return (_a = Number.parseInt(startValue, 10)) != null ? _a : 1;
|
|
55051
|
+
}
|
|
55052
|
+
}
|
|
55053
|
+
return 1;
|
|
55054
|
+
}
|
|
55023
55055
|
function getListData(elem) {
|
|
55024
55056
|
if (!isList(elem)) {
|
|
55025
55057
|
return {};
|
|
@@ -55027,10 +55059,10 @@ ${codeText}
|
|
|
55027
55059
|
const level = getLevel(elem);
|
|
55028
55060
|
const groupId = elem.getAttribute("data-group-id") || genId();
|
|
55029
55061
|
return {
|
|
55030
|
-
start:
|
|
55062
|
+
start: getListStart(elem),
|
|
55031
55063
|
level,
|
|
55032
55064
|
groupId,
|
|
55033
|
-
ordered:
|
|
55065
|
+
ordered: isOrderedList(elem),
|
|
55034
55066
|
type: "list"
|
|
55035
55067
|
};
|
|
55036
55068
|
}
|