编辑器兼容curd自动生成

This commit is contained in:
wolfcode
2023-11-20 12:43:05 +08:00
parent 646ccde5fa
commit 0bd1ec9d04
3 changed files with 8 additions and 6 deletions

View File

@@ -130,7 +130,7 @@ if (!function_exists('auth')) {
function editor_textarea($row, string $name = 'desc', string $placeholder = '请输入'): string
{
$editor_type = sysconfig('site', 'editor_type');
$detail = $row[$name] ?? '';
$detail = is_array($row) ? ($row[$name] ?? '') : $row;
return match ($editor_type) {
'ckeditor' => "<textarea name='{$name}' rows='20' class='layui-textarea editor' placeholder='{$placeholder}'>{$detail}</textarea>",
default => "<script type='text/plain' id='{$name}' name='{$name}' class='editor' data-content='{$detail}'></script>",