Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
fix(bug): bug
Browse files Browse the repository at this point in the history
bug

fix #367, fix #370
  • Loading branch information
wpxp123456 committed Dec 22, 2020
1 parent 552bac7 commit 19560eb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
29 changes: 24 additions & 5 deletions src/controllers/postil.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ const luckysheetPostil = {

let html = '<div id="luckysheet-postil-overshow">' +
'<canvas class="arrowCanvas" width="'+ size[2] +'" height="'+ size[3] +'" style="position:absolute;left:'+ size[0] +'px;top:'+ size[1] +'px;z-index:100;pointer-events:none;"></canvas>' +
'<div style="width:'+ (width - 12) +'px;min-height:'+ (height - 12) +'px;color:#000;padding:5px;border:1px solid #000;background-color:rgb(255,255,225);position:absolute;left:'+ fromX +'px;top:'+ fromY +'px;z-index:100;">'+ value +'</div>' +
'<div style="width:'+ (width - 12) +'px;min-height:'+ (height - 12) +'px;color:#000;padding:5px;border:1px solid #000;background-color:rgb(255,255,225);position:absolute;left:'+ fromX +'px;top:'+ fromY +'px;z-index:100;">'+ _this.htmlEscape(value) +'</div>' +
'</div>';

$(html).appendTo($("#luckysheet-cell-main"));
Expand Down Expand Up @@ -392,7 +392,7 @@ const luckysheetPostil = {
'</div>' +
'<div style="width:100%;height:100%;overflow:hidden;">' +
'<div class="formulaInputFocus" style="width:'+ (width - 12) +'px;height:'+ (height - 12) +'px;line-height:20px;box-sizing:border-box;text-align: center;;word-break:break-all;" spellcheck="false" contenteditable="true">' +
value +
_this.htmlEscape(value) +
'</div>' +
'</div>' +
'</div>' +
Expand Down Expand Up @@ -564,7 +564,7 @@ const luckysheetPostil = {
'</div>' +
'<div style="width:100%;height:100%;overflow:hidden;">' +
'<div class="formulaInputFocus" style="width:'+ (width - 12) +'px;height:'+ (height - 12) +'px;line-height:20px;box-sizing:border-box;text-align: center;;word-break:break-all;" spellcheck="false" contenteditable="true">' +
value +
_this.htmlEscape(value) +
'</div>' +
'</div>' +
'</div>' +
Expand Down Expand Up @@ -686,7 +686,7 @@ const luckysheetPostil = {
'</div>' +
'<div style="width:100%;height:100%;overflow:hidden;">' +
'<div class="formulaInputFocus" style="width:'+ (width - 12) +'px;height:'+ (height - 12) +'px;line-height:20px;box-sizing:border-box;text-align: center;;word-break:break-all;" spellcheck="false" contenteditable="true">' +
value +
_this.htmlEscape(value) +
'</div>' +
'</div>' +
'</div>' +
Expand Down Expand Up @@ -810,7 +810,7 @@ const luckysheetPostil = {
'</div>' +
'<div style="width:100%;height:100%;overflow:hidden;">' +
'<div class="formulaInputFocus" style="width:'+ (width - 12) +'px;height:'+ (height - 12) +'px;line-height:20px;box-sizing:border-box;text-align: center;;word-break:break-all;" spellcheck="false" contenteditable="true">' +
value +
_this.htmlEscape(value) +
'</div>' +
'</div>' +
'</div>' +
Expand Down Expand Up @@ -924,6 +924,25 @@ const luckysheetPostil = {
$("#" + id).hide();
}
});
},
htmlEscape: function(text){
return text.replace(/[<>"&]/g, function(match, pos, originalText){
console.log(match, pos, originalText)
switch(match){
case '<': {
return '&lt';
}
case '>': {
return '&gt';
}
case '&': {
return '&amp';
}
case '\"': {
return '&quot;';
}
}
})
}
}

Expand Down
1 change: 1 addition & 0 deletions src/controllers/sheetmanage.js
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,7 @@ const sheetmanage = {
storeSheetParam: function() {
let index = this.getSheetIndex(Store.currentSheetIndex);
let file = Store.luckysheetfile[index];
file["config"] = Store.config;
file["visibledatarow"] = Store.visibledatarow;
file["visibledatacolumn"] = Store.visibledatacolumn;
file["ch_width"] = Store.ch_width;
Expand Down

0 comments on commit 19560eb

Please sign in to comment.