我正在开发一个 PHP-web 应用程序,它使用 TinymceBundle 将文本框设置为所见即所得编辑器的样式(我接管了那个项目,我最初没有实现这个功能)。
显然,标准的 tinyMCE 编辑器有一个内置功能,可以捕获Ctrl+ SClick 事件并将其视为表单提交(而不是浏览器尝试保存当前站点)。
但是现在我更新了供应商库,包括 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 后是否也遇到过这种行为(如果它是 tinyMCE 的错误,我猜我无能为力)?
编辑:以下是应用程序中用于呈现编辑器的代码 - 不幸的是,几乎所有 JS 初始化都TinymceBundle
封装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 %}
更新的问题:有人知道我如何专门使用Stfalcon/TinymceBundle
for配置 tinyMCESymfony2
吗?. 据我了解,它意味着只能通过 symfony.yml
文件进行配置,这些文件不允许您添加诸如
setup: function (ed) { ... }
tinyMCE 的配置