使用 yii2-ckeditor-widget 自定义 ckeditor 以接受 html 和 body 标签
Customizing ckeditor to accept html and body tags using yii2-ckeditor-widget
我正在使用 2 个 amigos ckeditor 小部件
<?= $form->field($model, 'text')->widget(CKEditor::className(), [
'options' => ['rows' => 6],
'preset' => 'basic'
]) ?>
如何添加配置设置,我希望编辑器接受 HTML 标签 hTML 和编辑器通常剥离的正文。我在小部件中的什么位置指定此设置。
有一个名为 clientOptions
的特殊 属性 用于设置插件选项。
过滤标签使用allowedContent
选项,你可以阅读官方文档here。
这是一个代码示例:
<?= $form->field($model, 'text')->widget(CKEditor::className(), [
'options' => ['rows' => 6],
'preset' => 'basic',
'clientOptions' => [
'allowedContent' => ...,
],
]) ?>
所以我添加了配置 'allowedContent' => true
并且成功了。
我正在使用 2 个 amigos ckeditor 小部件
<?= $form->field($model, 'text')->widget(CKEditor::className(), [
'options' => ['rows' => 6],
'preset' => 'basic'
]) ?>
如何添加配置设置,我希望编辑器接受 HTML 标签 hTML 和编辑器通常剥离的正文。我在小部件中的什么位置指定此设置。
有一个名为 clientOptions
的特殊 属性 用于设置插件选项。
过滤标签使用allowedContent
选项,你可以阅读官方文档here。
这是一个代码示例:
<?= $form->field($model, 'text')->widget(CKEditor::className(), [
'options' => ['rows' => 6],
'preset' => 'basic',
'clientOptions' => [
'allowedContent' => ...,
],
]) ?>
所以我添加了配置 'allowedContent' => true
并且成功了。