我正在用marqu3s\ summernote \Summernote;https://github.com/undeman/yii2-summernote修改的Yii2实现Summernote
但我无法添加夏季注释文档中显示的工具栏选项:http://summernote.org/deep-dive/
这就是我试图使用它的方式,但每当我添加工具栏选项时,工具栏就消失了。
$tabReport .= $form->field($model, 'ysk')->widget(Summernote::className(), [
'clientOptions' => [
'placeholder' => 'You can write here some important public notes to be display on top of the report...',
'minHeight' => 100,
'toolbar' => [
'style' => ['bold', 'italic', 'underline', 'clear'],
],
],
]
);有什么线索吗?
发布于 2017-01-31 00:19:49
您的数组格式错误:
'toolbar' => [
'style' => ['bold', 'italic', 'underline', 'clear'],
],将生成js:
'toolbar': {'style': ['bold', 'italic', 'underline', 'clear']}要生成所需的js,请使用与在javascript中相同的结构,即:
'toolbar' => [
['style': ['bold', 'italic', 'underline', 'clear']]
]在your answer的情况下
'toolbar' => [
['style', ['style']],
['font', ['bold', 'italic', 'underline', 'clear']],
['fontname', ['fontname']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['height', ['height']],
['table', ['table']],
['insert', ['link', 'picture', 'hr']],
['view', ['fullscreen', 'codeview']],
['help', ['help']],
]发布于 2017-01-30 23:44:09
嗯,看起来工具栏选项必须直接与js一起发布。
我所做的是将一个id添加到主客户端选项中:
$tabReport .= $form->field($model, 'ysk')->widget(Summernote::className(), [
'clientOptions' => [
'placeholder' => 'You can write here some important public notes to be display on top of the report...',
'minHeight' => 100,
'id' => 'ysk-summernote',
],
]
);然后在我的app.js中通过js添加工具栏选项(或者更好地在视图中注册)
$('#book-ysk').summernote({
toolbar: [
['style', ['style']],
['font', ['bold', 'italic', 'underline', 'clear']],
['fontname', ['fontname']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['height', ['height']],
['table', ['table']],
['insert', ['link', 'picture', 'hr']],
['view', ['fullscreen', 'codeview']],
['help', ['help']],
]
});像个魔法师一样工作
https://stackoverflow.com/questions/41938292
复制相似问题