Fix: 页面存在多个 wangEditor 时获取内容异常
This commit is contained in:
@@ -1335,7 +1335,11 @@ define(["jquery", "tableSelect"], function ($, tableSelect) {
|
|||||||
break;
|
break;
|
||||||
case 'wangEditor':
|
case 'wangEditor':
|
||||||
var name = $(this).attr("name");
|
var name = $(this).attr("name");
|
||||||
dataField[name] = window.editor.getHtml()
|
try {
|
||||||
|
dataField[name] = eval("wangEditor_" + i + ".getHtml()");
|
||||||
|
} catch (e) {
|
||||||
|
layer.msg(e.message)
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
var name = $(this).attr("id");
|
var name = $(this).attr("id");
|
||||||
@@ -1494,6 +1498,7 @@ define(["jquery", "tableSelect"], function ($, tableSelect) {
|
|||||||
editor: function () {
|
editor: function () {
|
||||||
let editorList = document.querySelectorAll(".editor");
|
let editorList = document.querySelectorAll(".editor");
|
||||||
if (editorList.length > 0) {
|
if (editorList.length > 0) {
|
||||||
|
let wangEditors = {}
|
||||||
$.each(editorList, function (i, v) {
|
$.each(editorList, function (i, v) {
|
||||||
switch (window.CONFIG.EDITOR_TYPE) {
|
switch (window.CONFIG.EDITOR_TYPE) {
|
||||||
case 'ckeditor':
|
case 'ckeditor':
|
||||||
@@ -1505,8 +1510,9 @@ define(["jquery", "tableSelect"], function ($, tableSelect) {
|
|||||||
break;
|
break;
|
||||||
case 'wangEditor':
|
case 'wangEditor':
|
||||||
var wangEditor = window.wangEditor;
|
var wangEditor = window.wangEditor;
|
||||||
window.editor = wangEditor.createEditor({
|
var wangEditorName = "wangEditor_" + i
|
||||||
selector: '#editor_' + $(this).attr("name"),
|
wangEditors[wangEditorName] = wangEditor.createEditor({
|
||||||
|
selector: '#editor_' + $(this).attr('name'),
|
||||||
html: $(this).text(),
|
html: $(this).text(),
|
||||||
config: {
|
config: {
|
||||||
MENU_CONF: {
|
MENU_CONF: {
|
||||||
@@ -1531,12 +1537,13 @@ define(["jquery", "tableSelect"], function ($, tableSelect) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
window.toolbar = wangEditor.createToolbar({
|
let editor = wangEditors.wangEditor_0
|
||||||
|
window[wangEditorName] = wangEditors[wangEditorName]
|
||||||
|
wangEditor.createToolbar({
|
||||||
editor,
|
editor,
|
||||||
selector: '#editor_toolbar_' + $(this).attr("name"),
|
selector: '#editor_toolbar_' + $(this).attr("name"),
|
||||||
config: {}
|
config: {}
|
||||||
})
|
})
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
let name = $(this).attr("name");
|
let name = $(this).attr("name");
|
||||||
|
|||||||
Reference in New Issue
Block a user