交响乐 | CKEditor占位符
Symfony | CKEditor placeholder
我正在使用 IvoryCKEditorBundle (http://symfony.com/doc/master/bundles/IvoryCKEditorBundle/index.html)
我找不到在构建表单配置中添加占位符的方法。
这不起作用:
->add('text', CKEditorType::class, array(
'attr' => array(
'placeholder' => 'Your text ...'
)
))
我该怎么做?我必须在 JQuery ?
内完成
TY
你需要一个 CKEditor 插件来做到这一点。
从 http://ckeditor.com/addon/confighelper 下载 Configuration Helper 插件,并将文件夹从 zip 文件解压缩到您的应用程序 (web/bundles/confighelper/
) 的网络捆绑目录。
在您的 buildForm
方法中加载插件并设置占位符如下
->add('text', CKEditorType::class, array(
'config' => array(
'extraPlugins' => 'confighelper',
'placeholder' => 'Your text ...',
),
'plugins' => array(
'confighelper' => array(
'path' => '/bundles/confighelper/',
'filename' => 'plugin.js',
),
)
))
我不知道这是否曾经是最好的方法,但目前正确答案是:
->add('text', CKEditorType::class, array(
'config' => array(
'editorplaceholder' => 'placeholder text...',
),
))
我正在使用 IvoryCKEditorBundle (http://symfony.com/doc/master/bundles/IvoryCKEditorBundle/index.html)
我找不到在构建表单配置中添加占位符的方法。 这不起作用:
->add('text', CKEditorType::class, array(
'attr' => array(
'placeholder' => 'Your text ...'
)
))
我该怎么做?我必须在 JQuery ?
内完成TY
你需要一个 CKEditor 插件来做到这一点。
从 http://ckeditor.com/addon/confighelper 下载 Configuration Helper 插件,并将文件夹从 zip 文件解压缩到您的应用程序 (web/bundles/confighelper/
) 的网络捆绑目录。
在您的 buildForm
方法中加载插件并设置占位符如下
->add('text', CKEditorType::class, array(
'config' => array(
'extraPlugins' => 'confighelper',
'placeholder' => 'Your text ...',
),
'plugins' => array(
'confighelper' => array(
'path' => '/bundles/confighelper/',
'filename' => 'plugin.js',
),
)
))
我不知道这是否曾经是最好的方法,但目前正确答案是:
->add('text', CKEditorType::class, array(
'config' => array(
'editorplaceholder' => 'placeholder text...',
),
))