...
 
Commits (8)
    https://gitcode.net/wolfcode/EasyAdmin8-webman/-/commit/00ccd89135080492c1ffb6c17b92eefc790f99e8 简化Textarea写法 2023-11-19T11:16:39+08:00 wolfcode 37436228+wolf-leo@users.noreply.github.com https://gitcode.net/wolfcode/EasyAdmin8-webman/-/commit/35064f723c9581b54d70548274aa4363a44b323b 编辑器兼容curd自动生成 2023-11-20T21:09:20+08:00 wolfcode 37436228+wolf-leo@users.noreply.github.com https://gitcode.net/wolfcode/EasyAdmin8-webman/-/commit/205b4716fe777166047a64658df4a9c5fcaefdb1 Update app.php 2023-11-21T00:23:33+08:00 wolfcode 37436228+wolf-leo@users.noreply.github.com https://gitcode.net/wolfcode/EasyAdmin8-webman/-/commit/f00d787f6b1acc1a0315fe350107b3e19052fc61 安装步骤密码限制 2023-11-22T14:20:49+08:00 wolfcode 37436228+wolf-leo@users.noreply.github.com https://gitcode.net/wolfcode/EasyAdmin8-webman/-/commit/5721bbbc5ecbe51e65ec94d33d164f6721229edf Update public.css 2023-11-22T17:07:09+08:00 wolfcode 37436228+wolf-leo@users.noreply.github.com https://gitcode.net/wolfcode/EasyAdmin8-webman/-/commit/8015726ae2165120992dfbc7a8bff4914e191a67 Layui-v2.9.0 2023-11-30T13:24:09+08:00 wolfcode 37436228+wolf-leo@users.noreply.github.com https://gitcode.net/wolfcode/EasyAdmin8-webman/-/commit/dca509f440422ea60984d9984bac8b58646d4941 Update easy-admin.js 2024-01-06T11:17:32+08:00 wolfcode 37436228+wolf-leo@users.noreply.github.com https://gitcode.net/wolfcode/EasyAdmin8-webman/-/commit/d8b79d825e6065362db15a0e3dd1708467aa13b1 fix #1 2024-01-06T11:30:34+08:00 wolfcode 37436228+wolf-leo@users.noreply.github.com
