質問
デフォルトでは、フォーマットメニューの下(ボタンをクリックすると)の下に、次のオプションがあります。
Normal Text
Quote
Code
Header 1
Header ...
Header 5
.
これらのオプションしかありません。
Normal Text
Quote
Code
.
それをする方法はありますか?私は構成オプションを洗練していて、それをする方法を見つけることができなかった。
解決
Olivérsの答えは間違っています。
次のようにしてこれを簡単に達成できます。
$('#redactor').redactor({
formattingTags: ['p', 'blockquote', 'pre']
});
.
他のヒント
悲しいことにこれを達成する唯一の方法は、 extant initorインスタンスredactorのデフォルトのツールバーの設定を上書きします。
ここでは、ここで作業POCを見ることができます。 http://jsfiddle.net/zmetser/7m3f9/d>
$(function() {
// Decorate redactor Object before init
$.Redactor.fn = (function () {
var toolbarInitOriginal = this.toolbarInit;
// Create a new toolbarInit method which suits our needs
this.toolbarInit = function (lang) {
// Grab the default toolbar...
var toolbar = toolbarInitOriginal(lang);
// ...and overwrite the formatting dropdown menu
toolbar.formatting.dropdown = {
p: {
title: lang.paragraph,
func: 'formatBlocks'
},
blockquote: {
title: lang.quote,
func: 'formatQuote',
className: 'redactor_format_blockquote'
},
pre: {
title: lang.code,
func: 'formatBlocks',
className: 'redactor_format_pre'
},
};
return toolbar;
};
return this;
}.call($.Redactor.fn));
// Init redactor
$('#redactor').redactor({
buttons: ['link', 'formatting', 'html']
});
});
. 所属していません StackOverflow