Symfony | CKEditor占位符

Symfony | CKEditor占位符,ckeditor,placeholder,symfony,Ckeditor,Placeholder,Symfony,我用的是IvoryCKEditorBundle() 我找不到在buildform配置中添加占位符的方法。 这不起作用: ->add('text', CKEditorType::class, array( 'attr' => array( 'placeholder' => 'Your text ...' ) )) 我该怎么做?我必须在JQuery中完成它 TY您需要一个CKEdito

我用的是IvoryCKEditorBundle()

我找不到在buildform配置中添加占位符的方法。 这不起作用:

->add('text', CKEditorType::class, array(
            'attr' => array(
                'placeholder' => 'Your text ...'
            )
        ))
我该怎么做?我必须在JQuery中完成它


TY

您需要一个CKEditor插件来实现这一点

从下载配置帮助程序插件,并将该文件夹从zip文件解压缩到应用程序的web bundles目录(
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',
        ),
    )
))

要做到这一点,您需要一个CKEditor插件

从下载配置帮助程序插件,并将该文件夹从zip文件解压缩到应用程序的web bundles目录(
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...',
                ),
            ))

我不知道这是否曾经是最好的方式,但目前正确的答案是:

->add('text', CKEditorType::class, array(
                'config' => array(
                    'editorplaceholder' => 'placeholder text...',
                ),
            ))

您可以尝试使用“占位符”=>“您的文本…”指示相同级别的属性吗?如果我在相同级别的属性中使用“占位符”,则“占位符”选项不存在。您可以尝试使用“占位符”=>“您的文本…”指示相同级别的属性吗?如果我在相同级别的属性中使用“占位符”,则“占位符”选项不存在