kindeditor一些个人修改
1.替换script里面的内容的问题
2.颜色选择器扩展,复制的fck编辑器选颜色
3.swfupload.swf上传前图片预览功能
kindeditor.js
function _formatHtml(html, htmlTags, urlType, wellFormatted, indentChar) { if (html == null) { html = ''; } //2015-03-25 html = html.replace(/textarea__/ig, "textarea"); urlType = urlType || ''; wellFormatted = _undef(wellFormatted, false); indentChar = _undef(indentChar, '\t'); var fontSizeList = 'xx-small,x-small,small,medium,large,x-large,xx-large'.split(','); //2015-04-02将script里面的数据读取处理 var obj = {}; var index = 0; html = html.replace(/(<script\s[^>]*>)([\s\S]*"{$script__" + index + "$}"; obj[key] = value; index++; return $1 + key + $3; } else { return $0; } }); html = html.replace(/(<("'<>]+)|("]+="[^"]*")|("]+='[^']*'))*)(\/)"'" + val + "'"; } fontStyle += key + ':' + val + ';'; }); attrMap.style = fontStyle; } _each(attrMap, function (key, val) { if (_FILL_ATTR_MAP[key]) { attrMap[key] = key; } if (_inArray(key, ['src', 'href']) >= 0) { attrMap[key] = _formatUrl(val, urlType); } if (htmlTags && key !== 'style' && !htmlTagMap[tagName]['*'] && !htmlTagMap[tagName][key] || tagName === 'body' && key === 'contenteditable' || /^kindeditor_\d+$/.test(key)) { delete attrMap[key]; } if (key === 'style' && val !== '') { var styleMap = _getCssList(val); _each(styleMap, function (k, v) { if (htmlTags && !htmlTagMap[tagName].style && !htmlTagMap[tagName]['.' + k]) { delete styleMap[k]; } }); var style = ''; _each(styleMap, function (k, v) { style += k + ':' + v + ';'; }); attrMap.style = style; } }); attr = ''; _each(attrMap, function (key, val) { if (key === 'style' && val === '') { return; } val = val.replace(/"/g, '"'); attr += ' ' + key + '="' + val + '"'; }); } if (tagName === 'font') { tagName = 'span'; } return startNewline + '<' + startSlash + tagName + attr + endSlash + '>' + endNewline; }); html = html.replace(/(<("__kindeditor_pre_newline__">\n') + $3; }); html = html.replace(/\n\s*\n/g, '\n'); html = html.replace(/<span id="__kindeditor_pre_newline__">\n/g, '\n'); for (var key in obj) { html = html.replace(key, obj[key]); } //alert(html); return _trim(html); }
以上所述就是修改的kindeditor的全部代码了,希望大家能够喜欢。
标签:
kindeditor
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com
暂无“kindeditor修复会替换script内容的问题”评论...