zoukankan      html  css  js  c++  java
  • kindeditor在光标处插入编辑器外的数据

    页面

                   <div class="form-group clearfix">
                                <label class="control-label col-sm-3 col-md-3 col-lg-3 m-from-fon1" for="userName">用户</label>
                                <div class="col-sm-9 col-md-6 col-lg-6">
                                    <input id="userName" name="userName" class="form-control dddd" type="button" value="用户名"/>
                                    <input id="email" name="email" class="form-control dddd" type="button" value="邮箱"/>
                                </div>
                            </div>

    js

    $(document).ready(function () {
      
        buildEditor();
        $(".dddd").on("click",function(){
            //alert($(this).context.name); 拿到name
            var startOffset = contentEditor.cmd.range.startOffset;//kindEditor中当前光标的位置索引值startOffset
            contentEditor.insertHtml('<strong>${'+$(this).context.name+'}</strong>');//js插入指定的HTML内容到光标处。
        });
    });
    
    var contentEditor;
    
    function buildEditor() {
        KindEditor.ready(function (K) {
            contentEditor = K.create('#content', KindEditor.buildOption('/kindeditor/upload.html', 'attachFile'));
        });
    
    
    }
  • 相关阅读:
    多进程多线程
    JS---闭包
    Canvas:时钟
    CANVAS画布与SVG的区别
    CSS盒模型
    CSS---伪类与伪元素的区别
    CSS生成内容
    利用画布绘制折线图
    uiwebview与objective-c
    GoBelieve JS IM SDK接入备忘
  • 原文地址:https://www.cnblogs.com/xuerong/p/kindeditor.html
Copyright © 2011-2022 走看看