TinymceBundle を使用してテキストボックスを WYSIWYG エディターとしてスタイルする PHP Web アプリケーションに取り組んでいます (私はそのプロジェクトを引き継ぎましたが、最初はこの機能を実装していませんでした)。
どうやらtinyMCEエディタには標準で、Ctrl+Sクリックイベントをキャプチャしてフォーム送信として扱う機能が組み込まれています(ブラウザが現在のサイトを保存しようとするのではなく)。
しかし今、私は TinymceBundle を含むベンダー ライブラリの更新を行い、Ctrl+Sフォームを保存することはもう機能しません。
app/config.yml
これは、私が見つけたウィジェットの構成です。
stfalcon_tinymce:
include_jquery: true
textarea_class: "tinymce"
theme:
simple:
mode: "textareas"
theme: "advanced"
width: '728' #firefox on windows made it too wide for some reason
theme_advanced_buttons1: "mylistbox,mysplitbutton,bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,undo,redo,link,unlink"
theme_advanced_buttons2: ""
theme_advanced_buttons3: ""
theme_advanced_toolbar_location: "top"
theme_advanced_toolbar_align: "left"
theme_advanced_statusbar_location: "bottom"
plugins: "fullscreen"
theme_advanced_buttons1_add: "fullscreen"
advanced:
language: de
theme: "advanced"
plugins: "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,noneditable,visualchars,nonbreaking,xhtmlxtras,template"
theme_advanced_buttons1: "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,fontselect,fontsizeselect"
theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,cleanup,code,|,insertdate,inserttime,preview,|,forecolor,backcolor"
theme_advanced_buttons3: "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,|,ltr,rtl,|,fullscreen"
theme_advanced_buttons4: "moveforward,movebackward,|,scite,del,ins,|,visualchars,nonbreaking,pagebreak"
theme_advanced_toolbar_location: "top"
theme_advanced_toolbar_align: "left"
theme_advanced_statusbar_location: "bottom"
theme_advanced_resizing: true
Ctrl私が見る限り、 +保存機能を具体的に有効にするものは何もないSので、デフォルトで有効になっていると思いましたが、再び有効にするために何かが必要です(顧客は更新以来それを見逃しているため)、私はしませんでしたtinyMCE のドキュメントで、この設定オプションを見つけてください。
古いバージョンにとどまることは、実際にはオプションではありません。
Ctrl+ S= フォーム送信機能を手動で有効にする方法を知っている人はいますか、またはTinymceBundle の更新後にこの動作を経験しましたか (tinymceBundle のバグである場合、私はあまりできないと思います)?
編集:TinymceBundle
以下は、エディターをレンダリングするためにアプリケーションで使用されるコードです。残念ながら、ほとんどすべての JS 初期化は、呼び出しも含めて にカプセル化されています。tinyMCE.init( ... )
構成全体は、 のエントリに対して機能するはずapp/config.ym
です。
NoticeType
テキストフィールドを持つクラス:
class NoticeType extends AbstractType
{
public function buildForm(FormBuilder $builder, array $options)
{
$builder
->add('contact')
->add('user')
->add('direction', 'choice', array(
'choices' => array('out' => 'Ausgehend', 'in' => 'Eingehend', ),
'required' => true,
))
->add('text', 'textarea', array(
'attr' => array('class' => 'tinymce'),
))
->add('customer')
->add('date', 'datetime', array(
'input' => 'datetime',
// 'date_format' => \IntlDateFormatter::FULL,
'widget' => 'single_text',
))
;
}
public function getName()
{
return 'evenos_enoticebundle_noticetype';
}
}
フォームがレンダリングされるテンプレートで:
{% extends 'EvenosEnoticeBundle::base.html.twig' %}
{% block body %}
<h1>Neue Notiz</h1>
{{ tinymce_init() }}
<form action="{{ path('notice_create') }}" method="post" {{ form_enctype(form) }}>
[...other fields...]
{{ form_label(form.text, 'Text') }}
{{ form_widget(form.text, { 'attr': {'cols': '100', 'rows': 20} }) }}
[...]
<p>
<button type="submit" class="btnCreate">Anlegen</button>
</p>
</form>
[...]
{% endblock %}
更新された質問:を使用してtinyMCEを具体的に構成する方法を知っている人はいますか? Stfalcon/TinymceBundle
Symfony2
. 私が理解しているように、それはsymfony.yml
ファイルを介してのみ設定されることを意図しており、たとえば次のような機能を追加することはできません
setup: function (ed) { ... }
tinyMCE の設定