@fileverse-dev/fortune-core 1.0.74 → 1.0.76
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/es/events/paste.js +11 -2
- package/lib/events/paste.js +10 -1
- package/package.json +1 -1
package/es/events/paste.js
CHANGED
|
@@ -22,7 +22,7 @@ import { getBorderInfoCompute } from "../modules/border";
|
|
|
22
22
|
import { expandRowsAndColumns, storeSheetParamALL } from "../modules/sheet";
|
|
23
23
|
import { jfrefreshgrid } from "../modules/refresh";
|
|
24
24
|
import { setRowHeight } from "../api";
|
|
25
|
-
import { CFSplitRange, sanitizeDuneUrl } from "../modules";
|
|
25
|
+
import { CFSplitRange, sanitizeDuneUrl, saveHyperlink } from "../modules";
|
|
26
26
|
import clipboard from "../modules/clipboard";
|
|
27
27
|
function postPasteCut(ctx, source, target, RowlChange) {
|
|
28
28
|
var execF_rc = {};
|
|
@@ -991,7 +991,7 @@ function handleFormulaStringPaste(ctx, formulaStr) {
|
|
|
991
991
|
}
|
|
992
992
|
}
|
|
993
993
|
export function handlePaste(ctx, e) {
|
|
994
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
994
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
|
|
995
995
|
var allowEdit = isAllowEdit(ctx);
|
|
996
996
|
if (!allowEdit) return;
|
|
997
997
|
if (selectionCache.isPasteAction) {
|
|
@@ -1356,6 +1356,15 @@ export function handlePaste(ctx, e) {
|
|
|
1356
1356
|
var text = clipboardData === null || clipboardData === void 0 ? void 0 : clipboardData.getData("text/plain");
|
|
1357
1357
|
if (text) {
|
|
1358
1358
|
document.execCommand("insertText", false, text);
|
|
1359
|
+
var urlRegex = /^(https?:\/\/[^\s]+)/;
|
|
1360
|
+
if (urlRegex.test(text)) {
|
|
1361
|
+
var last = (_y = ctx.luckysheet_select_save) === null || _y === void 0 ? void 0 : _y[ctx.luckysheet_select_save.length - 1];
|
|
1362
|
+
if (last) {
|
|
1363
|
+
var rowIndex = (_1 = (_z = last.row_focus) !== null && _z !== void 0 ? _z : (_0 = last.row) === null || _0 === void 0 ? void 0 : _0[0]) !== null && _1 !== void 0 ? _1 : 0;
|
|
1364
|
+
var colIndex = (_4 = (_2 = last.column_focus) !== null && _2 !== void 0 ? _2 : (_3 = last.column) === null || _3 === void 0 ? void 0 : _3[0]) !== null && _4 !== void 0 ? _4 : 0;
|
|
1365
|
+
saveHyperlink(ctx, rowIndex, colIndex, text, "webpage", text);
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1359
1368
|
}
|
|
1360
1369
|
}
|
|
1361
1370
|
}
|
package/lib/events/paste.js
CHANGED
|
@@ -999,7 +999,7 @@ function handleFormulaStringPaste(ctx, formulaStr) {
|
|
|
999
999
|
}
|
|
1000
1000
|
}
|
|
1001
1001
|
function handlePaste(ctx, e) {
|
|
1002
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
1002
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
|
|
1003
1003
|
var allowEdit = (0, _utils.isAllowEdit)(ctx);
|
|
1004
1004
|
if (!allowEdit) return;
|
|
1005
1005
|
if (_selection.selectionCache.isPasteAction) {
|
|
@@ -1364,6 +1364,15 @@ function handlePaste(ctx, e) {
|
|
|
1364
1364
|
var text = clipboardData === null || clipboardData === void 0 ? void 0 : clipboardData.getData("text/plain");
|
|
1365
1365
|
if (text) {
|
|
1366
1366
|
document.execCommand("insertText", false, text);
|
|
1367
|
+
var urlRegex = /^(https?:\/\/[^\s]+)/;
|
|
1368
|
+
if (urlRegex.test(text)) {
|
|
1369
|
+
var last = (_y = ctx.luckysheet_select_save) === null || _y === void 0 ? void 0 : _y[ctx.luckysheet_select_save.length - 1];
|
|
1370
|
+
if (last) {
|
|
1371
|
+
var rowIndex = (_1 = (_z = last.row_focus) !== null && _z !== void 0 ? _z : (_0 = last.row) === null || _0 === void 0 ? void 0 : _0[0]) !== null && _1 !== void 0 ? _1 : 0;
|
|
1372
|
+
var colIndex = (_4 = (_2 = last.column_focus) !== null && _2 !== void 0 ? _2 : (_3 = last.column) === null || _3 === void 0 ? void 0 : _3[0]) !== null && _4 !== void 0 ? _4 : 0;
|
|
1373
|
+
(0, _modules.saveHyperlink)(ctx, rowIndex, colIndex, text, "webpage", text);
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1367
1376
|
}
|
|
1368
1377
|
}
|
|
1369
1378
|
}
|