File tree Expand file tree Collapse file tree 3 files changed +23
-6
lines changed Expand file tree Collapse file tree 3 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,8 @@ php artisan vendor:publish --provider='Overtrue\LaravelUEditor\UEditorServicePro
2929 // 编辑器的前端配置 参考:http://fex.baidu.com/ueditor/#start-config
3030 'config' => [
3131 'initialFrameHeight' => 400, // 例如初始化高度
32- ]
32+ ],
33+ // 'field_type' => '自定义名字'
3334 ]
3435 ]
3536
@@ -39,12 +40,28 @@ php artisan vendor:publish --provider='Overtrue\LaravelUEditor\UEditorServicePro
3940
4041## 使用
4142
43+ ### 2.*
44+ 组件名可配置,默认 ` UEditor `
45+
46+
4247在form表单中使用它:
4348``` php
44- $form->editor('content');
49+ $form->UEditor('content');
50+ // options 中参数会覆盖 extensions.ueditor.config 中参数
51+ $form->UEditor('content')->options(['initialFrameHeight' => 800]);
52+
53+ // 如果 extensions.ueditor.field_type 定义为 xxxEditor
54+ // $form->xxxEditor('content');
55+ ```
4556
57+ ### 1.*
58+ 在form表单中使用它:
59+ ``` php
60+ $form->editor('content');
4661// options 中参数会覆盖 extensions.ueditor.config 中参数
4762$form->editor('content')->options(['initialFrameHeight' => 800]);
63+
64+ // 升级2.* 后,不改代码兼容 1.*:可以配置 extensions.ueditor.field_type 为 editor
4865```
4966
5067## 大感谢
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ public function render()
1717 {
1818 $ name = $ this ->formatName ($ this ->column );
1919
20- $ config = Ueditor::config ('config ' ) ?? [] ;
20+ $ config = Ueditor::config ('config ' , []) ;
2121
2222 $ config = json_encode (array_merge ($ config , $ this ->options ));
2323
Original file line number Diff line number Diff line change @@ -13,16 +13,16 @@ class UeditorServiceProvider extends ServiceProvider
1313 */
1414 public function boot (Ueditor $ extension )
1515 {
16- if (! Ueditor::boot ()) {
17- return ;
16+ if (!Ueditor::boot ()) {
17+ return ;
1818 }
1919
2020 if ($ views = $ extension ->views ()) {
2121 $ this ->loadViewsFrom ($ views , 'laravel-admin-ueditor ' );
2222 }
2323
2424 Admin::booting (function () {
25- Form::extend (' editor ' , Editor::class);
25+ Form::extend (Ueditor:: config ( ' field_type ' , ' UEditor ' ) , Editor::class);
2626 });
2727 }
2828}
You can’t perform that action at this time.
0 commit comments