From c3db63784a35e508c9604cd54859ae1aa3856035 Mon Sep 17 00:00:00 2001
From: wolfcode <37436228+wolf-leo@users.noreply.github.com>
Date: Tue, 10 Oct 2023 12:47:02 +0800
Subject: [PATCH] =?UTF-8?q?fix=20=E6=96=87=E6=9C=AC=E7=BC=96=E8=BE=91?=
=?UTF-8?q?=E5=99=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/admin/view/mall/goods/add.html | 4 ++
app/admin/view/mall/goods/edit.html | 4 ++
public/static/plugs/easy-admin/easy-admin.js | 46 +++++++++-----------
3 files changed, 28 insertions(+), 26 deletions(-)
diff --git a/app/admin/view/mall/goods/add.html b/app/admin/view/mall/goods/add.html
index e323c05..7b6e39e 100644
--- a/app/admin/view/mall/goods/add.html
+++ b/app/admin/view/mall/goods/add.html
@@ -61,7 +61,11 @@
diff --git a/app/admin/view/mall/goods/edit.html b/app/admin/view/mall/goods/edit.html
index 11a059a..c13b7a8 100644
--- a/app/admin/view/mall/goods/edit.html
+++ b/app/admin/view/mall/goods/edit.html
@@ -62,7 +62,11 @@
diff --git a/public/static/plugs/easy-admin/easy-admin.js b/public/static/plugs/easy-admin/easy-admin.js
index 304f644..87f15e1 100644
--- a/public/static/plugs/easy-admin/easy-admin.js
+++ b/public/static/plugs/easy-admin/easy-admin.js
@@ -1301,23 +1301,18 @@ define(["jquery", "tableSelect", "ckeditor"], function ($, tableSelect, undefine
}
form.on('submit(' + filter + ')', function (data) {
var dataField = data.field;
-
+ var editorList = document.querySelectorAll(".editor");
// 富文本数据处理
- if (window.CONFIG.EDITOR_TYPE == 'ueditor') {
- var editorList = document.querySelectorAll("textarea.layui-textarea.editor");
+ if (editorList.length > 0) {
$.each(editorList, function (i, v) {
- var name = $(this).attr("name");
- dataField[name] = UE.getEditor(name + i).getContent();
- });
- } else {
- var editorList = document.querySelectorAll(".editor");
- if (editorList.length > 0) {
- $.each(editorList, function (i, v) {
+ if (window.CONFIG.EDITOR_TYPE == 'ueditor') {
+ var name = $(this).attr("id");
+ dataField[name] = UE.getEditor(name).getContent();
+ } else {
var name = $(this).attr("name");
dataField[name] = CKEDITOR.instances[name].getData();
-
- });
- }
+ }
+ });
}
if (typeof preposeCallback === 'function') {
dataField = preposeCallback(dataField);
@@ -1479,19 +1474,18 @@ define(["jquery", "tableSelect", "ckeditor"], function ($, tableSelect, undefine
$.each(editorList, function (i, v) {
if (window.CONFIG.EDITOR_TYPE == 'ueditor') {
var name = $(this).attr("name");
- $(this).parent().find('textarea').attr('id', name + i)
- setTimeout(function () {
- try {
- UE.getEditor(name + i, {
- initialFrameHeight: 420,
- toolbars: [
- ["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",]
- ],
- });
- } catch (e) {
- location.reload()
- }
- }, 200)
+ try {
+ UE.getEditor(name, {
+ initialFrameWidth: '100%',
+ initialFrameHeight: 420,
+ initialContent: $(this).data('content'),
+ toolbars: [
+ ["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",]
+ ],
+ });
+ } catch (e) {
+ location.reload()
+ }
} else {
CKEDITOR.replace(
$(this).attr("name"),