主题: KE 4 asp.net init script with relative path
作者: ryan, 发布日期: 2011-08-20 14:12:10, 浏览数: 3551

This is my code for how I initialize KindEditor 4.0 Beta in ASP.net.

-Relative path support for script loading

-Save button, a toolbar plugin to sync the textarea then execute a postback

-Uses asp:TextBox

 

<style type="text/css">
    .ke-icon-save {
	    background-image: url(<%= this.ResolveClientUrl("~/Images/saveButton.png") %>) !IMPORTANT;
	    width: 16px;
	    height: 16px;
    }
</style>
<script type="text/javascript" charset="utf-8" src="<%= this.ResolveClientUrl("~/Scripts/KindEditor/kindeditor.js") %>"></script>
    <link rel="stylesheet" href="<%= this.ResolveClientUrl("~/Scripts/KindEditor/themes/default/default.css") %>" />
    <script type="text/javascript" charset="utf-8" src="<%= this.ResolveClientUrl("~/Scripts/KindEditor/lang/en.js") %>"></script>
    <script type="text/javascript" charset="utf-8">
        var editor;

        KindEditor.ready(function (K) {
            editor = K.create('#<%=txtAspMultiLineTextBox.ClientID%>', {
                langType: 'en',
                allowFileManager: true,
                uploadJson: '<%= this.ResolveClientUrl("~/Scripts/KindEditor/asp.net/upload_json.ashx") %>',
                fileManagerJson: '<%= this.ResolveClientUrl("~/Scripts/KindEditor/asp.net/file_manager_json.ashx") %>',
                themeType: 'simple',
                items: [
               'save', '|', 'source', '|', 'fullscreen', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'cut', 'copy', 'paste', 
               'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright', 
               'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript', 
               'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 
               'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 
               'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 
               'flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'map', 'code', 'pagebreak', 'link', 'unlink' 
               ] 
            });
            K.plugin('save', function (K) {
                var self = this, name = 'save';
                self.clickToolbar(name, function () {
                    this.sync();
                    document.forms[0].submit();
                });
            });
        });
    </script>

 

发表新帖 发表回复