Wednesday, 15 February 2012

php - Symfony2 TinymceBundle - CTRL-S does not save after update -



php - Symfony2 TinymceBundle - CTRL-S does not save after update -

i'm working on php-web application, wich uses tinymcebundle style textboxes wysiwyg-editors (i took on project, didn't implement feature initially).

appearantly tinymce editor standard has build in feature captures ctrl+s click event , treats form submission (instead of browser trying save current site).

but did update of vendor libraries, including tinymcebundle , ctrl+s save form doesn't work anymore.

this configuration of widget in app/config.yml how found it:

stfalcon_tinymce: include_jquery: true textarea_class: "tinymce" theme: simple: mode: "textareas" theme: "advanced" width: '728' #firefox on windows made wide 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

for can see, there nil enabling ctrl+s save functionality, assumed enabled default, need enable 1 time again (as client missing since update) , didn't find config alternative @ tinymce documentation.

staying old version not option.

does know how enable ctrl+s = form submit functionality hand or did experience behaviour after update of tinymcebundle (if it's bug of tinymce can't much guess)?

thanks in advance!

edit: th next code used in application render editor - unfortunately of js-initialization encapsulated in tinymcebundle, tinymce.init( ... ) phone call - whole configuration supposed work on entries in app/config.ym.

the noticetype class has text field:

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() { homecoming 'evenos_enoticebundle_noticetype'; } }

in template form rendered:

{% 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 %}

updated question: know how can configure tinymce specifically using stfalcon/tinymcebundle symfony2?. grasp it, es meant configured through symfony .yml files, don't allow add together e.g. functions

setup: function (ed) { ... }

configuration tinymce

you implement advised here similar problem.

edit: here first-class tutorial symfone/tinymce. in section "override render method" insert setup configuration parameter follows

tinymce.init({ ... setup : function(ed) { ed.onkeydown.add(function onkeydown(ed, evt) { // shortcut: ctrl+h if (evt.keycode == 72 && !evt.altkey && !evt.shiftkey && evt.ctrlkey && !evt.metakey) { settimeout(function(){ var e = { type : 'keydown'}; e.charcode = e.keycode = e.which = 72; e.shiftkey = e.altkey = e.metakey = false; e.ctrlkey = true; window.parent && window.parent.receiveshortcutevent && window.parent.receiveshortcutevent(e); }, 1); } }); }, });

now insert script tag containing javascript function receive_shortcutevents in template.

php symfony2 tinymce

No comments:

Post a Comment