kindeditor-4.1.7--- 文本编辑器

来源:互联网 发布:淘宝自动关闭订单软件 编辑:程序博客网 时间:2024/05/16 07:39

引用实例

<script language="JavaScript" type="text/javascript" src="include/kindeditor-4.1.7/kindeditor-min.js"></script>
include 为项目根目录文件
<textarea name="content" style="width:400px;height:240px;visibility:hidden;">KindEditor</textarea>
           
{literal}
<script>
    var editor;
 KindEditor.ready(function(K) {
  editor = K.create('textarea[name="content"]', {
   //items:["image", "multiimage"] //控制当前页面显示的可用按钮,全部可以去kindeditor-min.js设置items数组可设置全局,当前页面不设      //置,默认全局items数组
    //下面这行代码就是关键的所在,当失去焦点时执行 this.sync();
    afterBlur: function(){this.sync();} 
  });
 });
  </script>
{/literal}

js获取输入域内值 直接调用当前页面 var  editor变量,此变量也默认为当前页面的已知变量,不用再var,直接调用
类本例获取:
editor.html


后台获取 转义 htmlspecialchars($_POST【'content'】)
http://www.stepday.com/topic/?670
http://www.it163.org/post/118fd1_878ec8


保存入库时htmlspecialchars()函数处理,数据读出显示时htmlspecialchars_decode()处理

==================================来发例子

<textarea name="shop_content" style="width:500px;height:300px;"><?php echo is_array_set($basic, 'shop_content');?></textarea>
<textarea name="product_return" style="width:500px;height:300px;"><?php echo is_array_set($basic, 'product_return');?></textarea>

<script src='/assets/javascripts/jquery/jquery.min.js' type='text/javascript'></script>
  <!-- / kindeditor -->
 <script src="/assets/javascripts/plugins/kindeditor-4.1.10/kindeditor-all-min.js"></script>
 <script src="/assets/javascripts/plugins/kindeditor-4.1.10/lang/zh_CN.js"></script>

<script>
  KindEditor.ready(function(K) {
   K.create('textarea[name="shop_content"]', {
    autoHeightMode : true,
    items:[
                 'source', '|', 'undo', 'redo', '|',  'cut', 'copy', 'paste', '|', 'justifyleft', 'justifycenter', 'justifyright',
                 'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent',
                 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
                 'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
                 'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'table', 'hr','pagebreak',
           ],
    afterCreate : function() {
     this.loadPlugin('autoheight');
    }
   });
  });
 </script>
 <script>
  KindEditor.ready(function(K) {
   K.create('textarea[name="product_return"]', {
    autoHeightMode : true,
    items:[
                 'source', '|', 'undo', 'redo', '|',  'cut', 'copy', 'paste', '|', 'justifyleft', 'justifycenter', 'justifyright',
                 'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent',
                 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
                 'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
                 'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'table', 'hr','pagebreak',
           ],
    afterCreate : function() {
     this.loadPlugin('autoheight');
    }
   });
  });
 </script>
0 0
原创粉丝点击