From fd057ee350a4232c8817f4b5773595d7d22ba35b Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Tue, 28 Jul 2020 12:09:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=92=E4=BB=B6=E6=94=AF=E6=8C=81=E4=B8=AD?= =?UTF-8?q?=E6=96=87;=E6=B7=BB=E5=8A=A0=E7=9B=B4=E6=8E=A5=E5=BC=B9?= =?UTF-8?q?=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _server/editor_table.js | 28 ++++++++++++++++++++-------- editor-mobile.html | 4 ++-- editor.html | 4 ++-- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/_server/editor_table.js b/_server/editor_table.js index 636d9667..b5b36baf 100644 --- a/_server/editor_table.js +++ b/_server/editor_table.js @@ -522,7 +522,9 @@ editor_table_wrapper = function (editor) { editor_mode.onmode(editor_mode._ids[modeNode.getAttribute('id')]); if (editor.table.checkRange(cobj, null)) { editor_mode.addAction(['delete', field, undefined]); - editor_mode.onmode('save');//自动保存 删掉此行的话点保存按钮才会保存 + editor_mode.onmode('save', function () { + printf('删除成功,刷新后生效。') + }); } else { printe(field + ' : 该值不允许为null,无法删除'); } @@ -532,9 +534,18 @@ editor_table_wrapper = function (editor) { * 添加表格项 */ editor_table.prototype.addfunc = function (guid, obj, commentObj, thisTr, input, field, cobj, modeNode) { - editor_mode.onmode(editor_mode._ids[modeNode.getAttribute('id')]); + if (modeNode) { + editor_mode.onmode(editor_mode._ids[modeNode.getAttribute('id')]); + } var mode = editor.dom.editModeSelect.value; + var supportText = mode === 'commonevent' || mode === 'plugins'; + + if (obj == null) { + if (mode === 'commonevent') obj = events_c12a15a8_c380_4b28_8144_256cba95f760; + else if (mode === 'plugins') obj = plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1; + else return; + } // 1.输入id var newid = '2'; @@ -546,15 +557,14 @@ editor_table_wrapper = function (editor) { newid = testid + ''; } } else { - newid = prompt('请输入新项的ID(仅公共事件支持中文ID)'); + newid = prompt(supportText ? '请输入新项的ID(支持中文)' : '请输入新项的ID(数字字母下划线)'); if (newid == null || newid.length == 0) { return; } } - // 检查commentEvents - if (mode !== 'commonevent') { - // 2.检查id是否符合规范或与已有id重复 + // 2.检查id是否符合规范或与已有id重复 + if (!supportText) { if (!/^[a-zA-Z0-9_]+$/.test(newid)) { printe('id不符合规范, 请使用大小写字母数字下划线来构成'); return; @@ -562,7 +572,7 @@ editor_table_wrapper = function (editor) { } var conflict = true; - var basefield = field.replace(/\[[^\[]*\]$/, ''); + var basefield = (field || "").replace(/\[[^\[]*\]$/, ''); if (basefield === "['main']") { printe("全塔属性 ~ ['main'] 不允许添加新值"); return; @@ -581,7 +591,9 @@ editor_table_wrapper = function (editor) { } // 3.添加 editor_mode.addAction(['add', basefield + "['" + newid + "']", null]); - editor_mode.onmode('save');//自动保存 删掉此行的话点保存按钮才会保存 + editor_mode.onmode('save', function () { + printf('添加成功,刷新后生效;也可以继续新增其他项目。') + });//自动保存 删掉此行的话点保存按钮才会保存 } ///////////////////////////////////////////////////////////////////////////// diff --git a/editor-mobile.html b/editor-mobile.html index f66a51e1..a2569747 100644 --- a/editor-mobile.html +++ b/editor-mobile.html @@ -264,7 +264,7 @@
-

公共事件         +

公共事件        

@@ -281,7 +281,7 @@
-

插件编写         +

插件编写        

diff --git a/editor.html b/editor.html index dcf29de9..831e1ada 100644 --- a/editor.html +++ b/editor.html @@ -260,7 +260,7 @@
-

公共事件         +

公共事件        

@@ -277,7 +277,7 @@
-

插件编写         +

插件编写