...@@ -62,11 +62,7 @@ ...@@ -62,11 +62,7 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">商品描述</label> <label class="layui-form-label">商品描述</label>
<div class="layui-input-block"> <div class="layui-input-block">
@if(sysconfig('site','editor_type')=='ckeditor') {!!editor_textarea('','describe') !!}
<textarea name="describe" rows="20" class="layui-textarea editor" placeholder="请输入商品描述"></textarea>
@else
<script type="text/plain" id="describe" name="describe" class="editor" data-content=""></script>
@endif
</div> </div>
</div> </div>
......
...@@ -63,11 +63,7 @@ ...@@ -63,11 +63,7 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">商品描述</label> <label class="layui-form-label">商品描述</label>
<div class="layui-input-block"> <div class="layui-input-block">
@if(sysconfig('site','editor_type')=='ckeditor') {!!editor_textarea($row["describe"],'describe') !!}
<textarea name="describe" rows="20" class="layui-textarea editor" placeholder="请输入商品描述">{{html_entity_decode($row['describe'])}}</textarea>
@else
<script type="text/plain" id="describe" name="describe" class="editor" data-content="{{html_entity_decode($row['describe'])}}"></script>
@endif
</div> </div>
</div> </div>
......
...@@ -871,7 +871,7 @@ class BuildCurd ...@@ -871,7 +871,7 @@ class BuildCurd
} }
// 判断富文本 // 判断富文本
if (in_array($field, $this->editorFields)) { if (in_array($field, $this->editorFields) || in_array($val['type'], ['text', 'tinytext', 'mediumtext', 'longtext'])) {
$this->tableColumns[$field]['formType'] = 'editor'; $this->tableColumns[$field]['formType'] = 'editor';
continue; continue;
} }
...@@ -939,7 +939,7 @@ class BuildCurd ...@@ -939,7 +939,7 @@ class BuildCurd
} }
// 判断富文本 // 判断富文本
if (in_array($field, $this->editorFields)) { if (in_array($field, $this->editorFields) || in_array($val['type'], ['text', 'tinytext', 'mediumtext', 'longtext'])) {
$this->relationArray[$table]['tableColumns'][$field]['formType'] = 'editor'; $this->relationArray[$table]['tableColumns'][$field]['formType'] = 'editor';
continue; continue;
} }
...@@ -1134,6 +1134,12 @@ class BuildCurd ...@@ -1134,6 +1134,12 @@ class BuildCurd
$templateFile = "view{$this->DS}module{$this->DS}input"; $templateFile = "view{$this->DS}module{$this->DS}input";
$define = ''; $define = '';
// 根据formType去获取具体模板
if ($val['formType'] == 'editor') {
$templateFile = "view{$this->DS}module{$this->DS}editor";
$val['default'] = '""';
}
$addFormList .= CommonTool::replaceTemplate( $addFormList .= CommonTool::replaceTemplate(
$this->getTemplate($templateFile), $this->getTemplate($templateFile),
[ [
...@@ -1166,6 +1172,12 @@ class BuildCurd ...@@ -1166,6 +1172,12 @@ class BuildCurd
$define = ''; $define = '';
$value = '{{$row[\'' . $field . '\']}}'; $value = '{{$row[\'' . $field . '\']}}';
// 根据formType去获取具体模板
if ($val['formType'] == 'editor') {
$templateFile = "view{$this->DS}module{$this->DS}editor";
$value = '$row["' . $field . '"]';
}
$editFormList .= CommonTool::replaceTemplate( $editFormList .= CommonTool::replaceTemplate(
$this->getTemplate($templateFile), $this->getTemplate($templateFile),
[ [
......
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">{{comment}}</label> <label class="layui-form-label">{{comment}}</label>
<div class="layui-input-block"> <div class="layui-input-block">
<textarea name="{{field}}" rows="20" class="layui-textarea editor" {{comment}} placeholder="请输入{{comment}}">{{value}}</textarea> {!! editor_textarea({{value}},"{{field}}","{{comment}}") !!}
</div> </div>
</div> </div>
\ No newline at end of file
...@@ -101,6 +101,7 @@ class InstallController ...@@ -101,6 +101,7 @@ class InstallController
$sqlArray = $this->parseSql($sqlPath, $config['prefix'], 'ea_'); $sqlArray = $this->parseSql($sqlPath, $config['prefix'], 'ea_');
$conn = mysqli_connect($config['host'], $config['username'], $config['password'], null, $config['port']); $conn = mysqli_connect($config['host'], $config['username'], $config['password'], null, $config['port']);
try { try {
mysqli_set_charset($conn, $config['charset']);
mysqli_select_db($conn, $config['database']); mysqli_select_db($conn, $config['database']);
foreach ($sqlArray as $sql) { foreach ($sqlArray as $sql) {
mysqli_query($conn, $sql); mysqli_query($conn, $sql);
......
...@@ -153,4 +153,18 @@ if (!function_exists('updateFields')) { ...@@ -153,4 +153,18 @@ if (!function_exists('updateFields')) {
return $row->save(); return $row->save();
} }
/**
* @param string $detail
* @param string $name
* @param string $placeholder
* @return string
*/
function editor_textarea(string $detail, string $name = 'desc', string $placeholder = '请输入'): string
{
$editor_type = sysconfig('site', 'editor_type');
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>",
};
}
} }
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">管理员密码</label> <label class="layui-form-label">管理员密码</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="password" class="layui-input" name="password" autocomplete="off" lay-verify="required" lay-reqtext="请输入管理员密码" placeholder="请输入管理员密码"> <input type="password" class="layui-input" name="password" maxlength="20" autocomplete="off" lay-verify="required" lay-reqtext="请输入管理员密码" placeholder="请输入管理员密码">
</div> </div>
</div> </div>
</div> </div>
......
...@@ -15,12 +15,12 @@ ...@@ -15,12 +15,12 @@
use support\Request; use support\Request;
return [ return [
'debug' => true, 'debug' => env('APP_DEBUG', true),
'error_reporting' => E_ALL, 'error_reporting' => E_ALL,
'default_timezone' => 'Asia/Shanghai', 'default_timezone' => 'Asia/Shanghai',
'request_class' => Request::class, 'request_class' => Request::class,
'public_path' => base_path() . DIRECTORY_SEPARATOR . 'public', 'public_path' => base_path() . DIRECTORY_SEPARATOR . 'public',
'runtime_path' => base_path(false) . DIRECTORY_SEPARATOR . 'runtime', 'runtime_path' => base_path(false) . DIRECTORY_SEPARATOR . 'runtime',
'controller_suffix' => 'Controller', 'controller_suffix' => 'Controller',
'controller_reuse' => false, 'controller_reuse' => false,
]; ];
...@@ -316,6 +316,12 @@ table样式 ...@@ -316,6 +316,12 @@ table样式
line-height: 1em; line-height: 1em;
} }
.layui-form-select dl {
border: 1px #16b777 solid;
border-top: none;
z-index: 99999;
}
.form-search .layui-form-select dl { .form-search .layui-form-select dl {
top: 31px; top: 31px;
padding: 0; padding: 0;
......
...@@ -1474,24 +1474,29 @@ define(["jquery", "tableSelect", "ckeditor"], function ($, tableSelect, undefine ...@@ -1474,24 +1474,29 @@ define(["jquery", "tableSelect", "ckeditor"], function ($, tableSelect, undefine
if (editorList.length > 0) { if (editorList.length > 0) {
$.each(editorList, function (i, v) { $.each(editorList, function (i, v) {
if (window.CONFIG.EDITOR_TYPE == 'ueditor') { if (window.CONFIG.EDITOR_TYPE == 'ueditor') {
var name = $(this).attr("name"); let name = $(this).attr("name");
try { let content = $(this).data('content')
UE.getEditor(name, { let editorOption = {
initialFrameWidth: '100%', initialFrameWidth: '100%',
initialFrameHeight: 420, initialFrameHeight: 420,
initialContent: $(this).data('content'), initialContent: content,
toolbars: [ toolbars: [["fullscreen", "source", "|", "undo", "redo", "|", "bold", "italic", "underline", "fontborder", "strikethrough",
["fullscreen", "source", "|", "undo", "redo", "|", "bold", "italic", "underline", "fontborder", "strikethrough", "superscript", "subscript", "removeformat", "formatmatch", "autotypeset", "blockquote", "pasteplain", "|", "forecolor", "backcolor", "insertorderedlist", "insertunorderedlist", "selectall", "cleardoc", "|", "rowspacingtop", "rowspacingbottom", "lineheight", "|", "customstyle", "paragraph", "fontfamily", "fontsize", "|", "directionalityltr", "directionalityrtl", "indent", "|", "justifyleft", "justifycenter", "justifyright", "justifyjustify", "|", "touppercase", "tolowercase", "|", "link", "unlink", "anchor", "|", "imagenone", "imageleft", "imageright", "imagecenter", "|", "insertimage", "emotion", "insertframe", "insertcode", "pagebreak", "template", "background", "formula", "|", "horizontal", "date", "time", "spechars", "wordimage", "|", "inserttable", "deletetable", "insertparagraphbeforetable", "insertrow", "deleterow", "insertcol", "deletecol", "mergecells", "mergeright", "mergedown", "splittocells", "splittorows", "splittocols", "|", "print", "preview", "searchreplace", "help",] "superscript", "subscript", "removeformat", "formatmatch", "autotypeset", "blockquote", "pasteplain", "|",
], "forecolor", "backcolor", "insertorderedlist", "insertunorderedlist", "selectall", "cleardoc", "|",
}); "rowspacingtop", "rowspacingbottom", "lineheight", "|", "customstyle", "paragraph", "fontfamily", "fontsize", "|",
} catch (e) { "directionalityltr", "directionalityrtl", "indent", "|", "justifyleft", "justifycenter", "justifyright", "justifyjustify", "|",
location.reload() "touppercase", "tolowercase", "|", "link", "unlink", "anchor", "|", "imagenone", "imageleft", "imageright", "imagecenter", "|",
"insertimage", "emotion", "insertframe", "insertcode", "pagebreak", "template", "background", "formula", "|",
"horizontal", "date", "time", "spechars", "wordimage", "|",
"inserttable", "deletetable", "insertparagraphbeforetable", "insertrow", "deleterow", "insertcol", "deletecol", "mergecells", "mergeright", "mergedown", "splittocells", "splittorows", "splittocols", "|",
"print", "preview", "searchreplace", "help",
]],
} }
setTimeout(function () {
let _UEditor = new baidu.editor.ui.Editor(editorOption);
_UEditor.render(name);
}, 100)
} else { } else {
CKEDITOR.config.fileTools_requestHeaders = {
'X-Requested-With': 'XMLHttpRequest',
'X-Csrf-Token': init.csrf_token,
};
CKEDITOR.replace($(this).attr("name"), { CKEDITOR.replace($(this).attr("name"), {
height: $(this).height(), height: $(this).height(),
filebrowserImageUploadUrl: admin.url('ajax/upload?type=editor'), filebrowserImageUploadUrl: admin.url('ajax/upload?type=editor'),
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob