Browse Source

Merge pull request #1061 from xu3927/dev

fix: cell data contains "<" sign
master
mengshukeji 3 years ago
committed by GitHub
parent
commit
b116d90b05
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      .gitignore
  2. 2
      src/controllers/selection.js
  3. 1
      src/controllers/updateCell.js
  4. 9
      src/global/formula.js

1
.gitignore

@ -7,3 +7,4 @@ docs/.vuepress/dist
.idea
.history
.vs
.vscode

2
src/controllers/selection.js

@ -468,6 +468,8 @@ const selection = {
c_value = "";
}
c_value = formula.ltGtSignDeal(c_value)
column += c_value;
}
else {

1
src/controllers/updateCell.js

@ -222,6 +222,7 @@ export function luckysheetupdateCell(row_index1, col_index1, d, cover, isnotfocu
$("#luckysheet-rich-text-editor").html("");
}
else{
value = formula.ltGtSignDeal(value);
$("#luckysheet-rich-text-editor").html(value);
if (!isnotfocus) {
luckysheetRangeLast($("#luckysheet-rich-text-editor")[0]);

9
src/global/formula.js

@ -325,6 +325,13 @@ const luckysheetformula = {
if (typeof str !== 'string') return str;
return str.replace(/<script>/g, '&lt;script&gt;').replace(/<\/script>/, '&lt;/script&gt;');
},
ltGtSignDeal: function (str) {
if (typeof str !== 'string') return str;
if (str.substr(0, 5) === "<span" || str.startsWith('=')) {
return str
}
return str.replace(/</g, '&lt;').replace(/>/g, '&gt;');
},
fucntionboxshow: function(r, c) {
if (!checkProtectionCellHidden(r, c, Store.currentSheetIndex)) {
@ -3407,10 +3414,12 @@ const luckysheetformula = {
}
else {
value = _this.ltGtSignDeal(value);
$copy.html(value);
}
}
else {
value = _this.ltGtSignDeal(value);
$copy.html(value);
}
}

Loading…
Cancel
Save