@fileverse-dev/fortune-core 1.0.18 → 1.0.20
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 +21 -2
- package/lib/events/paste.js +21 -2
- package/package.json +1 -1
package/es/events/paste.js
CHANGED
|
@@ -259,7 +259,7 @@ function pasteHandler(ctx, data, borderInfo) {
|
|
|
259
259
|
if (isRealNum(value)) {
|
|
260
260
|
if (originCell && originCell.ct && originCell.ct.fa === "@") {
|
|
261
261
|
value = String(value);
|
|
262
|
-
} else {
|
|
262
|
+
} else if (!/^0x?[a-fA-F0-9]+$/.test(value)) {
|
|
263
263
|
value = parseFloat(value);
|
|
264
264
|
}
|
|
265
265
|
}
|
|
@@ -278,6 +278,14 @@ function pasteHandler(ctx, data, borderInfo) {
|
|
|
278
278
|
var cell = {};
|
|
279
279
|
var mask = genarate(value);
|
|
280
280
|
_a = mask, cell.m = _a[0], cell.ct = _a[1], cell.v = _a[2];
|
|
281
|
+
if (/^0x?[a-fA-F0-9]+$/.test(value)) {
|
|
282
|
+
cell.m = value;
|
|
283
|
+
cell.ct = {
|
|
284
|
+
fa: "@",
|
|
285
|
+
t: "s"
|
|
286
|
+
};
|
|
287
|
+
cell.v = value;
|
|
288
|
+
}
|
|
281
289
|
x[c + curC] = cell;
|
|
282
290
|
}
|
|
283
291
|
}
|
|
@@ -1117,6 +1125,14 @@ export function handlePaste(ctx, e) {
|
|
|
1117
1125
|
} else {
|
|
1118
1126
|
var mask = genarate(txt);
|
|
1119
1127
|
cell.m = mask[0], cell.ct = mask[1], cell.v = mask[2];
|
|
1128
|
+
if (/^0x?[a-fA-F0-9]+$/.test(txt)) {
|
|
1129
|
+
cell.ct = {
|
|
1130
|
+
fa: "@",
|
|
1131
|
+
t: "s"
|
|
1132
|
+
};
|
|
1133
|
+
cell.m = txt;
|
|
1134
|
+
cell.v = txt;
|
|
1135
|
+
}
|
|
1120
1136
|
}
|
|
1121
1137
|
var styleString = typeof allStyleList_1[".".concat(className)] === "string" ? allStyleList_1[".".concat(className)].substring(1, allStyleList_1[".".concat(className)].length - 1).split("\n\t") : [];
|
|
1122
1138
|
var styles = {};
|
|
@@ -1333,7 +1349,10 @@ export function handlePasteByClick(ctx, clipboardData, triggerType) {
|
|
|
1333
1349
|
var _a, _b, _c;
|
|
1334
1350
|
var allowEdit = isAllowEdit(ctx);
|
|
1335
1351
|
if (!allowEdit) return;
|
|
1336
|
-
if (clipboardData)
|
|
1352
|
+
if (clipboardData) {
|
|
1353
|
+
var htmlWithPreservedNewlines = "<pre style=\"white-space: pre-wrap;\">".concat(clipboardData, "</pre>");
|
|
1354
|
+
clipboard.writeHtml(htmlWithPreservedNewlines);
|
|
1355
|
+
}
|
|
1337
1356
|
var textarea = document.querySelector("#fortune-copy-content");
|
|
1338
1357
|
var data = (textarea === null || textarea === void 0 ? void 0 : textarea.innerHTML) || (textarea === null || textarea === void 0 ? void 0 : textarea.textContent);
|
|
1339
1358
|
if (!data) return;
|
package/lib/events/paste.js
CHANGED
|
@@ -267,7 +267,7 @@ function pasteHandler(ctx, data, borderInfo) {
|
|
|
267
267
|
if ((0, _validation.isRealNum)(value)) {
|
|
268
268
|
if (originCell && originCell.ct && originCell.ct.fa === "@") {
|
|
269
269
|
value = String(value);
|
|
270
|
-
} else {
|
|
270
|
+
} else if (!/^0x?[a-fA-F0-9]+$/.test(value)) {
|
|
271
271
|
value = parseFloat(value);
|
|
272
272
|
}
|
|
273
273
|
}
|
|
@@ -286,6 +286,14 @@ function pasteHandler(ctx, data, borderInfo) {
|
|
|
286
286
|
var cell = {};
|
|
287
287
|
var mask = (0, _format.genarate)(value);
|
|
288
288
|
_a = mask, cell.m = _a[0], cell.ct = _a[1], cell.v = _a[2];
|
|
289
|
+
if (/^0x?[a-fA-F0-9]+$/.test(value)) {
|
|
290
|
+
cell.m = value;
|
|
291
|
+
cell.ct = {
|
|
292
|
+
fa: "@",
|
|
293
|
+
t: "s"
|
|
294
|
+
};
|
|
295
|
+
cell.v = value;
|
|
296
|
+
}
|
|
289
297
|
x[c + curC] = cell;
|
|
290
298
|
}
|
|
291
299
|
}
|
|
@@ -1125,6 +1133,14 @@ function handlePaste(ctx, e) {
|
|
|
1125
1133
|
} else {
|
|
1126
1134
|
var mask = (0, _format.genarate)(txt);
|
|
1127
1135
|
cell.m = mask[0], cell.ct = mask[1], cell.v = mask[2];
|
|
1136
|
+
if (/^0x?[a-fA-F0-9]+$/.test(txt)) {
|
|
1137
|
+
cell.ct = {
|
|
1138
|
+
fa: "@",
|
|
1139
|
+
t: "s"
|
|
1140
|
+
};
|
|
1141
|
+
cell.m = txt;
|
|
1142
|
+
cell.v = txt;
|
|
1143
|
+
}
|
|
1128
1144
|
}
|
|
1129
1145
|
var styleString = typeof allStyleList_1[".".concat(className)] === "string" ? allStyleList_1[".".concat(className)].substring(1, allStyleList_1[".".concat(className)].length - 1).split("\n\t") : [];
|
|
1130
1146
|
var styles = {};
|
|
@@ -1341,7 +1357,10 @@ function handlePasteByClick(ctx, clipboardData, triggerType) {
|
|
|
1341
1357
|
var _a, _b, _c;
|
|
1342
1358
|
var allowEdit = (0, _utils.isAllowEdit)(ctx);
|
|
1343
1359
|
if (!allowEdit) return;
|
|
1344
|
-
if (clipboardData)
|
|
1360
|
+
if (clipboardData) {
|
|
1361
|
+
var htmlWithPreservedNewlines = "<pre style=\"white-space: pre-wrap;\">".concat(clipboardData, "</pre>");
|
|
1362
|
+
_clipboard.default.writeHtml(htmlWithPreservedNewlines);
|
|
1363
|
+
}
|
|
1345
1364
|
var textarea = document.querySelector("#fortune-copy-content");
|
|
1346
1365
|
var data = (textarea === null || textarea === void 0 ? void 0 : textarea.innerHTML) || (textarea === null || textarea === void 0 ? void 0 : textarea.textContent);
|
|
1347
1366
|
if (!data) return;
|