ckeditor的HTML源缩进 [英] HTML source indentation for ckeditor

查看:77
本文介绍了ckeditor的HTML源缩进的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您在HTML视图中向ckeditor添加一些代码,然后更改为WYSIWYG视图并返回时,几乎所有HTML标记都已修改,并且缩进了。有什么办法可以防止这种行为? (参数,插件,硬代码...)

When you add some code to a ckeditor in HTML view and then change to WYSIWYG view and come back, almost all HTML tags have been modified and have loose the indentation. Is there any way to prevent this behaviour? (parameter, plugin, hard code...)

例如:

<div class="former input">
    <span class="big horizontal">
        <label for="test">Hi world</label>
        <input class="medium free" id="test" name="test" type="text" />
    </span>
</div>

成为:

<div class="former input">
    <span class="big horizontal"><label for="test">Hi world</label><input class="medium free" id="test" name="test" type="text" /></span></div>


推荐答案

以下是开发人员指南中页面的链接:

输出格式

Here's a link to a page in the developer's guide:
Output Formatting

它说明了如何控制编辑器输出的HTML代码的布局,并有一个示例设置了< p> 标记。

It explains how to control the layout of the HTML code that is output by the editor and has an example that sets the formatting for the <p> tag.

尝试使用< p> 标记示例作为模板,并设置<$ c $的格式c>< span> < label> < input> 标签

Try using the <p> tag example as a template and set the formatting for the <span>, <label> and <input> tags using the same approach.

writer.setRules( 'span',
writer.setRules( 'label',
writer.setRules( 'input',

请好,

Be Well,
Joe

这篇关于ckeditor的HTML源缩进的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