わかりました、これがあなたがやろうとしていることだと思います:
$('image-upload-tag').redactor({
allowedTags: ['img'], // We only want images
buttons: ['image'], // Only display the image button in the toolbar
placeholder: "Drop images here…", // Just to give some user info
focusCallback: function() {
// This stops the caret from being visable, it’s not necessary
// but stops it looking like the user should be able to type.
this.getEditor().css('color', 'transparent');
},
keydownCallback: function(e) {
// Loose focus everytime a key is pressed.
this.getEditor().blur();
}
});
基本的に、通常どおりにリダクター エリアを設定します。許可されるタグとツールバーに表示するボタンにいくつかの制限を設定しました。エンドユーザーを混乱させないように、プレースホルダーを追加し、点滅するキャレットを透明にしました。おそらく、ここではなく css で透過ビットを実行する必要があります。
これkeydownCallback
は、実際にテキストが追加されないようにする機能です。本当に簡単です。キーが押されるたびに、要素からフォーカスを取り除くだけです。this.getEditor
編集可能なリダクター領域を返すのでblur()
、適用できます。これにより、他のアクション (キーバインディング、画像のドロップなど) が正常に機能します。
それがあなたが探していたものではない場合はお知らせください。