Browse Source

feat: 优化复制生成html时,colgroup的生成

master
菜猫子neko 4 years ago
parent
commit
5d62486c06
  1. 30
      src/controllers/selection.js

30
src/controllers/selection.js

@ -100,8 +100,6 @@ const selection = {
if (!clipboardData) { // for chrome if (!clipboardData) { // for chrome
clipboardData = e.originalEvent.clipboardData; clipboardData = e.originalEvent.clipboardData;
} }
console.log('clipboardData', clipboardData);
Store.luckysheet_selection_range = []; Store.luckysheet_selection_range = [];
//copy范围 //copy范围
@ -189,10 +187,18 @@ const selection = {
cpdata += `<tr height="${Store.config['rowlen'][r.toString()]}">`; cpdata += `<tr height="${Store.config['rowlen'][r.toString()]}">`;
} }
for (let j = 0; j < colIndexArr.length; j++) { for (let j = 0; j < colIndexArr.length; j++) {
let c = colIndexArr[j]; let c = colIndexArr[j];
if(r == rowIndexArr[0]){
if(Store.config == null || Store.config["columnlen"] == null || Store.config["columnlen"][c.toString()] == null){
colgroup += '<colgroup width="72px"></colgroup>';
}
else {
colgroup += '<colgroup width="'+ Store.config["columnlen"][c.toString()] +'px"></colgroup>';
}
}
if (Store.config["colhidden"] != null && Store.config["colhidden"][c] != null) { if (Store.config["colhidden"] != null && Store.config["colhidden"][c] != null) {
continue; continue;
} }
@ -202,15 +208,6 @@ const selection = {
if (d[r] != null && d[r][c] != null) { if (d[r] != null && d[r][c] != null) {
let style = "", span = ""; let style = "", span = "";
if(r == rowIndexArr[0]){
if(Store.config == null || Store.config["columnlen"] == null || Store.config["columnlen"][c.toString()] == null){
colgroup += '<colgroup width="72px"></colgroup>';
}
else {
colgroup += '<colgroup width="'+ Store.config["columnlen"][c.toString()] +'px"></colgroup>';
}
}
let reg = /^(w|W)((0?)|(0\.0+))$/; let reg = /^(w|W)((0?)|(0\.0+))$/;
let c_value; let c_value;
if(d[r][c].ct != null && d[r][c].ct.fa != null && d[r][c].ct.fa.match(reg)){ if(d[r][c].ct != null && d[r][c].ct.fa != null && d[r][c].ct.fa.match(reg)){
@ -509,15 +506,6 @@ const selection = {
column += ""; column += "";
if(r == rowIndexArr[0]){
if(Store.config == null || Store.config["columnlen"] == null || Store.config["columnlen"][c.toString()] == null){
colgroup += '<colgroup width="72px"></colgroup>';
}
else {
colgroup += '<colgroup width="'+ Store.config["columnlen"][c.toString()] +'px"></colgroup>';
}
}
column = replaceHtml(column, {"style": style, "span": ""}); column = replaceHtml(column, {"style": style, "span": ""});
column += ""; column += "";
} }

Loading…
Cancel
Save