CKEditor 在文本输入中显示了一个文本区域
CKEditor shows me a textarea inside text input
我的视图渲染有问题。
这是我构建表单的方式:
$builder->add('intitule', CKEditorType::class, [
'label'=>'NEW_CGU',
'required'=>false,
'data'=>'testj'
]);
我是这样显示的:
<div class="row m-0">
<div class="col-xs-5 plr-16 pt-16 pb-16 background-white" style="width : 100%">
{{ form_label(form.intitule) }}
<textarea id="editor1" >
{{ form_start(form, { 'attr': { 'novalidate': 'novalidate' }}) }}
{{ form_widget(form.intitule, { 'attr': { 'class': 'inscription plr-16' , 'rows' : '20'}}) }}
{{ form_errors(form.intitule) }}
{#<p class="help-block">Maximum 500 caractères.</p>#}
</textarea>
<div class="text-right">
<a href="{{ path('users_list') }}" class="button-square-prev">{{ "BACK"|trans }}</a>
{% if is_granted('ROLE_PREVIOUS_ADMIN') %}
<button disabled class="button-square" title="non accessible en consultation">Valider</button>
{% else %}
<button type="submit" class="button-square" onclick="return confirm('Êtes vous sûr de vouloir effectuer ces modifications?')">Valider</button>
{% endif %}
</div>
{{ form_end(form) }}
</div>
</div>
一切正常,但我的显示有问题。我在 CKEditor
的 "block text" 中有一个文本区域
最后,我的 JS 是这样的:
$(function() {
CKEDITOR.replace( 'editor1', {
removePlugins: 'magicline',
height: 400
} );
});
请问我做错了什么?
只需简单地从 html 表单输入中呈现您的小部件!
删除您的 <textarea id="editor1" >
标签。
我的视图渲染有问题。 这是我构建表单的方式:
$builder->add('intitule', CKEditorType::class, [
'label'=>'NEW_CGU',
'required'=>false,
'data'=>'testj'
]);
我是这样显示的:
<div class="row m-0">
<div class="col-xs-5 plr-16 pt-16 pb-16 background-white" style="width : 100%">
{{ form_label(form.intitule) }}
<textarea id="editor1" >
{{ form_start(form, { 'attr': { 'novalidate': 'novalidate' }}) }}
{{ form_widget(form.intitule, { 'attr': { 'class': 'inscription plr-16' , 'rows' : '20'}}) }}
{{ form_errors(form.intitule) }}
{#<p class="help-block">Maximum 500 caractères.</p>#}
</textarea>
<div class="text-right">
<a href="{{ path('users_list') }}" class="button-square-prev">{{ "BACK"|trans }}</a>
{% if is_granted('ROLE_PREVIOUS_ADMIN') %}
<button disabled class="button-square" title="non accessible en consultation">Valider</button>
{% else %}
<button type="submit" class="button-square" onclick="return confirm('Êtes vous sûr de vouloir effectuer ces modifications?')">Valider</button>
{% endif %}
</div>
{{ form_end(form) }}
</div>
</div>
一切正常,但我的显示有问题。我在 CKEditor
的 "block text" 中有一个文本区域最后,我的 JS 是这样的:
$(function() {
CKEDITOR.replace( 'editor1', {
removePlugins: 'magicline',
height: 400
} );
});
请问我做错了什么?
只需简单地从 html 表单输入中呈现您的小部件!
删除您的 <textarea id="editor1" >
标签。