@ones-editor/editor 2.8.14-beta.6 → 2.8.14-beta.7
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/core/src/core/editor/actions/break-text-block.d.ts +1 -1
- package/@ones-editor/core/src/core/types.d.ts +1 -0
- package/@ones-editor/list-block/src/index.d.ts +1 -0
- package/@ones-editor/list-block/src/keyboard/enter.d.ts +3 -1
- package/@ones-editor/list-block/src/keyboard/index.d.ts +2 -0
- package/@ones-editor/paste-handler/src/text-data-converter.d.ts +2 -2
- package/@ones-editor/table-block/src/commands/table-block-commands.d.ts +1 -1
- package/@ones-editor/table-block/src/locale/en-us.d.ts +0 -1
- package/@ones-editor/table-block/src/locale/ja-jp.d.ts +0 -1
- package/@ones-editor/table-block/src/locale/zh-cn.d.ts +0 -1
- package/@ones-editor/toc/src/locale/en-us.d.ts +0 -1
- package/@ones-editor/toc/src/locale/ja-jp.d.ts +0 -1
- package/@ones-editor/toc/src/locale/zh-cn.d.ts +0 -1
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui-base/src/icons/index.d.ts +1 -3
- package/dist/helper/break-text-block.d.ts +2 -0
- package/dist/helper/index.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +240 -391
- package/package.json +1 -1
- package/@ones-editor/paste-handler/src/convert-link.d.ts +0 -6
- package/@ones-editor/table-block/src/commands/adjust-column-widths-evenly.d.ts +0 -3
package/dist/index.js
CHANGED
|
@@ -12978,7 +12978,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12978
12978
|
}
|
|
12979
12979
|
return {};
|
|
12980
12980
|
}
|
|
12981
|
-
function getOptions$
|
|
12981
|
+
function getOptions$9(editor) {
|
|
12982
12982
|
const commandMap = /* @__PURE__ */ new Map();
|
|
12983
12983
|
const insertBlockCommandItems = [];
|
|
12984
12984
|
editor.editorEmbeds.forEach((embedClass) => {
|
|
@@ -13071,7 +13071,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13071
13071
|
convertFrom: convertFrom$9,
|
|
13072
13072
|
convertTo: convertTo$l,
|
|
13073
13073
|
getBlockProperties: getBlockProperties$c,
|
|
13074
|
-
getOptions: getOptions$
|
|
13074
|
+
getOptions: getOptions$9,
|
|
13075
13075
|
handleDeleteBlock: handleDeleteBlock$9,
|
|
13076
13076
|
handleUpdateBlock: handleUpdateBlock$6,
|
|
13077
13077
|
handleDropOver: handleDropOver$2,
|
|
@@ -26196,7 +26196,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26196
26196
|
const y1 = rect.y < 0 ? 0 : rect.y;
|
|
26197
26197
|
const x2 = rect.right > window.innerWidth ? window.innerWidth : rect.right;
|
|
26198
26198
|
const mobileClient = editor.options.componentsOptions.mobile;
|
|
26199
|
-
const innerHeight =
|
|
26199
|
+
const innerHeight = clientType.isMobile ? mobileClient.getViewPortHeight() : window.innerHeight;
|
|
26200
26200
|
const y2 = rect.bottom > innerHeight ? innerHeight : rect.bottom;
|
|
26201
26201
|
return new DOMRect(x1, y1, x2 - x1, y2 - y1);
|
|
26202
26202
|
}
|
|
@@ -26677,15 +26677,20 @@ var __publicField = (obj, key, value) => {
|
|
|
26677
26677
|
return deleteCount;
|
|
26678
26678
|
}
|
|
26679
26679
|
const logger$3I = getLogger("break-text-block");
|
|
26680
|
-
function copyBlockAttributes(editor, block) {
|
|
26680
|
+
function copyBlockAttributes(editor, block, options) {
|
|
26681
26681
|
const blockData = editor.getBlockData(block);
|
|
26682
26682
|
const quoted = blockData.quoted;
|
|
26683
|
+
const ret = {};
|
|
26683
26684
|
if (quoted) {
|
|
26684
|
-
|
|
26685
|
-
quoted
|
|
26686
|
-
};
|
|
26685
|
+
ret.quoted = quoted;
|
|
26687
26686
|
}
|
|
26688
|
-
|
|
26687
|
+
if (options == null ? void 0 : options.copyHeading) {
|
|
26688
|
+
const heading = blockData.heading;
|
|
26689
|
+
if (heading) {
|
|
26690
|
+
ret.heading = heading;
|
|
26691
|
+
}
|
|
26692
|
+
}
|
|
26693
|
+
return ret;
|
|
26689
26694
|
}
|
|
26690
26695
|
function editorBreakTextBlock(editor, block, offset, options) {
|
|
26691
26696
|
assert(logger$3I, isTextKindBlock(editor, block), `block is not a text kind block: ${getBlockType(block)}`);
|
|
@@ -40623,8 +40628,6 @@ ${codeText}
|
|
|
40623
40628
|
const TabIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M14 2L2 2" stroke="#2D2D2E" stroke-linejoin="round"/>\n<path d="M14 6H7" stroke="#2D2D2E" stroke-linejoin="round"/>\n<path d="M2 10.5V5.5L5.5 8L2 10.5Z" fill="#2D2D2E"/>\n<path d="M14 10H7" stroke="#2D2D2E" stroke-linejoin="round"/>\n<path d="M14 14H2" stroke="#2D2D2E" stroke-linejoin="round"/>\n</svg>\n';
|
|
40624
40629
|
const ShiftTabIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M2 2H14" stroke="#2D2D2E" stroke-linejoin="round"/>\n<path d="M7 6H14" stroke="#2D2D2E" stroke-linejoin="round"/>\n<path d="M5.5 10.5V5.5L2 8L5.5 10.5Z" fill="#2D2D2E"/>\n<path d="M7 10H14" stroke="#2D2D2E" stroke-linejoin="round"/>\n<path d="M2 14H14" stroke="#2D2D2E" stroke-linejoin="round"/>\n</svg>\n';
|
|
40625
40630
|
const TableEditIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M8 14.5H2.5C1.94772 14.5 1.5 14.0523 1.5 13.5V2.5C1.5 1.94772 1.94772 1.5 2.5 1.5H13.5C14.0523 1.5 14.5 1.94772 14.5 2.5V8" stroke="#2D2D2E"/>\n<path d="M1.6 4.8H14.4" stroke="#2D2D2E"/>\n<path d="M1.6 9.6H8.00078" stroke="#2D2D2E"/>\n<path d="M5.6 1.6L5.6 14.4" stroke="#2D2D2E"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M11.5043 8.98727L11.6789 8.22924C11.7097 8.09564 11.8387 8 11.9881 8H12.8119C12.9613 8 13.0903 8.09564 13.1211 8.22924L13.2957 8.98727C13.3177 9.08256 13.3912 9.16027 13.488 9.20102C13.569 9.23514 13.648 9.2726 13.7248 9.31318C13.8018 9.35372 13.877 9.3976 13.95 9.44477C14.037 9.50098 14.1474 9.52034 14.2487 9.49008L15.0543 9.24927C15.1963 9.20683 15.3514 9.26108 15.4261 9.37933L15.9576 10.2206C16.0323 10.3389 16.0062 10.4888 15.895 10.5799L15.2639 11.0972C15.1846 11.1622 15.1477 11.2593 15.1575 11.3562C15.1657 11.4375 15.1698 11.5189 15.1697 11.6C15.1698 11.6811 15.1658 11.7625 15.1576 11.8438C15.1478 11.9407 15.1847 12.0378 15.264 12.1028L15.895 12.62C16.0062 12.7112 16.0324 12.8611 15.9577 12.9793L15.4262 13.8206C15.3515 13.9389 15.1963 13.9931 15.0544 13.9507L14.2487 13.7099C14.1474 13.6796 14.037 13.699 13.95 13.7552C13.877 13.8024 13.8018 13.8463 13.7248 13.8868C13.648 13.9274 13.569 13.9649 13.488 13.999C13.3912 14.0397 13.3177 14.1174 13.2957 14.2127L13.1211 14.9708C13.0903 15.1044 12.9613 15.2 12.8119 15.2H11.9881C11.8387 15.2 11.7097 15.1044 11.6789 14.9708L11.5043 14.2127C11.4823 14.1174 11.4088 14.0397 11.312 13.999C11.231 13.9649 11.152 13.9274 11.0752 13.8868C10.9982 13.8463 10.923 13.8024 10.85 13.7552C10.763 13.699 10.6526 13.6796 10.5513 13.7099L9.74565 13.9507C9.60366 13.9931 9.44854 13.9389 9.37384 13.8206L8.84234 12.9793C8.76764 12.8611 8.79378 12.7112 8.905 12.62L9.53602 12.1028C9.61534 12.0378 9.6522 11.9407 9.64243 11.8438C9.63424 11.7625 9.63023 11.6811 9.63031 11.6C9.63023 11.5189 9.63426 11.4375 9.64247 11.3562C9.65226 11.2593 9.61539 11.1622 9.53607 11.0972L8.90506 10.5799C8.79384 10.4888 8.7677 10.3389 8.8424 10.2206L9.3739 9.37933C9.4486 9.26108 9.60371 9.20683 9.74571 9.24927L10.5514 9.49008C10.6526 9.52034 10.7631 9.50098 10.8501 9.44477C10.923 9.3976 10.9982 9.35372 11.0752 9.31318C11.152 9.2726 11.231 9.23514 11.312 9.20102C11.4088 9.16027 11.4823 9.08256 11.5043 8.98727ZM12.3278 12.5136C12.8866 12.5136 13.3396 12.0996 13.3396 11.5889C13.3396 11.0783 12.8866 10.6643 12.3278 10.6643C11.769 10.6643 11.316 11.0783 11.316 11.5889C11.316 12.0996 11.769 12.5136 12.3278 12.5136Z" fill="#2D2D2E"/>\n</svg>\n';
|
|
40626
|
-
const AdjustWidthIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M8 6H2.5C1.94772 6 1.5 6.44772 1.5 7V13.5C1.5 14.0523 1.94772 14.5 2.5 14.5H8M8 6H13.5C14.0523 6 14.5 6.44772 14.5 7V13.5C14.5 14.0523 14.0523 14.5 13.5 14.5H8M8 6V14.5" stroke="#2D2D2E"/>\n<path d="M1.5 2.5H14.5M1.5 1V4M8 1V4M14.5 1V4" stroke="#2D2D2E"/>\n</svg>\n';
|
|
40627
|
-
const TocIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M2 3.5L14 3.5" stroke="#2D2D2E"/>\n<path d="M2 6.50397H10" stroke="#2D2D2E"/>\n<path d="M2 12.5L14 12.5" stroke="#2D2D2E"/>\n<path d="M6 9.5H14" stroke="#2D2D2E"/>\n</svg>\n';
|
|
40628
40631
|
const index$f = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
40629
40632
|
__proto__: null,
|
|
40630
40633
|
TableEditIcon,
|
|
@@ -40752,9 +40755,7 @@ ${codeText}
|
|
|
40752
40755
|
SearchIcon,
|
|
40753
40756
|
CalloutIcon: CalloutIcon$1,
|
|
40754
40757
|
LoadingCircleIcon,
|
|
40755
|
-
TextGroupIcon
|
|
40756
|
-
AdjustWidthIcon,
|
|
40757
|
-
TocIcon
|
|
40758
|
+
TextGroupIcon
|
|
40758
40759
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
40759
40760
|
function createLoading() {
|
|
40760
40761
|
const loading2 = createElement("span", ["editor-loading-icon"], null);
|
|
@@ -44008,9 +44009,6 @@ ${codeText}
|
|
|
44008
44009
|
"insert-emoji": {
|
|
44009
44010
|
shortcut: "/emoji"
|
|
44010
44011
|
},
|
|
44011
|
-
"insert-toc": {
|
|
44012
|
-
shortcut: "/toc"
|
|
44013
|
-
},
|
|
44014
44012
|
...fontShortCuts()
|
|
44015
44013
|
};
|
|
44016
44014
|
function getShortcutById(id) {
|
|
@@ -46560,183 +46558,6 @@ ${codeText}
|
|
|
46560
46558
|
editor.deleteChildContainers(deletedContainers);
|
|
46561
46559
|
});
|
|
46562
46560
|
}
|
|
46563
|
-
var TABLE_CLASS = /* @__PURE__ */ ((TABLE_CLASS2) => {
|
|
46564
|
-
TABLE_CLASS2["COL_TITLE_TABLE"] = "col-title-table";
|
|
46565
|
-
TABLE_CLASS2["COL_TITLE_ITEM"] = "col-title-item";
|
|
46566
|
-
TABLE_CLASS2["STRIPE_STYLE_TABLE"] = "stripe-style-table";
|
|
46567
|
-
TABLE_CLASS2["NO_BORDER"] = "table-no-border";
|
|
46568
|
-
return TABLE_CLASS2;
|
|
46569
|
-
})(TABLE_CLASS || {});
|
|
46570
|
-
const TABLE_BAR_WIDTH = 6;
|
|
46571
|
-
const INSERT_BUTTON_SIZE = 20;
|
|
46572
|
-
const TABLE_CELL_MENU_BUTTON_CLASS = "table-cell-menu-btn";
|
|
46573
|
-
const logger$2r = getLogger("table-resize-gripper");
|
|
46574
|
-
const GRIPPER_SIZE = 7;
|
|
46575
|
-
const GRIPPER_SIZE_HALF = (GRIPPER_SIZE - 1) / 2;
|
|
46576
|
-
const CONTAINER_CELL_DELTA = 3;
|
|
46577
|
-
function getCellFromRightBorder(table, x, y) {
|
|
46578
|
-
const { rows } = table;
|
|
46579
|
-
for (let i = 0; i < rows.length; i++) {
|
|
46580
|
-
const row = rows[i];
|
|
46581
|
-
const cells = Array.from(row.cells);
|
|
46582
|
-
for (let j = 0; j < cells.length; j++) {
|
|
46583
|
-
const cell = cells[j];
|
|
46584
|
-
const rect = cell.getBoundingClientRect();
|
|
46585
|
-
const pos = Math.round(rect.right);
|
|
46586
|
-
if (Math.abs(x - pos) <= GRIPPER_SIZE_HALF && rect.top <= y && y <= rect.bottom) {
|
|
46587
|
-
return cell;
|
|
46588
|
-
}
|
|
46589
|
-
}
|
|
46590
|
-
}
|
|
46591
|
-
return null;
|
|
46592
|
-
}
|
|
46593
|
-
function editorHasExistsResizeGripper(editor) {
|
|
46594
|
-
return !!editor.rootContainer.querySelector(".table-resize-gripper");
|
|
46595
|
-
}
|
|
46596
|
-
function getExistsResizeGripper$1(editor, block) {
|
|
46597
|
-
const tools = getTableTools(editor, block);
|
|
46598
|
-
const gripper = tools.querySelector(".table-resize-gripper");
|
|
46599
|
-
return gripper;
|
|
46600
|
-
}
|
|
46601
|
-
function createResizeGripper$2(editor, block) {
|
|
46602
|
-
const exists = getExistsResizeGripper$1(editor, block);
|
|
46603
|
-
assert(logger$2r, !exists, "resize gripper has already exists");
|
|
46604
|
-
const tools = getTableTools(editor, block);
|
|
46605
|
-
const gripper = createElement("div", ["table-resize-gripper", "table-indicator"], tools);
|
|
46606
|
-
createElement("div", ["table-resize-gripper-indicator"], gripper);
|
|
46607
|
-
return gripper;
|
|
46608
|
-
}
|
|
46609
|
-
function updateResizeGripper$1(editor, block, cell) {
|
|
46610
|
-
let gripper = getExistsResizeGripper$1(editor, block);
|
|
46611
|
-
if (!gripper) {
|
|
46612
|
-
gripper = createResizeGripper$2(editor, block);
|
|
46613
|
-
}
|
|
46614
|
-
const table = getBlockTable(block);
|
|
46615
|
-
const tableRect = table.getBoundingClientRect();
|
|
46616
|
-
const cellRect = cell.getBoundingClientRect();
|
|
46617
|
-
const top = 0;
|
|
46618
|
-
const height = tableRect.height;
|
|
46619
|
-
const scrollContentRect = editor.getCustom(getTableScrollKey(block)).contentElement.getBoundingClientRect();
|
|
46620
|
-
const left = cellRect.right - scrollContentRect.left;
|
|
46621
|
-
gripper.style.left = `${left - GRIPPER_SIZE_HALF - TABLE_BAR_WIDTH - INSERT_BUTTON_SIZE}px`;
|
|
46622
|
-
gripper.style.top = `${top}px`;
|
|
46623
|
-
gripper.style.height = `${height}px`;
|
|
46624
|
-
gripper.style.width = `${GRIPPER_SIZE}px`;
|
|
46625
|
-
}
|
|
46626
|
-
function removeAllResizeGripper(editor) {
|
|
46627
|
-
editor.rootContainer.querySelectorAll(".table-resize-gripper").forEach((gripper) => {
|
|
46628
|
-
gripper.remove();
|
|
46629
|
-
});
|
|
46630
|
-
}
|
|
46631
|
-
function setTableColumnWidths(editor, block, colsWidth) {
|
|
46632
|
-
const oldData = editor.getBlockData(block);
|
|
46633
|
-
const newData = {
|
|
46634
|
-
...oldData,
|
|
46635
|
-
colsWidth
|
|
46636
|
-
};
|
|
46637
|
-
editor.updateBlockData(block, newData, void 0, { noScroll: true });
|
|
46638
|
-
}
|
|
46639
|
-
const logger$2q = getLogger("column-width");
|
|
46640
|
-
function setColumnWidth(table, colIndex, width) {
|
|
46641
|
-
const col = getTableCol(table, colIndex);
|
|
46642
|
-
col.style.width = `${width}px`;
|
|
46643
|
-
col.style.minWidth = `${width}px`;
|
|
46644
|
-
}
|
|
46645
|
-
function getTableColumnWidthsFromDom(table) {
|
|
46646
|
-
const tableCols = Array.from(table.querySelector("colgroup").children);
|
|
46647
|
-
const widths = tableCols.map((col) => col.getBoundingClientRect().width);
|
|
46648
|
-
if (widths[0] !== 0) {
|
|
46649
|
-
return widths;
|
|
46650
|
-
}
|
|
46651
|
-
const grid = TableGrid.fromTable(table);
|
|
46652
|
-
const cellRightOffsets = Array(grid.colCount).fill(-1);
|
|
46653
|
-
const left = table.getBoundingClientRect().left;
|
|
46654
|
-
grid.toRealCells(grid.cells).forEach((cell) => {
|
|
46655
|
-
const colIndex = cell.col + cell.colSpan - 1;
|
|
46656
|
-
if (cellRightOffsets[colIndex] === -1) {
|
|
46657
|
-
cellRightOffsets[colIndex] = cell.cell.getBoundingClientRect().right - left;
|
|
46658
|
-
}
|
|
46659
|
-
});
|
|
46660
|
-
logger$2q.debug(`cellRightOffsets1: ${cellRightOffsets.join()}`);
|
|
46661
|
-
for (let col = 0; col < cellRightOffsets.length; col++) {
|
|
46662
|
-
const offset = cellRightOffsets[col];
|
|
46663
|
-
if (offset === -1 || col === 0) {
|
|
46664
|
-
continue;
|
|
46665
|
-
}
|
|
46666
|
-
let prevCol = col - 1;
|
|
46667
|
-
while (cellRightOffsets[prevCol] === -1) {
|
|
46668
|
-
prevCol--;
|
|
46669
|
-
if (prevCol === -1) {
|
|
46670
|
-
break;
|
|
46671
|
-
}
|
|
46672
|
-
}
|
|
46673
|
-
const prevOffset = prevCol === -1 ? 0 : cellRightOffsets[prevCol];
|
|
46674
|
-
const totalWidth = offset - prevOffset;
|
|
46675
|
-
const averageWidth = totalWidth / (col - prevCol);
|
|
46676
|
-
for (let i = prevCol + 1; i < col; i++) {
|
|
46677
|
-
cellRightOffsets[i] = prevOffset + averageWidth * (i - prevCol);
|
|
46678
|
-
}
|
|
46679
|
-
}
|
|
46680
|
-
logger$2q.debug(`cellRightOffsets2: ${cellRightOffsets.join()}`);
|
|
46681
|
-
const result = [];
|
|
46682
|
-
let prev = 0;
|
|
46683
|
-
for (let col = 0; col < cellRightOffsets.length; col++) {
|
|
46684
|
-
const offset = cellRightOffsets[col];
|
|
46685
|
-
result.push(offset - prev);
|
|
46686
|
-
prev = offset;
|
|
46687
|
-
}
|
|
46688
|
-
logger$2q.debug(`widths: ${result.join()}`);
|
|
46689
|
-
return result;
|
|
46690
|
-
}
|
|
46691
|
-
function getTableColumnWidths(table) {
|
|
46692
|
-
const tableCols = Array.from(table.querySelector("colgroup").children);
|
|
46693
|
-
const widths = tableCols.map((col) => col.getBoundingClientRect().width || Number.parseInt(col.style.width, 10));
|
|
46694
|
-
return widths;
|
|
46695
|
-
}
|
|
46696
|
-
function adjustColumnWidthsEvenly(editor, block, range) {
|
|
46697
|
-
const table = getBlockTable(block);
|
|
46698
|
-
const { start, end } = range;
|
|
46699
|
-
if (start.blockId !== end.blockId) {
|
|
46700
|
-
return false;
|
|
46701
|
-
}
|
|
46702
|
-
if (range.isSimple()) {
|
|
46703
|
-
return false;
|
|
46704
|
-
}
|
|
46705
|
-
const testBlock = editor.getBlockById(start.blockId);
|
|
46706
|
-
if (testBlock !== block)
|
|
46707
|
-
return false;
|
|
46708
|
-
if (getBlockType(block) !== "table")
|
|
46709
|
-
return false;
|
|
46710
|
-
const { fromCol, toCol } = getTableSelectionRange(block, range.start, range.end);
|
|
46711
|
-
if (fromCol === toCol)
|
|
46712
|
-
return false;
|
|
46713
|
-
const colWidths = getTableColumnWidthsFromDom(table);
|
|
46714
|
-
let totalWidth = 0;
|
|
46715
|
-
for (let i = fromCol; i <= toCol; i++) {
|
|
46716
|
-
totalWidth += colWidths[i];
|
|
46717
|
-
}
|
|
46718
|
-
for (let i = fromCol; i <= toCol; i++) {
|
|
46719
|
-
colWidths[i] = totalWidth / (toCol - fromCol + 1);
|
|
46720
|
-
}
|
|
46721
|
-
setTableColumnWidths(editor, block, colWidths);
|
|
46722
|
-
return true;
|
|
46723
|
-
}
|
|
46724
|
-
function canAdjustColumnWidthsEvenly(editor, block, range) {
|
|
46725
|
-
const { start, end } = range;
|
|
46726
|
-
if (start.blockId !== end.blockId) {
|
|
46727
|
-
return false;
|
|
46728
|
-
}
|
|
46729
|
-
if (range.isSimple()) {
|
|
46730
|
-
return false;
|
|
46731
|
-
}
|
|
46732
|
-
const testBlock = editor.getBlockById(start.blockId);
|
|
46733
|
-
if (testBlock !== block)
|
|
46734
|
-
return false;
|
|
46735
|
-
if (getBlockType(block) !== "table")
|
|
46736
|
-
return false;
|
|
46737
|
-
const { fromCol, toCol } = getTableSelectionRange(block, range.start, range.end);
|
|
46738
|
-
return fromCol !== toCol;
|
|
46739
|
-
}
|
|
46740
46561
|
const TABLE_COMMAND_GROUP_INDEX = 10;
|
|
46741
46562
|
const TableCommands = [
|
|
46742
46563
|
"table/merge-cells",
|
|
@@ -46745,8 +46566,7 @@ ${codeText}
|
|
|
46745
46566
|
"table/insert-row",
|
|
46746
46567
|
"table/delete-rows",
|
|
46747
46568
|
"table/delete-columns",
|
|
46748
|
-
"table/delete"
|
|
46749
|
-
"table/adjust-column-widths-evenly"
|
|
46569
|
+
"table/delete"
|
|
46750
46570
|
];
|
|
46751
46571
|
class TableBlockCommandProvider {
|
|
46752
46572
|
constructor() {
|
|
@@ -46758,8 +46578,6 @@ ${codeText}
|
|
|
46758
46578
|
return [];
|
|
46759
46579
|
}
|
|
46760
46580
|
const commands = [];
|
|
46761
|
-
const deleteColumns2 = canDeleteColumns(editor, block, range);
|
|
46762
|
-
const deleteRows2 = canDeleteRows(editor, block, range);
|
|
46763
46581
|
if (canMergeCells(editor, block, range)) {
|
|
46764
46582
|
commands.push({
|
|
46765
46583
|
id: "table/merge-cells",
|
|
@@ -46774,6 +46592,8 @@ ${codeText}
|
|
|
46774
46592
|
icon: SplitCellIcon
|
|
46775
46593
|
});
|
|
46776
46594
|
}
|
|
46595
|
+
const deleteColumns2 = canDeleteColumns(editor, block, range);
|
|
46596
|
+
const deleteRows2 = canDeleteRows(editor, block, range);
|
|
46777
46597
|
if (deleteColumns2 && deleteRows2) {
|
|
46778
46598
|
commands.push({
|
|
46779
46599
|
id: "table/delete",
|
|
@@ -46781,14 +46601,6 @@ ${codeText}
|
|
|
46781
46601
|
icon: DeleteTableIcon
|
|
46782
46602
|
});
|
|
46783
46603
|
}
|
|
46784
|
-
const adjustWidths = canAdjustColumnWidthsEvenly(editor, block, range);
|
|
46785
|
-
if (adjustWidths) {
|
|
46786
|
-
commands.push({
|
|
46787
|
-
id: "table/adjust-column-widths-evenly",
|
|
46788
|
-
name: i18n$1.t("table.adjustColumnWidthsEvenly"),
|
|
46789
|
-
icon: AdjustWidthIcon
|
|
46790
|
-
});
|
|
46791
|
-
}
|
|
46792
46604
|
return commands;
|
|
46793
46605
|
}
|
|
46794
46606
|
executeCommand(editor, block, range, command, params, result) {
|
|
@@ -46818,13 +46630,19 @@ ${codeText}
|
|
|
46818
46630
|
editor.deleteBlock(block);
|
|
46819
46631
|
return true;
|
|
46820
46632
|
}
|
|
46821
|
-
if (command.id === "table/adjust-column-widths-evenly") {
|
|
46822
|
-
adjustColumnWidthsEvenly(editor, block, range);
|
|
46823
|
-
return true;
|
|
46824
|
-
}
|
|
46825
46633
|
return false;
|
|
46826
46634
|
}
|
|
46827
46635
|
}
|
|
46636
|
+
var TABLE_CLASS = /* @__PURE__ */ ((TABLE_CLASS2) => {
|
|
46637
|
+
TABLE_CLASS2["COL_TITLE_TABLE"] = "col-title-table";
|
|
46638
|
+
TABLE_CLASS2["COL_TITLE_ITEM"] = "col-title-item";
|
|
46639
|
+
TABLE_CLASS2["STRIPE_STYLE_TABLE"] = "stripe-style-table";
|
|
46640
|
+
TABLE_CLASS2["NO_BORDER"] = "table-no-border";
|
|
46641
|
+
return TABLE_CLASS2;
|
|
46642
|
+
})(TABLE_CLASS || {});
|
|
46643
|
+
const TABLE_BAR_WIDTH = 6;
|
|
46644
|
+
const INSERT_BUTTON_SIZE = 20;
|
|
46645
|
+
const TABLE_CELL_MENU_BUTTON_CLASS = "table-cell-menu-btn";
|
|
46828
46646
|
function setColTitle(editor, tableBlock) {
|
|
46829
46647
|
if (!editor.isBlockWritable(tableBlock)) {
|
|
46830
46648
|
return;
|
|
@@ -46902,26 +46720,26 @@ ${codeText}
|
|
|
46902
46720
|
};
|
|
46903
46721
|
editor.updateBlockData(tableBlock, newBlockData);
|
|
46904
46722
|
}
|
|
46905
|
-
const logger$
|
|
46723
|
+
const logger$2r = getLogger("table-cell-dom");
|
|
46906
46724
|
function getCellElementByChildBlockId(editor, tableBlock, blockId) {
|
|
46907
46725
|
let blockElement = editor.getBlockById(blockId);
|
|
46908
46726
|
while (blockElement) {
|
|
46909
46727
|
const cell = blockElement.closest("td");
|
|
46910
|
-
assert(logger$
|
|
46728
|
+
assert(logger$2r, cell, "no parent cell");
|
|
46911
46729
|
const cellParentBlock = getParentBlock(cell);
|
|
46912
|
-
assert(logger$
|
|
46730
|
+
assert(logger$2r, cellParentBlock, "no parent block");
|
|
46913
46731
|
if (cellParentBlock === tableBlock) {
|
|
46914
46732
|
return cell;
|
|
46915
46733
|
}
|
|
46916
46734
|
blockElement = cellParentBlock;
|
|
46917
46735
|
}
|
|
46918
|
-
assert(logger$
|
|
46736
|
+
assert(logger$2r, false, "filed to get cell by child block id");
|
|
46919
46737
|
return null;
|
|
46920
46738
|
}
|
|
46921
46739
|
function createComplexPosFromBlockPos(editor, tableBlock, blockPosition) {
|
|
46922
46740
|
const blockElement = editor.getBlockById(blockPosition.blockId);
|
|
46923
46741
|
if (blockElement === tableBlock && !blockPosition.isSimple()) {
|
|
46924
|
-
assert(logger$
|
|
46742
|
+
assert(logger$2r, blockPosition.childContainerId, "block position must have childContainerId attribute");
|
|
46925
46743
|
return blockPosition;
|
|
46926
46744
|
}
|
|
46927
46745
|
const cellElement = getCellElementByChildBlockId(editor, tableBlock, blockPosition.blockId);
|
|
@@ -46935,12 +46753,12 @@ ${codeText}
|
|
|
46935
46753
|
return getTableSelectionRange(tableBlock, start, end);
|
|
46936
46754
|
}
|
|
46937
46755
|
function updateBarsDangerStatus(editor, tableBlock, selectedRows, selectedColumns) {
|
|
46938
|
-
assert(logger$
|
|
46756
|
+
assert(logger$2r, isTableBlock(tableBlock), "invalid table block");
|
|
46939
46757
|
const tools = getTableTools(editor, tableBlock);
|
|
46940
46758
|
const blockTools = getBlockTools(tableBlock);
|
|
46941
46759
|
const updateTop = () => {
|
|
46942
46760
|
const exists = tools.querySelector(".table-border-bar-container.top");
|
|
46943
|
-
assert(logger$
|
|
46761
|
+
assert(logger$2r, exists, "no top border bar container");
|
|
46944
46762
|
const cells = exists.querySelectorAll(".table-border-bar-cell.top");
|
|
46945
46763
|
cells.forEach((cell) => {
|
|
46946
46764
|
const colIndex = parseInt(cell.getAttribute("data-top-index") || "0", 10);
|
|
@@ -46953,7 +46771,7 @@ ${codeText}
|
|
|
46953
46771
|
};
|
|
46954
46772
|
const updateLeft = () => {
|
|
46955
46773
|
const left = blockTools.querySelector(".table-border-bar-container.left");
|
|
46956
|
-
assert(logger$
|
|
46774
|
+
assert(logger$2r, left, "no left border bar container");
|
|
46957
46775
|
const cells = left.querySelectorAll(".table-border-bar-cell.left");
|
|
46958
46776
|
cells.forEach((cell) => {
|
|
46959
46777
|
const rowIndex = parseInt(cell.getAttribute("data-left-index") || "0", 10);
|
|
@@ -46989,7 +46807,7 @@ ${codeText}
|
|
|
46989
46807
|
}
|
|
46990
46808
|
}
|
|
46991
46809
|
} catch (error2) {
|
|
46992
|
-
logger$
|
|
46810
|
+
logger$2r.error("update cells danger status failed: ", error2.message);
|
|
46993
46811
|
}
|
|
46994
46812
|
}
|
|
46995
46813
|
function updateCellBarsDangerStatus(editor, tableBlock, isDanger = true, isCol) {
|
|
@@ -47012,7 +46830,7 @@ ${codeText}
|
|
|
47012
46830
|
}
|
|
47013
46831
|
updateBarsDangerStatus(editor, tableBlock, Array.from(selectedRows), Array.from(selectedColumns));
|
|
47014
46832
|
} catch (error2) {
|
|
47015
|
-
logger$
|
|
46833
|
+
logger$2r.error("update cell bars danger status failed: ", error2.message);
|
|
47016
46834
|
}
|
|
47017
46835
|
}
|
|
47018
46836
|
function createEntireRowAndColumnRange(editor, tableBlock, isCol) {
|
|
@@ -47131,14 +46949,14 @@ ${codeText}
|
|
|
47131
46949
|
}
|
|
47132
46950
|
const DEFAULT_COLUMN_WIDTH$1 = 200;
|
|
47133
46951
|
const MIN_COLUMN_WIDTH = 40;
|
|
47134
|
-
const logger$
|
|
46952
|
+
const logger$2q = getLogger("table-insert-column");
|
|
47135
46953
|
function insertColumn(editor, tableBlock, insertIndex) {
|
|
47136
46954
|
editor.undoManager.runInGroup(() => {
|
|
47137
46955
|
var _a;
|
|
47138
46956
|
const table = getBlockTable(tableBlock);
|
|
47139
46957
|
const grid = TableGrid.fromTable(table);
|
|
47140
46958
|
const colCount = grid.colCount;
|
|
47141
|
-
assert(logger$
|
|
46959
|
+
assert(logger$2q, insertIndex >= 0 && insertIndex <= colCount, `insert index ${insertIndex} is out of range [0, ${colCount}]`);
|
|
47142
46960
|
const cells = grid.map((cell) => cell.containerId);
|
|
47143
46961
|
const spannedContainerIds = /* @__PURE__ */ new Set();
|
|
47144
46962
|
editor.doc.beginBatchUpdate();
|
|
@@ -47159,7 +46977,7 @@ ${codeText}
|
|
|
47159
46977
|
spannedContainerIds.forEach((containerId) => {
|
|
47160
46978
|
const key = `${containerId}_colSpan`;
|
|
47161
46979
|
const oldSpan = oldBlockData[key];
|
|
47162
|
-
assert(logger$
|
|
46980
|
+
assert(logger$2q, typeof oldSpan === "number" && oldSpan > 1, `no colSpan for containerId ${containerId}, ${oldSpan}`);
|
|
47163
46981
|
oldBlockData[key] = oldSpan + 1;
|
|
47164
46982
|
});
|
|
47165
46983
|
const colsWidth = ((_a = oldBlockData.colsWidth) == null ? void 0 : _a.concat()) || new Array(oldBlockData.cols).fill(0);
|
|
@@ -47175,13 +46993,13 @@ ${codeText}
|
|
|
47175
46993
|
editor.updateBlockData(tableBlock, newBlockData);
|
|
47176
46994
|
});
|
|
47177
46995
|
}
|
|
47178
|
-
const logger$
|
|
46996
|
+
const logger$2p = getLogger("table-insert-row");
|
|
47179
46997
|
function insertRow(editor, tableBlock, insertIndex) {
|
|
47180
46998
|
editor.undoManager.runInGroup(() => {
|
|
47181
46999
|
const table = getBlockTable(tableBlock);
|
|
47182
47000
|
const grid = TableGrid.fromTable(table);
|
|
47183
47001
|
const rowCount = grid.rowCount;
|
|
47184
|
-
assert(logger$
|
|
47002
|
+
assert(logger$2p, insertIndex >= 0 && insertIndex <= rowCount, `insert index ${insertIndex} is out of range [0, ${rowCount}]`);
|
|
47185
47003
|
const cells = grid.map((cell) => cell.containerId);
|
|
47186
47004
|
const spannedContainerIds = /* @__PURE__ */ new Set();
|
|
47187
47005
|
editor.doc.beginBatchUpdate();
|
|
@@ -47189,12 +47007,12 @@ ${codeText}
|
|
|
47189
47007
|
for (let col = 0; col < grid.colCount; col++) {
|
|
47190
47008
|
const top = insertIndex > 0 && cells[insertIndex - 1][col];
|
|
47191
47009
|
const bottom = insertIndex < grid.rowCount && cells[insertIndex][col];
|
|
47192
|
-
assert(logger$
|
|
47010
|
+
assert(logger$2p, top || bottom, "no top and bottom cell");
|
|
47193
47011
|
if (insertIndex === 0 || insertIndex === grid.rowCount || top !== bottom) {
|
|
47194
47012
|
const newContainerId = createEmptyContainer(editor.doc);
|
|
47195
47013
|
rowData.push(newContainerId);
|
|
47196
47014
|
} else {
|
|
47197
|
-
assert(logger$
|
|
47015
|
+
assert(logger$2p, top, "no top cell");
|
|
47198
47016
|
rowData.push(top);
|
|
47199
47017
|
spannedContainerIds.add(top);
|
|
47200
47018
|
}
|
|
@@ -47205,7 +47023,7 @@ ${codeText}
|
|
|
47205
47023
|
spannedContainerIds.forEach((containerId) => {
|
|
47206
47024
|
const key = `${containerId}_rowSpan`;
|
|
47207
47025
|
const oldSpan = oldBlockData[key];
|
|
47208
|
-
assert(logger$
|
|
47026
|
+
assert(logger$2p, typeof oldSpan === "number" && oldSpan > 1, `no rowSpan for containerId ${containerId}, ${oldSpan}`);
|
|
47209
47027
|
oldBlockData[key] = oldSpan + 1;
|
|
47210
47028
|
});
|
|
47211
47029
|
const newChildren = TableGrid.virtualCellContainersGridToChildren(cells);
|
|
@@ -47218,7 +47036,7 @@ ${codeText}
|
|
|
47218
47036
|
editor.updateBlockData(tableBlock, newBlockData);
|
|
47219
47037
|
});
|
|
47220
47038
|
}
|
|
47221
|
-
const logger$
|
|
47039
|
+
const logger$2o = getLogger("table-chart");
|
|
47222
47040
|
function removeChart(editor, block) {
|
|
47223
47041
|
const tableTools = findExistsTableTools(editor, block);
|
|
47224
47042
|
if (tableTools) {
|
|
@@ -47303,7 +47121,7 @@ ${codeText}
|
|
|
47303
47121
|
chartContainer = createElement("div", ["editor-table-chart"], tableTools);
|
|
47304
47122
|
}
|
|
47305
47123
|
const parent = chartContainer;
|
|
47306
|
-
assert(logger$
|
|
47124
|
+
assert(logger$2o, parent, "no chart container");
|
|
47307
47125
|
const options = editor.getComponentOptions("table");
|
|
47308
47126
|
const cdn = (options == null ? void 0 : options.chartCdn) || "https://cdn.jsdelivr.net/npm/chart.js@2.9.4/dist/Chart.min.js";
|
|
47309
47127
|
try {
|
|
@@ -47347,7 +47165,7 @@ ${codeText}
|
|
|
47347
47165
|
chartContainer.chartObject = chartObject;
|
|
47348
47166
|
}
|
|
47349
47167
|
} catch (err) {
|
|
47350
|
-
logger$
|
|
47168
|
+
logger$2o.error(`failed to resolve chart cdn: ${JSON.stringify(err)}`);
|
|
47351
47169
|
}
|
|
47352
47170
|
}
|
|
47353
47171
|
async function updateChartCore(editor, block) {
|
|
@@ -47504,7 +47322,7 @@ ${codeText}
|
|
|
47504
47322
|
const height = document.documentElement.clientHeight;
|
|
47505
47323
|
return new DOMRect(left, top, width, height);
|
|
47506
47324
|
}
|
|
47507
|
-
const logger$
|
|
47325
|
+
const logger$2n = getLogger("scroll-bar-handle");
|
|
47508
47326
|
const BOTTOM_FLOAT_HEIGHT = 2;
|
|
47509
47327
|
function getScrollbarContainer(scrollContainer) {
|
|
47510
47328
|
const tools = getTools(scrollContainer);
|
|
@@ -47515,7 +47333,7 @@ ${codeText}
|
|
|
47515
47333
|
scrollbarContainer.style.minHeight = "10px";
|
|
47516
47334
|
}
|
|
47517
47335
|
}
|
|
47518
|
-
assert(logger$
|
|
47336
|
+
assert(logger$2n, scrollbarContainer instanceof HTMLDivElement, "invalid child for container tools");
|
|
47519
47337
|
if (!scrollbarContainer.firstElementChild) {
|
|
47520
47338
|
createElement("div", [], scrollbarContainer);
|
|
47521
47339
|
}
|
|
@@ -47531,7 +47349,7 @@ ${codeText}
|
|
|
47531
47349
|
fixScrollWrapRightBoundary(scrollCore, scrollContainer);
|
|
47532
47350
|
fixScrollWrapLeftBoundary(scrollCore, scrollContainer);
|
|
47533
47351
|
const overflowWidth = scrollWidth - clientWidth;
|
|
47534
|
-
assert(logger$
|
|
47352
|
+
assert(logger$2n, scrollbarContainer.firstElementChild instanceof HTMLDivElement, "invalid child for scroll bar");
|
|
47535
47353
|
scrollbarContainer.style.width = `${getSizeAsScale(scrollContainer, originWidth + maxRight - paddingLeft - paddingRight)}px`;
|
|
47536
47354
|
scrollbarContainer.firstElementChild.style.width = `${getSizeAsScale(scrollContainer, originWidth + maxRight + overflowWidth - paddingLeft - paddingRight)}px`;
|
|
47537
47355
|
}
|
|
@@ -47618,7 +47436,7 @@ ${codeText}
|
|
|
47618
47436
|
this.intersectionObserver.disconnect();
|
|
47619
47437
|
}
|
|
47620
47438
|
}
|
|
47621
|
-
const logger$
|
|
47439
|
+
const logger$2m = getLogger("container-scroll-shadow");
|
|
47622
47440
|
function setShadowBottom(shadow, scrollContainer, scrollWrap) {
|
|
47623
47441
|
const elem = shadow;
|
|
47624
47442
|
const contentRect = scrollContainer.getBoundingClientRect();
|
|
@@ -47637,22 +47455,22 @@ ${codeText}
|
|
|
47637
47455
|
}
|
|
47638
47456
|
function showLeftShadow(scrollContainer) {
|
|
47639
47457
|
const targetTools = getTools(scrollContainer);
|
|
47640
|
-
assert(logger$
|
|
47458
|
+
assert(logger$2m, targetTools, "no container tools");
|
|
47641
47459
|
let shadow = targetTools.querySelector(`.${SHADOW_CLASS.LEFT}`);
|
|
47642
47460
|
if (!shadow) {
|
|
47643
47461
|
const scrollWrap = getContainerScrollArea(scrollContainer);
|
|
47644
47462
|
const classes = [SHADOW_CLASS.COMMON, SHADOW_CLASS.LEFT];
|
|
47645
47463
|
shadow = createElement("div", classes, targetTools);
|
|
47646
|
-
assert(logger$
|
|
47464
|
+
assert(logger$2m, shadow instanceof HTMLDivElement, "invalid child for container tools");
|
|
47647
47465
|
setShadowBottom(shadow, scrollContainer, scrollWrap);
|
|
47648
47466
|
}
|
|
47649
|
-
assert(logger$
|
|
47467
|
+
assert(logger$2m, shadow instanceof HTMLElement, "invalid child for container tools");
|
|
47650
47468
|
const container = getContainer(scrollContainer);
|
|
47651
47469
|
const containerRect = container.getBoundingClientRect();
|
|
47652
47470
|
const scrollContainerRect = scrollContainer.getBoundingClientRect();
|
|
47653
47471
|
shadow.style.left = `${getSizeAsScale(scrollContainer, scrollContainerRect.left - containerRect.left)}px`;
|
|
47654
47472
|
const leftRest = getElementScrollSize(scrollContainer).scrollLeft;
|
|
47655
|
-
assert(logger$
|
|
47473
|
+
assert(logger$2m, shadow instanceof HTMLDivElement, "invalid child for container tools");
|
|
47656
47474
|
setShadowWidth(shadow, leftRest);
|
|
47657
47475
|
addClass(shadow, SHADOW_CLASS.ACTIVE);
|
|
47658
47476
|
}
|
|
@@ -47663,17 +47481,17 @@ ${codeText}
|
|
|
47663
47481
|
const scrollWrap = getContainerScrollArea(scrollContainer);
|
|
47664
47482
|
const classes = [SHADOW_CLASS.COMMON, SHADOW_CLASS.RIGHT];
|
|
47665
47483
|
shadow = createElement("div", classes, tools);
|
|
47666
|
-
assert(logger$
|
|
47484
|
+
assert(logger$2m, shadow instanceof HTMLDivElement, "no div, create shadow failed");
|
|
47667
47485
|
setShadowBottom(shadow, scrollContainer, scrollWrap);
|
|
47668
47486
|
}
|
|
47669
|
-
assert(logger$
|
|
47487
|
+
assert(logger$2m, shadow instanceof HTMLElement, "");
|
|
47670
47488
|
const container = getContainer(scrollContainer);
|
|
47671
47489
|
const containerRect = container.getBoundingClientRect();
|
|
47672
47490
|
const scrollContainerRect = scrollContainer.getBoundingClientRect();
|
|
47673
47491
|
shadow.style.right = `${getSizeAsScale(scrollContainer, containerRect.right - scrollContainerRect.right)}px`;
|
|
47674
47492
|
const { scrollWidth, scrollLeft, clientWidth } = getElementScrollSize(scrollContainer);
|
|
47675
47493
|
const rightRest = scrollWidth - scrollLeft - clientWidth;
|
|
47676
|
-
assert(logger$
|
|
47494
|
+
assert(logger$2m, shadow instanceof HTMLDivElement, "no shadow element");
|
|
47677
47495
|
setShadowWidth(shadow, rightRest);
|
|
47678
47496
|
addClass(shadow, SHADOW_CLASS.ACTIVE);
|
|
47679
47497
|
}
|
|
@@ -47746,12 +47564,12 @@ ${codeText}
|
|
|
47746
47564
|
this.resizeObserver.disconnect();
|
|
47747
47565
|
}
|
|
47748
47566
|
}
|
|
47749
|
-
const logger$
|
|
47567
|
+
const logger$2l = getLogger("container-scroll-observer");
|
|
47750
47568
|
class ContainerScrollObserver {
|
|
47751
47569
|
constructor(scrollCore, callback) {
|
|
47752
47570
|
__publicField(this, "handleContentScroll", (e2) => {
|
|
47753
47571
|
const scrollContainer = e2.target;
|
|
47754
|
-
assert(logger$
|
|
47572
|
+
assert(logger$2l, scrollContainer instanceof Element, "invalid target for scroll event");
|
|
47755
47573
|
const scrollbarContainer = getScrollbarContainer(scrollContainer);
|
|
47756
47574
|
scrollbarContainer.removeEventListener("scroll", this.handleScroll);
|
|
47757
47575
|
const needFixScrollbarContainer = true;
|
|
@@ -47762,7 +47580,7 @@ ${codeText}
|
|
|
47762
47580
|
});
|
|
47763
47581
|
__publicField(this, "handleScroll", (e2) => {
|
|
47764
47582
|
const scrollbarContainer = e2.target;
|
|
47765
|
-
assert(logger$
|
|
47583
|
+
assert(logger$2l, scrollbarContainer instanceof HTMLElement, "");
|
|
47766
47584
|
const scrollLeft = scrollbarContainer.scrollLeft;
|
|
47767
47585
|
const needFixScrollbarContainer = false;
|
|
47768
47586
|
const scrollContainer = getScrollContainerByScrollBar(scrollbarContainer);
|
|
@@ -47842,7 +47660,7 @@ ${codeText}
|
|
|
47842
47660
|
this.scrollContainers.clear();
|
|
47843
47661
|
}
|
|
47844
47662
|
}
|
|
47845
|
-
const logger$
|
|
47663
|
+
const logger$2k = getLogger("scroll-wrap-resize-observer");
|
|
47846
47664
|
class ScrollWrapResizeObserve {
|
|
47847
47665
|
constructor(scrollCore) {
|
|
47848
47666
|
__publicField(this, "resizeObserver");
|
|
@@ -47858,7 +47676,7 @@ ${codeText}
|
|
|
47858
47676
|
});
|
|
47859
47677
|
__publicField(this, "handleScrollWrapResizeEntry", (entry) => {
|
|
47860
47678
|
const scrollWrap = entry.target;
|
|
47861
|
-
assert(logger$
|
|
47679
|
+
assert(logger$2k, scrollWrap instanceof HTMLElement, "invalid target for observer entry");
|
|
47862
47680
|
const scrollContainer = getScrollContainer(scrollWrap);
|
|
47863
47681
|
resetScrollbar(this.scrollCore, scrollWrap);
|
|
47864
47682
|
resetScrollWrapShadow(scrollContainer);
|
|
@@ -48063,7 +47881,7 @@ ${codeText}
|
|
|
48063
47881
|
window.removeEventListener("scroll", this.handleWindowEffect);
|
|
48064
47882
|
}
|
|
48065
47883
|
}
|
|
48066
|
-
const logger$
|
|
47884
|
+
const logger$2j = getLogger("scroll-container");
|
|
48067
47885
|
const rootScrollMap = /* @__PURE__ */ new Map();
|
|
48068
47886
|
class ScrollContainer extends tinyTypedEmitter.TypedEmitter {
|
|
48069
47887
|
constructor() {
|
|
@@ -48111,11 +47929,11 @@ ${codeText}
|
|
|
48111
47929
|
return this.scrollContainerElement;
|
|
48112
47930
|
}
|
|
48113
47931
|
get contentElement() {
|
|
48114
|
-
assert(logger$
|
|
47932
|
+
assert(logger$2j, this.scrollContainerElement, "scrollContainerElement cannot be undefined");
|
|
48115
47933
|
return getContainerScrollArea(this.scrollContainerElement);
|
|
48116
47934
|
}
|
|
48117
47935
|
get scrollOptions() {
|
|
48118
|
-
assert(logger$
|
|
47936
|
+
assert(logger$2j, this.options, "options cannot be undefined");
|
|
48119
47937
|
return { ...this.options };
|
|
48120
47938
|
}
|
|
48121
47939
|
handleBaseListenerDestroy(baseListener) {
|
|
@@ -48139,6 +47957,129 @@ ${codeText}
|
|
|
48139
47957
|
function createScrollContainer() {
|
|
48140
47958
|
return new ScrollContainer();
|
|
48141
47959
|
}
|
|
47960
|
+
const logger$2i = getLogger("column-width");
|
|
47961
|
+
function setColumnWidth(table, colIndex, width) {
|
|
47962
|
+
const col = getTableCol(table, colIndex);
|
|
47963
|
+
col.style.width = `${width}px`;
|
|
47964
|
+
col.style.minWidth = `${width}px`;
|
|
47965
|
+
}
|
|
47966
|
+
function getTableColumnWidthsFromDom(table) {
|
|
47967
|
+
const tableCols = Array.from(table.querySelector("colgroup").children);
|
|
47968
|
+
const widths = tableCols.map((col) => col.getBoundingClientRect().width);
|
|
47969
|
+
if (widths[0] !== 0) {
|
|
47970
|
+
return widths;
|
|
47971
|
+
}
|
|
47972
|
+
const grid = TableGrid.fromTable(table);
|
|
47973
|
+
const cellRightOffsets = Array(grid.colCount).fill(-1);
|
|
47974
|
+
const left = table.getBoundingClientRect().left;
|
|
47975
|
+
grid.toRealCells(grid.cells).forEach((cell) => {
|
|
47976
|
+
const colIndex = cell.col + cell.colSpan - 1;
|
|
47977
|
+
if (cellRightOffsets[colIndex] === -1) {
|
|
47978
|
+
cellRightOffsets[colIndex] = cell.cell.getBoundingClientRect().right - left;
|
|
47979
|
+
}
|
|
47980
|
+
});
|
|
47981
|
+
logger$2i.debug(`cellRightOffsets1: ${cellRightOffsets.join()}`);
|
|
47982
|
+
for (let col = 0; col < cellRightOffsets.length; col++) {
|
|
47983
|
+
const offset = cellRightOffsets[col];
|
|
47984
|
+
if (offset === -1 || col === 0) {
|
|
47985
|
+
continue;
|
|
47986
|
+
}
|
|
47987
|
+
let prevCol = col - 1;
|
|
47988
|
+
while (cellRightOffsets[prevCol] === -1) {
|
|
47989
|
+
prevCol--;
|
|
47990
|
+
if (prevCol === -1) {
|
|
47991
|
+
break;
|
|
47992
|
+
}
|
|
47993
|
+
}
|
|
47994
|
+
const prevOffset = prevCol === -1 ? 0 : cellRightOffsets[prevCol];
|
|
47995
|
+
const totalWidth = offset - prevOffset;
|
|
47996
|
+
const averageWidth = totalWidth / (col - prevCol);
|
|
47997
|
+
for (let i = prevCol + 1; i < col; i++) {
|
|
47998
|
+
cellRightOffsets[i] = prevOffset + averageWidth * (i - prevCol);
|
|
47999
|
+
}
|
|
48000
|
+
}
|
|
48001
|
+
logger$2i.debug(`cellRightOffsets2: ${cellRightOffsets.join()}`);
|
|
48002
|
+
const result = [];
|
|
48003
|
+
let prev = 0;
|
|
48004
|
+
for (let col = 0; col < cellRightOffsets.length; col++) {
|
|
48005
|
+
const offset = cellRightOffsets[col];
|
|
48006
|
+
result.push(offset - prev);
|
|
48007
|
+
prev = offset;
|
|
48008
|
+
}
|
|
48009
|
+
logger$2i.debug(`widths: ${result.join()}`);
|
|
48010
|
+
return result;
|
|
48011
|
+
}
|
|
48012
|
+
function getTableColumnWidths(table) {
|
|
48013
|
+
const tableCols = Array.from(table.querySelector("colgroup").children);
|
|
48014
|
+
const widths = tableCols.map((col) => col.getBoundingClientRect().width || Number.parseInt(col.style.width, 10));
|
|
48015
|
+
return widths;
|
|
48016
|
+
}
|
|
48017
|
+
const logger$2h = getLogger("table-resize-gripper");
|
|
48018
|
+
const GRIPPER_SIZE = 7;
|
|
48019
|
+
const GRIPPER_SIZE_HALF = (GRIPPER_SIZE - 1) / 2;
|
|
48020
|
+
const CONTAINER_CELL_DELTA = 3;
|
|
48021
|
+
function getCellFromRightBorder(table, x, y) {
|
|
48022
|
+
const { rows } = table;
|
|
48023
|
+
for (let i = 0; i < rows.length; i++) {
|
|
48024
|
+
const row = rows[i];
|
|
48025
|
+
const cells = Array.from(row.cells);
|
|
48026
|
+
for (let j = 0; j < cells.length; j++) {
|
|
48027
|
+
const cell = cells[j];
|
|
48028
|
+
const rect = cell.getBoundingClientRect();
|
|
48029
|
+
const pos = Math.round(rect.right);
|
|
48030
|
+
if (Math.abs(x - pos) <= GRIPPER_SIZE_HALF && rect.top <= y && y <= rect.bottom) {
|
|
48031
|
+
return cell;
|
|
48032
|
+
}
|
|
48033
|
+
}
|
|
48034
|
+
}
|
|
48035
|
+
return null;
|
|
48036
|
+
}
|
|
48037
|
+
function editorHasExistsResizeGripper(editor) {
|
|
48038
|
+
return !!editor.rootContainer.querySelector(".table-resize-gripper");
|
|
48039
|
+
}
|
|
48040
|
+
function getExistsResizeGripper$1(editor, block) {
|
|
48041
|
+
const tools = getTableTools(editor, block);
|
|
48042
|
+
const gripper = tools.querySelector(".table-resize-gripper");
|
|
48043
|
+
return gripper;
|
|
48044
|
+
}
|
|
48045
|
+
function createResizeGripper$2(editor, block) {
|
|
48046
|
+
const exists = getExistsResizeGripper$1(editor, block);
|
|
48047
|
+
assert(logger$2h, !exists, "resize gripper has already exists");
|
|
48048
|
+
const tools = getTableTools(editor, block);
|
|
48049
|
+
const gripper = createElement("div", ["table-resize-gripper", "table-indicator"], tools);
|
|
48050
|
+
createElement("div", ["table-resize-gripper-indicator"], gripper);
|
|
48051
|
+
return gripper;
|
|
48052
|
+
}
|
|
48053
|
+
function updateResizeGripper$1(editor, block, cell) {
|
|
48054
|
+
let gripper = getExistsResizeGripper$1(editor, block);
|
|
48055
|
+
if (!gripper) {
|
|
48056
|
+
gripper = createResizeGripper$2(editor, block);
|
|
48057
|
+
}
|
|
48058
|
+
const table = getBlockTable(block);
|
|
48059
|
+
const tableRect = table.getBoundingClientRect();
|
|
48060
|
+
const cellRect = cell.getBoundingClientRect();
|
|
48061
|
+
const top = 0;
|
|
48062
|
+
const height = tableRect.height;
|
|
48063
|
+
const scrollContentRect = editor.getCustom(getTableScrollKey(block)).contentElement.getBoundingClientRect();
|
|
48064
|
+
const left = cellRect.right - scrollContentRect.left;
|
|
48065
|
+
gripper.style.left = `${left - GRIPPER_SIZE_HALF - TABLE_BAR_WIDTH - INSERT_BUTTON_SIZE}px`;
|
|
48066
|
+
gripper.style.top = `${top}px`;
|
|
48067
|
+
gripper.style.height = `${height}px`;
|
|
48068
|
+
gripper.style.width = `${GRIPPER_SIZE}px`;
|
|
48069
|
+
}
|
|
48070
|
+
function removeAllResizeGripper(editor) {
|
|
48071
|
+
editor.rootContainer.querySelectorAll(".table-resize-gripper").forEach((gripper) => {
|
|
48072
|
+
gripper.remove();
|
|
48073
|
+
});
|
|
48074
|
+
}
|
|
48075
|
+
function setTableColumnWidths(editor, block, colsWidth) {
|
|
48076
|
+
const oldData = editor.getBlockData(block);
|
|
48077
|
+
const newData = {
|
|
48078
|
+
...oldData,
|
|
48079
|
+
colsWidth
|
|
48080
|
+
};
|
|
48081
|
+
editor.updateBlockData(block, newData, void 0, { noScroll: true });
|
|
48082
|
+
}
|
|
48142
48083
|
function getTableResizeMinX(editor, draggingRefCell, table, x) {
|
|
48143
48084
|
const cell = draggingRefCell;
|
|
48144
48085
|
const grid = TableGrid.fromTable(table);
|
|
@@ -51723,16 +51664,22 @@ ${codeText}
|
|
|
51723
51664
|
function breakListBlock(editor, block, offset, attributesBlock) {
|
|
51724
51665
|
const fixStart = new FixStartByList(editor, attributesBlock);
|
|
51725
51666
|
const start = getListBlockStart(attributesBlock) + 1;
|
|
51726
|
-
editorBreakTextBlock(editor, block, offset, {
|
|
51667
|
+
const result = editorBreakTextBlock(editor, block, offset, {
|
|
51727
51668
|
forceInsertAfter: true,
|
|
51728
51669
|
newBlockData: cloneListData(editor, attributesBlock, {
|
|
51729
51670
|
start
|
|
51730
51671
|
})
|
|
51731
51672
|
});
|
|
51732
51673
|
fixStart.fix();
|
|
51674
|
+
return result;
|
|
51733
51675
|
}
|
|
51734
|
-
function
|
|
51676
|
+
function autoBreakListBlock(editor, block, offset) {
|
|
51735
51677
|
var _a;
|
|
51678
|
+
const atBlockEnd = offset === getBlockTextLength$6(editor, block);
|
|
51679
|
+
const attributesBlock = (_a = atBlockEnd ? findCloneableList(block) : block) != null ? _a : block;
|
|
51680
|
+
return breakListBlock(editor, block, offset, attributesBlock);
|
|
51681
|
+
}
|
|
51682
|
+
function handleEnter$1(editor) {
|
|
51736
51683
|
if (editor.selection.range.isCollapsed()) {
|
|
51737
51684
|
const block2 = editor.selection.focusedBlock;
|
|
51738
51685
|
if (isListBlock(block2)) {
|
|
@@ -51756,9 +51703,7 @@ ${codeText}
|
|
|
51756
51703
|
return false;
|
|
51757
51704
|
}
|
|
51758
51705
|
const offset = focus.offset;
|
|
51759
|
-
|
|
51760
|
-
const attributesBlock = (_a = atBlockEnd ? findCloneableList(block) : block) != null ? _a : block;
|
|
51761
|
-
breakListBlock(editor, block, offset, attributesBlock);
|
|
51706
|
+
autoBreakListBlock(editor, block, offset);
|
|
51762
51707
|
return true;
|
|
51763
51708
|
}
|
|
51764
51709
|
function findPrevBrotherAsParent(block) {
|
|
@@ -54817,7 +54762,7 @@ ${codeText}
|
|
|
54817
54762
|
};
|
|
54818
54763
|
return { blockData };
|
|
54819
54764
|
}
|
|
54820
|
-
function getOptions$
|
|
54765
|
+
function getOptions$8(editor) {
|
|
54821
54766
|
return {
|
|
54822
54767
|
name: "Mathjax"
|
|
54823
54768
|
};
|
|
@@ -54849,7 +54794,7 @@ $$${mathData.mathjaxText}$$
|
|
|
54849
54794
|
const MathjaxEmbed = {
|
|
54850
54795
|
embedType: "math",
|
|
54851
54796
|
createEmbedContent: createEmbedContent$9,
|
|
54852
|
-
getOptions: getOptions$
|
|
54797
|
+
getOptions: getOptions$8,
|
|
54853
54798
|
convertFrom: convertFrom$7,
|
|
54854
54799
|
handleDeleteBlock: handleDeleteBlock$7,
|
|
54855
54800
|
convertTo: convertTo$g,
|
|
@@ -65319,7 +65264,7 @@ $$${mathData.mathjaxText}$$
|
|
|
65319
65264
|
editor.focus();
|
|
65320
65265
|
return editor.insertBlock(options.containerId, options.blockIndex, blockData, createBlockSimpleRange(editor, focusBlockId, 0));
|
|
65321
65266
|
}
|
|
65322
|
-
function getOptions$
|
|
65267
|
+
function getOptions$7(editor) {
|
|
65323
65268
|
return {
|
|
65324
65269
|
name: "CodeBlock",
|
|
65325
65270
|
insertBlockCommandItems: [
|
|
@@ -65384,7 +65329,7 @@ ${codeText}
|
|
|
65384
65329
|
getSelectedContainers: getSelectedContainers$2,
|
|
65385
65330
|
convertFrom: convertToCode,
|
|
65386
65331
|
handleBlockElementUpdated,
|
|
65387
|
-
getOptions: getOptions$
|
|
65332
|
+
getOptions: getOptions$7,
|
|
65388
65333
|
getBlockProperties: getBlockProperties$a,
|
|
65389
65334
|
convertTo: convertTo$e,
|
|
65390
65335
|
handleDeleteBlock: handleDeleteBlock$6
|
|
@@ -68361,7 +68306,7 @@ ${codeText}
|
|
|
68361
68306
|
abstract: `${i18n$1.t("image.abstract")}`
|
|
68362
68307
|
};
|
|
68363
68308
|
};
|
|
68364
|
-
function getOptions$
|
|
68309
|
+
function getOptions$6() {
|
|
68365
68310
|
return {
|
|
68366
68311
|
name: "Image",
|
|
68367
68312
|
insertEmbedCommandItems: [{
|
|
@@ -68461,7 +68406,7 @@ ${codeText}
|
|
|
68461
68406
|
convertTo: convertTo$d,
|
|
68462
68407
|
convertFrom: convertFrom$6,
|
|
68463
68408
|
getBlockProperties: getBlockProperties$9,
|
|
68464
|
-
getOptions: getOptions$
|
|
68409
|
+
getOptions: getOptions$6,
|
|
68465
68410
|
handleDrop: handleDrop$1,
|
|
68466
68411
|
handleDropOver: handleDropOver$1,
|
|
68467
68412
|
handleDeleteBlock: handleDeleteBlock$5
|
|
@@ -73278,7 +73223,7 @@ ${codeText}
|
|
|
73278
73223
|
}
|
|
73279
73224
|
return createEmptyTableDataByFirstRowText(editor, editor.getBlockString(srcBlock).trim());
|
|
73280
73225
|
}
|
|
73281
|
-
function getOptions$
|
|
73226
|
+
function getOptions$5(editor) {
|
|
73282
73227
|
return {
|
|
73283
73228
|
name: "TableBlock",
|
|
73284
73229
|
insertBlockCommandItems: [{
|
|
@@ -73355,7 +73300,7 @@ ${codeText}
|
|
|
73355
73300
|
adjustSelectionPos,
|
|
73356
73301
|
getClientRects,
|
|
73357
73302
|
selectionToDoc,
|
|
73358
|
-
getOptions: getOptions$
|
|
73303
|
+
getOptions: getOptions$5,
|
|
73359
73304
|
getTextToolbarReferenceClient: getTextToolbarReferenceClient$1,
|
|
73360
73305
|
handleUpdateBlock: handleUpdateBlock$5,
|
|
73361
73306
|
handleDeleteBlock: handleDeleteBlock$4,
|
|
@@ -73391,7 +73336,6 @@ ${codeText}
|
|
|
73391
73336
|
splitCell: "\u62C6\u5206\u5355\u5143\u683C",
|
|
73392
73337
|
tableConfigKey: "\u8868\u683C\u8BBE\u7F6E",
|
|
73393
73338
|
deleteTable: "\u5220\u9664\u8868\u683C",
|
|
73394
|
-
adjustColumnWidthsEvenly: "\u5E73\u5747\u5206\u914D\u5217\u5BBD",
|
|
73395
73339
|
insertCol: "\u63D2\u5165\u5217",
|
|
73396
73340
|
insertRow: "\u63D2\u5165\u884C",
|
|
73397
73341
|
deleteCol: "\u5220\u9664\u5217",
|
|
@@ -73423,7 +73367,6 @@ ${codeText}
|
|
|
73423
73367
|
splitCell: "Split cell",
|
|
73424
73368
|
tableConfigKey: "Table settings",
|
|
73425
73369
|
deleteTable: "Delete table",
|
|
73426
|
-
adjustColumnWidthsEvenly: "Adjust column widths evenly",
|
|
73427
73370
|
insertCol: "Insert column",
|
|
73428
73371
|
insertRow: "Insert row",
|
|
73429
73372
|
deleteCol: "Delete column",
|
|
@@ -73455,7 +73398,6 @@ ${codeText}
|
|
|
73455
73398
|
splitCell: "\u30BB\u30EB\u306E\u7D50\u5408\u3092\u89E3\u9664",
|
|
73456
73399
|
tableConfigKey: "\u30C6\u30FC\u30D6\u30EB\u8A2D\u5B9A",
|
|
73457
73400
|
deleteTable: "\u30C6\u30FC\u30D6\u30EB\u3092\u524A\u9664",
|
|
73458
|
-
adjustColumnWidthsEvenly: "\u5217\u5E45\u3092\u5747\u7B49\u306B\u8ABF\u6574",
|
|
73459
73401
|
insertCol: "\u5217\u3092\u633F\u5165",
|
|
73460
73402
|
insertRow: "\u884C\u3092\u633F\u5165",
|
|
73461
73403
|
deleteCol: "\u5217\u3092\u524A\u9664",
|
|
@@ -76851,8 +76793,25 @@ ${docStr}
|
|
|
76851
76793
|
};
|
|
76852
76794
|
}
|
|
76853
76795
|
}
|
|
76796
|
+
function isContainHyperlink(text2) {
|
|
76797
|
+
const pattern = /^([\d\w\u4e00-\u9fa5\s]*[\u4e00-\u9fa5\s]{1}|)((https|http|ftp)?:\/\/)[^\s]+/;
|
|
76798
|
+
return pattern.test(text2);
|
|
76799
|
+
}
|
|
76800
|
+
function transText2TextOp(text2) {
|
|
76801
|
+
const ret = [];
|
|
76802
|
+
const prefix = text2.split(/https|http|ftp/)[0];
|
|
76803
|
+
const link2 = text2.substring(prefix.length).trim();
|
|
76804
|
+
if (prefix && prefix.length) {
|
|
76805
|
+
const textOp = createTextOp(prefix, null);
|
|
76806
|
+
ret.push(textOp, createTextOp(" ", null));
|
|
76807
|
+
}
|
|
76808
|
+
const linkOp = createTextOp(link2, { link: link2 });
|
|
76809
|
+
ret.push(linkOp, createTextOp(" ", null));
|
|
76810
|
+
return ret;
|
|
76811
|
+
}
|
|
76854
76812
|
class TextDataConverter {
|
|
76855
|
-
async fromData(editor, data2) {
|
|
76813
|
+
async fromData(editor, data2, options) {
|
|
76814
|
+
const { toPlainText: toPlainText2 = false } = options || {};
|
|
76856
76815
|
const result = {};
|
|
76857
76816
|
const text2 = data2.getData("text/plain");
|
|
76858
76817
|
if (text2) {
|
|
@@ -76862,6 +76821,10 @@ ${docStr}
|
|
|
76862
76821
|
id: genId(),
|
|
76863
76822
|
type: "text"
|
|
76864
76823
|
};
|
|
76824
|
+
if (isContainHyperlink(line) && !toPlainText2) {
|
|
76825
|
+
block.text = transText2TextOp(line);
|
|
76826
|
+
return block;
|
|
76827
|
+
}
|
|
76865
76828
|
const text22 = line ? [createTextOp(line, null)] : [];
|
|
76866
76829
|
block.text = text22;
|
|
76867
76830
|
return block;
|
|
@@ -76878,103 +76841,6 @@ ${docStr}
|
|
|
76878
76841
|
return result;
|
|
76879
76842
|
}
|
|
76880
76843
|
}
|
|
76881
|
-
function findLinks(text2) {
|
|
76882
|
-
const pattern = /https?:\/\/[^\s/$.?#].[^\s]*/g;
|
|
76883
|
-
const results = [];
|
|
76884
|
-
let match;
|
|
76885
|
-
while ((match = pattern.exec(text2)) !== null) {
|
|
76886
|
-
const url = match[0];
|
|
76887
|
-
const startIndex = match.index;
|
|
76888
|
-
const endIndex = pattern.lastIndex;
|
|
76889
|
-
results.push({ url, startIndex, endIndex });
|
|
76890
|
-
}
|
|
76891
|
-
return results;
|
|
76892
|
-
}
|
|
76893
|
-
function urlToLinkOp(result) {
|
|
76894
|
-
const attributes = {
|
|
76895
|
-
link: result.url
|
|
76896
|
-
};
|
|
76897
|
-
return {
|
|
76898
|
-
insert: result.url,
|
|
76899
|
-
attributes
|
|
76900
|
-
};
|
|
76901
|
-
}
|
|
76902
|
-
function opToLinks(op) {
|
|
76903
|
-
var _a, _b;
|
|
76904
|
-
if ((_a = op.attributes) == null ? void 0 : _a.box) {
|
|
76905
|
-
return [op];
|
|
76906
|
-
}
|
|
76907
|
-
if ((_b = op.attributes) == null ? void 0 : _b.link) {
|
|
76908
|
-
return [op];
|
|
76909
|
-
}
|
|
76910
|
-
const text2 = op.insert;
|
|
76911
|
-
const attributes = op.attributes;
|
|
76912
|
-
const results = findLinks(text2);
|
|
76913
|
-
if (results.length === 0) {
|
|
76914
|
-
return [op];
|
|
76915
|
-
}
|
|
76916
|
-
let current = text2;
|
|
76917
|
-
const ops = [];
|
|
76918
|
-
for (let i = results.length - 1; i >= 0; i--) {
|
|
76919
|
-
const result = results[i];
|
|
76920
|
-
const right = current.substring(result.endIndex);
|
|
76921
|
-
if (right) {
|
|
76922
|
-
const rightOp = {
|
|
76923
|
-
insert: right
|
|
76924
|
-
};
|
|
76925
|
-
if (attributes) {
|
|
76926
|
-
rightOp.attributes = JSON.parse(JSON.stringify(attributes));
|
|
76927
|
-
}
|
|
76928
|
-
ops.unshift(rightOp);
|
|
76929
|
-
}
|
|
76930
|
-
const boxOp = urlToLinkOp(result);
|
|
76931
|
-
if (boxOp) {
|
|
76932
|
-
ops.unshift(boxOp);
|
|
76933
|
-
} else {
|
|
76934
|
-
const keepText = current.substring(result.startIndex, result.endIndex);
|
|
76935
|
-
const keepOp = {
|
|
76936
|
-
insert: keepText
|
|
76937
|
-
};
|
|
76938
|
-
if (attributes) {
|
|
76939
|
-
keepOp.attributes = attributes;
|
|
76940
|
-
}
|
|
76941
|
-
ops.unshift(keepOp);
|
|
76942
|
-
}
|
|
76943
|
-
current = current.substring(0, result.startIndex);
|
|
76944
|
-
}
|
|
76945
|
-
if (current) {
|
|
76946
|
-
const lastOp = {
|
|
76947
|
-
insert: current
|
|
76948
|
-
};
|
|
76949
|
-
if (attributes) {
|
|
76950
|
-
lastOp.attributes = attributes;
|
|
76951
|
-
}
|
|
76952
|
-
ops.unshift(lastOp);
|
|
76953
|
-
}
|
|
76954
|
-
return ops;
|
|
76955
|
-
}
|
|
76956
|
-
class ConvertLinkPasteHandler {
|
|
76957
|
-
constructor() {
|
|
76958
|
-
__publicField(this, "order");
|
|
76959
|
-
this.order = 200;
|
|
76960
|
-
}
|
|
76961
|
-
async handleBeforePasteDoc(editor, doc2) {
|
|
76962
|
-
for (const blocks of Object.values(doc2.blocks)) {
|
|
76963
|
-
for (const block of blocks) {
|
|
76964
|
-
if (block.type === "text") {
|
|
76965
|
-
const ops = block.text || [];
|
|
76966
|
-
const newOps = [];
|
|
76967
|
-
for (const op of ops) {
|
|
76968
|
-
const subOps = opToLinks(op);
|
|
76969
|
-
newOps.push(...subOps);
|
|
76970
|
-
}
|
|
76971
|
-
block.text = newOps;
|
|
76972
|
-
}
|
|
76973
|
-
}
|
|
76974
|
-
}
|
|
76975
|
-
return false;
|
|
76976
|
-
}
|
|
76977
|
-
}
|
|
76978
76844
|
function getImages(files) {
|
|
76979
76845
|
const images = [];
|
|
76980
76846
|
for (let i = 0; i < files.length; i++) {
|
|
@@ -76988,7 +76854,6 @@ ${docStr}
|
|
|
76988
76854
|
}
|
|
76989
76855
|
class OnesEditorPasteHandler {
|
|
76990
76856
|
constructor(editor) {
|
|
76991
|
-
editor.input.addHandler(new ConvertLinkPasteHandler());
|
|
76992
76857
|
editor.dataConverter.addConverter(new HtmlDataConverter());
|
|
76993
76858
|
editor.dataConverter.addConverter(new TextDataConverter());
|
|
76994
76859
|
editor.dataConverter.addConverter(new MarkdownDataConverter());
|
|
@@ -82191,45 +82056,24 @@ ${docStr}
|
|
|
82191
82056
|
};
|
|
82192
82057
|
return { blockData };
|
|
82193
82058
|
}
|
|
82194
|
-
function getOptions$5() {
|
|
82195
|
-
return {
|
|
82196
|
-
name: "toc",
|
|
82197
|
-
insertEmbedCommandItems: [{
|
|
82198
|
-
id: "insert-toc",
|
|
82199
|
-
name: i18n$1.t("toc.name"),
|
|
82200
|
-
icon: TocIcon,
|
|
82201
|
-
order: 510,
|
|
82202
|
-
group: "common",
|
|
82203
|
-
subText: getShortcutById("insert-toc")
|
|
82204
|
-
}],
|
|
82205
|
-
handleInsertEmptyEmbed: async (editor, options) => {
|
|
82206
|
-
const { containerId, blockIndex } = options;
|
|
82207
|
-
return editor.insertEmbed(containerId, blockIndex, "toc", {});
|
|
82208
|
-
}
|
|
82209
|
-
};
|
|
82210
|
-
}
|
|
82211
82059
|
const TocEmbed = {
|
|
82212
82060
|
embedType: "toc",
|
|
82213
82061
|
createEmbedContent: createEmbedContent$6,
|
|
82214
82062
|
convertTo: convertTo$8,
|
|
82215
|
-
convertFrom: convertFrom$4
|
|
82216
|
-
getOptions: getOptions$5
|
|
82063
|
+
convertFrom: convertFrom$4
|
|
82217
82064
|
};
|
|
82218
82065
|
const zhCN$c = {
|
|
82219
82066
|
toc: {
|
|
82220
|
-
name: "\u6807\u9898\u76EE\u5F55",
|
|
82221
82067
|
empty: "No Toc"
|
|
82222
82068
|
}
|
|
82223
82069
|
};
|
|
82224
82070
|
const enUS$c = {
|
|
82225
82071
|
toc: {
|
|
82226
|
-
name: "Toc",
|
|
82227
82072
|
empty: "No Toc"
|
|
82228
82073
|
}
|
|
82229
82074
|
};
|
|
82230
82075
|
const jaJP$c = {
|
|
82231
82076
|
toc: {
|
|
82232
|
-
name: "Toc",
|
|
82233
82077
|
empty: "No Toc"
|
|
82234
82078
|
}
|
|
82235
82079
|
};
|
|
@@ -86767,7 +86611,7 @@ ${data2.plantumlText}
|
|
|
86767
86611
|
this.editor.removeListener("selectionChanged", this.handleSelectionChange);
|
|
86768
86612
|
this.editor.removeListener("docChanged", this.handleSelectionChange);
|
|
86769
86613
|
document.removeEventListener("touchstart", this.handleTouchStart);
|
|
86770
|
-
document.removeEventListener("touchend", this.handleTouchEnd
|
|
86614
|
+
document.removeEventListener("touchend", this.handleTouchEnd);
|
|
86771
86615
|
document.removeEventListener("touchmove", this.handleTouchMove);
|
|
86772
86616
|
this.mobileEmbedMask.destroy();
|
|
86773
86617
|
this.cursorToolbar.destroy();
|
|
@@ -92529,6 +92373,12 @@ ${data2.plantumlText}
|
|
|
92529
92373
|
this.toolbar.updateItems(items);
|
|
92530
92374
|
}
|
|
92531
92375
|
}
|
|
92376
|
+
function editorAutoBreakTextBlock(editor, block, offset, options) {
|
|
92377
|
+
if (isListBlock(block)) {
|
|
92378
|
+
return autoBreakListBlock(editor, block, offset);
|
|
92379
|
+
}
|
|
92380
|
+
return editorBreakTextBlock(editor, block, offset, options);
|
|
92381
|
+
}
|
|
92532
92382
|
const logger = getLogger("create-editor");
|
|
92533
92383
|
function getDefaultOnesEditorOptions(options) {
|
|
92534
92384
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
@@ -92776,7 +92626,7 @@ ${data2.plantumlText}
|
|
|
92776
92626
|
}
|
|
92777
92627
|
}
|
|
92778
92628
|
});
|
|
92779
|
-
editor.version = "2.8.14-beta.
|
|
92629
|
+
editor.version = "2.8.14-beta.7";
|
|
92780
92630
|
return editor;
|
|
92781
92631
|
}
|
|
92782
92632
|
function isDoc(doc2) {
|
|
@@ -92889,7 +92739,7 @@ ${data2.plantumlText}
|
|
|
92889
92739
|
}
|
|
92890
92740
|
});
|
|
92891
92741
|
OnesEditorToolbar.register(editor);
|
|
92892
|
-
editor.version = "2.8.14-beta.
|
|
92742
|
+
editor.version = "2.8.14-beta.7";
|
|
92893
92743
|
return editor;
|
|
92894
92744
|
}
|
|
92895
92745
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -138666,7 +138516,6 @@ ${data2.plantumlText}
|
|
|
138666
138516
|
exports2.AddCommentToOldDocCommandProvider = AddCommentToOldDocCommandProvider;
|
|
138667
138517
|
exports2.AddEmojiIcon = AddEmojiIcon;
|
|
138668
138518
|
exports2.AddIcon = AddIcon;
|
|
138669
|
-
exports2.AdjustWidthIcon = AdjustWidthIcon;
|
|
138670
138519
|
exports2.AlertDialog = AlertDialog;
|
|
138671
138520
|
exports2.AlertEmojiIcon = alterEmoji;
|
|
138672
138521
|
exports2.AlignCenterIcon = AlignCenterIcon;
|
|
@@ -138942,7 +138791,6 @@ ${data2.plantumlText}
|
|
|
138942
138791
|
exports2.TimeIcon = TimeIcon;
|
|
138943
138792
|
exports2.ToMindMapIcon = ToMindMapIcon;
|
|
138944
138793
|
exports2.TocEmbed = TocEmbed;
|
|
138945
|
-
exports2.TocIcon = TocIcon;
|
|
138946
138794
|
exports2.TreeIcon = TreeIcon;
|
|
138947
138795
|
exports2.UmlBrandIcon = UmlBrandIcon;
|
|
138948
138796
|
exports2.UmlIcon = UmlIcon;
|
|
@@ -139076,6 +138924,7 @@ ${data2.plantumlText}
|
|
|
139076
138924
|
exports2.editLink = editLink;
|
|
139077
138925
|
exports2.editorAddComment = editorAddComment;
|
|
139078
138926
|
exports2.editorAddTextAttribute = editorAddTextAttribute;
|
|
138927
|
+
exports2.editorAutoBreakTextBlock = editorAutoBreakTextBlock;
|
|
139079
138928
|
exports2.editorAutoInsertBlock = editorAutoInsertBlock;
|
|
139080
138929
|
exports2.editorBreakTextBlock = editorBreakTextBlock;
|
|
139081
138930
|
exports2.editorClearCompositionText = editorClearCompositionText;
|