主题: 修正表格td带有colspan rowspan 属性错误 |
作者: Zxxk, 发布日期: 2009-06-05 16:17:42, 浏览数: 4086 |
当处理表格遇到td带有colspan rowspan 属性时,获取的代码表格就会错乱.. 解决方法(适用于3.1.2): 查找: var val = node.getAttribute(attr); if (val != null && val !== '') { if (typeof val == 'string' && val.match(/^javascript:/)) val = ''; if ((tagName == 'a' && attr == 'href') || (tagName == 'img' && attr == 'src') || (tagName == 'embed' && attr == 'src')) val = KEditor.util.removeDomain(id, val); attrStr += ' ' + attr + '="' + val + '"'; } 替换成: var val = node.getAttribute(attr); if (val != null && val !== '') { if (tagName == 'td' && (attr == 'colspan' || attr == 'rowspan')) { if (parseInt(val) > 1) attrStr += ' ' + attr + '="' + val + '"'; } else { if (typeof val == 'string' && val.match(/^javascript:/)) val = ''; if ((tagName == 'a' && attr == 'href') || (tagName == 'img' && attr == 'src') || (tagName == 'embed' && attr == 'src')) val = KEditor.util.removeDomain(id, val); attrStr += ' ' + attr + '="' + val + '"'; } }
查找: 'td': ['align', '.text-align', '.color', '.background-color', '.font-size', '.font-family', '.font-weight', '.font-style', '.text-decoration', '.vertical-align'] 替换成: 'td': ['align', 'valign', 'width','colspan', 'rowspan', 'bgcolor','.text-align', '.color', '.background-color', '.font-size', '.font-family', '.font-weight', '.font-style', '.text-decoration', '.vertical-align'] |