@ones-editor/editor 2.8.14-beta.5 → 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 +335 -303
- 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 -2
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,91 +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
|
-
function adjustColumnWidthsEvenly(editor, tableBlock) {
|
|
46640
|
-
const tableData = editor.getBlockData(tableBlock);
|
|
46641
|
-
const grid = tableData2Grid(tableData);
|
|
46642
|
-
const colCount = grid.colCount;
|
|
46643
|
-
const table = getBlockTable(tableBlock);
|
|
46644
|
-
const tableWidth = table.getBoundingClientRect().width;
|
|
46645
|
-
const colWidth = tableWidth / colCount;
|
|
46646
|
-
setTableColumnWidths(editor, tableBlock, Array(colCount).fill(colWidth));
|
|
46647
|
-
}
|
|
46648
46556
|
const TABLE_COMMAND_GROUP_INDEX = 10;
|
|
46649
46557
|
const TableCommands = [
|
|
46650
46558
|
"table/merge-cells",
|
|
@@ -46653,8 +46561,7 @@ ${codeText}
|
|
|
46653
46561
|
"table/insert-row",
|
|
46654
46562
|
"table/delete-rows",
|
|
46655
46563
|
"table/delete-columns",
|
|
46656
|
-
"table/delete"
|
|
46657
|
-
"table/adjust-column-widths-evenly"
|
|
46564
|
+
"table/delete"
|
|
46658
46565
|
];
|
|
46659
46566
|
class TableBlockCommandProvider {
|
|
46660
46567
|
constructor() {
|
|
@@ -46666,8 +46573,6 @@ ${codeText}
|
|
|
46666
46573
|
return [];
|
|
46667
46574
|
}
|
|
46668
46575
|
const commands = [];
|
|
46669
|
-
const deleteColumns2 = canDeleteColumns(editor, block, range);
|
|
46670
|
-
const deleteRows2 = canDeleteRows(editor, block, range);
|
|
46671
46576
|
if (canMergeCells(editor, block, range)) {
|
|
46672
46577
|
commands.push({
|
|
46673
46578
|
id: "table/merge-cells",
|
|
@@ -46682,6 +46587,8 @@ ${codeText}
|
|
|
46682
46587
|
icon: SplitCellIcon
|
|
46683
46588
|
});
|
|
46684
46589
|
}
|
|
46590
|
+
const deleteColumns2 = canDeleteColumns(editor, block, range);
|
|
46591
|
+
const deleteRows2 = canDeleteRows(editor, block, range);
|
|
46685
46592
|
if (deleteColumns2 && deleteRows2) {
|
|
46686
46593
|
commands.push({
|
|
46687
46594
|
id: "table/delete",
|
|
@@ -46689,14 +46596,6 @@ ${codeText}
|
|
|
46689
46596
|
icon: DeleteTableIcon
|
|
46690
46597
|
});
|
|
46691
46598
|
}
|
|
46692
|
-
const allColumnsSelected = deleteRows2;
|
|
46693
|
-
if (allColumnsSelected) {
|
|
46694
|
-
commands.push({
|
|
46695
|
-
id: "table/adjust-column-widths-evenly",
|
|
46696
|
-
name: i18n$1.t("table.adjustColumnWidthsEvenly"),
|
|
46697
|
-
icon: AdjustWidthIcon
|
|
46698
|
-
});
|
|
46699
|
-
}
|
|
46700
46599
|
return commands;
|
|
46701
46600
|
}
|
|
46702
46601
|
executeCommand(editor, block, range, command, params, result) {
|
|
@@ -46726,13 +46625,19 @@ ${codeText}
|
|
|
46726
46625
|
editor.deleteBlock(block);
|
|
46727
46626
|
return true;
|
|
46728
46627
|
}
|
|
46729
|
-
if (command.id === "table/adjust-column-widths-evenly") {
|
|
46730
|
-
adjustColumnWidthsEvenly(editor, block);
|
|
46731
|
-
return true;
|
|
46732
|
-
}
|
|
46733
46628
|
return false;
|
|
46734
46629
|
}
|
|
46735
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";
|
|
46736
46641
|
function setColTitle(editor, tableBlock) {
|
|
46737
46642
|
if (!editor.isBlockWritable(tableBlock)) {
|
|
46738
46643
|
return;
|
|
@@ -46810,26 +46715,26 @@ ${codeText}
|
|
|
46810
46715
|
};
|
|
46811
46716
|
editor.updateBlockData(tableBlock, newBlockData);
|
|
46812
46717
|
}
|
|
46813
|
-
const logger$
|
|
46718
|
+
const logger$2r = getLogger("table-cell-dom");
|
|
46814
46719
|
function getCellElementByChildBlockId(editor, tableBlock, blockId) {
|
|
46815
46720
|
let blockElement = editor.getBlockById(blockId);
|
|
46816
46721
|
while (blockElement) {
|
|
46817
46722
|
const cell = blockElement.closest("td");
|
|
46818
|
-
assert(logger$
|
|
46723
|
+
assert(logger$2r, cell, "no parent cell");
|
|
46819
46724
|
const cellParentBlock = getParentBlock(cell);
|
|
46820
|
-
assert(logger$
|
|
46725
|
+
assert(logger$2r, cellParentBlock, "no parent block");
|
|
46821
46726
|
if (cellParentBlock === tableBlock) {
|
|
46822
46727
|
return cell;
|
|
46823
46728
|
}
|
|
46824
46729
|
blockElement = cellParentBlock;
|
|
46825
46730
|
}
|
|
46826
|
-
assert(logger$
|
|
46731
|
+
assert(logger$2r, false, "filed to get cell by child block id");
|
|
46827
46732
|
return null;
|
|
46828
46733
|
}
|
|
46829
46734
|
function createComplexPosFromBlockPos(editor, tableBlock, blockPosition) {
|
|
46830
46735
|
const blockElement = editor.getBlockById(blockPosition.blockId);
|
|
46831
46736
|
if (blockElement === tableBlock && !blockPosition.isSimple()) {
|
|
46832
|
-
assert(logger$
|
|
46737
|
+
assert(logger$2r, blockPosition.childContainerId, "block position must have childContainerId attribute");
|
|
46833
46738
|
return blockPosition;
|
|
46834
46739
|
}
|
|
46835
46740
|
const cellElement = getCellElementByChildBlockId(editor, tableBlock, blockPosition.blockId);
|
|
@@ -46843,12 +46748,12 @@ ${codeText}
|
|
|
46843
46748
|
return getTableSelectionRange(tableBlock, start, end);
|
|
46844
46749
|
}
|
|
46845
46750
|
function updateBarsDangerStatus(editor, tableBlock, selectedRows, selectedColumns) {
|
|
46846
|
-
assert(logger$
|
|
46751
|
+
assert(logger$2r, isTableBlock(tableBlock), "invalid table block");
|
|
46847
46752
|
const tools = getTableTools(editor, tableBlock);
|
|
46848
46753
|
const blockTools = getBlockTools(tableBlock);
|
|
46849
46754
|
const updateTop = () => {
|
|
46850
46755
|
const exists = tools.querySelector(".table-border-bar-container.top");
|
|
46851
|
-
assert(logger$
|
|
46756
|
+
assert(logger$2r, exists, "no top border bar container");
|
|
46852
46757
|
const cells = exists.querySelectorAll(".table-border-bar-cell.top");
|
|
46853
46758
|
cells.forEach((cell) => {
|
|
46854
46759
|
const colIndex = parseInt(cell.getAttribute("data-top-index") || "0", 10);
|
|
@@ -46861,7 +46766,7 @@ ${codeText}
|
|
|
46861
46766
|
};
|
|
46862
46767
|
const updateLeft = () => {
|
|
46863
46768
|
const left = blockTools.querySelector(".table-border-bar-container.left");
|
|
46864
|
-
assert(logger$
|
|
46769
|
+
assert(logger$2r, left, "no left border bar container");
|
|
46865
46770
|
const cells = left.querySelectorAll(".table-border-bar-cell.left");
|
|
46866
46771
|
cells.forEach((cell) => {
|
|
46867
46772
|
const rowIndex = parseInt(cell.getAttribute("data-left-index") || "0", 10);
|
|
@@ -46897,7 +46802,7 @@ ${codeText}
|
|
|
46897
46802
|
}
|
|
46898
46803
|
}
|
|
46899
46804
|
} catch (error2) {
|
|
46900
|
-
logger$
|
|
46805
|
+
logger$2r.error("update cells danger status failed: ", error2.message);
|
|
46901
46806
|
}
|
|
46902
46807
|
}
|
|
46903
46808
|
function updateCellBarsDangerStatus(editor, tableBlock, isDanger = true, isCol) {
|
|
@@ -46920,7 +46825,7 @@ ${codeText}
|
|
|
46920
46825
|
}
|
|
46921
46826
|
updateBarsDangerStatus(editor, tableBlock, Array.from(selectedRows), Array.from(selectedColumns));
|
|
46922
46827
|
} catch (error2) {
|
|
46923
|
-
logger$
|
|
46828
|
+
logger$2r.error("update cell bars danger status failed: ", error2.message);
|
|
46924
46829
|
}
|
|
46925
46830
|
}
|
|
46926
46831
|
function createEntireRowAndColumnRange(editor, tableBlock, isCol) {
|
|
@@ -47039,14 +46944,14 @@ ${codeText}
|
|
|
47039
46944
|
}
|
|
47040
46945
|
const DEFAULT_COLUMN_WIDTH$1 = 200;
|
|
47041
46946
|
const MIN_COLUMN_WIDTH = 40;
|
|
47042
|
-
const logger$
|
|
46947
|
+
const logger$2q = getLogger("table-insert-column");
|
|
47043
46948
|
function insertColumn(editor, tableBlock, insertIndex) {
|
|
47044
46949
|
editor.undoManager.runInGroup(() => {
|
|
47045
46950
|
var _a;
|
|
47046
46951
|
const table = getBlockTable(tableBlock);
|
|
47047
46952
|
const grid = TableGrid.fromTable(table);
|
|
47048
46953
|
const colCount = grid.colCount;
|
|
47049
|
-
assert(logger$
|
|
46954
|
+
assert(logger$2q, insertIndex >= 0 && insertIndex <= colCount, `insert index ${insertIndex} is out of range [0, ${colCount}]`);
|
|
47050
46955
|
const cells = grid.map((cell) => cell.containerId);
|
|
47051
46956
|
const spannedContainerIds = /* @__PURE__ */ new Set();
|
|
47052
46957
|
editor.doc.beginBatchUpdate();
|
|
@@ -47067,7 +46972,7 @@ ${codeText}
|
|
|
47067
46972
|
spannedContainerIds.forEach((containerId) => {
|
|
47068
46973
|
const key = `${containerId}_colSpan`;
|
|
47069
46974
|
const oldSpan = oldBlockData[key];
|
|
47070
|
-
assert(logger$
|
|
46975
|
+
assert(logger$2q, typeof oldSpan === "number" && oldSpan > 1, `no colSpan for containerId ${containerId}, ${oldSpan}`);
|
|
47071
46976
|
oldBlockData[key] = oldSpan + 1;
|
|
47072
46977
|
});
|
|
47073
46978
|
const colsWidth = ((_a = oldBlockData.colsWidth) == null ? void 0 : _a.concat()) || new Array(oldBlockData.cols).fill(0);
|
|
@@ -47083,13 +46988,13 @@ ${codeText}
|
|
|
47083
46988
|
editor.updateBlockData(tableBlock, newBlockData);
|
|
47084
46989
|
});
|
|
47085
46990
|
}
|
|
47086
|
-
const logger$
|
|
46991
|
+
const logger$2p = getLogger("table-insert-row");
|
|
47087
46992
|
function insertRow(editor, tableBlock, insertIndex) {
|
|
47088
46993
|
editor.undoManager.runInGroup(() => {
|
|
47089
46994
|
const table = getBlockTable(tableBlock);
|
|
47090
46995
|
const grid = TableGrid.fromTable(table);
|
|
47091
46996
|
const rowCount = grid.rowCount;
|
|
47092
|
-
assert(logger$
|
|
46997
|
+
assert(logger$2p, insertIndex >= 0 && insertIndex <= rowCount, `insert index ${insertIndex} is out of range [0, ${rowCount}]`);
|
|
47093
46998
|
const cells = grid.map((cell) => cell.containerId);
|
|
47094
46999
|
const spannedContainerIds = /* @__PURE__ */ new Set();
|
|
47095
47000
|
editor.doc.beginBatchUpdate();
|
|
@@ -47097,12 +47002,12 @@ ${codeText}
|
|
|
47097
47002
|
for (let col = 0; col < grid.colCount; col++) {
|
|
47098
47003
|
const top = insertIndex > 0 && cells[insertIndex - 1][col];
|
|
47099
47004
|
const bottom = insertIndex < grid.rowCount && cells[insertIndex][col];
|
|
47100
|
-
assert(logger$
|
|
47005
|
+
assert(logger$2p, top || bottom, "no top and bottom cell");
|
|
47101
47006
|
if (insertIndex === 0 || insertIndex === grid.rowCount || top !== bottom) {
|
|
47102
47007
|
const newContainerId = createEmptyContainer(editor.doc);
|
|
47103
47008
|
rowData.push(newContainerId);
|
|
47104
47009
|
} else {
|
|
47105
|
-
assert(logger$
|
|
47010
|
+
assert(logger$2p, top, "no top cell");
|
|
47106
47011
|
rowData.push(top);
|
|
47107
47012
|
spannedContainerIds.add(top);
|
|
47108
47013
|
}
|
|
@@ -47113,7 +47018,7 @@ ${codeText}
|
|
|
47113
47018
|
spannedContainerIds.forEach((containerId) => {
|
|
47114
47019
|
const key = `${containerId}_rowSpan`;
|
|
47115
47020
|
const oldSpan = oldBlockData[key];
|
|
47116
|
-
assert(logger$
|
|
47021
|
+
assert(logger$2p, typeof oldSpan === "number" && oldSpan > 1, `no rowSpan for containerId ${containerId}, ${oldSpan}`);
|
|
47117
47022
|
oldBlockData[key] = oldSpan + 1;
|
|
47118
47023
|
});
|
|
47119
47024
|
const newChildren = TableGrid.virtualCellContainersGridToChildren(cells);
|
|
@@ -47126,7 +47031,7 @@ ${codeText}
|
|
|
47126
47031
|
editor.updateBlockData(tableBlock, newBlockData);
|
|
47127
47032
|
});
|
|
47128
47033
|
}
|
|
47129
|
-
const logger$
|
|
47034
|
+
const logger$2o = getLogger("table-chart");
|
|
47130
47035
|
function removeChart(editor, block) {
|
|
47131
47036
|
const tableTools = findExistsTableTools(editor, block);
|
|
47132
47037
|
if (tableTools) {
|
|
@@ -47211,7 +47116,7 @@ ${codeText}
|
|
|
47211
47116
|
chartContainer = createElement("div", ["editor-table-chart"], tableTools);
|
|
47212
47117
|
}
|
|
47213
47118
|
const parent = chartContainer;
|
|
47214
|
-
assert(logger$
|
|
47119
|
+
assert(logger$2o, parent, "no chart container");
|
|
47215
47120
|
const options = editor.getComponentOptions("table");
|
|
47216
47121
|
const cdn = (options == null ? void 0 : options.chartCdn) || "https://cdn.jsdelivr.net/npm/chart.js@2.9.4/dist/Chart.min.js";
|
|
47217
47122
|
try {
|
|
@@ -47255,7 +47160,7 @@ ${codeText}
|
|
|
47255
47160
|
chartContainer.chartObject = chartObject;
|
|
47256
47161
|
}
|
|
47257
47162
|
} catch (err) {
|
|
47258
|
-
logger$
|
|
47163
|
+
logger$2o.error(`failed to resolve chart cdn: ${JSON.stringify(err)}`);
|
|
47259
47164
|
}
|
|
47260
47165
|
}
|
|
47261
47166
|
async function updateChartCore(editor, block) {
|
|
@@ -47412,7 +47317,7 @@ ${codeText}
|
|
|
47412
47317
|
const height = document.documentElement.clientHeight;
|
|
47413
47318
|
return new DOMRect(left, top, width, height);
|
|
47414
47319
|
}
|
|
47415
|
-
const logger$
|
|
47320
|
+
const logger$2n = getLogger("scroll-bar-handle");
|
|
47416
47321
|
const BOTTOM_FLOAT_HEIGHT = 2;
|
|
47417
47322
|
function getScrollbarContainer(scrollContainer) {
|
|
47418
47323
|
const tools = getTools(scrollContainer);
|
|
@@ -47423,7 +47328,7 @@ ${codeText}
|
|
|
47423
47328
|
scrollbarContainer.style.minHeight = "10px";
|
|
47424
47329
|
}
|
|
47425
47330
|
}
|
|
47426
|
-
assert(logger$
|
|
47331
|
+
assert(logger$2n, scrollbarContainer instanceof HTMLDivElement, "invalid child for container tools");
|
|
47427
47332
|
if (!scrollbarContainer.firstElementChild) {
|
|
47428
47333
|
createElement("div", [], scrollbarContainer);
|
|
47429
47334
|
}
|
|
@@ -47439,7 +47344,7 @@ ${codeText}
|
|
|
47439
47344
|
fixScrollWrapRightBoundary(scrollCore, scrollContainer);
|
|
47440
47345
|
fixScrollWrapLeftBoundary(scrollCore, scrollContainer);
|
|
47441
47346
|
const overflowWidth = scrollWidth - clientWidth;
|
|
47442
|
-
assert(logger$
|
|
47347
|
+
assert(logger$2n, scrollbarContainer.firstElementChild instanceof HTMLDivElement, "invalid child for scroll bar");
|
|
47443
47348
|
scrollbarContainer.style.width = `${getSizeAsScale(scrollContainer, originWidth + maxRight - paddingLeft - paddingRight)}px`;
|
|
47444
47349
|
scrollbarContainer.firstElementChild.style.width = `${getSizeAsScale(scrollContainer, originWidth + maxRight + overflowWidth - paddingLeft - paddingRight)}px`;
|
|
47445
47350
|
}
|
|
@@ -47526,7 +47431,7 @@ ${codeText}
|
|
|
47526
47431
|
this.intersectionObserver.disconnect();
|
|
47527
47432
|
}
|
|
47528
47433
|
}
|
|
47529
|
-
const logger$
|
|
47434
|
+
const logger$2m = getLogger("container-scroll-shadow");
|
|
47530
47435
|
function setShadowBottom(shadow, scrollContainer, scrollWrap) {
|
|
47531
47436
|
const elem = shadow;
|
|
47532
47437
|
const contentRect = scrollContainer.getBoundingClientRect();
|
|
@@ -47545,22 +47450,22 @@ ${codeText}
|
|
|
47545
47450
|
}
|
|
47546
47451
|
function showLeftShadow(scrollContainer) {
|
|
47547
47452
|
const targetTools = getTools(scrollContainer);
|
|
47548
|
-
assert(logger$
|
|
47453
|
+
assert(logger$2m, targetTools, "no container tools");
|
|
47549
47454
|
let shadow = targetTools.querySelector(`.${SHADOW_CLASS.LEFT}`);
|
|
47550
47455
|
if (!shadow) {
|
|
47551
47456
|
const scrollWrap = getContainerScrollArea(scrollContainer);
|
|
47552
47457
|
const classes = [SHADOW_CLASS.COMMON, SHADOW_CLASS.LEFT];
|
|
47553
47458
|
shadow = createElement("div", classes, targetTools);
|
|
47554
|
-
assert(logger$
|
|
47459
|
+
assert(logger$2m, shadow instanceof HTMLDivElement, "invalid child for container tools");
|
|
47555
47460
|
setShadowBottom(shadow, scrollContainer, scrollWrap);
|
|
47556
47461
|
}
|
|
47557
|
-
assert(logger$
|
|
47462
|
+
assert(logger$2m, shadow instanceof HTMLElement, "invalid child for container tools");
|
|
47558
47463
|
const container = getContainer(scrollContainer);
|
|
47559
47464
|
const containerRect = container.getBoundingClientRect();
|
|
47560
47465
|
const scrollContainerRect = scrollContainer.getBoundingClientRect();
|
|
47561
47466
|
shadow.style.left = `${getSizeAsScale(scrollContainer, scrollContainerRect.left - containerRect.left)}px`;
|
|
47562
47467
|
const leftRest = getElementScrollSize(scrollContainer).scrollLeft;
|
|
47563
|
-
assert(logger$
|
|
47468
|
+
assert(logger$2m, shadow instanceof HTMLDivElement, "invalid child for container tools");
|
|
47564
47469
|
setShadowWidth(shadow, leftRest);
|
|
47565
47470
|
addClass(shadow, SHADOW_CLASS.ACTIVE);
|
|
47566
47471
|
}
|
|
@@ -47571,17 +47476,17 @@ ${codeText}
|
|
|
47571
47476
|
const scrollWrap = getContainerScrollArea(scrollContainer);
|
|
47572
47477
|
const classes = [SHADOW_CLASS.COMMON, SHADOW_CLASS.RIGHT];
|
|
47573
47478
|
shadow = createElement("div", classes, tools);
|
|
47574
|
-
assert(logger$
|
|
47479
|
+
assert(logger$2m, shadow instanceof HTMLDivElement, "no div, create shadow failed");
|
|
47575
47480
|
setShadowBottom(shadow, scrollContainer, scrollWrap);
|
|
47576
47481
|
}
|
|
47577
|
-
assert(logger$
|
|
47482
|
+
assert(logger$2m, shadow instanceof HTMLElement, "");
|
|
47578
47483
|
const container = getContainer(scrollContainer);
|
|
47579
47484
|
const containerRect = container.getBoundingClientRect();
|
|
47580
47485
|
const scrollContainerRect = scrollContainer.getBoundingClientRect();
|
|
47581
47486
|
shadow.style.right = `${getSizeAsScale(scrollContainer, containerRect.right - scrollContainerRect.right)}px`;
|
|
47582
47487
|
const { scrollWidth, scrollLeft, clientWidth } = getElementScrollSize(scrollContainer);
|
|
47583
47488
|
const rightRest = scrollWidth - scrollLeft - clientWidth;
|
|
47584
|
-
assert(logger$
|
|
47489
|
+
assert(logger$2m, shadow instanceof HTMLDivElement, "no shadow element");
|
|
47585
47490
|
setShadowWidth(shadow, rightRest);
|
|
47586
47491
|
addClass(shadow, SHADOW_CLASS.ACTIVE);
|
|
47587
47492
|
}
|
|
@@ -47654,12 +47559,12 @@ ${codeText}
|
|
|
47654
47559
|
this.resizeObserver.disconnect();
|
|
47655
47560
|
}
|
|
47656
47561
|
}
|
|
47657
|
-
const logger$
|
|
47562
|
+
const logger$2l = getLogger("container-scroll-observer");
|
|
47658
47563
|
class ContainerScrollObserver {
|
|
47659
47564
|
constructor(scrollCore, callback) {
|
|
47660
47565
|
__publicField(this, "handleContentScroll", (e2) => {
|
|
47661
47566
|
const scrollContainer = e2.target;
|
|
47662
|
-
assert(logger$
|
|
47567
|
+
assert(logger$2l, scrollContainer instanceof Element, "invalid target for scroll event");
|
|
47663
47568
|
const scrollbarContainer = getScrollbarContainer(scrollContainer);
|
|
47664
47569
|
scrollbarContainer.removeEventListener("scroll", this.handleScroll);
|
|
47665
47570
|
const needFixScrollbarContainer = true;
|
|
@@ -47670,7 +47575,7 @@ ${codeText}
|
|
|
47670
47575
|
});
|
|
47671
47576
|
__publicField(this, "handleScroll", (e2) => {
|
|
47672
47577
|
const scrollbarContainer = e2.target;
|
|
47673
|
-
assert(logger$
|
|
47578
|
+
assert(logger$2l, scrollbarContainer instanceof HTMLElement, "");
|
|
47674
47579
|
const scrollLeft = scrollbarContainer.scrollLeft;
|
|
47675
47580
|
const needFixScrollbarContainer = false;
|
|
47676
47581
|
const scrollContainer = getScrollContainerByScrollBar(scrollbarContainer);
|
|
@@ -47750,7 +47655,7 @@ ${codeText}
|
|
|
47750
47655
|
this.scrollContainers.clear();
|
|
47751
47656
|
}
|
|
47752
47657
|
}
|
|
47753
|
-
const logger$
|
|
47658
|
+
const logger$2k = getLogger("scroll-wrap-resize-observer");
|
|
47754
47659
|
class ScrollWrapResizeObserve {
|
|
47755
47660
|
constructor(scrollCore) {
|
|
47756
47661
|
__publicField(this, "resizeObserver");
|
|
@@ -47766,7 +47671,7 @@ ${codeText}
|
|
|
47766
47671
|
});
|
|
47767
47672
|
__publicField(this, "handleScrollWrapResizeEntry", (entry) => {
|
|
47768
47673
|
const scrollWrap = entry.target;
|
|
47769
|
-
assert(logger$
|
|
47674
|
+
assert(logger$2k, scrollWrap instanceof HTMLElement, "invalid target for observer entry");
|
|
47770
47675
|
const scrollContainer = getScrollContainer(scrollWrap);
|
|
47771
47676
|
resetScrollbar(this.scrollCore, scrollWrap);
|
|
47772
47677
|
resetScrollWrapShadow(scrollContainer);
|
|
@@ -47971,7 +47876,7 @@ ${codeText}
|
|
|
47971
47876
|
window.removeEventListener("scroll", this.handleWindowEffect);
|
|
47972
47877
|
}
|
|
47973
47878
|
}
|
|
47974
|
-
const logger$
|
|
47879
|
+
const logger$2j = getLogger("scroll-container");
|
|
47975
47880
|
const rootScrollMap = /* @__PURE__ */ new Map();
|
|
47976
47881
|
class ScrollContainer extends tinyTypedEmitter.TypedEmitter {
|
|
47977
47882
|
constructor() {
|
|
@@ -48019,11 +47924,11 @@ ${codeText}
|
|
|
48019
47924
|
return this.scrollContainerElement;
|
|
48020
47925
|
}
|
|
48021
47926
|
get contentElement() {
|
|
48022
|
-
assert(logger$
|
|
47927
|
+
assert(logger$2j, this.scrollContainerElement, "scrollContainerElement cannot be undefined");
|
|
48023
47928
|
return getContainerScrollArea(this.scrollContainerElement);
|
|
48024
47929
|
}
|
|
48025
47930
|
get scrollOptions() {
|
|
48026
|
-
assert(logger$
|
|
47931
|
+
assert(logger$2j, this.options, "options cannot be undefined");
|
|
48027
47932
|
return { ...this.options };
|
|
48028
47933
|
}
|
|
48029
47934
|
handleBaseListenerDestroy(baseListener) {
|
|
@@ -48047,7 +47952,7 @@ ${codeText}
|
|
|
48047
47952
|
function createScrollContainer() {
|
|
48048
47953
|
return new ScrollContainer();
|
|
48049
47954
|
}
|
|
48050
|
-
const logger$
|
|
47955
|
+
const logger$2i = getLogger("column-width");
|
|
48051
47956
|
function setColumnWidth(table, colIndex, width) {
|
|
48052
47957
|
const col = getTableCol(table, colIndex);
|
|
48053
47958
|
col.style.width = `${width}px`;
|
|
@@ -48068,7 +47973,7 @@ ${codeText}
|
|
|
48068
47973
|
cellRightOffsets[colIndex] = cell.cell.getBoundingClientRect().right - left;
|
|
48069
47974
|
}
|
|
48070
47975
|
});
|
|
48071
|
-
logger$
|
|
47976
|
+
logger$2i.debug(`cellRightOffsets1: ${cellRightOffsets.join()}`);
|
|
48072
47977
|
for (let col = 0; col < cellRightOffsets.length; col++) {
|
|
48073
47978
|
const offset = cellRightOffsets[col];
|
|
48074
47979
|
if (offset === -1 || col === 0) {
|
|
@@ -48088,7 +47993,7 @@ ${codeText}
|
|
|
48088
47993
|
cellRightOffsets[i] = prevOffset + averageWidth * (i - prevCol);
|
|
48089
47994
|
}
|
|
48090
47995
|
}
|
|
48091
|
-
logger$
|
|
47996
|
+
logger$2i.debug(`cellRightOffsets2: ${cellRightOffsets.join()}`);
|
|
48092
47997
|
const result = [];
|
|
48093
47998
|
let prev = 0;
|
|
48094
47999
|
for (let col = 0; col < cellRightOffsets.length; col++) {
|
|
@@ -48096,7 +48001,7 @@ ${codeText}
|
|
|
48096
48001
|
result.push(offset - prev);
|
|
48097
48002
|
prev = offset;
|
|
48098
48003
|
}
|
|
48099
|
-
logger$
|
|
48004
|
+
logger$2i.debug(`widths: ${result.join()}`);
|
|
48100
48005
|
return result;
|
|
48101
48006
|
}
|
|
48102
48007
|
function getTableColumnWidths(table) {
|
|
@@ -48104,6 +48009,72 @@ ${codeText}
|
|
|
48104
48009
|
const widths = tableCols.map((col) => col.getBoundingClientRect().width || Number.parseInt(col.style.width, 10));
|
|
48105
48010
|
return widths;
|
|
48106
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
|
+
}
|
|
48107
48078
|
function getTableResizeMinX(editor, draggingRefCell, table, x) {
|
|
48108
48079
|
const cell = draggingRefCell;
|
|
48109
48080
|
const grid = TableGrid.fromTable(table);
|
|
@@ -48736,7 +48707,9 @@ ${codeText}
|
|
|
48736
48707
|
this.resizeType = resizeType;
|
|
48737
48708
|
setDefaultCursor(window.getComputedStyle(gripper).cursor);
|
|
48738
48709
|
if (this.block) {
|
|
48739
|
-
this.editor.selection.selectBlock(this.block, 0
|
|
48710
|
+
this.editor.selection.selectBlock(this.block, 0, void 0, {
|
|
48711
|
+
noScroll: true
|
|
48712
|
+
});
|
|
48740
48713
|
}
|
|
48741
48714
|
});
|
|
48742
48715
|
__publicField(this, "handleMouseMove", (event) => {
|
|
@@ -54782,7 +54755,7 @@ ${codeText}
|
|
|
54782
54755
|
};
|
|
54783
54756
|
return { blockData };
|
|
54784
54757
|
}
|
|
54785
|
-
function getOptions$
|
|
54758
|
+
function getOptions$8(editor) {
|
|
54786
54759
|
return {
|
|
54787
54760
|
name: "Mathjax"
|
|
54788
54761
|
};
|
|
@@ -54814,7 +54787,7 @@ $$${mathData.mathjaxText}$$
|
|
|
54814
54787
|
const MathjaxEmbed = {
|
|
54815
54788
|
embedType: "math",
|
|
54816
54789
|
createEmbedContent: createEmbedContent$9,
|
|
54817
|
-
getOptions: getOptions$
|
|
54790
|
+
getOptions: getOptions$8,
|
|
54818
54791
|
convertFrom: convertFrom$7,
|
|
54819
54792
|
handleDeleteBlock: handleDeleteBlock$7,
|
|
54820
54793
|
convertTo: convertTo$g,
|
|
@@ -65284,7 +65257,7 @@ $$${mathData.mathjaxText}$$
|
|
|
65284
65257
|
editor.focus();
|
|
65285
65258
|
return editor.insertBlock(options.containerId, options.blockIndex, blockData, createBlockSimpleRange(editor, focusBlockId, 0));
|
|
65286
65259
|
}
|
|
65287
|
-
function getOptions$
|
|
65260
|
+
function getOptions$7(editor) {
|
|
65288
65261
|
return {
|
|
65289
65262
|
name: "CodeBlock",
|
|
65290
65263
|
insertBlockCommandItems: [
|
|
@@ -65349,7 +65322,7 @@ ${codeText}
|
|
|
65349
65322
|
getSelectedContainers: getSelectedContainers$2,
|
|
65350
65323
|
convertFrom: convertToCode,
|
|
65351
65324
|
handleBlockElementUpdated,
|
|
65352
|
-
getOptions: getOptions$
|
|
65325
|
+
getOptions: getOptions$7,
|
|
65353
65326
|
getBlockProperties: getBlockProperties$a,
|
|
65354
65327
|
convertTo: convertTo$e,
|
|
65355
65328
|
handleDeleteBlock: handleDeleteBlock$6
|
|
@@ -68326,7 +68299,7 @@ ${codeText}
|
|
|
68326
68299
|
abstract: `${i18n$1.t("image.abstract")}`
|
|
68327
68300
|
};
|
|
68328
68301
|
};
|
|
68329
|
-
function getOptions$
|
|
68302
|
+
function getOptions$6() {
|
|
68330
68303
|
return {
|
|
68331
68304
|
name: "Image",
|
|
68332
68305
|
insertEmbedCommandItems: [{
|
|
@@ -68426,7 +68399,7 @@ ${codeText}
|
|
|
68426
68399
|
convertTo: convertTo$d,
|
|
68427
68400
|
convertFrom: convertFrom$6,
|
|
68428
68401
|
getBlockProperties: getBlockProperties$9,
|
|
68429
|
-
getOptions: getOptions$
|
|
68402
|
+
getOptions: getOptions$6,
|
|
68430
68403
|
handleDrop: handleDrop$1,
|
|
68431
68404
|
handleDropOver: handleDropOver$1,
|
|
68432
68405
|
handleDeleteBlock: handleDeleteBlock$5
|
|
@@ -73243,7 +73216,7 @@ ${codeText}
|
|
|
73243
73216
|
}
|
|
73244
73217
|
return createEmptyTableDataByFirstRowText(editor, editor.getBlockString(srcBlock).trim());
|
|
73245
73218
|
}
|
|
73246
|
-
function getOptions$
|
|
73219
|
+
function getOptions$5(editor) {
|
|
73247
73220
|
return {
|
|
73248
73221
|
name: "TableBlock",
|
|
73249
73222
|
insertBlockCommandItems: [{
|
|
@@ -73320,7 +73293,7 @@ ${codeText}
|
|
|
73320
73293
|
adjustSelectionPos,
|
|
73321
73294
|
getClientRects,
|
|
73322
73295
|
selectionToDoc,
|
|
73323
|
-
getOptions: getOptions$
|
|
73296
|
+
getOptions: getOptions$5,
|
|
73324
73297
|
getTextToolbarReferenceClient: getTextToolbarReferenceClient$1,
|
|
73325
73298
|
handleUpdateBlock: handleUpdateBlock$5,
|
|
73326
73299
|
handleDeleteBlock: handleDeleteBlock$4,
|
|
@@ -73356,7 +73329,6 @@ ${codeText}
|
|
|
73356
73329
|
splitCell: "\u62C6\u5206\u5355\u5143\u683C",
|
|
73357
73330
|
tableConfigKey: "\u8868\u683C\u8BBE\u7F6E",
|
|
73358
73331
|
deleteTable: "\u5220\u9664\u8868\u683C",
|
|
73359
|
-
adjustColumnWidthsEvenly: "\u5E73\u5747\u5206\u914D\u5217\u5BBD",
|
|
73360
73332
|
insertCol: "\u63D2\u5165\u5217",
|
|
73361
73333
|
insertRow: "\u63D2\u5165\u884C",
|
|
73362
73334
|
deleteCol: "\u5220\u9664\u5217",
|
|
@@ -73388,7 +73360,6 @@ ${codeText}
|
|
|
73388
73360
|
splitCell: "Split cell",
|
|
73389
73361
|
tableConfigKey: "Table settings",
|
|
73390
73362
|
deleteTable: "Delete table",
|
|
73391
|
-
adjustColumnWidthsEvenly: "Adjust column widths evenly",
|
|
73392
73363
|
insertCol: "Insert column",
|
|
73393
73364
|
insertRow: "Insert row",
|
|
73394
73365
|
deleteCol: "Delete column",
|
|
@@ -73420,7 +73391,6 @@ ${codeText}
|
|
|
73420
73391
|
splitCell: "\u30BB\u30EB\u306E\u7D50\u5408\u3092\u89E3\u9664",
|
|
73421
73392
|
tableConfigKey: "\u30C6\u30FC\u30D6\u30EB\u8A2D\u5B9A",
|
|
73422
73393
|
deleteTable: "\u30C6\u30FC\u30D6\u30EB\u3092\u524A\u9664",
|
|
73423
|
-
adjustColumnWidthsEvenly: "\u5217\u5E45\u3092\u5747\u7B49\u306B\u8ABF\u6574",
|
|
73424
73394
|
insertCol: "\u5217\u3092\u633F\u5165",
|
|
73425
73395
|
insertRow: "\u884C\u3092\u633F\u5165",
|
|
73426
73396
|
deleteCol: "\u5217\u3092\u524A\u9664",
|
|
@@ -76816,8 +76786,25 @@ ${docStr}
|
|
|
76816
76786
|
};
|
|
76817
76787
|
}
|
|
76818
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
|
+
}
|
|
76819
76805
|
class TextDataConverter {
|
|
76820
|
-
async fromData(editor, data2) {
|
|
76806
|
+
async fromData(editor, data2, options) {
|
|
76807
|
+
const { toPlainText: toPlainText2 = false } = options || {};
|
|
76821
76808
|
const result = {};
|
|
76822
76809
|
const text2 = data2.getData("text/plain");
|
|
76823
76810
|
if (text2) {
|
|
@@ -76827,6 +76814,10 @@ ${docStr}
|
|
|
76827
76814
|
id: genId(),
|
|
76828
76815
|
type: "text"
|
|
76829
76816
|
};
|
|
76817
|
+
if (isContainHyperlink(line) && !toPlainText2) {
|
|
76818
|
+
block.text = transText2TextOp(line);
|
|
76819
|
+
return block;
|
|
76820
|
+
}
|
|
76830
76821
|
const text22 = line ? [createTextOp(line, null)] : [];
|
|
76831
76822
|
block.text = text22;
|
|
76832
76823
|
return block;
|
|
@@ -76843,103 +76834,6 @@ ${docStr}
|
|
|
76843
76834
|
return result;
|
|
76844
76835
|
}
|
|
76845
76836
|
}
|
|
76846
|
-
function findLinks(text2) {
|
|
76847
|
-
const pattern = /https?:\/\/[^\s/$.?#].[^\s]*/g;
|
|
76848
|
-
const results = [];
|
|
76849
|
-
let match;
|
|
76850
|
-
while ((match = pattern.exec(text2)) !== null) {
|
|
76851
|
-
const url = match[0];
|
|
76852
|
-
const startIndex = match.index;
|
|
76853
|
-
const endIndex = pattern.lastIndex;
|
|
76854
|
-
results.push({ url, startIndex, endIndex });
|
|
76855
|
-
}
|
|
76856
|
-
return results;
|
|
76857
|
-
}
|
|
76858
|
-
function urlToLinkOp(result) {
|
|
76859
|
-
const attributes = {
|
|
76860
|
-
link: result.url
|
|
76861
|
-
};
|
|
76862
|
-
return {
|
|
76863
|
-
insert: result.url,
|
|
76864
|
-
attributes
|
|
76865
|
-
};
|
|
76866
|
-
}
|
|
76867
|
-
function opToLinks(op) {
|
|
76868
|
-
var _a, _b;
|
|
76869
|
-
if ((_a = op.attributes) == null ? void 0 : _a.box) {
|
|
76870
|
-
return [op];
|
|
76871
|
-
}
|
|
76872
|
-
if ((_b = op.attributes) == null ? void 0 : _b.link) {
|
|
76873
|
-
return [op];
|
|
76874
|
-
}
|
|
76875
|
-
const text2 = op.insert;
|
|
76876
|
-
const attributes = op.attributes;
|
|
76877
|
-
const results = findLinks(text2);
|
|
76878
|
-
if (results.length === 0) {
|
|
76879
|
-
return [op];
|
|
76880
|
-
}
|
|
76881
|
-
let current = text2;
|
|
76882
|
-
const ops = [];
|
|
76883
|
-
for (let i = results.length - 1; i >= 0; i--) {
|
|
76884
|
-
const result = results[i];
|
|
76885
|
-
const right = current.substring(result.endIndex);
|
|
76886
|
-
if (right) {
|
|
76887
|
-
const rightOp = {
|
|
76888
|
-
insert: right
|
|
76889
|
-
};
|
|
76890
|
-
if (attributes) {
|
|
76891
|
-
rightOp.attributes = JSON.parse(JSON.stringify(attributes));
|
|
76892
|
-
}
|
|
76893
|
-
ops.unshift(rightOp);
|
|
76894
|
-
}
|
|
76895
|
-
const boxOp = urlToLinkOp(result);
|
|
76896
|
-
if (boxOp) {
|
|
76897
|
-
ops.unshift(boxOp);
|
|
76898
|
-
} else {
|
|
76899
|
-
const keepText = current.substring(result.startIndex, result.endIndex);
|
|
76900
|
-
const keepOp = {
|
|
76901
|
-
insert: keepText
|
|
76902
|
-
};
|
|
76903
|
-
if (attributes) {
|
|
76904
|
-
keepOp.attributes = attributes;
|
|
76905
|
-
}
|
|
76906
|
-
ops.unshift(keepOp);
|
|
76907
|
-
}
|
|
76908
|
-
current = current.substring(0, result.startIndex);
|
|
76909
|
-
}
|
|
76910
|
-
if (current) {
|
|
76911
|
-
const lastOp = {
|
|
76912
|
-
insert: current
|
|
76913
|
-
};
|
|
76914
|
-
if (attributes) {
|
|
76915
|
-
lastOp.attributes = attributes;
|
|
76916
|
-
}
|
|
76917
|
-
ops.unshift(lastOp);
|
|
76918
|
-
}
|
|
76919
|
-
return ops;
|
|
76920
|
-
}
|
|
76921
|
-
class ConvertLinkPasteHandler {
|
|
76922
|
-
constructor() {
|
|
76923
|
-
__publicField(this, "order");
|
|
76924
|
-
this.order = 200;
|
|
76925
|
-
}
|
|
76926
|
-
async handleBeforePasteDoc(editor, doc2) {
|
|
76927
|
-
for (const blocks of Object.values(doc2.blocks)) {
|
|
76928
|
-
for (const block of blocks) {
|
|
76929
|
-
if (block.type === "text") {
|
|
76930
|
-
const ops = block.text || [];
|
|
76931
|
-
const newOps = [];
|
|
76932
|
-
for (const op of ops) {
|
|
76933
|
-
const subOps = opToLinks(op);
|
|
76934
|
-
newOps.push(...subOps);
|
|
76935
|
-
}
|
|
76936
|
-
block.text = newOps;
|
|
76937
|
-
}
|
|
76938
|
-
}
|
|
76939
|
-
}
|
|
76940
|
-
return false;
|
|
76941
|
-
}
|
|
76942
|
-
}
|
|
76943
76837
|
function getImages(files) {
|
|
76944
76838
|
const images = [];
|
|
76945
76839
|
for (let i = 0; i < files.length; i++) {
|
|
@@ -76953,7 +76847,6 @@ ${docStr}
|
|
|
76953
76847
|
}
|
|
76954
76848
|
class OnesEditorPasteHandler {
|
|
76955
76849
|
constructor(editor) {
|
|
76956
|
-
editor.input.addHandler(new ConvertLinkPasteHandler());
|
|
76957
76850
|
editor.dataConverter.addConverter(new HtmlDataConverter());
|
|
76958
76851
|
editor.dataConverter.addConverter(new TextDataConverter());
|
|
76959
76852
|
editor.dataConverter.addConverter(new MarkdownDataConverter());
|
|
@@ -82156,45 +82049,24 @@ ${docStr}
|
|
|
82156
82049
|
};
|
|
82157
82050
|
return { blockData };
|
|
82158
82051
|
}
|
|
82159
|
-
function getOptions$5() {
|
|
82160
|
-
return {
|
|
82161
|
-
name: "toc",
|
|
82162
|
-
insertEmbedCommandItems: [{
|
|
82163
|
-
id: "insert-toc",
|
|
82164
|
-
name: i18n$1.t("toc.name"),
|
|
82165
|
-
icon: TocIcon,
|
|
82166
|
-
order: 510,
|
|
82167
|
-
group: "common",
|
|
82168
|
-
subText: getShortcutById("insert-toc")
|
|
82169
|
-
}],
|
|
82170
|
-
handleInsertEmptyEmbed: async (editor, options) => {
|
|
82171
|
-
const { containerId, blockIndex } = options;
|
|
82172
|
-
return editor.insertEmbed(containerId, blockIndex, "toc", {});
|
|
82173
|
-
}
|
|
82174
|
-
};
|
|
82175
|
-
}
|
|
82176
82052
|
const TocEmbed = {
|
|
82177
82053
|
embedType: "toc",
|
|
82178
82054
|
createEmbedContent: createEmbedContent$6,
|
|
82179
82055
|
convertTo: convertTo$8,
|
|
82180
|
-
convertFrom: convertFrom$4
|
|
82181
|
-
getOptions: getOptions$5
|
|
82056
|
+
convertFrom: convertFrom$4
|
|
82182
82057
|
};
|
|
82183
82058
|
const zhCN$c = {
|
|
82184
82059
|
toc: {
|
|
82185
|
-
name: "\u6807\u9898\u76EE\u5F55",
|
|
82186
82060
|
empty: "No Toc"
|
|
82187
82061
|
}
|
|
82188
82062
|
};
|
|
82189
82063
|
const enUS$c = {
|
|
82190
82064
|
toc: {
|
|
82191
|
-
name: "Toc",
|
|
82192
82065
|
empty: "No Toc"
|
|
82193
82066
|
}
|
|
82194
82067
|
};
|
|
82195
82068
|
const jaJP$c = {
|
|
82196
82069
|
toc: {
|
|
82197
|
-
name: "Toc",
|
|
82198
82070
|
empty: "No Toc"
|
|
82199
82071
|
}
|
|
82200
82072
|
};
|
|
@@ -86732,7 +86604,7 @@ ${data2.plantumlText}
|
|
|
86732
86604
|
this.editor.removeListener("selectionChanged", this.handleSelectionChange);
|
|
86733
86605
|
this.editor.removeListener("docChanged", this.handleSelectionChange);
|
|
86734
86606
|
document.removeEventListener("touchstart", this.handleTouchStart);
|
|
86735
|
-
document.removeEventListener("touchend", this.handleTouchEnd
|
|
86607
|
+
document.removeEventListener("touchend", this.handleTouchEnd);
|
|
86736
86608
|
document.removeEventListener("touchmove", this.handleTouchMove);
|
|
86737
86609
|
this.mobileEmbedMask.destroy();
|
|
86738
86610
|
this.cursorToolbar.destroy();
|
|
@@ -88409,6 +88281,172 @@ ${data2.plantumlText}
|
|
|
88409
88281
|
super.destroy();
|
|
88410
88282
|
}
|
|
88411
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();
|
|
88412
88450
|
const getCommandItems = () => [
|
|
88413
88451
|
{
|
|
88414
88452
|
name: i18n$1.t("webpage.bilibili"),
|
|
@@ -88471,11 +88509,8 @@ ${data2.plantumlText}
|
|
|
88471
88509
|
function isWebPageItem(id) {
|
|
88472
88510
|
return id === "insert-webPage";
|
|
88473
88511
|
}
|
|
88474
|
-
|
|
88475
|
-
|
|
88476
|
-
return editor.doc.externalDoc.recognizeLink(url);
|
|
88477
|
-
}
|
|
88478
|
-
return null;
|
|
88512
|
+
function recognizeWebPageLink(editor, url) {
|
|
88513
|
+
return urlAnalyzer.analyze(url);
|
|
88479
88514
|
}
|
|
88480
88515
|
function formatValue(value) {
|
|
88481
88516
|
if (value && !value.startsWith("http://") && !value.startsWith("https://") && !value.startsWith("//")) {
|
|
@@ -88526,14 +88561,13 @@ ${data2.plantumlText}
|
|
|
88526
88561
|
id: "webpage",
|
|
88527
88562
|
title: i18n$1.t("webpage.dialog.title", { name: (itemOption == null ? void 0 : itemOption.name) || "" }),
|
|
88528
88563
|
async onOk() {
|
|
88529
|
-
var _a;
|
|
88530
88564
|
const value = formatValue(getInputValue());
|
|
88531
88565
|
try {
|
|
88532
88566
|
await checkValue(value);
|
|
88533
|
-
const detail =
|
|
88567
|
+
const detail = recognizeWebPageLink(editor, value);
|
|
88534
88568
|
resolve((detail == null ? void 0 : detail.url) || "");
|
|
88535
88569
|
} catch (error2) {
|
|
88536
|
-
if ((
|
|
88570
|
+
if ((error2 == null ? void 0 : error2.message) === ErrCode.ANALYZER_UNKNOWN_URL) {
|
|
88537
88571
|
if (isWebPageItem(itemId)) {
|
|
88538
88572
|
resolve(value);
|
|
88539
88573
|
} else {
|
|
@@ -92741,7 +92775,7 @@ ${data2.plantumlText}
|
|
|
92741
92775
|
}
|
|
92742
92776
|
}
|
|
92743
92777
|
});
|
|
92744
|
-
editor.version = "2.8.
|
|
92778
|
+
editor.version = "2.8.15-beta.1";
|
|
92745
92779
|
return editor;
|
|
92746
92780
|
}
|
|
92747
92781
|
function isDoc(doc2) {
|
|
@@ -92854,7 +92888,7 @@ ${data2.plantumlText}
|
|
|
92854
92888
|
}
|
|
92855
92889
|
});
|
|
92856
92890
|
OnesEditorToolbar.register(editor);
|
|
92857
|
-
editor.version = "2.8.
|
|
92891
|
+
editor.version = "2.8.15-beta.1";
|
|
92858
92892
|
return editor;
|
|
92859
92893
|
}
|
|
92860
92894
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -138631,7 +138665,6 @@ ${data2.plantumlText}
|
|
|
138631
138665
|
exports2.AddCommentToOldDocCommandProvider = AddCommentToOldDocCommandProvider;
|
|
138632
138666
|
exports2.AddEmojiIcon = AddEmojiIcon;
|
|
138633
138667
|
exports2.AddIcon = AddIcon;
|
|
138634
|
-
exports2.AdjustWidthIcon = AdjustWidthIcon;
|
|
138635
138668
|
exports2.AlertDialog = AlertDialog;
|
|
138636
138669
|
exports2.AlertEmojiIcon = alterEmoji;
|
|
138637
138670
|
exports2.AlignCenterIcon = AlignCenterIcon;
|
|
@@ -138907,7 +138940,6 @@ ${data2.plantumlText}
|
|
|
138907
138940
|
exports2.TimeIcon = TimeIcon;
|
|
138908
138941
|
exports2.ToMindMapIcon = ToMindMapIcon;
|
|
138909
138942
|
exports2.TocEmbed = TocEmbed;
|
|
138910
|
-
exports2.TocIcon = TocIcon;
|
|
138911
138943
|
exports2.TreeIcon = TreeIcon;
|
|
138912
138944
|
exports2.UmlBrandIcon = UmlBrandIcon;
|
|
138913
138945
|
exports2.UmlIcon = UmlIcon;
|