主题: 添加引用插件
作者: mconcise, 发布日期: 2012-10-18 08:44:03, 浏览数: 2687
KindEditor.plugin('kindEditorButtonQuote', function(K) {
        var editor = this, name = 'kindEditorButtonQuote';
        editor.clickToolbar(name, function() {
            html = ['<div style="padding:10px 20px;">',
				'<textarea class="ke-textarea" style="width:408px;height:260px;"></textarea>',
				'</div>'].join(''),
			dialog = editor.createDialog({
				name : name,
				width : 450,
				title : editor.lang(name),
				body : html,
				yesBtn : {
					name : editor.lang('yes'),
					click : function(e) {
						var code = textarea.val(),
							html = "<div class='quote'><blockquote>"+ K.escape(code) + "</blockquote></div>";
						editor.insertHtml(html).hideDialog().focus();
					}
				}
			}),
			textarea = K('textarea', dialog.div);
			textarea[0].focus();
        });
});
KindEditor.lang({
	kindEditorButtonQuote : '添加引用',
});
.ke-icon-kindEditorButtonQuote {
    background-position: 0px -960px;
    width: 16px;
    height: 16px;
}
.quote {
	border: 0;
	border-left: 3px solid rgb(204, 204, 204);
	margin-left: 2em;
	padding: 0.5em;
	font-size: 110%;
	display: block;
	font-family: "Consolas", "Monaco", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace;
	margin: 1em 0px;
	white-space: pre;
}//把这段代码放进js/kindeditor/plugins/quote/quote.css里
cssPath : ['js/kindeditor/plugins/quote/quote.css'],
这里只处理了编辑器里的样式,并没有处理提交后的样式,如果想处理提交后的样式,请自行添加相应的css代码
发表新帖 发表回复