1
0
Fork 0

component editor

develop
panliang 2023-05-29 15:19:05 +08:00
parent 007f5bb08d
commit 2c2436aa8e
3 changed files with 9 additions and 28 deletions

View File

@ -4,6 +4,7 @@ namespace App\Admin;
use App\Models\Keyword;
use Slowlyo\OwlAdmin\Renderers\BaseRenderer;
use Slowlyo\OwlAdmin\Renderers\WangEditor;
class Components extends BaseRenderer {
@ -46,31 +47,13 @@ class Components extends BaseRenderer {
/**
* 富文本编辑器
*/
public function fuEditorControl($name ='content', $label = '内容', $uploadUrl = ''){
return amisMake()->RichTextControl()->vendor('tinymce')
->options([
"menubar" => false,
"min_height" => 500,
"plugins" => 'image link table lists charmap emoticons code table fullscreen',
"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",
"toolbar_mode" => "wrap",
"help_tabs" => [],
"convert_urls" => false,
// "quickbars_selection_toolbar" => "fontsize forecolor backcolor",
// "quickbars_insert_toolbar" => false,
])
->receiver(admin_url('upload_rich'))
public function fuEditorControl($name ='content', $label = '内容')
{
return WangEditor::make()
->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>
->label($label)
->height('auto')
->excludeKeys(['group-video']);
}
public function enableControl($name = 'is_enable', $label= '状态', $mode = 'horizontal'){

View File

@ -71,7 +71,7 @@ class ArticleController extends AdminController
])),
TextControl::make()->static(true)->name('published_at')->label(__('article.published_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),
]);
}

View File

@ -29,8 +29,6 @@ interface IProps {
}
const WangEditor = forwardRef((props: IProps, ref: any) => {
console.clear()
console.log(props)
const {appSettings} = useSelector((state: GlobalState) => state)
const locale = appSettings.locale == "zh_CN" ? "zh-CN" : "en"