關於KindEditor插件一般寫法

$(document).ready(function() {
//加載編輯器
	KindEditor.ready(function(K) {
		editor1 = K.create('textarea[name="advertdescrition"]', {
				resizeType : 1,//可拖動變化編輯框的高度
				allowImageUpload : true,//顯示圖片上傳按鈕
				uploadJson : 'plugins/kindeditor-4.1.10/jsp/upload_json.jsp',
				items : [//字體,大小,顏色,粗體,斜體,取消格式,全屏,“換行符號”,左對齊,增加縮進,減少縮進,超鏈接,取消超鏈接,圖片上傳,預覽
					'fontname', 'fontsize', 'forecolor','bold', 'italic','removeformat','fullscreen','|', 
					'justifyleft','justifycenter','indent','outdent','link','unlink','image','preview'],
				cssPath : 'plugins/kindeditor/plugins/code/prettify.css',
			minWidth:500,
			minHeight:350,
			afterCreate : function() {//創建編輯框之後
				var self = this;
				K.ctrl(document, 13, function() {
					self.sync();
					document.forms['example'].submit();
				});
				K.ctrl(self.edit.doc, 13, function() {
					self.sync();
					document.forms['example'].submit();
				});
			}
		});
		//prettyPrint();
	});
});

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章