在线编辑文本网站(文本在线处理)

lxf2023-07-31 19:40:01

客户在使用kindeditor文本编辑器时,直接将Excel中的文本内容粘贴到文本编辑器中(能偷懒吗),然后不调整粘贴的内容直接保存(能偷懒吗)!对于这种无语的行为,我只能吼他。我来做个标签滤镜,这样你贴的时候就不会有问题了。谁惹得起客户)。

过滤方法也很简单:

善良的编辑。ready(function(k){ editor = k . create(' textarea[name = " content "]',{filter mode: true,//是否打开过滤模式});});

默认的过滤模式是关闭的。首先,将filterMode设置为true,然后添加htmlTags。指定要保留的HTML标记和属性。散列数组的键是HTML标记名,值是HTML属性数组,属性以“.”开头表示样式属性。数据类型:对象

KindEditor.ready(function (K) { editor = K.create('textarea[name="content"]', { filterMode: true,//是否开启过滤模式 htmlTags : { font : ['id', 'class', 'color', 'size', 'face', '.background-color'], div : [ 'id', 'class', 'align', '.border', '.margin', '.padding', '.text-align', '.color', '.background-color', '.font-size', '.font-family', '.font-weight', '.background', '.font-style', '.text-decoration', '.vertical-align', '.margin-left' ], a : ['id', 'class', 'href', 'target', 'name'], embed : ['id', 'class', 'src', 'width', 'height', 'type', 'loop', 'autostart', 'quality', '.width', '.height', 'align', 'allowscriptaccess'], img : ['id', 'class', 'src', 'width', 'height', 'border', 'alt', 'title', 'align', '.width', '.height', '.border'], 'p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6' : [ 'id', 'class', 'align', '.text-align', '.color', '.background-color', '.font-size', '.font-family', '.background', '.font-weight', '.font-style', '.text-decoration', '.vertical-align', '.text-indent', '.margin-left' ], pre : ['id', 'class'], hr : ['id', 'class', '.page-break-after'], 'br,tbody,tr,strong,b,sub,sup,em,i,u,strike,s,del' : ['id', 'class'], iframe : ['id', 'class', 'src', 'frameborder', 'width', 'height', '.width', '.height'] } });}); 善良的编辑。ready(function(k){ editor = k . create(' textarea[name = " content "]'),{filtermode: true,//是否开启过滤模式htmlTags: {font: ['id ',' class ',' color ',' size ','。背景色'],div : [ 'id ',' class ',' align ','。边框“,”。边距“,”。填充“,”。文本对齐“,”。颜色','。背景色','。字体大小','。字体系列“,”。字体粗细','。背景“,”。字体样式“,”。文本装饰“,”。垂直对齐“,”。左边距'],a : ['id ',' class ',' href ',' target ',' name'],embed : ['id ',' class ',' src ',' width ',' height ',' type ',' loop ',' autostart ',' quality ','。宽度','。height ',' align ',' allowscriptaccess'],img : ['id ',' class ',' src ',' width ',' height ',' border ',' alt ',' title ',' align ','。宽度','。高度','。border'],' p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6' : [ 'id ',' class ',' align ','。文本对齐“,”。颜色','。背景色','。字体大小','。字体系列“,”。背景“,”。字体粗细','。字体样式“,”。文本装饰“,”。垂直对齐“,”。文本缩进“,”。左边距'],前置:['id ',' class'],后置:['id ',' class ','。'],' br,tbody,tr,strong,b,sub,sup,em,I,u,strike,s,del' : ['id ',' class'],iframe : ['id ',' class ',' src ',' frameborder ',' width ',' height ','。宽度','。高度']} });});

adminjs.cn是一个以CSS、JavaScript、Vue、HTML为核心的前端开发技术网站。我们致力于为广大前端开发者提供专业、全面、实用的前端开发知识和技术支持。 在本网站中,您可以学习到最新的前端开发技术,了解前端开发的最新趋势和最佳实践。我们提供丰富的教程和案例,让您可以快速掌握前端开发的核心技术和流程。 Adminjs.cn还提供一系列实用的工具和插件,帮助您更加高效地进行前端开发工作。我们提供的工具和插件都经过精心设计和优化,可以帮助您节省时间和精力,提升开发效率。 在Adminjs.cn中,您可以找到您需要的一切前端开发资源,让您成为一名更加优秀的前端开发者。欢迎您加入我们的大家庭,一起探索前端开发的无限可能!