yii2 - 如何在 Yii2 中使用 Froala 所见即所得编辑器在保存内容时禁用 html 编码?
问题描述
我在 Yii2 应用程序中使用了 Froala 编辑器。在将内容保存到数据库列问题时,它会添加 HTML 标记。如何禁用该选项,我只想按原样保存内容?
<?php echo froala\froalaeditor\FroalaEditorWidget::widget([
'model' => $model,
'attribute' => 'question',
'options' => [
// html attributes
'id'=>'question'
],
'clientOptions' => [
'toolbarInline' => false,
'theme' => 'royal', //optional: dark, red, gray, royal
'language' => 'en_gb' // optional: ar, bs, cs, da, de, en_ca, en_gb, en_us ...
]
]); ?>
解决方案
尝试这个:
<?php echo froala\froalaeditor\FroalaEditorWidget::widget([
'model' => $model,
'attribute' => 'question',
'options' => [
// html attributes
'id'=>'question'
],
'clientOptions' => [
'toolbarInline' => false,
'theme' => 'royal', //optional: dark, red, gray, royal
'language' => 'en_gb',
'entities' => '', // <- this
]
]); ?>
推荐阅读
- elasticsearch - Elastic-Cloud 未从 Serilog Sink 接收数据
- android - 我想每隔三个位置在列表视图中添加 google admob 原生广告,但我不能
- linux - linux中的简单排序
- postgresql - PostgreSQL 使用 JSONB 和 TypeORM 加入
- java - 一段时间后如何启动代码?
- php - prestashop 网址到类别
- docker - 在 devcontainers 中配置对私有存储库的访问
- scala - spark检测并提取列值中的模式
- swift - XCode + Swift:线程 1:EXC_BAD_ACCESS(代码=2,地址=0x7ffee99cdfd8)
- c# - C# http-get url JSON 数据并将其解析为文本..?