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
clipboardData = e.originalEvent.clipboardData;
}
console.log('clipboardData', clipboardData);
Store.luckysheet_selection_range = [];
//copy范围
@ -189,19 +187,9 @@ const selection = {
cpdata += `<tr height="${Store.config['rowlen'][r.toString()]}">`;
}
for (let j = 0; j < colIndexArr.length; j++) {
let c = colIndexArr[j];
if (Store.config["colhidden"] != null && Store.config["colhidden"][c] != null) {
continue;
}
let column = '<td ${span} style="${style}">';
if (d[r] != null && d[r][c] != null) {
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>';
@ -211,6 +199,15 @@ const selection = {
}
}
if (Store.config["colhidden"] != null && Store.config["colhidden"][c] != null) {
continue;
}
let column = '<td ${span} style="${style}">';
if (d[r] != null && d[r][c] != null) {
let style = "", span = "";
let reg = /^(w|W)((0?)|(0\.0+))$/;
let c_value;
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 += "";
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 += "";
}

Loading…
Cancel
Save