리치 텍스트 편집기 - Kindeditor - 4.1.10

14173 단어 프런트 엔드
<head>
    
  <link rel="stylesheet" href="../plugins/kindeditor/themes/default/default.css" />  
  <script charset="utf-8" src="../plugins/kindeditor/kindeditor-min.js">script>  
  <script charset="utf-8" src="../plugins/kindeditor/lang/zh_CN.js">script>
head>
<body>
    
    <textarea name="content" style="width:800px;height:400px;visibility:hidden;" >textarea>
body>
<!-- -->
<script type="text/javascript">  
    var editor;  
    KindEditor.ready(function(K) {  
        editor = K.create('textarea[name="content"]', {  
            allowFileManager : true  
        }); 
        // 
        K('input[name=getHtml]').click(function(e) {
            alert(editor.html());
        });

        K('input[name=isEmpty]').click(function(e) {
            alert(editor.isEmpty());
        });

        K('input[name=getText]').click(function(e) {
            alert(editor.text());
        });

        K('input[name=selectedHtml]').click(function(e) {
            alert(editor.selectedHtml());
        });

        K('input[name=setHtml]').click(function(e) {
            editor.html('

Hello KindEditor

'
); }); K('input[name=setText]').click(function(e) { editor.text('

Hello KindEditor

'
); }); K('input[name=insertHtml]').click(function(e) { editor.insertHtml(' HTML'); }); K('input[name=appendHtml]').click(function(e) { editor.appendHtml(' HTML'); }); K('input[name=clear]').click(function(e) { editor.html(''); }); }); </script>

좋은 웹페이지 즐겨찾기