@ones-editor/editor 2.8.14-beta.6 → 2.8.15-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/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/@ones-editor/webpage-embed/src/webpage-embed/url-analyzer/design/figma.d.ts +5 -0
- package/@ones-editor/webpage-embed/src/webpage-embed/url-analyzer/design/modao.d.ts +5 -0
- package/@ones-editor/webpage-embed/src/webpage-embed/url-analyzer/doc/airtable.d.ts +5 -0
- package/@ones-editor/webpage-embed/src/webpage-embed/url-analyzer/error.d.ts +3 -0
- package/@ones-editor/webpage-embed/src/webpage-embed/url-analyzer/media/bilibili.d.ts +5 -0
- package/@ones-editor/webpage-embed/src/webpage-embed/url-analyzer/media/qqvideo.d.ts +5 -0
- package/@ones-editor/webpage-embed/src/webpage-embed/url-analyzer/media/youku.d.ts +5 -0
- package/@ones-editor/webpage-embed/src/webpage-embed/url-analyzer/media/youtube.d.ts +5 -0
- package/@ones-editor/webpage-embed/src/webpage-embed/url-analyzer/service.d.ts +8 -0
- package/@ones-editor/webpage-embed/src/webpage-embed/url-analyzer/types.d.ts +8 -0
- package/dist/index.js +388 -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
|
@@ -8296,7 +8296,7 @@ div[data-command-bar-id=layout-column-toolbar] .tippy-box .tippy-content button.
|
|
|
8296
8296
|
}
|
|
8297
8297
|
.embed-block[data-embed-type=webpage] > div[data-type=block-content] > .editor-embed .editor-preview-iframe {
|
|
8298
8298
|
width: 100%;
|
|
8299
|
-
max-height:
|
|
8299
|
+
max-height: 1000px;
|
|
8300
8300
|
height: 100%;
|
|
8301
8301
|
border: none;
|
|
8302
8302
|
position: relative;
|
|
@@ -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
|
}
|
|
@@ -40623,8 +40623,6 @@ ${codeText}
|
|
|
40623
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';
|
|
40624
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';
|
|
40625
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="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
40626
|
const index$f = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
40629
40627
|
__proto__: null,
|
|
40630
40628
|
TableEditIcon,
|
|
@@ -40752,9 +40750,7 @@ ${codeText}
|
|
|
40752
40750
|
SearchIcon,
|
|
40753
40751
|
CalloutIcon: CalloutIcon$1,
|
|
40754
40752
|
LoadingCircleIcon,
|
|
40755
|
-
TextGroupIcon
|
|
40756
|
-
AdjustWidthIcon,
|
|
40757
|
-
TocIcon
|
|
40753
|
+
TextGroupIcon
|
|
40758
40754
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
40759
40755
|
function createLoading() {
|
|
40760
40756
|
const loading2 = createElement("span", ["editor-loading-icon"], null);
|
|
@@ -44008,9 +44004,6 @@ ${codeText}
|
|
|
44008
44004
|
"insert-emoji": {
|
|
44009
44005
|
shortcut: "/emoji"
|
|
44010
44006
|
},
|
|
44011
|
-
"insert-toc": {
|
|
44012
|
-
shortcut: "/toc"
|
|
44013
|
-
},
|
|
44014
44007
|
...fontShortCuts()
|
|
44015
44008
|
};
|
|
44016
44009
|
function getShortcutById(id) {
|
|
@@ -46560,183 +46553,6 @@ ${codeText}
|
|
|
46560
46553
|
editor.deleteChildContainers(deletedContainers);
|
|
46561
46554
|
});
|
|
46562
46555
|
}
|
|
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
46556
|
const TABLE_COMMAND_GROUP_INDEX = 10;
|
|
46741
46557
|
const TableCommands = [
|
|
46742
46558
|
"table/merge-cells",
|
|
@@ -46745,8 +46561,7 @@ ${codeText}
|
|
|
46745
46561
|
"table/insert-row",
|
|
46746
46562
|
"table/delete-rows",
|
|
46747
46563
|
"table/delete-columns",
|
|
46748
|
-
"table/delete"
|
|
46749
|
-
"table/adjust-column-widths-evenly"
|
|
46564
|
+
"table/delete"
|
|
46750
46565
|
];
|
|
46751
46566
|
class TableBlockCommandProvider {
|
|
46752
46567
|
constructor() {
|
|
@@ -46758,8 +46573,6 @@ ${codeText}
|
|
|
46758
46573
|
return [];
|
|
46759
46574
|
}
|
|
46760
46575
|
const commands = [];
|
|
46761
|
-
const deleteColumns2 = canDeleteColumns(editor, block, range);
|
|
46762
|
-
const deleteRows2 = canDeleteRows(editor, block, range);
|
|
46763
46576
|
if (canMergeCells(editor, block, range)) {
|
|
46764
46577
|
commands.push({
|
|
46765
46578
|
id: "table/merge-cells",
|
|
@@ -46774,6 +46587,8 @@ ${codeText}
|
|
|
46774
46587
|
icon: SplitCellIcon
|
|
46775
46588
|
});
|
|
46776
46589
|
}
|
|
46590
|
+
const deleteColumns2 = canDeleteColumns(editor, block, range);
|
|
46591
|
+
const deleteRows2 = canDeleteRows(editor, block, range);
|
|
46777
46592
|
if (deleteColumns2 && deleteRows2) {
|
|
46778
46593
|
commands.push({
|
|
46779
46594
|
id: "table/delete",
|
|
@@ -46781,14 +46596,6 @@ ${codeText}
|
|
|
46781
46596
|
icon: DeleteTableIcon
|
|
46782
46597
|
});
|
|
46783
46598
|
}
|
|
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
46599
|
return commands;
|
|
46793
46600
|
}
|
|
46794
46601
|
executeCommand(editor, block, range, command, params, result) {
|
|
@@ -46818,13 +46625,19 @@ ${codeText}
|
|
|
46818
46625
|
editor.deleteBlock(block);
|
|
46819
46626
|
return true;
|
|
46820
46627
|
}
|
|
46821
|
-
if (command.id === "table/adjust-column-widths-evenly") {
|
|
46822
|
-
adjustColumnWidthsEvenly(editor, block, range);
|
|
46823
|
-
return true;
|
|
46824
|
-
}
|
|
46825
46628
|
return false;
|
|
46826
46629
|
}
|
|
46827
46630
|
}
|
|
46631
|
+
var TABLE_CLASS = /* @__PURE__ */ ((TABLE_CLASS2) => {
|
|
46632
|
+
TABLE_CLASS2["COL_TITLE_TABLE"] = "col-title-table";
|
|
46633
|
+
TABLE_CLASS2["COL_TITLE_ITEM"] = "col-title-item";
|
|
46634
|
+
TABLE_CLASS2["STRIPE_STYLE_TABLE"] = "stripe-style-table";
|
|
46635
|
+
TABLE_CLASS2["NO_BORDER"] = "table-no-border";
|
|
46636
|
+
return TABLE_CLASS2;
|
|
46637
|
+
})(TABLE_CLASS || {});
|
|
46638
|
+
const TABLE_BAR_WIDTH = 6;
|
|
46639
|
+
const INSERT_BUTTON_SIZE = 20;
|
|
46640
|
+
const TABLE_CELL_MENU_BUTTON_CLASS = "table-cell-menu-btn";
|
|
46828
46641
|
function setColTitle(editor, tableBlock) {
|
|
46829
46642
|
if (!editor.isBlockWritable(tableBlock)) {
|
|
46830
46643
|
return;
|
|
@@ -46902,26 +46715,26 @@ ${codeText}
|
|
|
46902
46715
|
};
|
|
46903
46716
|
editor.updateBlockData(tableBlock, newBlockData);
|
|
46904
46717
|
}
|
|
46905
|
-
const logger$
|
|
46718
|
+
const logger$2r = getLogger("table-cell-dom");
|
|
46906
46719
|
function getCellElementByChildBlockId(editor, tableBlock, blockId) {
|
|
46907
46720
|
let blockElement = editor.getBlockById(blockId);
|
|
46908
46721
|
while (blockElement) {
|
|
46909
46722
|
const cell = blockElement.closest("td");
|
|
46910
|
-
assert(logger$
|
|
46723
|
+
assert(logger$2r, cell, "no parent cell");
|
|
46911
46724
|
const cellParentBlock = getParentBlock(cell);
|
|
46912
|
-
assert(logger$
|
|
46725
|
+
assert(logger$2r, cellParentBlock, "no parent block");
|
|
46913
46726
|
if (cellParentBlock === tableBlock) {
|
|
46914
46727
|
return cell;
|
|
46915
46728
|
}
|
|
46916
46729
|
blockElement = cellParentBlock;
|
|
46917
46730
|
}
|
|
46918
|
-
assert(logger$
|
|
46731
|
+
assert(logger$2r, false, "filed to get cell by child block id");
|
|
46919
46732
|
return null;
|
|
46920
46733
|
}
|
|
46921
46734
|
function createComplexPosFromBlockPos(editor, tableBlock, blockPosition) {
|
|
46922
46735
|
const blockElement = editor.getBlockById(blockPosition.blockId);
|
|
46923
46736
|
if (blockElement === tableBlock && !blockPosition.isSimple()) {
|
|
46924
|
-
assert(logger$
|
|
46737
|
+
assert(logger$2r, blockPosition.childContainerId, "block position must have childContainerId attribute");
|
|
46925
46738
|
return blockPosition;
|
|
46926
46739
|
}
|
|
46927
46740
|
const cellElement = getCellElementByChildBlockId(editor, tableBlock, blockPosition.blockId);
|
|
@@ -46935,12 +46748,12 @@ ${codeText}
|
|
|
46935
46748
|
return getTableSelectionRange(tableBlock, start, end);
|
|
46936
46749
|
}
|
|
46937
46750
|
function updateBarsDangerStatus(editor, tableBlock, selectedRows, selectedColumns) {
|
|
46938
|
-
assert(logger$
|
|
46751
|
+
assert(logger$2r, isTableBlock(tableBlock), "invalid table block");
|
|
46939
46752
|
const tools = getTableTools(editor, tableBlock);
|
|
46940
46753
|
const blockTools = getBlockTools(tableBlock);
|
|
46941
46754
|
const updateTop = () => {
|
|
46942
46755
|
const exists = tools.querySelector(".table-border-bar-container.top");
|
|
46943
|
-
assert(logger$
|
|
46756
|
+
assert(logger$2r, exists, "no top border bar container");
|
|
46944
46757
|
const cells = exists.querySelectorAll(".table-border-bar-cell.top");
|
|
46945
46758
|
cells.forEach((cell) => {
|
|
46946
46759
|
const colIndex = parseInt(cell.getAttribute("data-top-index") || "0", 10);
|
|
@@ -46953,7 +46766,7 @@ ${codeText}
|
|
|
46953
46766
|
};
|
|
46954
46767
|
const updateLeft = () => {
|
|
46955
46768
|
const left = blockTools.querySelector(".table-border-bar-container.left");
|
|
46956
|
-
assert(logger$
|
|
46769
|
+
assert(logger$2r, left, "no left border bar container");
|
|
46957
46770
|
const cells = left.querySelectorAll(".table-border-bar-cell.left");
|
|
46958
46771
|
cells.forEach((cell) => {
|
|
46959
46772
|
const rowIndex = parseInt(cell.getAttribute("data-left-index") || "0", 10);
|
|
@@ -46989,7 +46802,7 @@ ${codeText}
|
|
|
46989
46802
|
}
|
|
46990
46803
|
}
|
|
46991
46804
|
} catch (error2) {
|
|
46992
|
-
logger$
|
|
46805
|
+
logger$2r.error("update cells danger status failed: ", error2.message);
|
|
46993
46806
|
}
|
|
46994
46807
|
}
|
|
46995
46808
|
function updateCellBarsDangerStatus(editor, tableBlock, isDanger = true, isCol) {
|
|
@@ -47012,7 +46825,7 @@ ${codeText}
|
|
|
47012
46825
|
}
|
|
47013
46826
|
updateBarsDangerStatus(editor, tableBlock, Array.from(selectedRows), Array.from(selectedColumns));
|
|
47014
46827
|
} catch (error2) {
|
|
47015
|
-
logger$
|
|
46828
|
+
logger$2r.error("update cell bars danger status failed: ", error2.message);
|
|
47016
46829
|
}
|
|
47017
46830
|
}
|
|
47018
46831
|
function createEntireRowAndColumnRange(editor, tableBlock, isCol) {
|
|
@@ -47131,14 +46944,14 @@ ${codeText}
|
|
|
47131
46944
|
}
|
|
47132
46945
|
const DEFAULT_COLUMN_WIDTH$1 = 200;
|
|
47133
46946
|
const MIN_COLUMN_WIDTH = 40;
|
|
47134
|
-
const logger$
|
|
46947
|
+
const logger$2q = getLogger("table-insert-column");
|
|
47135
46948
|
function insertColumn(editor, tableBlock, insertIndex) {
|
|
47136
46949
|
editor.undoManager.runInGroup(() => {
|
|
47137
46950
|
var _a;
|
|
47138
46951
|
const table = getBlockTable(tableBlock);
|
|
47139
46952
|
const grid = TableGrid.fromTable(table);
|
|
47140
46953
|
const colCount = grid.colCount;
|
|
47141
|
-
assert(logger$
|
|
46954
|
+
assert(logger$2q, insertIndex >= 0 && insertIndex <= colCount, `insert index ${insertIndex} is out of range [0, ${colCount}]`);
|
|
47142
46955
|
const cells = grid.map((cell) => cell.containerId);
|
|
47143
46956
|
const spannedContainerIds = /* @__PURE__ */ new Set();
|
|
47144
46957
|
editor.doc.beginBatchUpdate();
|
|
@@ -47159,7 +46972,7 @@ ${codeText}
|
|
|
47159
46972
|
spannedContainerIds.forEach((containerId) => {
|
|
47160
46973
|
const key = `${containerId}_colSpan`;
|
|
47161
46974
|
const oldSpan = oldBlockData[key];
|
|
47162
|
-
assert(logger$
|
|
46975
|
+
assert(logger$2q, typeof oldSpan === "number" && oldSpan > 1, `no colSpan for containerId ${containerId}, ${oldSpan}`);
|
|
47163
46976
|
oldBlockData[key] = oldSpan + 1;
|
|
47164
46977
|
});
|
|
47165
46978
|
const colsWidth = ((_a = oldBlockData.colsWidth) == null ? void 0 : _a.concat()) || new Array(oldBlockData.cols).fill(0);
|
|
@@ -47175,13 +46988,13 @@ ${codeText}
|
|
|
47175
46988
|
editor.updateBlockData(tableBlock, newBlockData);
|
|
47176
46989
|
});
|
|
47177
46990
|
}
|
|
47178
|
-
const logger$
|
|
46991
|
+
const logger$2p = getLogger("table-insert-row");
|
|
47179
46992
|
function insertRow(editor, tableBlock, insertIndex) {
|
|
47180
46993
|
editor.undoManager.runInGroup(() => {
|
|
47181
46994
|
const table = getBlockTable(tableBlock);
|
|
47182
46995
|
const grid = TableGrid.fromTable(table);
|
|
47183
46996
|
const rowCount = grid.rowCount;
|
|
47184
|
-
assert(logger$
|
|
46997
|
+
assert(logger$2p, insertIndex >= 0 && insertIndex <= rowCount, `insert index ${insertIndex} is out of range [0, ${rowCount}]`);
|
|
47185
46998
|
const cells = grid.map((cell) => cell.containerId);
|
|
47186
46999
|
const spannedContainerIds = /* @__PURE__ */ new Set();
|
|
47187
47000
|
editor.doc.beginBatchUpdate();
|
|
@@ -47189,12 +47002,12 @@ ${codeText}
|
|
|
47189
47002
|
for (let col = 0; col < grid.colCount; col++) {
|
|
47190
47003
|
const top = insertIndex > 0 && cells[insertIndex - 1][col];
|
|
47191
47004
|
const bottom = insertIndex < grid.rowCount && cells[insertIndex][col];
|
|
47192
|
-
assert(logger$
|
|
47005
|
+
assert(logger$2p, top || bottom, "no top and bottom cell");
|
|
47193
47006
|
if (insertIndex === 0 || insertIndex === grid.rowCount || top !== bottom) {
|
|
47194
47007
|
const newContainerId = createEmptyContainer(editor.doc);
|
|
47195
47008
|
rowData.push(newContainerId);
|
|
47196
47009
|
} else {
|
|
47197
|
-
assert(logger$
|
|
47010
|
+
assert(logger$2p, top, "no top cell");
|
|
47198
47011
|
rowData.push(top);
|
|
47199
47012
|
spannedContainerIds.add(top);
|
|
47200
47013
|
}
|
|
@@ -47205,7 +47018,7 @@ ${codeText}
|
|
|
47205
47018
|
spannedContainerIds.forEach((containerId) => {
|
|
47206
47019
|
const key = `${containerId}_rowSpan`;
|
|
47207
47020
|
const oldSpan = oldBlockData[key];
|
|
47208
|
-
assert(logger$
|
|
47021
|
+
assert(logger$2p, typeof oldSpan === "number" && oldSpan > 1, `no rowSpan for containerId ${containerId}, ${oldSpan}`);
|
|
47209
47022
|
oldBlockData[key] = oldSpan + 1;
|
|
47210
47023
|
});
|
|
47211
47024
|
const newChildren = TableGrid.virtualCellContainersGridToChildren(cells);
|
|
@@ -47218,7 +47031,7 @@ ${codeText}
|
|
|
47218
47031
|
editor.updateBlockData(tableBlock, newBlockData);
|
|
47219
47032
|
});
|
|
47220
47033
|
}
|
|
47221
|
-
const logger$
|
|
47034
|
+
const logger$2o = getLogger("table-chart");
|
|
47222
47035
|
function removeChart(editor, block) {
|
|
47223
47036
|
const tableTools = findExistsTableTools(editor, block);
|
|
47224
47037
|
if (tableTools) {
|
|
@@ -47303,7 +47116,7 @@ ${codeText}
|
|
|
47303
47116
|
chartContainer = createElement("div", ["editor-table-chart"], tableTools);
|
|
47304
47117
|
}
|
|
47305
47118
|
const parent = chartContainer;
|
|
47306
|
-
assert(logger$
|
|
47119
|
+
assert(logger$2o, parent, "no chart container");
|
|
47307
47120
|
const options = editor.getComponentOptions("table");
|
|
47308
47121
|
const cdn = (options == null ? void 0 : options.chartCdn) || "https://cdn.jsdelivr.net/npm/chart.js@2.9.4/dist/Chart.min.js";
|
|
47309
47122
|
try {
|
|
@@ -47347,7 +47160,7 @@ ${codeText}
|
|
|
47347
47160
|
chartContainer.chartObject = chartObject;
|
|
47348
47161
|
}
|
|
47349
47162
|
} catch (err) {
|
|
47350
|
-
logger$
|
|
47163
|
+
logger$2o.error(`failed to resolve chart cdn: ${JSON.stringify(err)}`);
|
|
47351
47164
|
}
|
|
47352
47165
|
}
|
|
47353
47166
|
async function updateChartCore(editor, block) {
|
|
@@ -47504,7 +47317,7 @@ ${codeText}
|
|
|
47504
47317
|
const height = document.documentElement.clientHeight;
|
|
47505
47318
|
return new DOMRect(left, top, width, height);
|
|
47506
47319
|
}
|
|
47507
|
-
const logger$
|
|
47320
|
+
const logger$2n = getLogger("scroll-bar-handle");
|
|
47508
47321
|
const BOTTOM_FLOAT_HEIGHT = 2;
|
|
47509
47322
|
function getScrollbarContainer(scrollContainer) {
|
|
47510
47323
|
const tools = getTools(scrollContainer);
|
|
@@ -47515,7 +47328,7 @@ ${codeText}
|
|
|
47515
47328
|
scrollbarContainer.style.minHeight = "10px";
|
|
47516
47329
|
}
|
|
47517
47330
|
}
|
|
47518
|
-
assert(logger$
|
|
47331
|
+
assert(logger$2n, scrollbarContainer instanceof HTMLDivElement, "invalid child for container tools");
|
|
47519
47332
|
if (!scrollbarContainer.firstElementChild) {
|
|
47520
47333
|
createElement("div", [], scrollbarContainer);
|
|
47521
47334
|
}
|
|
@@ -47531,7 +47344,7 @@ ${codeText}
|
|
|
47531
47344
|
fixScrollWrapRightBoundary(scrollCore, scrollContainer);
|
|
47532
47345
|
fixScrollWrapLeftBoundary(scrollCore, scrollContainer);
|
|
47533
47346
|
const overflowWidth = scrollWidth - clientWidth;
|
|
47534
|
-
assert(logger$
|
|
47347
|
+
assert(logger$2n, scrollbarContainer.firstElementChild instanceof HTMLDivElement, "invalid child for scroll bar");
|
|
47535
47348
|
scrollbarContainer.style.width = `${getSizeAsScale(scrollContainer, originWidth + maxRight - paddingLeft - paddingRight)}px`;
|
|
47536
47349
|
scrollbarContainer.firstElementChild.style.width = `${getSizeAsScale(scrollContainer, originWidth + maxRight + overflowWidth - paddingLeft - paddingRight)}px`;
|
|
47537
47350
|
}
|
|
@@ -47618,7 +47431,7 @@ ${codeText}
|
|
|
47618
47431
|
this.intersectionObserver.disconnect();
|
|
47619
47432
|
}
|
|
47620
47433
|
}
|
|
47621
|
-
const logger$
|
|
47434
|
+
const logger$2m = getLogger("container-scroll-shadow");
|
|
47622
47435
|
function setShadowBottom(shadow, scrollContainer, scrollWrap) {
|
|
47623
47436
|
const elem = shadow;
|
|
47624
47437
|
const contentRect = scrollContainer.getBoundingClientRect();
|
|
@@ -47637,22 +47450,22 @@ ${codeText}
|
|
|
47637
47450
|
}
|
|
47638
47451
|
function showLeftShadow(scrollContainer) {
|
|
47639
47452
|
const targetTools = getTools(scrollContainer);
|
|
47640
|
-
assert(logger$
|
|
47453
|
+
assert(logger$2m, targetTools, "no container tools");
|
|
47641
47454
|
let shadow = targetTools.querySelector(`.${SHADOW_CLASS.LEFT}`);
|
|
47642
47455
|
if (!shadow) {
|
|
47643
47456
|
const scrollWrap = getContainerScrollArea(scrollContainer);
|
|
47644
47457
|
const classes = [SHADOW_CLASS.COMMON, SHADOW_CLASS.LEFT];
|
|
47645
47458
|
shadow = createElement("div", classes, targetTools);
|
|
47646
|
-
assert(logger$
|
|
47459
|
+
assert(logger$2m, shadow instanceof HTMLDivElement, "invalid child for container tools");
|
|
47647
47460
|
setShadowBottom(shadow, scrollContainer, scrollWrap);
|
|
47648
47461
|
}
|
|
47649
|
-
assert(logger$
|
|
47462
|
+
assert(logger$2m, shadow instanceof HTMLElement, "invalid child for container tools");
|
|
47650
47463
|
const container = getContainer(scrollContainer);
|
|
47651
47464
|
const containerRect = container.getBoundingClientRect();
|
|
47652
47465
|
const scrollContainerRect = scrollContainer.getBoundingClientRect();
|
|
47653
47466
|
shadow.style.left = `${getSizeAsScale(scrollContainer, scrollContainerRect.left - containerRect.left)}px`;
|
|
47654
47467
|
const leftRest = getElementScrollSize(scrollContainer).scrollLeft;
|
|
47655
|
-
assert(logger$
|
|
47468
|
+
assert(logger$2m, shadow instanceof HTMLDivElement, "invalid child for container tools");
|
|
47656
47469
|
setShadowWidth(shadow, leftRest);
|
|
47657
47470
|
addClass(shadow, SHADOW_CLASS.ACTIVE);
|
|
47658
47471
|
}
|
|
@@ -47663,17 +47476,17 @@ ${codeText}
|
|
|
47663
47476
|
const scrollWrap = getContainerScrollArea(scrollContainer);
|
|
47664
47477
|
const classes = [SHADOW_CLASS.COMMON, SHADOW_CLASS.RIGHT];
|
|
47665
47478
|
shadow = createElement("div", classes, tools);
|
|
47666
|
-
assert(logger$
|
|
47479
|
+
assert(logger$2m, shadow instanceof HTMLDivElement, "no div, create shadow failed");
|
|
47667
47480
|
setShadowBottom(shadow, scrollContainer, scrollWrap);
|
|
47668
47481
|
}
|
|
47669
|
-
assert(logger$
|
|
47482
|
+
assert(logger$2m, shadow instanceof HTMLElement, "");
|
|
47670
47483
|
const container = getContainer(scrollContainer);
|
|
47671
47484
|
const containerRect = container.getBoundingClientRect();
|
|
47672
47485
|
const scrollContainerRect = scrollContainer.getBoundingClientRect();
|
|
47673
47486
|
shadow.style.right = `${getSizeAsScale(scrollContainer, containerRect.right - scrollContainerRect.right)}px`;
|
|
47674
47487
|
const { scrollWidth, scrollLeft, clientWidth } = getElementScrollSize(scrollContainer);
|
|
47675
47488
|
const rightRest = scrollWidth - scrollLeft - clientWidth;
|
|
47676
|
-
assert(logger$
|
|
47489
|
+
assert(logger$2m, shadow instanceof HTMLDivElement, "no shadow element");
|
|
47677
47490
|
setShadowWidth(shadow, rightRest);
|
|
47678
47491
|
addClass(shadow, SHADOW_CLASS.ACTIVE);
|
|
47679
47492
|
}
|
|
@@ -47746,12 +47559,12 @@ ${codeText}
|
|
|
47746
47559
|
this.resizeObserver.disconnect();
|
|
47747
47560
|
}
|
|
47748
47561
|
}
|
|
47749
|
-
const logger$
|
|
47562
|
+
const logger$2l = getLogger("container-scroll-observer");
|
|
47750
47563
|
class ContainerScrollObserver {
|
|
47751
47564
|
constructor(scrollCore, callback) {
|
|
47752
47565
|
__publicField(this, "handleContentScroll", (e2) => {
|
|
47753
47566
|
const scrollContainer = e2.target;
|
|
47754
|
-
assert(logger$
|
|
47567
|
+
assert(logger$2l, scrollContainer instanceof Element, "invalid target for scroll event");
|
|
47755
47568
|
const scrollbarContainer = getScrollbarContainer(scrollContainer);
|
|
47756
47569
|
scrollbarContainer.removeEventListener("scroll", this.handleScroll);
|
|
47757
47570
|
const needFixScrollbarContainer = true;
|
|
@@ -47762,7 +47575,7 @@ ${codeText}
|
|
|
47762
47575
|
});
|
|
47763
47576
|
__publicField(this, "handleScroll", (e2) => {
|
|
47764
47577
|
const scrollbarContainer = e2.target;
|
|
47765
|
-
assert(logger$
|
|
47578
|
+
assert(logger$2l, scrollbarContainer instanceof HTMLElement, "");
|
|
47766
47579
|
const scrollLeft = scrollbarContainer.scrollLeft;
|
|
47767
47580
|
const needFixScrollbarContainer = false;
|
|
47768
47581
|
const scrollContainer = getScrollContainerByScrollBar(scrollbarContainer);
|
|
@@ -47842,7 +47655,7 @@ ${codeText}
|
|
|
47842
47655
|
this.scrollContainers.clear();
|
|
47843
47656
|
}
|
|
47844
47657
|
}
|
|
47845
|
-
const logger$
|
|
47658
|
+
const logger$2k = getLogger("scroll-wrap-resize-observer");
|
|
47846
47659
|
class ScrollWrapResizeObserve {
|
|
47847
47660
|
constructor(scrollCore) {
|
|
47848
47661
|
__publicField(this, "resizeObserver");
|
|
@@ -47858,7 +47671,7 @@ ${codeText}
|
|
|
47858
47671
|
});
|
|
47859
47672
|
__publicField(this, "handleScrollWrapResizeEntry", (entry) => {
|
|
47860
47673
|
const scrollWrap = entry.target;
|
|
47861
|
-
assert(logger$
|
|
47674
|
+
assert(logger$2k, scrollWrap instanceof HTMLElement, "invalid target for observer entry");
|
|
47862
47675
|
const scrollContainer = getScrollContainer(scrollWrap);
|
|
47863
47676
|
resetScrollbar(this.scrollCore, scrollWrap);
|
|
47864
47677
|
resetScrollWrapShadow(scrollContainer);
|
|
@@ -48063,7 +47876,7 @@ ${codeText}
|
|
|
48063
47876
|
window.removeEventListener("scroll", this.handleWindowEffect);
|
|
48064
47877
|
}
|
|
48065
47878
|
}
|
|
48066
|
-
const logger$
|
|
47879
|
+
const logger$2j = getLogger("scroll-container");
|
|
48067
47880
|
const rootScrollMap = /* @__PURE__ */ new Map();
|
|
48068
47881
|
class ScrollContainer extends tinyTypedEmitter.TypedEmitter {
|
|
48069
47882
|
constructor() {
|
|
@@ -48111,11 +47924,11 @@ ${codeText}
|
|
|
48111
47924
|
return this.scrollContainerElement;
|
|
48112
47925
|
}
|
|
48113
47926
|
get contentElement() {
|
|
48114
|
-
assert(logger$
|
|
47927
|
+
assert(logger$2j, this.scrollContainerElement, "scrollContainerElement cannot be undefined");
|
|
48115
47928
|
return getContainerScrollArea(this.scrollContainerElement);
|
|
48116
47929
|
}
|
|
48117
47930
|
get scrollOptions() {
|
|
48118
|
-
assert(logger$
|
|
47931
|
+
assert(logger$2j, this.options, "options cannot be undefined");
|
|
48119
47932
|
return { ...this.options };
|
|
48120
47933
|
}
|
|
48121
47934
|
handleBaseListenerDestroy(baseListener) {
|
|
@@ -48139,6 +47952,129 @@ ${codeText}
|
|
|
48139
47952
|
function createScrollContainer() {
|
|
48140
47953
|
return new ScrollContainer();
|
|
48141
47954
|
}
|
|
47955
|
+
const logger$2i = getLogger("column-width");
|
|
47956
|
+
function setColumnWidth(table, colIndex, width) {
|
|
47957
|
+
const col = getTableCol(table, colIndex);
|
|
47958
|
+
col.style.width = `${width}px`;
|
|
47959
|
+
col.style.minWidth = `${width}px`;
|
|
47960
|
+
}
|
|
47961
|
+
function getTableColumnWidthsFromDom(table) {
|
|
47962
|
+
const tableCols = Array.from(table.querySelector("colgroup").children);
|
|
47963
|
+
const widths = tableCols.map((col) => col.getBoundingClientRect().width);
|
|
47964
|
+
if (widths[0] !== 0) {
|
|
47965
|
+
return widths;
|
|
47966
|
+
}
|
|
47967
|
+
const grid = TableGrid.fromTable(table);
|
|
47968
|
+
const cellRightOffsets = Array(grid.colCount).fill(-1);
|
|
47969
|
+
const left = table.getBoundingClientRect().left;
|
|
47970
|
+
grid.toRealCells(grid.cells).forEach((cell) => {
|
|
47971
|
+
const colIndex = cell.col + cell.colSpan - 1;
|
|
47972
|
+
if (cellRightOffsets[colIndex] === -1) {
|
|
47973
|
+
cellRightOffsets[colIndex] = cell.cell.getBoundingClientRect().right - left;
|
|
47974
|
+
}
|
|
47975
|
+
});
|
|
47976
|
+
logger$2i.debug(`cellRightOffsets1: ${cellRightOffsets.join()}`);
|
|
47977
|
+
for (let col = 0; col < cellRightOffsets.length; col++) {
|
|
47978
|
+
const offset = cellRightOffsets[col];
|
|
47979
|
+
if (offset === -1 || col === 0) {
|
|
47980
|
+
continue;
|
|
47981
|
+
}
|
|
47982
|
+
let prevCol = col - 1;
|
|
47983
|
+
while (cellRightOffsets[prevCol] === -1) {
|
|
47984
|
+
prevCol--;
|
|
47985
|
+
if (prevCol === -1) {
|
|
47986
|
+
break;
|
|
47987
|
+
}
|
|
47988
|
+
}
|
|
47989
|
+
const prevOffset = prevCol === -1 ? 0 : cellRightOffsets[prevCol];
|
|
47990
|
+
const totalWidth = offset - prevOffset;
|
|
47991
|
+
const averageWidth = totalWidth / (col - prevCol);
|
|
47992
|
+
for (let i = prevCol + 1; i < col; i++) {
|
|
47993
|
+
cellRightOffsets[i] = prevOffset + averageWidth * (i - prevCol);
|
|
47994
|
+
}
|
|
47995
|
+
}
|
|
47996
|
+
logger$2i.debug(`cellRightOffsets2: ${cellRightOffsets.join()}`);
|
|
47997
|
+
const result = [];
|
|
47998
|
+
let prev = 0;
|
|
47999
|
+
for (let col = 0; col < cellRightOffsets.length; col++) {
|
|
48000
|
+
const offset = cellRightOffsets[col];
|
|
48001
|
+
result.push(offset - prev);
|
|
48002
|
+
prev = offset;
|
|
48003
|
+
}
|
|
48004
|
+
logger$2i.debug(`widths: ${result.join()}`);
|
|
48005
|
+
return result;
|
|
48006
|
+
}
|
|
48007
|
+
function getTableColumnWidths(table) {
|
|
48008
|
+
const tableCols = Array.from(table.querySelector("colgroup").children);
|
|
48009
|
+
const widths = tableCols.map((col) => col.getBoundingClientRect().width || Number.parseInt(col.style.width, 10));
|
|
48010
|
+
return widths;
|
|
48011
|
+
}
|
|
48012
|
+
const logger$2h = getLogger("table-resize-gripper");
|
|
48013
|
+
const GRIPPER_SIZE = 7;
|
|
48014
|
+
const GRIPPER_SIZE_HALF = (GRIPPER_SIZE - 1) / 2;
|
|
48015
|
+
const CONTAINER_CELL_DELTA = 3;
|
|
48016
|
+
function getCellFromRightBorder(table, x, y) {
|
|
48017
|
+
const { rows } = table;
|
|
48018
|
+
for (let i = 0; i < rows.length; i++) {
|
|
48019
|
+
const row = rows[i];
|
|
48020
|
+
const cells = Array.from(row.cells);
|
|
48021
|
+
for (let j = 0; j < cells.length; j++) {
|
|
48022
|
+
const cell = cells[j];
|
|
48023
|
+
const rect = cell.getBoundingClientRect();
|
|
48024
|
+
const pos = Math.round(rect.right);
|
|
48025
|
+
if (Math.abs(x - pos) <= GRIPPER_SIZE_HALF && rect.top <= y && y <= rect.bottom) {
|
|
48026
|
+
return cell;
|
|
48027
|
+
}
|
|
48028
|
+
}
|
|
48029
|
+
}
|
|
48030
|
+
return null;
|
|
48031
|
+
}
|
|
48032
|
+
function editorHasExistsResizeGripper(editor) {
|
|
48033
|
+
return !!editor.rootContainer.querySelector(".table-resize-gripper");
|
|
48034
|
+
}
|
|
48035
|
+
function getExistsResizeGripper$1(editor, block) {
|
|
48036
|
+
const tools = getTableTools(editor, block);
|
|
48037
|
+
const gripper = tools.querySelector(".table-resize-gripper");
|
|
48038
|
+
return gripper;
|
|
48039
|
+
}
|
|
48040
|
+
function createResizeGripper$2(editor, block) {
|
|
48041
|
+
const exists = getExistsResizeGripper$1(editor, block);
|
|
48042
|
+
assert(logger$2h, !exists, "resize gripper has already exists");
|
|
48043
|
+
const tools = getTableTools(editor, block);
|
|
48044
|
+
const gripper = createElement("div", ["table-resize-gripper", "table-indicator"], tools);
|
|
48045
|
+
createElement("div", ["table-resize-gripper-indicator"], gripper);
|
|
48046
|
+
return gripper;
|
|
48047
|
+
}
|
|
48048
|
+
function updateResizeGripper$1(editor, block, cell) {
|
|
48049
|
+
let gripper = getExistsResizeGripper$1(editor, block);
|
|
48050
|
+
if (!gripper) {
|
|
48051
|
+
gripper = createResizeGripper$2(editor, block);
|
|
48052
|
+
}
|
|
48053
|
+
const table = getBlockTable(block);
|
|
48054
|
+
const tableRect = table.getBoundingClientRect();
|
|
48055
|
+
const cellRect = cell.getBoundingClientRect();
|
|
48056
|
+
const top = 0;
|
|
48057
|
+
const height = tableRect.height;
|
|
48058
|
+
const scrollContentRect = editor.getCustom(getTableScrollKey(block)).contentElement.getBoundingClientRect();
|
|
48059
|
+
const left = cellRect.right - scrollContentRect.left;
|
|
48060
|
+
gripper.style.left = `${left - GRIPPER_SIZE_HALF - TABLE_BAR_WIDTH - INSERT_BUTTON_SIZE}px`;
|
|
48061
|
+
gripper.style.top = `${top}px`;
|
|
48062
|
+
gripper.style.height = `${height}px`;
|
|
48063
|
+
gripper.style.width = `${GRIPPER_SIZE}px`;
|
|
48064
|
+
}
|
|
48065
|
+
function removeAllResizeGripper(editor) {
|
|
48066
|
+
editor.rootContainer.querySelectorAll(".table-resize-gripper").forEach((gripper) => {
|
|
48067
|
+
gripper.remove();
|
|
48068
|
+
});
|
|
48069
|
+
}
|
|
48070
|
+
function setTableColumnWidths(editor, block, colsWidth) {
|
|
48071
|
+
const oldData = editor.getBlockData(block);
|
|
48072
|
+
const newData = {
|
|
48073
|
+
...oldData,
|
|
48074
|
+
colsWidth
|
|
48075
|
+
};
|
|
48076
|
+
editor.updateBlockData(block, newData, void 0, { noScroll: true });
|
|
48077
|
+
}
|
|
48142
48078
|
function getTableResizeMinX(editor, draggingRefCell, table, x) {
|
|
48143
48079
|
const cell = draggingRefCell;
|
|
48144
48080
|
const grid = TableGrid.fromTable(table);
|
|
@@ -48771,7 +48707,9 @@ ${codeText}
|
|
|
48771
48707
|
this.resizeType = resizeType;
|
|
48772
48708
|
setDefaultCursor(window.getComputedStyle(gripper).cursor);
|
|
48773
48709
|
if (this.block) {
|
|
48774
|
-
this.editor.selection.selectBlock(this.block, 0
|
|
48710
|
+
this.editor.selection.selectBlock(this.block, 0, void 0, {
|
|
48711
|
+
noScroll: true
|
|
48712
|
+
});
|
|
48775
48713
|
}
|
|
48776
48714
|
});
|
|
48777
48715
|
__publicField(this, "handleMouseMove", (event) => {
|
|
@@ -54817,7 +54755,7 @@ ${codeText}
|
|
|
54817
54755
|
};
|
|
54818
54756
|
return { blockData };
|
|
54819
54757
|
}
|
|
54820
|
-
function getOptions$
|
|
54758
|
+
function getOptions$8(editor) {
|
|
54821
54759
|
return {
|
|
54822
54760
|
name: "Mathjax"
|
|
54823
54761
|
};
|
|
@@ -54849,7 +54787,7 @@ $$${mathData.mathjaxText}$$
|
|
|
54849
54787
|
const MathjaxEmbed = {
|
|
54850
54788
|
embedType: "math",
|
|
54851
54789
|
createEmbedContent: createEmbedContent$9,
|
|
54852
|
-
getOptions: getOptions$
|
|
54790
|
+
getOptions: getOptions$8,
|
|
54853
54791
|
convertFrom: convertFrom$7,
|
|
54854
54792
|
handleDeleteBlock: handleDeleteBlock$7,
|
|
54855
54793
|
convertTo: convertTo$g,
|
|
@@ -65319,7 +65257,7 @@ $$${mathData.mathjaxText}$$
|
|
|
65319
65257
|
editor.focus();
|
|
65320
65258
|
return editor.insertBlock(options.containerId, options.blockIndex, blockData, createBlockSimpleRange(editor, focusBlockId, 0));
|
|
65321
65259
|
}
|
|
65322
|
-
function getOptions$
|
|
65260
|
+
function getOptions$7(editor) {
|
|
65323
65261
|
return {
|
|
65324
65262
|
name: "CodeBlock",
|
|
65325
65263
|
insertBlockCommandItems: [
|
|
@@ -65384,7 +65322,7 @@ ${codeText}
|
|
|
65384
65322
|
getSelectedContainers: getSelectedContainers$2,
|
|
65385
65323
|
convertFrom: convertToCode,
|
|
65386
65324
|
handleBlockElementUpdated,
|
|
65387
|
-
getOptions: getOptions$
|
|
65325
|
+
getOptions: getOptions$7,
|
|
65388
65326
|
getBlockProperties: getBlockProperties$a,
|
|
65389
65327
|
convertTo: convertTo$e,
|
|
65390
65328
|
handleDeleteBlock: handleDeleteBlock$6
|
|
@@ -68361,7 +68299,7 @@ ${codeText}
|
|
|
68361
68299
|
abstract: `${i18n$1.t("image.abstract")}`
|
|
68362
68300
|
};
|
|
68363
68301
|
};
|
|
68364
|
-
function getOptions$
|
|
68302
|
+
function getOptions$6() {
|
|
68365
68303
|
return {
|
|
68366
68304
|
name: "Image",
|
|
68367
68305
|
insertEmbedCommandItems: [{
|
|
@@ -68461,7 +68399,7 @@ ${codeText}
|
|
|
68461
68399
|
convertTo: convertTo$d,
|
|
68462
68400
|
convertFrom: convertFrom$6,
|
|
68463
68401
|
getBlockProperties: getBlockProperties$9,
|
|
68464
|
-
getOptions: getOptions$
|
|
68402
|
+
getOptions: getOptions$6,
|
|
68465
68403
|
handleDrop: handleDrop$1,
|
|
68466
68404
|
handleDropOver: handleDropOver$1,
|
|
68467
68405
|
handleDeleteBlock: handleDeleteBlock$5
|
|
@@ -73278,7 +73216,7 @@ ${codeText}
|
|
|
73278
73216
|
}
|
|
73279
73217
|
return createEmptyTableDataByFirstRowText(editor, editor.getBlockString(srcBlock).trim());
|
|
73280
73218
|
}
|
|
73281
|
-
function getOptions$
|
|
73219
|
+
function getOptions$5(editor) {
|
|
73282
73220
|
return {
|
|
73283
73221
|
name: "TableBlock",
|
|
73284
73222
|
insertBlockCommandItems: [{
|
|
@@ -73355,7 +73293,7 @@ ${codeText}
|
|
|
73355
73293
|
adjustSelectionPos,
|
|
73356
73294
|
getClientRects,
|
|
73357
73295
|
selectionToDoc,
|
|
73358
|
-
getOptions: getOptions$
|
|
73296
|
+
getOptions: getOptions$5,
|
|
73359
73297
|
getTextToolbarReferenceClient: getTextToolbarReferenceClient$1,
|
|
73360
73298
|
handleUpdateBlock: handleUpdateBlock$5,
|
|
73361
73299
|
handleDeleteBlock: handleDeleteBlock$4,
|
|
@@ -73391,7 +73329,6 @@ ${codeText}
|
|
|
73391
73329
|
splitCell: "\u62C6\u5206\u5355\u5143\u683C",
|
|
73392
73330
|
tableConfigKey: "\u8868\u683C\u8BBE\u7F6E",
|
|
73393
73331
|
deleteTable: "\u5220\u9664\u8868\u683C",
|
|
73394
|
-
adjustColumnWidthsEvenly: "\u5E73\u5747\u5206\u914D\u5217\u5BBD",
|
|
73395
73332
|
insertCol: "\u63D2\u5165\u5217",
|
|
73396
73333
|
insertRow: "\u63D2\u5165\u884C",
|
|
73397
73334
|
deleteCol: "\u5220\u9664\u5217",
|
|
@@ -73423,7 +73360,6 @@ ${codeText}
|
|
|
73423
73360
|
splitCell: "Split cell",
|
|
73424
73361
|
tableConfigKey: "Table settings",
|
|
73425
73362
|
deleteTable: "Delete table",
|
|
73426
|
-
adjustColumnWidthsEvenly: "Adjust column widths evenly",
|
|
73427
73363
|
insertCol: "Insert column",
|
|
73428
73364
|
insertRow: "Insert row",
|
|
73429
73365
|
deleteCol: "Delete column",
|
|
@@ -73455,7 +73391,6 @@ ${codeText}
|
|
|
73455
73391
|
splitCell: "\u30BB\u30EB\u306E\u7D50\u5408\u3092\u89E3\u9664",
|
|
73456
73392
|
tableConfigKey: "\u30C6\u30FC\u30D6\u30EB\u8A2D\u5B9A",
|
|
73457
73393
|
deleteTable: "\u30C6\u30FC\u30D6\u30EB\u3092\u524A\u9664",
|
|
73458
|
-
adjustColumnWidthsEvenly: "\u5217\u5E45\u3092\u5747\u7B49\u306B\u8ABF\u6574",
|
|
73459
73394
|
insertCol: "\u5217\u3092\u633F\u5165",
|
|
73460
73395
|
insertRow: "\u884C\u3092\u633F\u5165",
|
|
73461
73396
|
deleteCol: "\u5217\u3092\u524A\u9664",
|
|
@@ -76851,8 +76786,25 @@ ${docStr}
|
|
|
76851
76786
|
};
|
|
76852
76787
|
}
|
|
76853
76788
|
}
|
|
76789
|
+
function isContainHyperlink(text2) {
|
|
76790
|
+
const pattern = /^([\d\w\u4e00-\u9fa5\s]*[\u4e00-\u9fa5\s]{1}|)((https|http|ftp)?:\/\/)[^\s]+/;
|
|
76791
|
+
return pattern.test(text2);
|
|
76792
|
+
}
|
|
76793
|
+
function transText2TextOp(text2) {
|
|
76794
|
+
const ret = [];
|
|
76795
|
+
const prefix = text2.split(/https|http|ftp/)[0];
|
|
76796
|
+
const link2 = text2.substring(prefix.length).trim();
|
|
76797
|
+
if (prefix && prefix.length) {
|
|
76798
|
+
const textOp = createTextOp(prefix, null);
|
|
76799
|
+
ret.push(textOp, createTextOp(" ", null));
|
|
76800
|
+
}
|
|
76801
|
+
const linkOp = createTextOp(link2, { link: link2 });
|
|
76802
|
+
ret.push(linkOp, createTextOp(" ", null));
|
|
76803
|
+
return ret;
|
|
76804
|
+
}
|
|
76854
76805
|
class TextDataConverter {
|
|
76855
|
-
async fromData(editor, data2) {
|
|
76806
|
+
async fromData(editor, data2, options) {
|
|
76807
|
+
const { toPlainText: toPlainText2 = false } = options || {};
|
|
76856
76808
|
const result = {};
|
|
76857
76809
|
const text2 = data2.getData("text/plain");
|
|
76858
76810
|
if (text2) {
|
|
@@ -76862,6 +76814,10 @@ ${docStr}
|
|
|
76862
76814
|
id: genId(),
|
|
76863
76815
|
type: "text"
|
|
76864
76816
|
};
|
|
76817
|
+
if (isContainHyperlink(line) && !toPlainText2) {
|
|
76818
|
+
block.text = transText2TextOp(line);
|
|
76819
|
+
return block;
|
|
76820
|
+
}
|
|
76865
76821
|
const text22 = line ? [createTextOp(line, null)] : [];
|
|
76866
76822
|
block.text = text22;
|
|
76867
76823
|
return block;
|
|
@@ -76878,103 +76834,6 @@ ${docStr}
|
|
|
76878
76834
|
return result;
|
|
76879
76835
|
}
|
|
76880
76836
|
}
|
|
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
76837
|
function getImages(files) {
|
|
76979
76838
|
const images = [];
|
|
76980
76839
|
for (let i = 0; i < files.length; i++) {
|
|
@@ -76988,7 +76847,6 @@ ${docStr}
|
|
|
76988
76847
|
}
|
|
76989
76848
|
class OnesEditorPasteHandler {
|
|
76990
76849
|
constructor(editor) {
|
|
76991
|
-
editor.input.addHandler(new ConvertLinkPasteHandler());
|
|
76992
76850
|
editor.dataConverter.addConverter(new HtmlDataConverter());
|
|
76993
76851
|
editor.dataConverter.addConverter(new TextDataConverter());
|
|
76994
76852
|
editor.dataConverter.addConverter(new MarkdownDataConverter());
|
|
@@ -82191,45 +82049,24 @@ ${docStr}
|
|
|
82191
82049
|
};
|
|
82192
82050
|
return { blockData };
|
|
82193
82051
|
}
|
|
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
82052
|
const TocEmbed = {
|
|
82212
82053
|
embedType: "toc",
|
|
82213
82054
|
createEmbedContent: createEmbedContent$6,
|
|
82214
82055
|
convertTo: convertTo$8,
|
|
82215
|
-
convertFrom: convertFrom$4
|
|
82216
|
-
getOptions: getOptions$5
|
|
82056
|
+
convertFrom: convertFrom$4
|
|
82217
82057
|
};
|
|
82218
82058
|
const zhCN$c = {
|
|
82219
82059
|
toc: {
|
|
82220
|
-
name: "\u6807\u9898\u76EE\u5F55",
|
|
82221
82060
|
empty: "No Toc"
|
|
82222
82061
|
}
|
|
82223
82062
|
};
|
|
82224
82063
|
const enUS$c = {
|
|
82225
82064
|
toc: {
|
|
82226
|
-
name: "Toc",
|
|
82227
82065
|
empty: "No Toc"
|
|
82228
82066
|
}
|
|
82229
82067
|
};
|
|
82230
82068
|
const jaJP$c = {
|
|
82231
82069
|
toc: {
|
|
82232
|
-
name: "Toc",
|
|
82233
82070
|
empty: "No Toc"
|
|
82234
82071
|
}
|
|
82235
82072
|
};
|
|
@@ -86767,7 +86604,7 @@ ${data2.plantumlText}
|
|
|
86767
86604
|
this.editor.removeListener("selectionChanged", this.handleSelectionChange);
|
|
86768
86605
|
this.editor.removeListener("docChanged", this.handleSelectionChange);
|
|
86769
86606
|
document.removeEventListener("touchstart", this.handleTouchStart);
|
|
86770
|
-
document.removeEventListener("touchend", this.handleTouchEnd
|
|
86607
|
+
document.removeEventListener("touchend", this.handleTouchEnd);
|
|
86771
86608
|
document.removeEventListener("touchmove", this.handleTouchMove);
|
|
86772
86609
|
this.mobileEmbedMask.destroy();
|
|
86773
86610
|
this.cursorToolbar.destroy();
|
|
@@ -88444,6 +88281,172 @@ ${data2.plantumlText}
|
|
|
88444
88281
|
super.destroy();
|
|
88445
88282
|
}
|
|
88446
88283
|
}
|
|
88284
|
+
const ErrCode = {
|
|
88285
|
+
ANALYZER_UNKNOWN_URL: "analyzer cannot recognize this url"
|
|
88286
|
+
};
|
|
88287
|
+
class FigmaAnalyzer {
|
|
88288
|
+
constructor() {
|
|
88289
|
+
__publicField(this, "regex", /https:\/\/([\w.-]+\.)?figma.com\/design\/.*$/);
|
|
88290
|
+
}
|
|
88291
|
+
analyze(url) {
|
|
88292
|
+
if (url.match(this.regex)) {
|
|
88293
|
+
const urlObj = new URL(url);
|
|
88294
|
+
const search = new URLSearchParams();
|
|
88295
|
+
const nodeId = urlObj.searchParams.get("node-id");
|
|
88296
|
+
if (nodeId) {
|
|
88297
|
+
search.append("node-id", nodeId);
|
|
88298
|
+
}
|
|
88299
|
+
search.append("embed-host", "share");
|
|
88300
|
+
return {
|
|
88301
|
+
type: "iframe",
|
|
88302
|
+
providerName: "figma",
|
|
88303
|
+
url: `https://embed.figma.com${urlObj.pathname}?${search.toString()}`
|
|
88304
|
+
};
|
|
88305
|
+
}
|
|
88306
|
+
return null;
|
|
88307
|
+
}
|
|
88308
|
+
}
|
|
88309
|
+
class ModaoAnalyzer {
|
|
88310
|
+
constructor() {
|
|
88311
|
+
__publicField(this, "regex", /https:\/\/([\w.-]+\.)?modao\.cc\/app\/([0-9a-zA-Z]+)([?/].*)?/);
|
|
88312
|
+
}
|
|
88313
|
+
analyze(url) {
|
|
88314
|
+
const match = url.match(this.regex);
|
|
88315
|
+
if (match) {
|
|
88316
|
+
return {
|
|
88317
|
+
type: "iframe",
|
|
88318
|
+
providerName: "modao",
|
|
88319
|
+
url: `https://modao.cc/app/${match[2]}/embed/v2`
|
|
88320
|
+
};
|
|
88321
|
+
}
|
|
88322
|
+
return null;
|
|
88323
|
+
}
|
|
88324
|
+
}
|
|
88325
|
+
class AirtableAnalyzer {
|
|
88326
|
+
constructor() {
|
|
88327
|
+
__publicField(this, "regex", /https:\/\/([\w.-]+\.)?airtable.com\/([0-9a-zA-Z]{16,128})(?:\/.*)?$/);
|
|
88328
|
+
}
|
|
88329
|
+
analyze(url) {
|
|
88330
|
+
const m = url.match(this.regex);
|
|
88331
|
+
if (m) {
|
|
88332
|
+
return {
|
|
88333
|
+
type: "iframe",
|
|
88334
|
+
providerName: "airtable",
|
|
88335
|
+
url: `https://airtable.com/embed/${m[2]}?backgroundColor=orange`
|
|
88336
|
+
};
|
|
88337
|
+
}
|
|
88338
|
+
return null;
|
|
88339
|
+
}
|
|
88340
|
+
}
|
|
88341
|
+
class BilibiliAnalyzer {
|
|
88342
|
+
constructor() {
|
|
88343
|
+
__publicField(this, "regexs", [
|
|
88344
|
+
/https?:\/\/(m.|www.|)bilibili.(com|tv)\/video\/([ab])v([A-Za-z0-9]+)(\/?.*?&p=|\/?\?p=)?(\d+)?/i,
|
|
88345
|
+
/https?:\/\/(www.|)(acg|b23).tv\/([ab])v([A-Za-z0-9]+)(\/?.*?&p=|\/?\?p=)?(\d+)?/i
|
|
88346
|
+
]);
|
|
88347
|
+
}
|
|
88348
|
+
analyze(url) {
|
|
88349
|
+
for (const item of this.regexs) {
|
|
88350
|
+
const match = url.match(item);
|
|
88351
|
+
if (match) {
|
|
88352
|
+
const vid = Number.isNaN(+match[4]) ? `bvid=${match[4]}` : `aid=${match[4]}`;
|
|
88353
|
+
const page = match[6] == null ? "" : `&page=${match[6]}`;
|
|
88354
|
+
return {
|
|
88355
|
+
type: "iframe",
|
|
88356
|
+
providerName: "bilibili",
|
|
88357
|
+
url: `https://player.bilibili.com/player.html?${vid}${page}`
|
|
88358
|
+
};
|
|
88359
|
+
}
|
|
88360
|
+
}
|
|
88361
|
+
return null;
|
|
88362
|
+
}
|
|
88363
|
+
}
|
|
88364
|
+
class QQVideoAnalyzer {
|
|
88365
|
+
constructor() {
|
|
88366
|
+
__publicField(this, "regexs", [
|
|
88367
|
+
/https?:\/\/v.qq.com\/x\/page\/([^/]+?)(\.html?)/i,
|
|
88368
|
+
/https?:\/\/v.qq.com\/x\/cover\/[^/]+\/([^/]+?)(\.html?)/i
|
|
88369
|
+
]);
|
|
88370
|
+
}
|
|
88371
|
+
analyze(url) {
|
|
88372
|
+
for (const item of this.regexs) {
|
|
88373
|
+
const match = url.match(item);
|
|
88374
|
+
if (match) {
|
|
88375
|
+
return {
|
|
88376
|
+
type: "iframe",
|
|
88377
|
+
providerName: "qqvideo",
|
|
88378
|
+
url: `https://v.qq.com/txp/iframe/player.html?vid=${match[1]}`
|
|
88379
|
+
};
|
|
88380
|
+
}
|
|
88381
|
+
}
|
|
88382
|
+
return null;
|
|
88383
|
+
}
|
|
88384
|
+
}
|
|
88385
|
+
class YoukuAnalyzer {
|
|
88386
|
+
constructor() {
|
|
88387
|
+
__publicField(this, "regexs", [
|
|
88388
|
+
/^https?:\/\/v.youku.com\/v_show\/id_([^/]+)(.html?)/i
|
|
88389
|
+
]);
|
|
88390
|
+
}
|
|
88391
|
+
analyze(url) {
|
|
88392
|
+
for (const item of this.regexs) {
|
|
88393
|
+
const match = url.match(item);
|
|
88394
|
+
if (match) {
|
|
88395
|
+
return {
|
|
88396
|
+
type: "iframe",
|
|
88397
|
+
providerName: "youku",
|
|
88398
|
+
url: `https://player.youku.com/embed/${match[1]}`
|
|
88399
|
+
};
|
|
88400
|
+
}
|
|
88401
|
+
}
|
|
88402
|
+
return null;
|
|
88403
|
+
}
|
|
88404
|
+
}
|
|
88405
|
+
class YoutubeAnalyzer {
|
|
88406
|
+
constructor() {
|
|
88407
|
+
__publicField(this, "regexs", [
|
|
88408
|
+
/^https?:\/\/www\.youtube\.com\/watch\?v=([^/&]+)&?/i,
|
|
88409
|
+
/^https?:\/\/youtu\.be\/([^/&?]+).*/i
|
|
88410
|
+
]);
|
|
88411
|
+
}
|
|
88412
|
+
analyze(url) {
|
|
88413
|
+
for (const item of this.regexs) {
|
|
88414
|
+
const match = url.match(item);
|
|
88415
|
+
if (match) {
|
|
88416
|
+
return {
|
|
88417
|
+
type: "iframe",
|
|
88418
|
+
providerName: "youtube",
|
|
88419
|
+
url: `https://www.youtube.com/embed/${match[1]}`
|
|
88420
|
+
};
|
|
88421
|
+
}
|
|
88422
|
+
}
|
|
88423
|
+
return null;
|
|
88424
|
+
}
|
|
88425
|
+
}
|
|
88426
|
+
class URLAnalyzer {
|
|
88427
|
+
constructor() {
|
|
88428
|
+
__publicField(this, "analyzers");
|
|
88429
|
+
this.analyzers = [
|
|
88430
|
+
new YoutubeAnalyzer(),
|
|
88431
|
+
new QQVideoAnalyzer(),
|
|
88432
|
+
new BilibiliAnalyzer(),
|
|
88433
|
+
new YoukuAnalyzer(),
|
|
88434
|
+
new FigmaAnalyzer(),
|
|
88435
|
+
new ModaoAnalyzer(),
|
|
88436
|
+
new AirtableAnalyzer()
|
|
88437
|
+
];
|
|
88438
|
+
}
|
|
88439
|
+
analyze(url) {
|
|
88440
|
+
for (const item of this.analyzers) {
|
|
88441
|
+
const ret = item.analyze(url);
|
|
88442
|
+
if (ret) {
|
|
88443
|
+
return ret;
|
|
88444
|
+
}
|
|
88445
|
+
}
|
|
88446
|
+
throw new Error(ErrCode.ANALYZER_UNKNOWN_URL);
|
|
88447
|
+
}
|
|
88448
|
+
}
|
|
88449
|
+
const urlAnalyzer = new URLAnalyzer();
|
|
88447
88450
|
const getCommandItems = () => [
|
|
88448
88451
|
{
|
|
88449
88452
|
name: i18n$1.t("webpage.bilibili"),
|
|
@@ -88506,11 +88509,8 @@ ${data2.plantumlText}
|
|
|
88506
88509
|
function isWebPageItem(id) {
|
|
88507
88510
|
return id === "insert-webPage";
|
|
88508
88511
|
}
|
|
88509
|
-
|
|
88510
|
-
|
|
88511
|
-
return editor.doc.externalDoc.recognizeLink(url);
|
|
88512
|
-
}
|
|
88513
|
-
return null;
|
|
88512
|
+
function recognizeWebPageLink(editor, url) {
|
|
88513
|
+
return urlAnalyzer.analyze(url);
|
|
88514
88514
|
}
|
|
88515
88515
|
function formatValue(value) {
|
|
88516
88516
|
if (value && !value.startsWith("http://") && !value.startsWith("https://") && !value.startsWith("//")) {
|
|
@@ -88561,14 +88561,13 @@ ${data2.plantumlText}
|
|
|
88561
88561
|
id: "webpage",
|
|
88562
88562
|
title: i18n$1.t("webpage.dialog.title", { name: (itemOption == null ? void 0 : itemOption.name) || "" }),
|
|
88563
88563
|
async onOk() {
|
|
88564
|
-
var _a;
|
|
88565
88564
|
const value = formatValue(getInputValue());
|
|
88566
88565
|
try {
|
|
88567
88566
|
await checkValue(value);
|
|
88568
|
-
const detail =
|
|
88567
|
+
const detail = recognizeWebPageLink(editor, value);
|
|
88569
88568
|
resolve((detail == null ? void 0 : detail.url) || "");
|
|
88570
88569
|
} catch (error2) {
|
|
88571
|
-
if ((
|
|
88570
|
+
if ((error2 == null ? void 0 : error2.message) === ErrCode.ANALYZER_UNKNOWN_URL) {
|
|
88572
88571
|
if (isWebPageItem(itemId)) {
|
|
88573
88572
|
resolve(value);
|
|
88574
88573
|
} else {
|
|
@@ -92776,7 +92775,7 @@ ${data2.plantumlText}
|
|
|
92776
92775
|
}
|
|
92777
92776
|
}
|
|
92778
92777
|
});
|
|
92779
|
-
editor.version = "2.8.
|
|
92778
|
+
editor.version = "2.8.15-beta.1";
|
|
92780
92779
|
return editor;
|
|
92781
92780
|
}
|
|
92782
92781
|
function isDoc(doc2) {
|
|
@@ -92889,7 +92888,7 @@ ${data2.plantumlText}
|
|
|
92889
92888
|
}
|
|
92890
92889
|
});
|
|
92891
92890
|
OnesEditorToolbar.register(editor);
|
|
92892
|
-
editor.version = "2.8.
|
|
92891
|
+
editor.version = "2.8.15-beta.1";
|
|
92893
92892
|
return editor;
|
|
92894
92893
|
}
|
|
92895
92894
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -138666,7 +138665,6 @@ ${data2.plantumlText}
|
|
|
138666
138665
|
exports2.AddCommentToOldDocCommandProvider = AddCommentToOldDocCommandProvider;
|
|
138667
138666
|
exports2.AddEmojiIcon = AddEmojiIcon;
|
|
138668
138667
|
exports2.AddIcon = AddIcon;
|
|
138669
|
-
exports2.AdjustWidthIcon = AdjustWidthIcon;
|
|
138670
138668
|
exports2.AlertDialog = AlertDialog;
|
|
138671
138669
|
exports2.AlertEmojiIcon = alterEmoji;
|
|
138672
138670
|
exports2.AlignCenterIcon = AlignCenterIcon;
|
|
@@ -138942,7 +138940,6 @@ ${data2.plantumlText}
|
|
|
138942
138940
|
exports2.TimeIcon = TimeIcon;
|
|
138943
138941
|
exports2.ToMindMapIcon = ToMindMapIcon;
|
|
138944
138942
|
exports2.TocEmbed = TocEmbed;
|
|
138945
|
-
exports2.TocIcon = TocIcon;
|
|
138946
138943
|
exports2.TreeIcon = TreeIcon;
|
|
138947
138944
|
exports2.UmlBrandIcon = UmlBrandIcon;
|
|
138948
138945
|
exports2.UmlIcon = UmlIcon;
|