component editor
parent
007f5bb08d
commit
2c2436aa8e
|
|
@ -4,6 +4,7 @@ namespace App\Admin;
|
||||||
|
|
||||||
use App\Models\Keyword;
|
use App\Models\Keyword;
|
||||||
use Slowlyo\OwlAdmin\Renderers\BaseRenderer;
|
use Slowlyo\OwlAdmin\Renderers\BaseRenderer;
|
||||||
|
use Slowlyo\OwlAdmin\Renderers\WangEditor;
|
||||||
|
|
||||||
class Components extends BaseRenderer {
|
class Components extends BaseRenderer {
|
||||||
|
|
||||||
|
|
@ -46,31 +47,13 @@ class Components extends BaseRenderer {
|
||||||
/**
|
/**
|
||||||
* 富文本编辑器
|
* 富文本编辑器
|
||||||
*/
|
*/
|
||||||
public function fuEditorControl($name ='content', $label = '内容', $uploadUrl = ''){
|
public function fuEditorControl($name ='content', $label = '内容')
|
||||||
return amisMake()->RichTextControl()->vendor('tinymce')
|
{
|
||||||
->options([
|
return WangEditor::make()
|
||||||
"menubar" => false,
|
->name($name)
|
||||||
"min_height" => 500,
|
->label($label)
|
||||||
"plugins" => 'image link table lists charmap emoticons code table fullscreen',
|
->height('auto')
|
||||||
"toolbar" => "undo redo | bold italic underline strikethrough | fontfamily fontsize blocks | alignleft aligncenter alignright alignjustify | image link | outdent indent | numlist bullist table | forecolor backcolor removeformat | charmap emoticons | code fullscreen",
|
->excludeKeys(['group-video']);
|
||||||
"toolbar_mode" => "wrap",
|
|
||||||
"help_tabs" => [],
|
|
||||||
"convert_urls" => false,
|
|
||||||
// "quickbars_selection_toolbar" => "fontsize forecolor backcolor",
|
|
||||||
// "quickbars_insert_toolbar" => false,
|
|
||||||
])
|
|
||||||
->receiver(admin_url('upload_rich'))
|
|
||||||
->name($name)
|
|
||||||
->label($label);
|
|
||||||
|
|
||||||
//froala去除授权提示;(但是保存会有额外内容,需要处理)
|
|
||||||
//<style type="text/css">
|
|
||||||
// a[href="https://froala.com/wysiwyg-editor"], a[href="https://www.froala.com/wysiwyg-editor?k=u"]{
|
|
||||||
// display: none !important;
|
|
||||||
// position: absolute;
|
|
||||||
// top: -99999999px;
|
|
||||||
// }
|
|
||||||
// </style>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function enableControl($name = 'is_enable', $label= '状态', $mode = 'horizontal'){
|
public function enableControl($name = 'is_enable', $label= '状态', $mode = 'horizontal'){
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ class ArticleController extends AdminController
|
||||||
])),
|
])),
|
||||||
TextControl::make()->static(true)->name('published_at')->label(__('article.published_at')),
|
TextControl::make()->static(true)->name('published_at')->label(__('article.published_at')),
|
||||||
TextControl::make()->static(true)->name('created_at')->label(__('article.created_at')),
|
TextControl::make()->static(true)->name('created_at')->label(__('article.created_at')),
|
||||||
TextControl::make()->name('content')->label(__('article.content'))->static(true)->staticSchema(Html::make()),
|
Components::make()->fuEditorControl('content', __('article.content'))->static(true),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,6 @@ interface IProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
const WangEditor = forwardRef((props: IProps, ref: any) => {
|
const WangEditor = forwardRef((props: IProps, ref: any) => {
|
||||||
console.clear()
|
|
||||||
console.log(props)
|
|
||||||
const {appSettings} = useSelector((state: GlobalState) => state)
|
const {appSettings} = useSelector((state: GlobalState) => state)
|
||||||
const locale = appSettings.locale == "zh_CN" ? "zh-CN" : "en"
|
const locale = appSettings.locale == "zh_CN" ? "zh-CN" : "en"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue