zoukankan      html  css  js  c++  java
  • Js~xheditor的高级应用

    xheditor确实好用,但由于是第三方的插件,所以,在我们设置起来难免有点麻烦,下面我说几个场景:

    一 当你希望动态改变xheditor里的内容里需要这样做:   

         var editor = $('#Content').xheditor({ tools: 'full',  500, height: 200 });
    editor.setSource("");//清空上一次调用时的内容 editor.focus(); editor.pasteHTML(info
    + "</br>");

    二 当这个xheditor变化焦点或者移出焦点时,改变它的内容:

            var editor = $('#Content').xheditor({ tools: 'full',  500, height: 200 });
                editor.settings.focus = function () {
                    $("#Content").val("");
                }
                editor.settings.blur = function () {
                    if ($("#Content").val() == '填写您发表讨论的内容' || $("#Content").val() == '')
                        $("#Content").val("填写您发表讨论的内容");
                }

    三 如果希望使用xheditor的其它事件,可以参考下表:

    internalScript:是否清除内部代码
    inlineScript
    :是否清除内联代码
    internalStyle
    :是否清除内部样式
    inlineStyle
    :是否清除内联样式
    forcePtag
    :强制使用P标签
    upLinkUrl
    :超链接上传接口地址
    upLinkExt
    :超链接本地上传扩展限制
    upImgUrl
    :图片上传接口地址
    upImgExt
    :图片本地上传扩展限制
    upFlashUrl
    :动画上传接口地址
    upFlashExt
    :动画本地上传扩展限制
    upMediaUrl
    :视频上传接口地址
    upMediaExt
    :视频本地上传扩展限制
    beforeSetSource
    :在设置源代码到编辑器前调用此函数
    beforeGetSource
    :从编辑器返回源代码前调用此函数
    focus
    :编辑器获得焦点时回调此函数
    blur
    :编辑器失去焦点时回调此函数
  • 相关阅读:
    HDU
    HDU
    HDU
    2016蓝桥杯省赛C/C++A组第二题 跳蚱蜢
    2016蓝桥杯决赛C/C++A组第四题 路径之谜
    【洛谷P2397】yyy loves Maths VI (mode)【模拟】
    【洛谷P2397】yyy loves Maths VI (mode)【模拟】
    【NOIP2018】【洛谷P5017】摆渡车【DP】
    【NOIP2018】【洛谷P5017】摆渡车【DP】
    2018NOIP普及组 划水记
  • 原文地址:https://www.cnblogs.com/lori/p/2791334.html
Copyright © 2011-2022 走看看