• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com专业计算机教程网站
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • html/xhtml
  • html5
  • CSS
  • XML/XSLT
  • Dreamweaver教程
  • Frontpage教程
  • 心得技巧
  • bootstrap
  • vue
  • AngularJS
  • HBuilder教程
  • css3
  • 浏览器兼容
  • div/css
  • 网页编辑器
  • axure
您的位置:首页 > 网页设计 >网页编辑器 > 百度编辑器 ueditor 内容编辑自动套P标签,及p标签 替换

百度编辑器 ueditor 内容编辑自动套P标签,及p标签 替换

作者:James2017 字体:[增加 减小] 来源:互联网 时间:2017-06-05

本文主要包含百度编辑器ueditor,百度ueditor,百度ueditor插件,ueditor 百度地图,百度ueditor工具下载等相关知识,James2017 希望在学习及工作中可以帮助到您

如图,红框为回车键和shift+回车 :

   ===>> 

ueditor.all.js中:

1:

搜索修改成false:allowDivTransToP: false
再搜索并修改以下:

//编辑器不能为空内容

if (domUtils.isEmptyNode(me.body)) {
me.body.innerHTML = '<div>' + (browser.ie ? '' : '<br/>') + '</div>';
}
</div>

2:

//给文本或者inline节点套p标签
      if (me.options.enterTag == 'p') {

        var child = this.body.firstChild, tmpNode;
        if (!child || child.nodeType == 1 &&
          (dtd.$cdata[child.tagName] || isCdataDiv(child) ||
            domUtils.isCustomeNode(child)
            )
          && child === this.body.lastChild) {
          this.body.innerHTML = '<div>' + (browser.ie ? ' ' : '<br/>') + '</div>' + this.body.innerHTML;

        } else {
          var p = me.document.createElement('div');
          while (child) {
            while (child && (child.nodeType == 3 || child.nodeType == 1 && dtd.p[child.tagName] && !dtd.$cdata[child.tagName])) {
              tmpNode = child.nextSibling;
              p.appendChild(child);
              child = tmpNode;
            }
            if (p.firstChild) {
              if (!child) {
                me.body.appendChild(p);
                break;
              } else {
                child.parentNode.insertBefore(p, child);
                p = me.document.createElement('div');
              }
            }
            child = child.nextSibling;
          }
        }
      }
</div>

以上类似的有好几处,将p 改为 div

3:

上代码框中 if (me.options.enterTag == 'p') 这个P根据以下开关来走
enterTag: 'p',//改后为回车换行增加br,不改为换行增加div
4:

//进入编辑器的li要套p标签,我不需要套P,注释掉吧

//进入编辑器的li要套p标签
  /*这里开始注释掉 me.addInputRule(function(root){
    utils.each(root.getNodesByTagName('li'),function(li){
      var tmpP = UE.uNode.createElement('p');
      for(var i= 0,ci;ci=li.children[i];){
        if(ci.type == 'text' || dtd.p[ci.tagName]){
</div>

5:以下找到并注释

//注释掉,这个是自动给ul增加一个内置的样式,如<ul class=" list-paddingleft-2">
node.className = utils.trim(node.className.replace(/list-paddingleft-\w+/,'')) + ' list-paddingleft-' + type;
</div>
//往下隔一行的这个注释掉,这个是自动去除粘贴进去的代码的li的style样式,为何清除我的样式?
li.style.cssText && (li.style.cssText = '');
</div>

到此就完成了

</div>

您可能想查找下面的文章:

  • php UEditor百度编辑器安装与使用方法分享
  • Ueditor百度编辑器的Html模式自动替换样式的解决方法
  • 百度编辑器 ueditor 内容编辑自动套P标签,及p标签 替换
  • 百度编辑器Ueditor增加字体的修改方法
  • Ueditor和CKeditor 两款编辑器的使用与配置方法
  • 百度UEditor编辑器使用教程与使用方法(图文)
  • ueditor编辑器不能上传图片问题的解决方法
  • 百度ueditor组件上传图片后如何设置img里的alt属性
  • 百度UEditor修改右下角统计字数包含html样式
  • UEditor编辑文章出现多余空行问题的解决办法

相关文章

  • 2017-06-05javascript fckeditor编辑器取值与赋值实现代码
  • 2017-06-05百度编辑器Ueditor增加字体的修改方法
  • 2017-06-05浏览器执行history.go(-1) FCKeditor编辑框内显示html源代码的解决方法
  • 2017-06-05免费开源百度编辑器(UEditor)使用方法
  • 2017-06-05javascript 在线文本编辑器实现代码
  • 2017-06-05fckeditor 防止上传非法文件 增加登录判断
  • 2017-06-0519款Javascript富文本网页编辑器
  • 2017-06-05FCKeditor添加自定义按钮的方法
  • 2017-06-05ckeditor syntaxhighlighter代码高亮插件配置分享
  • 2017-06-05fckeditor编辑器在php中的配置方法

文章分类

  • html/xhtml
  • html5
  • CSS
  • XML/XSLT
  • Dreamweaver教程
  • Frontpage教程
  • 心得技巧
  • bootstrap
  • vue
  • AngularJS
  • HBuilder教程
  • css3
  • 浏览器兼容
  • div/css
  • 网页编辑器
  • axure

最近更新的内容

    • syntaxhighlighter 去掉右上角问号图标的三种方法
    • CKeditor与syntaxhighlight打造joomla代码高亮
    • CuteEditor 编辑器的字体样式无法控制的解决方法
    • myFocus 一个KindEditor的焦点图插件
    • FCKeditorAPI 手册 js操作获取等
    • kindSoft在线网页编辑器简单的配置参数介绍
    • 一款支持插入表情的编辑器实现代码(简单思路挺重要)
    • FCKeditor 2.6.5 ASP环境安装配置使用说明
    • FCKeditor 和 SyntaxHighlighter 代码高亮插件的整合
    • ThinkPHP中FCKeditor编辑器的使用方法

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有