diff --git a/src/controllers/handler.js b/src/controllers/handler.js index 0013006..1b1eba8 100644 --- a/src/controllers/handler.js +++ b/src/controllers/handler.js @@ -5684,8 +5684,7 @@ export default function luckysheetHandler() { }); $('#luckysheet-wa-editor,#luckysheet-icon-morebtn-div,.luckysheet-toolbar-button').click(function(e){ - // 取消格式刷状态 - if(menuButton.luckysheetPaintModelOn){ + if(this.id != 'luckysheet-icon-paintformat' && menuButton.luckysheetPaintModelOn){ menuButton.cancelPaintModel(); } }) diff --git a/src/controllers/menuButton.js b/src/controllers/menuButton.js index 6a94403..6547105 100644 --- a/src/controllers/menuButton.js +++ b/src/controllers/menuButton.js @@ -118,8 +118,8 @@ const menuButton = { let _this = this; //格式刷 - $("#luckysheet-icon-paintformat").click(function(){ - + $("#luckysheet-icon-paintformat").click(function(e){ + e.stopPropagation(); let _locale = locale(); let locale_paint = _locale.paint; diff --git a/src/controllers/selection.js b/src/controllers/selection.js index 1e28a39..0c1e0aa 100644 --- a/src/controllers/selection.js +++ b/src/controllers/selection.js @@ -1765,16 +1765,23 @@ const selection = { } if(getObjType(x[c]) == "object"){ - let format = ['bg','fc','ct','ht','vt','bl','it','cl','un','fs','ff','tb'] - format.forEach(item=>{ - Reflect.deleteProperty(x[c],item); - }) + if(x[c].ct && x[c].ct.t === "inlineStr"){ + delete value["ct"]; + }else{ + let format = ['bg','fc','ct','ht','vt','bl','it','cl','un','fs','ff','tb'] + format.forEach(item=>{ + Reflect.deleteProperty(x[c],item); + }) + } } else{ x[c] = {"v": x[c] }; } x[c] = $.extend(true, x[c], value); + if(x[c].ct && x[c].ct.t === "inlineStr"){ + x[c].ct.s.forEach(item=> item = $.extend(true, item, value)) + } if(copyHasMC && ("mc" in x[c])){ if(x[c]["mc"].rs != null){ diff --git a/src/global/getRowlen.js b/src/global/getRowlen.js index 3f7cc4a..2ce7b69 100644 --- a/src/global/getRowlen.js +++ b/src/global/getRowlen.js @@ -36,12 +36,23 @@ function rowlenByRange(d, r1, r2, cfg) { for(let c = 0; c < d[r].length; c++){ let cell = d[r][c]; - if(cell == null || cell.mc != null){ + if(cell == null){ continue; } if(cell != null && (cell.v != null || isInlineStringCell(cell)) ){ - let cellWidth = colLocationByIndex(c)[1] - colLocationByIndex(c)[0] - 2; + let cellWidth; + if(cell.mc){ + if(c === cell.mc.c){ + let st_cellWidth = colLocationByIndex(c)[0]; + let ed_cellWidth = colLocationByIndex(cell.mc.c + cell.mc.cs - 1)[1]; + cellWidth = ed_cellWidth - st_cellWidth - 2; + }else{ + continue; + } + } else { + cellWidth = colLocationByIndex(c)[1] - colLocationByIndex(c)[0] - 2; + } let textInfo = getCellTextInfo(cell, canvas,{ r:r,