Browse Source

Merge pull request #1019 from nekobc1998923/alt-enter-error

修复行高自适应场景问题、部分样式时回车换行样式覆盖问题
master
mengshukeji 3 years ago
committed by GitHub
parent
commit
69d8b4cec2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      src/controllers/inlineString.js
  2. 4
      src/global/formula.js

7
src/controllers/inlineString.js

@ -72,7 +72,7 @@ export function updateInlineStringFormat(cell, attr, value, $input){
if(startContainer===endContainer){
let span = startContainer.parentNode, spanIndex, inherit=false;
let content = span.innerHTML;
let content = span.innerText;
let fullContent = $textEditor.html();
if(fullContent.substr(0,5) != "<span"){
@ -303,8 +303,11 @@ export function enterKeyControll(cell){
$(startSpan).replaceWith(cont);
}
else{
// 这里不能取整个单元格的样式,因为如果设置了部分样式的话就会出问题
// let cssText = getFontStyleByCell(cell);
let cssText = startSpan.style.cssText;
let cssText = getFontStyleByCell(cell);
if(sright==""){
cont = "<span style='"+ cssText +"'>" + sleft + "\n\n" + "</span>";
}

4
src/global/formula.js

@ -1562,7 +1562,9 @@ const luckysheetformula = {
cfg["rowlen"] = {};
}
if ((d[r][c].tb == "2" && d[r][c].v != null) || isInlineStringCell(d[r][c])) {//自动换行
// 单元格行高自适应,只有在单元格不是合并单元格时才能生效
if ((d[r][c].tb == "2" && d[r][c].v != null) || isInlineStringCell(d[r][c]) && (typeof d[r][c]['mc'] == 'undefined')) {
//自动换行
let defaultrowlen = Store.defaultrowlen;
let canvas = $("#luckysheetTableContent").get(0).getContext("2d");

Loading…
Cancel
Save