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. 3
      .gitignore
  2. 2
      src/controllers/selection.js
  3. 1
      src/controllers/updateCell.js
  4. 9
      src/global/formula.js

3
.gitignore

@ -6,4 +6,5 @@ docs/.vuepress/dist
.idea .idea
.history .history
.vs .vs
.vscode

2
src/controllers/selection.js

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

1
src/controllers/updateCell.js

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

9
src/global/formula.js

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

Loading…
Cancel
Save