@ones-editor/editor 2.8.12 → 2.8.14-beta.1
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/table-block/src/commands/adjust-column-widths-evenly.d.ts +2 -0
- 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 +1 -0
- package/@ones-editor/table-block/src/locale/ja-jp.d.ts +1 -0
- package/@ones-editor/table-block/src/locale/zh-cn.d.ts +1 -0
- package/@ones-editor/toc/src/locale/en-us.d.ts +1 -0
- package/@ones-editor/toc/src/locale/ja-jp.d.ts +1 -0
- package/@ones-editor/toc/src/locale/zh-cn.d.ts +1 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui-base/src/icons/index.d.ts +2 -1
- package/dist/index.js +205 -146
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8011,6 +8011,7 @@ div.editor-root div.editor-content div[data-block-type=embed] > .embed-mask::aft
|
|
|
8011
8011
|
display: flex;
|
|
8012
8012
|
justify-content: center;
|
|
8013
8013
|
align-items: center;
|
|
8014
|
+
color: transparent;
|
|
8014
8015
|
width: 20px;
|
|
8015
8016
|
height: 20px;
|
|
8016
8017
|
border-radius: 3px;
|
|
@@ -8022,6 +8023,7 @@ div.editor-root div.editor-content div[data-block-type=embed] > .embed-mask::aft
|
|
|
8022
8023
|
cursor: pointer;
|
|
8023
8024
|
}
|
|
8024
8025
|
.editor-root [data-type=editor-container].root div[data-type=editor-block].layout-block .creation-dot-button:hover {
|
|
8026
|
+
color: white;
|
|
8025
8027
|
background: var(--background-default-o-color-bg-primary, #0064ff);
|
|
8026
8028
|
/* o-shadow-3 */
|
|
8027
8029
|
box-shadow: 0px 0px 1px 0px rgba(45, 45, 46, 0.2), 0px 8px 16px -4px rgba(45, 45, 46, 0.15);
|
|
@@ -12976,7 +12978,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12976
12978
|
}
|
|
12977
12979
|
return {};
|
|
12978
12980
|
}
|
|
12979
|
-
function getOptions$
|
|
12981
|
+
function getOptions$a(editor) {
|
|
12980
12982
|
const commandMap = /* @__PURE__ */ new Map();
|
|
12981
12983
|
const insertBlockCommandItems = [];
|
|
12982
12984
|
editor.editorEmbeds.forEach((embedClass) => {
|
|
@@ -13069,7 +13071,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13069
13071
|
convertFrom: convertFrom$9,
|
|
13070
13072
|
convertTo: convertTo$l,
|
|
13071
13073
|
getBlockProperties: getBlockProperties$c,
|
|
13072
|
-
getOptions: getOptions$
|
|
13074
|
+
getOptions: getOptions$a,
|
|
13073
13075
|
handleDeleteBlock: handleDeleteBlock$9,
|
|
13074
13076
|
handleUpdateBlock: handleUpdateBlock$6,
|
|
13075
13077
|
handleDropOver: handleDropOver$2,
|
|
@@ -40500,7 +40502,7 @@ ${codeText}
|
|
|
40500
40502
|
const NextIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M5.76573 4.17763L9.58809 7.99999L5.76573 11.8209" stroke="currentColor"/>\n</svg>\n';
|
|
40501
40503
|
const MoreIcon$1 = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<circle cx="3" cy="8" r="0.5" fill="currentColor" stroke="currentColor"/>\n<circle cx="8" cy="8" r="0.5" fill="currentColor" stroke="currentColor"/>\n<circle cx="13" cy="8" r="0.5" fill="currentColor" stroke="currentColor"/>\n</svg>';
|
|
40502
40504
|
const TextColorIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M2.5 14.5L8 1.5L13.5 14.5" stroke="currentColor" stroke-linejoin="round"/>\n<path d="M4.5 9.5H11.5" stroke="currentColor"/>\n</svg>';
|
|
40503
|
-
const AddIcon = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M6.005 5.99501L5.99501 1M6.005 5.99501H11M6.005 5.99501V11M6.005 5.99501L1 6.005" stroke="
|
|
40505
|
+
const AddIcon = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M6.005 5.99501L5.99501 1M6.005 5.99501H11M6.005 5.99501V11M6.005 5.99501L1 6.005" stroke="currentColor" stroke-linecap="square" stroke-linejoin="round"/>\n</svg>\n';
|
|
40504
40506
|
const ArrowDownIcon$1 = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M4.17763 5.76573L7.99999 9.58809L11.8209 5.76573" stroke="currentColor"/>\n</svg>\n';
|
|
40505
40507
|
const arrowUp = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M4.17763 10.2343L7.99999 6.41191L11.8209 10.2343" stroke="currentColor"/>\n</svg>\n';
|
|
40506
40508
|
const arrowLeft = '<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">\n<path d="M10.2343 4.17763L6.41191 7.99999L10.2343 11.8209" stroke="currentColor"/>\n</svg>\n';
|
|
@@ -40621,6 +40623,7 @@ ${codeText}
|
|
|
40621
40623
|
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';
|
|
40622
40624
|
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';
|
|
40623
40625
|
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="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M7.10156 13.7031V1.625H8.17188V13.7031H7.10156ZM3.14844 14.4297C2.39323 14.4297 1.82552 14.2422 1.44531 13.8672C1.07031 13.4974 0.882812 12.9401 0.882812 12.1953V3.16406C0.882812 2.41927 1.07031 1.86198 1.44531 1.49219C1.82552 1.11719 2.39323 0.929688 3.14844 0.929688H12.1328C12.888 0.929688 13.4531 1.11719 13.8281 1.49219C14.2031 1.86719 14.3906 2.42448 14.3906 3.16406V12.1953C14.3906 12.9349 14.2031 13.4922 13.8281 13.8672C13.4531 14.2422 12.888 14.4297 12.1328 14.4297H3.14844ZM3.16406 13.3516H12.1172C12.4974 13.3516 12.7917 13.25 13 13.0469C13.2083 12.8438 13.3125 12.5417 13.3125 12.1406V3.21875C13.3125 2.81771 13.2083 2.51562 13 2.3125C12.7917 2.10938 12.4974 2.00781 12.1172 2.00781H3.16406C2.77865 2.00781 2.48177 2.10938 2.27344 2.3125C2.07031 2.51562 1.96875 2.81771 1.96875 3.21875V12.1406C1.96875 12.5417 2.07031 12.8438 2.27344 13.0469C2.48177 13.25 2.77865 13.3516 3.16406 13.3516Z" fill="#2D2D2E"/>\n</svg>\n';
|
|
40624
40627
|
const index$f = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
40625
40628
|
__proto__: null,
|
|
40626
40629
|
TableEditIcon,
|
|
@@ -40748,7 +40751,8 @@ ${codeText}
|
|
|
40748
40751
|
SearchIcon,
|
|
40749
40752
|
CalloutIcon: CalloutIcon$1,
|
|
40750
40753
|
LoadingCircleIcon,
|
|
40751
|
-
TextGroupIcon
|
|
40754
|
+
TextGroupIcon,
|
|
40755
|
+
AdjustWidthIcon
|
|
40752
40756
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
40753
40757
|
function createLoading() {
|
|
40754
40758
|
const loading2 = createElement("span", ["editor-loading-icon"], null);
|
|
@@ -43415,6 +43419,7 @@ ${codeText}
|
|
|
43415
43419
|
}
|
|
43416
43420
|
setCurrentButtonColor(colors) {
|
|
43417
43421
|
setColorButtonColor(this.element, colors);
|
|
43422
|
+
this.latestColors = colors;
|
|
43418
43423
|
}
|
|
43419
43424
|
}
|
|
43420
43425
|
const input = "";
|
|
@@ -44001,6 +44006,9 @@ ${codeText}
|
|
|
44001
44006
|
"insert-emoji": {
|
|
44002
44007
|
shortcut: "/emoji"
|
|
44003
44008
|
},
|
|
44009
|
+
"insert-toc": {
|
|
44010
|
+
shortcut: "/toc"
|
|
44011
|
+
},
|
|
44004
44012
|
...fontShortCuts()
|
|
44005
44013
|
};
|
|
44006
44014
|
function getShortcutById(id) {
|
|
@@ -46550,6 +46558,91 @@ ${codeText}
|
|
|
46550
46558
|
editor.deleteChildContainers(deletedContainers);
|
|
46551
46559
|
});
|
|
46552
46560
|
}
|
|
46561
|
+
var TABLE_CLASS = /* @__PURE__ */ ((TABLE_CLASS2) => {
|
|
46562
|
+
TABLE_CLASS2["COL_TITLE_TABLE"] = "col-title-table";
|
|
46563
|
+
TABLE_CLASS2["COL_TITLE_ITEM"] = "col-title-item";
|
|
46564
|
+
TABLE_CLASS2["STRIPE_STYLE_TABLE"] = "stripe-style-table";
|
|
46565
|
+
TABLE_CLASS2["NO_BORDER"] = "table-no-border";
|
|
46566
|
+
return TABLE_CLASS2;
|
|
46567
|
+
})(TABLE_CLASS || {});
|
|
46568
|
+
const TABLE_BAR_WIDTH = 6;
|
|
46569
|
+
const INSERT_BUTTON_SIZE = 20;
|
|
46570
|
+
const TABLE_CELL_MENU_BUTTON_CLASS = "table-cell-menu-btn";
|
|
46571
|
+
const logger$2r = getLogger("table-resize-gripper");
|
|
46572
|
+
const GRIPPER_SIZE = 7;
|
|
46573
|
+
const GRIPPER_SIZE_HALF = (GRIPPER_SIZE - 1) / 2;
|
|
46574
|
+
const CONTAINER_CELL_DELTA = 3;
|
|
46575
|
+
function getCellFromRightBorder(table, x, y) {
|
|
46576
|
+
const { rows } = table;
|
|
46577
|
+
for (let i = 0; i < rows.length; i++) {
|
|
46578
|
+
const row = rows[i];
|
|
46579
|
+
const cells = Array.from(row.cells);
|
|
46580
|
+
for (let j = 0; j < cells.length; j++) {
|
|
46581
|
+
const cell = cells[j];
|
|
46582
|
+
const rect = cell.getBoundingClientRect();
|
|
46583
|
+
const pos = Math.round(rect.right);
|
|
46584
|
+
if (Math.abs(x - pos) <= GRIPPER_SIZE_HALF && rect.top <= y && y <= rect.bottom) {
|
|
46585
|
+
return cell;
|
|
46586
|
+
}
|
|
46587
|
+
}
|
|
46588
|
+
}
|
|
46589
|
+
return null;
|
|
46590
|
+
}
|
|
46591
|
+
function editorHasExistsResizeGripper(editor) {
|
|
46592
|
+
return !!editor.rootContainer.querySelector(".table-resize-gripper");
|
|
46593
|
+
}
|
|
46594
|
+
function getExistsResizeGripper$1(editor, block) {
|
|
46595
|
+
const tools = getTableTools(editor, block);
|
|
46596
|
+
const gripper = tools.querySelector(".table-resize-gripper");
|
|
46597
|
+
return gripper;
|
|
46598
|
+
}
|
|
46599
|
+
function createResizeGripper$2(editor, block) {
|
|
46600
|
+
const exists = getExistsResizeGripper$1(editor, block);
|
|
46601
|
+
assert(logger$2r, !exists, "resize gripper has already exists");
|
|
46602
|
+
const tools = getTableTools(editor, block);
|
|
46603
|
+
const gripper = createElement("div", ["table-resize-gripper", "table-indicator"], tools);
|
|
46604
|
+
createElement("div", ["table-resize-gripper-indicator"], gripper);
|
|
46605
|
+
return gripper;
|
|
46606
|
+
}
|
|
46607
|
+
function updateResizeGripper$1(editor, block, cell) {
|
|
46608
|
+
let gripper = getExistsResizeGripper$1(editor, block);
|
|
46609
|
+
if (!gripper) {
|
|
46610
|
+
gripper = createResizeGripper$2(editor, block);
|
|
46611
|
+
}
|
|
46612
|
+
const table = getBlockTable(block);
|
|
46613
|
+
const tableRect = table.getBoundingClientRect();
|
|
46614
|
+
const cellRect = cell.getBoundingClientRect();
|
|
46615
|
+
const top = 0;
|
|
46616
|
+
const height = tableRect.height;
|
|
46617
|
+
const scrollContentRect = editor.getCustom(getTableScrollKey(block)).contentElement.getBoundingClientRect();
|
|
46618
|
+
const left = cellRect.right - scrollContentRect.left;
|
|
46619
|
+
gripper.style.left = `${left - GRIPPER_SIZE_HALF - TABLE_BAR_WIDTH - INSERT_BUTTON_SIZE}px`;
|
|
46620
|
+
gripper.style.top = `${top}px`;
|
|
46621
|
+
gripper.style.height = `${height}px`;
|
|
46622
|
+
gripper.style.width = `${GRIPPER_SIZE}px`;
|
|
46623
|
+
}
|
|
46624
|
+
function removeAllResizeGripper(editor) {
|
|
46625
|
+
editor.rootContainer.querySelectorAll(".table-resize-gripper").forEach((gripper) => {
|
|
46626
|
+
gripper.remove();
|
|
46627
|
+
});
|
|
46628
|
+
}
|
|
46629
|
+
function setTableColumnWidths(editor, block, colsWidth) {
|
|
46630
|
+
const oldData = editor.getBlockData(block);
|
|
46631
|
+
const newData = {
|
|
46632
|
+
...oldData,
|
|
46633
|
+
colsWidth
|
|
46634
|
+
};
|
|
46635
|
+
editor.updateBlockData(block, newData, void 0, { noScroll: true });
|
|
46636
|
+
}
|
|
46637
|
+
function adjustColumnWidthsEvenly(editor, tableBlock) {
|
|
46638
|
+
const tableData = editor.getBlockData(tableBlock);
|
|
46639
|
+
const grid = tableData2Grid(tableData);
|
|
46640
|
+
const colCount = grid.colCount;
|
|
46641
|
+
const table = getBlockTable(tableBlock);
|
|
46642
|
+
const tableWidth = table.getBoundingClientRect().width;
|
|
46643
|
+
const colWidth = tableWidth / colCount;
|
|
46644
|
+
setTableColumnWidths(editor, tableBlock, Array(colCount).fill(colWidth));
|
|
46645
|
+
}
|
|
46553
46646
|
const TABLE_COMMAND_GROUP_INDEX = 10;
|
|
46554
46647
|
const TableCommands = [
|
|
46555
46648
|
"table/merge-cells",
|
|
@@ -46558,7 +46651,8 @@ ${codeText}
|
|
|
46558
46651
|
"table/insert-row",
|
|
46559
46652
|
"table/delete-rows",
|
|
46560
46653
|
"table/delete-columns",
|
|
46561
|
-
"table/delete"
|
|
46654
|
+
"table/delete",
|
|
46655
|
+
"table/adjust-column-widths-evenly"
|
|
46562
46656
|
];
|
|
46563
46657
|
class TableBlockCommandProvider {
|
|
46564
46658
|
constructor() {
|
|
@@ -46570,6 +46664,8 @@ ${codeText}
|
|
|
46570
46664
|
return [];
|
|
46571
46665
|
}
|
|
46572
46666
|
const commands = [];
|
|
46667
|
+
const deleteColumns2 = canDeleteColumns(editor, block, range);
|
|
46668
|
+
const deleteRows2 = canDeleteRows(editor, block, range);
|
|
46573
46669
|
if (canMergeCells(editor, block, range)) {
|
|
46574
46670
|
commands.push({
|
|
46575
46671
|
id: "table/merge-cells",
|
|
@@ -46584,8 +46680,6 @@ ${codeText}
|
|
|
46584
46680
|
icon: SplitCellIcon
|
|
46585
46681
|
});
|
|
46586
46682
|
}
|
|
46587
|
-
const deleteColumns2 = canDeleteColumns(editor, block, range);
|
|
46588
|
-
const deleteRows2 = canDeleteRows(editor, block, range);
|
|
46589
46683
|
if (deleteColumns2 && deleteRows2) {
|
|
46590
46684
|
commands.push({
|
|
46591
46685
|
id: "table/delete",
|
|
@@ -46593,6 +46687,14 @@ ${codeText}
|
|
|
46593
46687
|
icon: DeleteTableIcon
|
|
46594
46688
|
});
|
|
46595
46689
|
}
|
|
46690
|
+
const allColumnsSelected = deleteRows2;
|
|
46691
|
+
if (allColumnsSelected) {
|
|
46692
|
+
commands.push({
|
|
46693
|
+
id: "table/adjust-column-widths-evenly",
|
|
46694
|
+
name: i18n$1.t("table.adjustColumnWidthsEvenly"),
|
|
46695
|
+
icon: AdjustWidthIcon
|
|
46696
|
+
});
|
|
46697
|
+
}
|
|
46596
46698
|
return commands;
|
|
46597
46699
|
}
|
|
46598
46700
|
executeCommand(editor, block, range, command, params, result) {
|
|
@@ -46622,19 +46724,13 @@ ${codeText}
|
|
|
46622
46724
|
editor.deleteBlock(block);
|
|
46623
46725
|
return true;
|
|
46624
46726
|
}
|
|
46727
|
+
if (command.id === "table/adjust-column-widths-evenly") {
|
|
46728
|
+
adjustColumnWidthsEvenly(editor, block);
|
|
46729
|
+
return true;
|
|
46730
|
+
}
|
|
46625
46731
|
return false;
|
|
46626
46732
|
}
|
|
46627
46733
|
}
|
|
46628
|
-
var TABLE_CLASS = /* @__PURE__ */ ((TABLE_CLASS2) => {
|
|
46629
|
-
TABLE_CLASS2["COL_TITLE_TABLE"] = "col-title-table";
|
|
46630
|
-
TABLE_CLASS2["COL_TITLE_ITEM"] = "col-title-item";
|
|
46631
|
-
TABLE_CLASS2["STRIPE_STYLE_TABLE"] = "stripe-style-table";
|
|
46632
|
-
TABLE_CLASS2["NO_BORDER"] = "table-no-border";
|
|
46633
|
-
return TABLE_CLASS2;
|
|
46634
|
-
})(TABLE_CLASS || {});
|
|
46635
|
-
const TABLE_BAR_WIDTH = 6;
|
|
46636
|
-
const INSERT_BUTTON_SIZE = 20;
|
|
46637
|
-
const TABLE_CELL_MENU_BUTTON_CLASS = "table-cell-menu-btn";
|
|
46638
46734
|
function setColTitle(editor, tableBlock) {
|
|
46639
46735
|
if (!editor.isBlockWritable(tableBlock)) {
|
|
46640
46736
|
return;
|
|
@@ -46712,26 +46808,26 @@ ${codeText}
|
|
|
46712
46808
|
};
|
|
46713
46809
|
editor.updateBlockData(tableBlock, newBlockData);
|
|
46714
46810
|
}
|
|
46715
|
-
const logger$
|
|
46811
|
+
const logger$2q = getLogger("table-cell-dom");
|
|
46716
46812
|
function getCellElementByChildBlockId(editor, tableBlock, blockId) {
|
|
46717
46813
|
let blockElement = editor.getBlockById(blockId);
|
|
46718
46814
|
while (blockElement) {
|
|
46719
46815
|
const cell = blockElement.closest("td");
|
|
46720
|
-
assert(logger$
|
|
46816
|
+
assert(logger$2q, cell, "no parent cell");
|
|
46721
46817
|
const cellParentBlock = getParentBlock(cell);
|
|
46722
|
-
assert(logger$
|
|
46818
|
+
assert(logger$2q, cellParentBlock, "no parent block");
|
|
46723
46819
|
if (cellParentBlock === tableBlock) {
|
|
46724
46820
|
return cell;
|
|
46725
46821
|
}
|
|
46726
46822
|
blockElement = cellParentBlock;
|
|
46727
46823
|
}
|
|
46728
|
-
assert(logger$
|
|
46824
|
+
assert(logger$2q, false, "filed to get cell by child block id");
|
|
46729
46825
|
return null;
|
|
46730
46826
|
}
|
|
46731
46827
|
function createComplexPosFromBlockPos(editor, tableBlock, blockPosition) {
|
|
46732
46828
|
const blockElement = editor.getBlockById(blockPosition.blockId);
|
|
46733
46829
|
if (blockElement === tableBlock && !blockPosition.isSimple()) {
|
|
46734
|
-
assert(logger$
|
|
46830
|
+
assert(logger$2q, blockPosition.childContainerId, "block position must have childContainerId attribute");
|
|
46735
46831
|
return blockPosition;
|
|
46736
46832
|
}
|
|
46737
46833
|
const cellElement = getCellElementByChildBlockId(editor, tableBlock, blockPosition.blockId);
|
|
@@ -46745,12 +46841,12 @@ ${codeText}
|
|
|
46745
46841
|
return getTableSelectionRange(tableBlock, start, end);
|
|
46746
46842
|
}
|
|
46747
46843
|
function updateBarsDangerStatus(editor, tableBlock, selectedRows, selectedColumns) {
|
|
46748
|
-
assert(logger$
|
|
46844
|
+
assert(logger$2q, isTableBlock(tableBlock), "invalid table block");
|
|
46749
46845
|
const tools = getTableTools(editor, tableBlock);
|
|
46750
46846
|
const blockTools = getBlockTools(tableBlock);
|
|
46751
46847
|
const updateTop = () => {
|
|
46752
46848
|
const exists = tools.querySelector(".table-border-bar-container.top");
|
|
46753
|
-
assert(logger$
|
|
46849
|
+
assert(logger$2q, exists, "no top border bar container");
|
|
46754
46850
|
const cells = exists.querySelectorAll(".table-border-bar-cell.top");
|
|
46755
46851
|
cells.forEach((cell) => {
|
|
46756
46852
|
const colIndex = parseInt(cell.getAttribute("data-top-index") || "0", 10);
|
|
@@ -46763,7 +46859,7 @@ ${codeText}
|
|
|
46763
46859
|
};
|
|
46764
46860
|
const updateLeft = () => {
|
|
46765
46861
|
const left = blockTools.querySelector(".table-border-bar-container.left");
|
|
46766
|
-
assert(logger$
|
|
46862
|
+
assert(logger$2q, left, "no left border bar container");
|
|
46767
46863
|
const cells = left.querySelectorAll(".table-border-bar-cell.left");
|
|
46768
46864
|
cells.forEach((cell) => {
|
|
46769
46865
|
const rowIndex = parseInt(cell.getAttribute("data-left-index") || "0", 10);
|
|
@@ -46799,7 +46895,7 @@ ${codeText}
|
|
|
46799
46895
|
}
|
|
46800
46896
|
}
|
|
46801
46897
|
} catch (error2) {
|
|
46802
|
-
logger$
|
|
46898
|
+
logger$2q.error("update cells danger status failed: ", error2.message);
|
|
46803
46899
|
}
|
|
46804
46900
|
}
|
|
46805
46901
|
function updateCellBarsDangerStatus(editor, tableBlock, isDanger = true, isCol) {
|
|
@@ -46822,7 +46918,7 @@ ${codeText}
|
|
|
46822
46918
|
}
|
|
46823
46919
|
updateBarsDangerStatus(editor, tableBlock, Array.from(selectedRows), Array.from(selectedColumns));
|
|
46824
46920
|
} catch (error2) {
|
|
46825
|
-
logger$
|
|
46921
|
+
logger$2q.error("update cell bars danger status failed: ", error2.message);
|
|
46826
46922
|
}
|
|
46827
46923
|
}
|
|
46828
46924
|
function createEntireRowAndColumnRange(editor, tableBlock, isCol) {
|
|
@@ -46941,14 +47037,14 @@ ${codeText}
|
|
|
46941
47037
|
}
|
|
46942
47038
|
const DEFAULT_COLUMN_WIDTH$1 = 200;
|
|
46943
47039
|
const MIN_COLUMN_WIDTH = 40;
|
|
46944
|
-
const logger$
|
|
47040
|
+
const logger$2p = getLogger("table-insert-column");
|
|
46945
47041
|
function insertColumn(editor, tableBlock, insertIndex) {
|
|
46946
47042
|
editor.undoManager.runInGroup(() => {
|
|
46947
47043
|
var _a;
|
|
46948
47044
|
const table = getBlockTable(tableBlock);
|
|
46949
47045
|
const grid = TableGrid.fromTable(table);
|
|
46950
47046
|
const colCount = grid.colCount;
|
|
46951
|
-
assert(logger$
|
|
47047
|
+
assert(logger$2p, insertIndex >= 0 && insertIndex <= colCount, `insert index ${insertIndex} is out of range [0, ${colCount}]`);
|
|
46952
47048
|
const cells = grid.map((cell) => cell.containerId);
|
|
46953
47049
|
const spannedContainerIds = /* @__PURE__ */ new Set();
|
|
46954
47050
|
editor.doc.beginBatchUpdate();
|
|
@@ -46969,7 +47065,7 @@ ${codeText}
|
|
|
46969
47065
|
spannedContainerIds.forEach((containerId) => {
|
|
46970
47066
|
const key = `${containerId}_colSpan`;
|
|
46971
47067
|
const oldSpan = oldBlockData[key];
|
|
46972
|
-
assert(logger$
|
|
47068
|
+
assert(logger$2p, typeof oldSpan === "number" && oldSpan > 1, `no colSpan for containerId ${containerId}, ${oldSpan}`);
|
|
46973
47069
|
oldBlockData[key] = oldSpan + 1;
|
|
46974
47070
|
});
|
|
46975
47071
|
const colsWidth = ((_a = oldBlockData.colsWidth) == null ? void 0 : _a.concat()) || new Array(oldBlockData.cols).fill(0);
|
|
@@ -46985,13 +47081,13 @@ ${codeText}
|
|
|
46985
47081
|
editor.updateBlockData(tableBlock, newBlockData);
|
|
46986
47082
|
});
|
|
46987
47083
|
}
|
|
46988
|
-
const logger$
|
|
47084
|
+
const logger$2o = getLogger("table-insert-row");
|
|
46989
47085
|
function insertRow(editor, tableBlock, insertIndex) {
|
|
46990
47086
|
editor.undoManager.runInGroup(() => {
|
|
46991
47087
|
const table = getBlockTable(tableBlock);
|
|
46992
47088
|
const grid = TableGrid.fromTable(table);
|
|
46993
47089
|
const rowCount = grid.rowCount;
|
|
46994
|
-
assert(logger$
|
|
47090
|
+
assert(logger$2o, insertIndex >= 0 && insertIndex <= rowCount, `insert index ${insertIndex} is out of range [0, ${rowCount}]`);
|
|
46995
47091
|
const cells = grid.map((cell) => cell.containerId);
|
|
46996
47092
|
const spannedContainerIds = /* @__PURE__ */ new Set();
|
|
46997
47093
|
editor.doc.beginBatchUpdate();
|
|
@@ -46999,12 +47095,12 @@ ${codeText}
|
|
|
46999
47095
|
for (let col = 0; col < grid.colCount; col++) {
|
|
47000
47096
|
const top = insertIndex > 0 && cells[insertIndex - 1][col];
|
|
47001
47097
|
const bottom = insertIndex < grid.rowCount && cells[insertIndex][col];
|
|
47002
|
-
assert(logger$
|
|
47098
|
+
assert(logger$2o, top || bottom, "no top and bottom cell");
|
|
47003
47099
|
if (insertIndex === 0 || insertIndex === grid.rowCount || top !== bottom) {
|
|
47004
47100
|
const newContainerId = createEmptyContainer(editor.doc);
|
|
47005
47101
|
rowData.push(newContainerId);
|
|
47006
47102
|
} else {
|
|
47007
|
-
assert(logger$
|
|
47103
|
+
assert(logger$2o, top, "no top cell");
|
|
47008
47104
|
rowData.push(top);
|
|
47009
47105
|
spannedContainerIds.add(top);
|
|
47010
47106
|
}
|
|
@@ -47015,7 +47111,7 @@ ${codeText}
|
|
|
47015
47111
|
spannedContainerIds.forEach((containerId) => {
|
|
47016
47112
|
const key = `${containerId}_rowSpan`;
|
|
47017
47113
|
const oldSpan = oldBlockData[key];
|
|
47018
|
-
assert(logger$
|
|
47114
|
+
assert(logger$2o, typeof oldSpan === "number" && oldSpan > 1, `no rowSpan for containerId ${containerId}, ${oldSpan}`);
|
|
47019
47115
|
oldBlockData[key] = oldSpan + 1;
|
|
47020
47116
|
});
|
|
47021
47117
|
const newChildren = TableGrid.virtualCellContainersGridToChildren(cells);
|
|
@@ -47028,7 +47124,7 @@ ${codeText}
|
|
|
47028
47124
|
editor.updateBlockData(tableBlock, newBlockData);
|
|
47029
47125
|
});
|
|
47030
47126
|
}
|
|
47031
|
-
const logger$
|
|
47127
|
+
const logger$2n = getLogger("table-chart");
|
|
47032
47128
|
function removeChart(editor, block) {
|
|
47033
47129
|
const tableTools = findExistsTableTools(editor, block);
|
|
47034
47130
|
if (tableTools) {
|
|
@@ -47113,7 +47209,7 @@ ${codeText}
|
|
|
47113
47209
|
chartContainer = createElement("div", ["editor-table-chart"], tableTools);
|
|
47114
47210
|
}
|
|
47115
47211
|
const parent = chartContainer;
|
|
47116
|
-
assert(logger$
|
|
47212
|
+
assert(logger$2n, parent, "no chart container");
|
|
47117
47213
|
const options = editor.getComponentOptions("table");
|
|
47118
47214
|
const cdn = (options == null ? void 0 : options.chartCdn) || "https://cdn.jsdelivr.net/npm/chart.js@2.9.4/dist/Chart.min.js";
|
|
47119
47215
|
try {
|
|
@@ -47157,7 +47253,7 @@ ${codeText}
|
|
|
47157
47253
|
chartContainer.chartObject = chartObject;
|
|
47158
47254
|
}
|
|
47159
47255
|
} catch (err) {
|
|
47160
|
-
logger$
|
|
47256
|
+
logger$2n.error(`failed to resolve chart cdn: ${JSON.stringify(err)}`);
|
|
47161
47257
|
}
|
|
47162
47258
|
}
|
|
47163
47259
|
async function updateChartCore(editor, block) {
|
|
@@ -47314,7 +47410,7 @@ ${codeText}
|
|
|
47314
47410
|
const height = document.documentElement.clientHeight;
|
|
47315
47411
|
return new DOMRect(left, top, width, height);
|
|
47316
47412
|
}
|
|
47317
|
-
const logger$
|
|
47413
|
+
const logger$2m = getLogger("scroll-bar-handle");
|
|
47318
47414
|
const BOTTOM_FLOAT_HEIGHT = 2;
|
|
47319
47415
|
function getScrollbarContainer(scrollContainer) {
|
|
47320
47416
|
const tools = getTools(scrollContainer);
|
|
@@ -47325,7 +47421,7 @@ ${codeText}
|
|
|
47325
47421
|
scrollbarContainer.style.minHeight = "10px";
|
|
47326
47422
|
}
|
|
47327
47423
|
}
|
|
47328
|
-
assert(logger$
|
|
47424
|
+
assert(logger$2m, scrollbarContainer instanceof HTMLDivElement, "invalid child for container tools");
|
|
47329
47425
|
if (!scrollbarContainer.firstElementChild) {
|
|
47330
47426
|
createElement("div", [], scrollbarContainer);
|
|
47331
47427
|
}
|
|
@@ -47341,7 +47437,7 @@ ${codeText}
|
|
|
47341
47437
|
fixScrollWrapRightBoundary(scrollCore, scrollContainer);
|
|
47342
47438
|
fixScrollWrapLeftBoundary(scrollCore, scrollContainer);
|
|
47343
47439
|
const overflowWidth = scrollWidth - clientWidth;
|
|
47344
|
-
assert(logger$
|
|
47440
|
+
assert(logger$2m, scrollbarContainer.firstElementChild instanceof HTMLDivElement, "invalid child for scroll bar");
|
|
47345
47441
|
scrollbarContainer.style.width = `${getSizeAsScale(scrollContainer, originWidth + maxRight - paddingLeft - paddingRight)}px`;
|
|
47346
47442
|
scrollbarContainer.firstElementChild.style.width = `${getSizeAsScale(scrollContainer, originWidth + maxRight + overflowWidth - paddingLeft - paddingRight)}px`;
|
|
47347
47443
|
}
|
|
@@ -47428,7 +47524,7 @@ ${codeText}
|
|
|
47428
47524
|
this.intersectionObserver.disconnect();
|
|
47429
47525
|
}
|
|
47430
47526
|
}
|
|
47431
|
-
const logger$
|
|
47527
|
+
const logger$2l = getLogger("container-scroll-shadow");
|
|
47432
47528
|
function setShadowBottom(shadow, scrollContainer, scrollWrap) {
|
|
47433
47529
|
const elem = shadow;
|
|
47434
47530
|
const contentRect = scrollContainer.getBoundingClientRect();
|
|
@@ -47447,22 +47543,22 @@ ${codeText}
|
|
|
47447
47543
|
}
|
|
47448
47544
|
function showLeftShadow(scrollContainer) {
|
|
47449
47545
|
const targetTools = getTools(scrollContainer);
|
|
47450
|
-
assert(logger$
|
|
47546
|
+
assert(logger$2l, targetTools, "no container tools");
|
|
47451
47547
|
let shadow = targetTools.querySelector(`.${SHADOW_CLASS.LEFT}`);
|
|
47452
47548
|
if (!shadow) {
|
|
47453
47549
|
const scrollWrap = getContainerScrollArea(scrollContainer);
|
|
47454
47550
|
const classes = [SHADOW_CLASS.COMMON, SHADOW_CLASS.LEFT];
|
|
47455
47551
|
shadow = createElement("div", classes, targetTools);
|
|
47456
|
-
assert(logger$
|
|
47552
|
+
assert(logger$2l, shadow instanceof HTMLDivElement, "invalid child for container tools");
|
|
47457
47553
|
setShadowBottom(shadow, scrollContainer, scrollWrap);
|
|
47458
47554
|
}
|
|
47459
|
-
assert(logger$
|
|
47555
|
+
assert(logger$2l, shadow instanceof HTMLElement, "invalid child for container tools");
|
|
47460
47556
|
const container = getContainer(scrollContainer);
|
|
47461
47557
|
const containerRect = container.getBoundingClientRect();
|
|
47462
47558
|
const scrollContainerRect = scrollContainer.getBoundingClientRect();
|
|
47463
47559
|
shadow.style.left = `${getSizeAsScale(scrollContainer, scrollContainerRect.left - containerRect.left)}px`;
|
|
47464
47560
|
const leftRest = getElementScrollSize(scrollContainer).scrollLeft;
|
|
47465
|
-
assert(logger$
|
|
47561
|
+
assert(logger$2l, shadow instanceof HTMLDivElement, "invalid child for container tools");
|
|
47466
47562
|
setShadowWidth(shadow, leftRest);
|
|
47467
47563
|
addClass(shadow, SHADOW_CLASS.ACTIVE);
|
|
47468
47564
|
}
|
|
@@ -47473,17 +47569,17 @@ ${codeText}
|
|
|
47473
47569
|
const scrollWrap = getContainerScrollArea(scrollContainer);
|
|
47474
47570
|
const classes = [SHADOW_CLASS.COMMON, SHADOW_CLASS.RIGHT];
|
|
47475
47571
|
shadow = createElement("div", classes, tools);
|
|
47476
|
-
assert(logger$
|
|
47572
|
+
assert(logger$2l, shadow instanceof HTMLDivElement, "no div, create shadow failed");
|
|
47477
47573
|
setShadowBottom(shadow, scrollContainer, scrollWrap);
|
|
47478
47574
|
}
|
|
47479
|
-
assert(logger$
|
|
47575
|
+
assert(logger$2l, shadow instanceof HTMLElement, "");
|
|
47480
47576
|
const container = getContainer(scrollContainer);
|
|
47481
47577
|
const containerRect = container.getBoundingClientRect();
|
|
47482
47578
|
const scrollContainerRect = scrollContainer.getBoundingClientRect();
|
|
47483
47579
|
shadow.style.right = `${getSizeAsScale(scrollContainer, containerRect.right - scrollContainerRect.right)}px`;
|
|
47484
47580
|
const { scrollWidth, scrollLeft, clientWidth } = getElementScrollSize(scrollContainer);
|
|
47485
47581
|
const rightRest = scrollWidth - scrollLeft - clientWidth;
|
|
47486
|
-
assert(logger$
|
|
47582
|
+
assert(logger$2l, shadow instanceof HTMLDivElement, "no shadow element");
|
|
47487
47583
|
setShadowWidth(shadow, rightRest);
|
|
47488
47584
|
addClass(shadow, SHADOW_CLASS.ACTIVE);
|
|
47489
47585
|
}
|
|
@@ -47556,12 +47652,12 @@ ${codeText}
|
|
|
47556
47652
|
this.resizeObserver.disconnect();
|
|
47557
47653
|
}
|
|
47558
47654
|
}
|
|
47559
|
-
const logger$
|
|
47655
|
+
const logger$2k = getLogger("container-scroll-observer");
|
|
47560
47656
|
class ContainerScrollObserver {
|
|
47561
47657
|
constructor(scrollCore, callback) {
|
|
47562
47658
|
__publicField(this, "handleContentScroll", (e2) => {
|
|
47563
47659
|
const scrollContainer = e2.target;
|
|
47564
|
-
assert(logger$
|
|
47660
|
+
assert(logger$2k, scrollContainer instanceof Element, "invalid target for scroll event");
|
|
47565
47661
|
const scrollbarContainer = getScrollbarContainer(scrollContainer);
|
|
47566
47662
|
scrollbarContainer.removeEventListener("scroll", this.handleScroll);
|
|
47567
47663
|
const needFixScrollbarContainer = true;
|
|
@@ -47572,7 +47668,7 @@ ${codeText}
|
|
|
47572
47668
|
});
|
|
47573
47669
|
__publicField(this, "handleScroll", (e2) => {
|
|
47574
47670
|
const scrollbarContainer = e2.target;
|
|
47575
|
-
assert(logger$
|
|
47671
|
+
assert(logger$2k, scrollbarContainer instanceof HTMLElement, "");
|
|
47576
47672
|
const scrollLeft = scrollbarContainer.scrollLeft;
|
|
47577
47673
|
const needFixScrollbarContainer = false;
|
|
47578
47674
|
const scrollContainer = getScrollContainerByScrollBar(scrollbarContainer);
|
|
@@ -47652,7 +47748,7 @@ ${codeText}
|
|
|
47652
47748
|
this.scrollContainers.clear();
|
|
47653
47749
|
}
|
|
47654
47750
|
}
|
|
47655
|
-
const logger$
|
|
47751
|
+
const logger$2j = getLogger("scroll-wrap-resize-observer");
|
|
47656
47752
|
class ScrollWrapResizeObserve {
|
|
47657
47753
|
constructor(scrollCore) {
|
|
47658
47754
|
__publicField(this, "resizeObserver");
|
|
@@ -47668,7 +47764,7 @@ ${codeText}
|
|
|
47668
47764
|
});
|
|
47669
47765
|
__publicField(this, "handleScrollWrapResizeEntry", (entry) => {
|
|
47670
47766
|
const scrollWrap = entry.target;
|
|
47671
|
-
assert(logger$
|
|
47767
|
+
assert(logger$2j, scrollWrap instanceof HTMLElement, "invalid target for observer entry");
|
|
47672
47768
|
const scrollContainer = getScrollContainer(scrollWrap);
|
|
47673
47769
|
resetScrollbar(this.scrollCore, scrollWrap);
|
|
47674
47770
|
resetScrollWrapShadow(scrollContainer);
|
|
@@ -47873,7 +47969,7 @@ ${codeText}
|
|
|
47873
47969
|
window.removeEventListener("scroll", this.handleWindowEffect);
|
|
47874
47970
|
}
|
|
47875
47971
|
}
|
|
47876
|
-
const logger$
|
|
47972
|
+
const logger$2i = getLogger("scroll-container");
|
|
47877
47973
|
const rootScrollMap = /* @__PURE__ */ new Map();
|
|
47878
47974
|
class ScrollContainer extends tinyTypedEmitter.TypedEmitter {
|
|
47879
47975
|
constructor() {
|
|
@@ -47921,11 +48017,11 @@ ${codeText}
|
|
|
47921
48017
|
return this.scrollContainerElement;
|
|
47922
48018
|
}
|
|
47923
48019
|
get contentElement() {
|
|
47924
|
-
assert(logger$
|
|
48020
|
+
assert(logger$2i, this.scrollContainerElement, "scrollContainerElement cannot be undefined");
|
|
47925
48021
|
return getContainerScrollArea(this.scrollContainerElement);
|
|
47926
48022
|
}
|
|
47927
48023
|
get scrollOptions() {
|
|
47928
|
-
assert(logger$
|
|
48024
|
+
assert(logger$2i, this.options, "options cannot be undefined");
|
|
47929
48025
|
return { ...this.options };
|
|
47930
48026
|
}
|
|
47931
48027
|
handleBaseListenerDestroy(baseListener) {
|
|
@@ -47949,7 +48045,7 @@ ${codeText}
|
|
|
47949
48045
|
function createScrollContainer() {
|
|
47950
48046
|
return new ScrollContainer();
|
|
47951
48047
|
}
|
|
47952
|
-
const logger$
|
|
48048
|
+
const logger$2h = getLogger("column-width");
|
|
47953
48049
|
function setColumnWidth(table, colIndex, width) {
|
|
47954
48050
|
const col = getTableCol(table, colIndex);
|
|
47955
48051
|
col.style.width = `${width}px`;
|
|
@@ -47970,7 +48066,7 @@ ${codeText}
|
|
|
47970
48066
|
cellRightOffsets[colIndex] = cell.cell.getBoundingClientRect().right - left;
|
|
47971
48067
|
}
|
|
47972
48068
|
});
|
|
47973
|
-
logger$
|
|
48069
|
+
logger$2h.debug(`cellRightOffsets1: ${cellRightOffsets.join()}`);
|
|
47974
48070
|
for (let col = 0; col < cellRightOffsets.length; col++) {
|
|
47975
48071
|
const offset = cellRightOffsets[col];
|
|
47976
48072
|
if (offset === -1 || col === 0) {
|
|
@@ -47990,7 +48086,7 @@ ${codeText}
|
|
|
47990
48086
|
cellRightOffsets[i] = prevOffset + averageWidth * (i - prevCol);
|
|
47991
48087
|
}
|
|
47992
48088
|
}
|
|
47993
|
-
logger$
|
|
48089
|
+
logger$2h.debug(`cellRightOffsets2: ${cellRightOffsets.join()}`);
|
|
47994
48090
|
const result = [];
|
|
47995
48091
|
let prev = 0;
|
|
47996
48092
|
for (let col = 0; col < cellRightOffsets.length; col++) {
|
|
@@ -47998,7 +48094,7 @@ ${codeText}
|
|
|
47998
48094
|
result.push(offset - prev);
|
|
47999
48095
|
prev = offset;
|
|
48000
48096
|
}
|
|
48001
|
-
logger$
|
|
48097
|
+
logger$2h.debug(`widths: ${result.join()}`);
|
|
48002
48098
|
return result;
|
|
48003
48099
|
}
|
|
48004
48100
|
function getTableColumnWidths(table) {
|
|
@@ -48006,72 +48102,6 @@ ${codeText}
|
|
|
48006
48102
|
const widths = tableCols.map((col) => col.getBoundingClientRect().width || Number.parseInt(col.style.width, 10));
|
|
48007
48103
|
return widths;
|
|
48008
48104
|
}
|
|
48009
|
-
const logger$2h = getLogger("table-resize-gripper");
|
|
48010
|
-
const GRIPPER_SIZE = 7;
|
|
48011
|
-
const GRIPPER_SIZE_HALF = (GRIPPER_SIZE - 1) / 2;
|
|
48012
|
-
const CONTAINER_CELL_DELTA = 3;
|
|
48013
|
-
function getCellFromRightBorder(table, x, y) {
|
|
48014
|
-
const { rows } = table;
|
|
48015
|
-
for (let i = 0; i < rows.length; i++) {
|
|
48016
|
-
const row = rows[i];
|
|
48017
|
-
const cells = Array.from(row.cells);
|
|
48018
|
-
for (let j = 0; j < cells.length; j++) {
|
|
48019
|
-
const cell = cells[j];
|
|
48020
|
-
const rect = cell.getBoundingClientRect();
|
|
48021
|
-
const pos = Math.round(rect.right);
|
|
48022
|
-
if (Math.abs(x - pos) <= GRIPPER_SIZE_HALF && rect.top <= y && y <= rect.bottom) {
|
|
48023
|
-
return cell;
|
|
48024
|
-
}
|
|
48025
|
-
}
|
|
48026
|
-
}
|
|
48027
|
-
return null;
|
|
48028
|
-
}
|
|
48029
|
-
function editorHasExistsResizeGripper(editor) {
|
|
48030
|
-
return !!editor.rootContainer.querySelector(".table-resize-gripper");
|
|
48031
|
-
}
|
|
48032
|
-
function getExistsResizeGripper$1(editor, block) {
|
|
48033
|
-
const tools = getTableTools(editor, block);
|
|
48034
|
-
const gripper = tools.querySelector(".table-resize-gripper");
|
|
48035
|
-
return gripper;
|
|
48036
|
-
}
|
|
48037
|
-
function createResizeGripper$2(editor, block) {
|
|
48038
|
-
const exists = getExistsResizeGripper$1(editor, block);
|
|
48039
|
-
assert(logger$2h, !exists, "resize gripper has already exists");
|
|
48040
|
-
const tools = getTableTools(editor, block);
|
|
48041
|
-
const gripper = createElement("div", ["table-resize-gripper", "table-indicator"], tools);
|
|
48042
|
-
createElement("div", ["table-resize-gripper-indicator"], gripper);
|
|
48043
|
-
return gripper;
|
|
48044
|
-
}
|
|
48045
|
-
function updateResizeGripper$1(editor, block, cell) {
|
|
48046
|
-
let gripper = getExistsResizeGripper$1(editor, block);
|
|
48047
|
-
if (!gripper) {
|
|
48048
|
-
gripper = createResizeGripper$2(editor, block);
|
|
48049
|
-
}
|
|
48050
|
-
const table = getBlockTable(block);
|
|
48051
|
-
const tableRect = table.getBoundingClientRect();
|
|
48052
|
-
const cellRect = cell.getBoundingClientRect();
|
|
48053
|
-
const top = 0;
|
|
48054
|
-
const height = tableRect.height;
|
|
48055
|
-
const scrollContentRect = editor.getCustom(getTableScrollKey(block)).contentElement.getBoundingClientRect();
|
|
48056
|
-
const left = cellRect.right - scrollContentRect.left;
|
|
48057
|
-
gripper.style.left = `${left - GRIPPER_SIZE_HALF - TABLE_BAR_WIDTH - INSERT_BUTTON_SIZE}px`;
|
|
48058
|
-
gripper.style.top = `${top}px`;
|
|
48059
|
-
gripper.style.height = `${height}px`;
|
|
48060
|
-
gripper.style.width = `${GRIPPER_SIZE}px`;
|
|
48061
|
-
}
|
|
48062
|
-
function removeAllResizeGripper(editor) {
|
|
48063
|
-
editor.rootContainer.querySelectorAll(".table-resize-gripper").forEach((gripper) => {
|
|
48064
|
-
gripper.remove();
|
|
48065
|
-
});
|
|
48066
|
-
}
|
|
48067
|
-
function setTableColumnWidths(editor, block, colsWidth) {
|
|
48068
|
-
const oldData = editor.getBlockData(block);
|
|
48069
|
-
const newData = {
|
|
48070
|
-
...oldData,
|
|
48071
|
-
colsWidth
|
|
48072
|
-
};
|
|
48073
|
-
editor.updateBlockData(block, newData, void 0, { noScroll: true });
|
|
48074
|
-
}
|
|
48075
48105
|
function getTableResizeMinX(editor, draggingRefCell, table, x) {
|
|
48076
48106
|
const cell = draggingRefCell;
|
|
48077
48107
|
const grid = TableGrid.fromTable(table);
|
|
@@ -54750,7 +54780,7 @@ ${codeText}
|
|
|
54750
54780
|
};
|
|
54751
54781
|
return { blockData };
|
|
54752
54782
|
}
|
|
54753
|
-
function getOptions$
|
|
54783
|
+
function getOptions$9(editor) {
|
|
54754
54784
|
return {
|
|
54755
54785
|
name: "Mathjax"
|
|
54756
54786
|
};
|
|
@@ -54782,7 +54812,7 @@ $$${mathData.mathjaxText}$$
|
|
|
54782
54812
|
const MathjaxEmbed = {
|
|
54783
54813
|
embedType: "math",
|
|
54784
54814
|
createEmbedContent: createEmbedContent$9,
|
|
54785
|
-
getOptions: getOptions$
|
|
54815
|
+
getOptions: getOptions$9,
|
|
54786
54816
|
convertFrom: convertFrom$7,
|
|
54787
54817
|
handleDeleteBlock: handleDeleteBlock$7,
|
|
54788
54818
|
convertTo: convertTo$g,
|
|
@@ -65252,7 +65282,7 @@ $$${mathData.mathjaxText}$$
|
|
|
65252
65282
|
editor.focus();
|
|
65253
65283
|
return editor.insertBlock(options.containerId, options.blockIndex, blockData, createBlockSimpleRange(editor, focusBlockId, 0));
|
|
65254
65284
|
}
|
|
65255
|
-
function getOptions$
|
|
65285
|
+
function getOptions$8(editor) {
|
|
65256
65286
|
return {
|
|
65257
65287
|
name: "CodeBlock",
|
|
65258
65288
|
insertBlockCommandItems: [
|
|
@@ -65317,7 +65347,7 @@ ${codeText}
|
|
|
65317
65347
|
getSelectedContainers: getSelectedContainers$2,
|
|
65318
65348
|
convertFrom: convertToCode,
|
|
65319
65349
|
handleBlockElementUpdated,
|
|
65320
|
-
getOptions: getOptions$
|
|
65350
|
+
getOptions: getOptions$8,
|
|
65321
65351
|
getBlockProperties: getBlockProperties$a,
|
|
65322
65352
|
convertTo: convertTo$e,
|
|
65323
65353
|
handleDeleteBlock: handleDeleteBlock$6
|
|
@@ -68294,7 +68324,7 @@ ${codeText}
|
|
|
68294
68324
|
abstract: `${i18n$1.t("image.abstract")}`
|
|
68295
68325
|
};
|
|
68296
68326
|
};
|
|
68297
|
-
function getOptions$
|
|
68327
|
+
function getOptions$7() {
|
|
68298
68328
|
return {
|
|
68299
68329
|
name: "Image",
|
|
68300
68330
|
insertEmbedCommandItems: [{
|
|
@@ -68394,7 +68424,7 @@ ${codeText}
|
|
|
68394
68424
|
convertTo: convertTo$d,
|
|
68395
68425
|
convertFrom: convertFrom$6,
|
|
68396
68426
|
getBlockProperties: getBlockProperties$9,
|
|
68397
|
-
getOptions: getOptions$
|
|
68427
|
+
getOptions: getOptions$7,
|
|
68398
68428
|
handleDrop: handleDrop$1,
|
|
68399
68429
|
handleDropOver: handleDropOver$1,
|
|
68400
68430
|
handleDeleteBlock: handleDeleteBlock$5
|
|
@@ -71364,7 +71394,7 @@ ${codeText}
|
|
|
71364
71394
|
elem.remove();
|
|
71365
71395
|
});
|
|
71366
71396
|
editor.domEvents.removeEventListener(getBlockContent(tableBlock), "scroll", handleTableScroll);
|
|
71367
|
-
editor.
|
|
71397
|
+
editor.removeListener("afterClearSelection", handleAfterClearSelection);
|
|
71368
71398
|
}
|
|
71369
71399
|
function getTopBorderHeight(editor, tableBlock) {
|
|
71370
71400
|
assert(logger$13, isTableBlock(tableBlock), "invalid table block");
|
|
@@ -73211,7 +73241,7 @@ ${codeText}
|
|
|
73211
73241
|
}
|
|
73212
73242
|
return createEmptyTableDataByFirstRowText(editor, editor.getBlockString(srcBlock).trim());
|
|
73213
73243
|
}
|
|
73214
|
-
function getOptions$
|
|
73244
|
+
function getOptions$6(editor) {
|
|
73215
73245
|
return {
|
|
73216
73246
|
name: "TableBlock",
|
|
73217
73247
|
insertBlockCommandItems: [{
|
|
@@ -73288,7 +73318,7 @@ ${codeText}
|
|
|
73288
73318
|
adjustSelectionPos,
|
|
73289
73319
|
getClientRects,
|
|
73290
73320
|
selectionToDoc,
|
|
73291
|
-
getOptions: getOptions$
|
|
73321
|
+
getOptions: getOptions$6,
|
|
73292
73322
|
getTextToolbarReferenceClient: getTextToolbarReferenceClient$1,
|
|
73293
73323
|
handleUpdateBlock: handleUpdateBlock$5,
|
|
73294
73324
|
handleDeleteBlock: handleDeleteBlock$4,
|
|
@@ -73324,6 +73354,7 @@ ${codeText}
|
|
|
73324
73354
|
splitCell: "\u62C6\u5206\u5355\u5143\u683C",
|
|
73325
73355
|
tableConfigKey: "\u8868\u683C\u8BBE\u7F6E",
|
|
73326
73356
|
deleteTable: "\u5220\u9664\u8868\u683C",
|
|
73357
|
+
adjustColumnWidthsEvenly: "\u5E73\u5747\u5206\u914D\u5217\u5BBD",
|
|
73327
73358
|
insertCol: "\u63D2\u5165\u5217",
|
|
73328
73359
|
insertRow: "\u63D2\u5165\u884C",
|
|
73329
73360
|
deleteCol: "\u5220\u9664\u5217",
|
|
@@ -73355,6 +73386,7 @@ ${codeText}
|
|
|
73355
73386
|
splitCell: "Split cell",
|
|
73356
73387
|
tableConfigKey: "Table settings",
|
|
73357
73388
|
deleteTable: "Delete table",
|
|
73389
|
+
adjustColumnWidthsEvenly: "Adjust column widths evenly",
|
|
73358
73390
|
insertCol: "Insert column",
|
|
73359
73391
|
insertRow: "Insert row",
|
|
73360
73392
|
deleteCol: "Delete column",
|
|
@@ -73386,6 +73418,7 @@ ${codeText}
|
|
|
73386
73418
|
splitCell: "\u30BB\u30EB\u306E\u7D50\u5408\u3092\u89E3\u9664",
|
|
73387
73419
|
tableConfigKey: "\u30C6\u30FC\u30D6\u30EB\u8A2D\u5B9A",
|
|
73388
73420
|
deleteTable: "\u30C6\u30FC\u30D6\u30EB\u3092\u524A\u9664",
|
|
73421
|
+
adjustColumnWidthsEvenly: "\u5217\u5E45\u3092\u5747\u7B49\u306B\u8ABF\u6574",
|
|
73389
73422
|
insertCol: "\u5217\u3092\u633F\u5165",
|
|
73390
73423
|
insertRow: "\u884C\u3092\u633F\u5165",
|
|
73391
73424
|
deleteCol: "\u5217\u3092\u524A\u9664",
|
|
@@ -82044,24 +82077,45 @@ ${docStr}
|
|
|
82044
82077
|
};
|
|
82045
82078
|
return { blockData };
|
|
82046
82079
|
}
|
|
82080
|
+
function getOptions$5() {
|
|
82081
|
+
return {
|
|
82082
|
+
name: "toc",
|
|
82083
|
+
insertEmbedCommandItems: [{
|
|
82084
|
+
id: "insert-toc",
|
|
82085
|
+
name: i18n$1.t("toc.name"),
|
|
82086
|
+
icon: DividingLineIcon,
|
|
82087
|
+
order: 510,
|
|
82088
|
+
group: "common",
|
|
82089
|
+
subText: getShortcutById("insert-toc")
|
|
82090
|
+
}],
|
|
82091
|
+
handleInsertEmptyEmbed: async (editor, options) => {
|
|
82092
|
+
const { containerId, blockIndex } = options;
|
|
82093
|
+
return editor.insertEmbed(containerId, blockIndex, "toc", {});
|
|
82094
|
+
}
|
|
82095
|
+
};
|
|
82096
|
+
}
|
|
82047
82097
|
const TocEmbed = {
|
|
82048
82098
|
embedType: "toc",
|
|
82049
82099
|
createEmbedContent: createEmbedContent$6,
|
|
82050
82100
|
convertTo: convertTo$8,
|
|
82051
|
-
convertFrom: convertFrom$4
|
|
82101
|
+
convertFrom: convertFrom$4,
|
|
82102
|
+
getOptions: getOptions$5
|
|
82052
82103
|
};
|
|
82053
82104
|
const zhCN$c = {
|
|
82054
82105
|
toc: {
|
|
82106
|
+
name: "\u6807\u9898\u76EE\u5F55",
|
|
82055
82107
|
empty: "No Toc"
|
|
82056
82108
|
}
|
|
82057
82109
|
};
|
|
82058
82110
|
const enUS$c = {
|
|
82059
82111
|
toc: {
|
|
82112
|
+
name: "Toc",
|
|
82060
82113
|
empty: "No Toc"
|
|
82061
82114
|
}
|
|
82062
82115
|
};
|
|
82063
82116
|
const jaJP$c = {
|
|
82064
82117
|
toc: {
|
|
82118
|
+
name: "Toc",
|
|
82065
82119
|
empty: "No Toc"
|
|
82066
82120
|
}
|
|
82067
82121
|
};
|
|
@@ -84007,13 +84061,17 @@ ${docStr}
|
|
|
84007
84061
|
var _a;
|
|
84008
84062
|
const header = this.block.querySelector(".embed-graph-header");
|
|
84009
84063
|
assert(logger$l, header, "header does not exist");
|
|
84010
|
-
|
|
84011
|
-
|
|
84012
|
-
|
|
84013
|
-
|
|
84014
|
-
|
|
84015
|
-
|
|
84016
|
-
|
|
84064
|
+
try {
|
|
84065
|
+
const data2 = this.editor.getBlockData(this.block);
|
|
84066
|
+
const { flex = DEFAULT_FLEX, code, src, view } = this.getGraphData(data2);
|
|
84067
|
+
header.style.display = editor.readonly || clientType.isMobile ? "none" : "flex";
|
|
84068
|
+
const realView = this.getRealView(view);
|
|
84069
|
+
(_a = this.viewSelect) == null ? void 0 : _a.setSelectedView(realView);
|
|
84070
|
+
this.updateLayout(realView, flex);
|
|
84071
|
+
this.updateDraw(src, code);
|
|
84072
|
+
} catch (err) {
|
|
84073
|
+
logger$l.debug(`handleReadonlyChanged error: ${err}`);
|
|
84074
|
+
}
|
|
84017
84075
|
});
|
|
84018
84076
|
__publicField(this, "updateLayoutData", () => {
|
|
84019
84077
|
var _a;
|
|
@@ -92604,7 +92662,7 @@ ${data2.plantumlText}
|
|
|
92604
92662
|
}
|
|
92605
92663
|
}
|
|
92606
92664
|
});
|
|
92607
|
-
editor.version = "2.8.
|
|
92665
|
+
editor.version = "2.8.14-beta.1";
|
|
92608
92666
|
return editor;
|
|
92609
92667
|
}
|
|
92610
92668
|
function isDoc(doc2) {
|
|
@@ -92717,7 +92775,7 @@ ${data2.plantumlText}
|
|
|
92717
92775
|
}
|
|
92718
92776
|
});
|
|
92719
92777
|
OnesEditorToolbar.register(editor);
|
|
92720
|
-
editor.version = "2.8.
|
|
92778
|
+
editor.version = "2.8.14-beta.1";
|
|
92721
92779
|
return editor;
|
|
92722
92780
|
}
|
|
92723
92781
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -138494,6 +138552,7 @@ ${data2.plantumlText}
|
|
|
138494
138552
|
exports2.AddCommentToOldDocCommandProvider = AddCommentToOldDocCommandProvider;
|
|
138495
138553
|
exports2.AddEmojiIcon = AddEmojiIcon;
|
|
138496
138554
|
exports2.AddIcon = AddIcon;
|
|
138555
|
+
exports2.AdjustWidthIcon = AdjustWidthIcon;
|
|
138497
138556
|
exports2.AlertDialog = AlertDialog;
|
|
138498
138557
|
exports2.AlertEmojiIcon = alterEmoji;
|
|
138499
138558
|
exports2.AlignCenterIcon = AlignCenterIcon;
|