diff --git a/_server/css/editor_mode.css b/_server/css/editor_mode.css
index 27b042e4..1542cf22 100644
--- a/_server/css/editor_mode.css
+++ b/_server/css/editor_mode.css
@@ -220,7 +220,7 @@ div.etableInputDiv {
margin-top: -8px;
}
-.etableInputDiv .cannotInOutCheckbox {
+.etableInputDiv .checkboxSetMember {
width: 16px;
height: 16px;
display: inline-block;
diff --git a/_server/editor_table.js b/_server/editor_table.js
index 2ed5dc84..f8a4409d 100644
--- a/_server/editor_table.js
+++ b/_server/editor_table.js
@@ -8,7 +8,7 @@ editor_table_wrapper = function (editor) {
// HTML模板
editor_table.prototype.select = function (value, values) {
- let content = editor.table.option(value) +
+ var content = editor.table.option(value) +
values.map(function (v) {
return editor.table.option(v)
}).join('')
@@ -26,12 +26,24 @@ editor_table_wrapper = function (editor) {
editor_table.prototype.textarea = function (value, indent) {
return /* html */`\n`
}
- editor_table.prototype.cannotInOutCheckbox = function (value) {
+ editor_table.prototype.checkboxSet = function (value, keys, prefixStrings) {
if (!(value instanceof Array)) value = [];
- return /* html */`上:=0 ? 'checked ' : ''} />
- 下:=0 ? 'checked ' : ''} />
- 左:=0 ? 'checked ' : ''} />
- 右:=0 ? 'checked ' : ''} />
`;
+ keys=Array.from(keys)
+ prefixStrings=Array.from(prefixStrings)
+ for (var index = 0; index < value.length; index++) {
+ if (keys.indexOf(value[index])==-1) {
+ keys.push(value[index])
+ prefixStrings.push('
'+value[index]+': ')
+ }
+ }
+ var content=[]
+ for (var index = 0; index < keys.length; index++) {
+ content.push(editor.table.checkboxSetMember(value.indexOf(keys[index])!=-1,keys[index],prefixStrings[index]))
+ }
+ return /* html */`
${content.join('')}
\n`;
+ }
+ editor_table.prototype.checkboxSetMember = function (value,key,prefixString) {
+ return /* html */`${prefixString}\n`;
}
editor_table.prototype.editGrid = function (showComment) {
var html = "";
@@ -58,6 +70,25 @@ editor_table_wrapper = function (editor) {
}
+ /**
+ * checkboxset中checkbox的onchange
+ */
+ editor_table.prototype.checkboxSetMemberOnchange = function (onemember) {
+ var thisset=onemember.parentNode
+ var inputs=thisset.children
+ var value=[]
+ for (var i in inputs) {
+ if (inputs[i].nodeName == 'INPUT') {
+ if (inputs[i].checked) value.push(inputs[i].getAttribute('key'));
+ }
+ }
+ thiseval = value;
+ // if (value.length == 0) thiseval = null;
+ thisset.value=JSON.stringify(thiseval)
+ thisset.onchange()
+ }
+
+
/////////////////////////////////////////////////////////////////////////////
// 表格生成的控制
@@ -232,8 +263,8 @@ editor_table_wrapper = function (editor) {
return editor.table.select(thiseval, cobj._select.values);
case 'checkbox':
return editor.table.checkbox(thiseval);
- case 'cannotInOutCheckbox':
- return editor.table.cannotInOutCheckbox(thiseval);
+ case 'checkboxSet':
+ return editor.table.checkboxSet(thiseval, cobj._checkboxSet.key, cobj._checkboxSet.prefix);
default:
return editor.table.textarea(thiseval, cobj.indent || 0);
}
@@ -269,24 +300,15 @@ editor_table_wrapper = function (editor) {
// >td[title=comment,cobj=cobj:json]
// >td>div>input[value=thiseval]
var thisTr = document.getElementById(guid);
- var inputs = thisTr.children[2].children[0].children;
+ var input = thisTr.children[2].children[0].children[0];
var field = thisTr.children[0].getAttribute('title');
var cobj = JSON.parse(thisTr.children[1].getAttribute('cobj'));
var modeNode = thisTr.parentNode;
while (!editor_mode._ids.hasOwnProperty(modeNode.getAttribute('id'))) {
modeNode = modeNode.parentNode;
}
- for (var i = 0; i < inputs.length; ++i) {
- var input = inputs[i];
- if (input.nodeName == 'INPUT' || input.nodeName == 'SELECT' || input.nodeName == 'TEXTAREA') {
- input.onchange = function () {
- if (cobj._type == 'cannotInOutCheckbox') {
- editor.table.onCannotInOutChange(guid, obj, commentObj, thisTr, inputs, field, cobj, modeNode);
- } else {
- editor.table.onchange(guid, obj, commentObj, thisTr, input, field, cobj, modeNode);
- }
- }
- }
+ input.onchange = function () {
+ editor.table.onchange(guid, obj, commentObj, thisTr, input, field, cobj, modeNode)
}
// 用检测两次单击的方式来实现双击(以支持手机端的双击)
var doubleClickCheck = [0];
diff --git a/_server/table/comment.js b/_server/table/comment.js
index 63e2c958..9ab67b0f 100644
--- a/_server/table/comment.js
+++ b/_server/table/comment.js
@@ -262,12 +262,20 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
},
"cannotOut": {
"_leaf": true,
- "_type": "cannotInOutCheckbox",
+ "_type": "checkboxSet",
+ "_checkboxSet": {
+ "prefix":["上: ","下: ","
左: ","右: "],
+ "key":["up","down","left","right"]
+ },
"_data": "该图块的不可出方向\n可以在这里定义在该图块时不能前往哪个方向,可以达到悬崖之类的效果\n例如 [\"up\", \"left\"] 代表在该图块时不能往上和左走\n此值对背景层、事件层、前景层上的图块均有效"
},
"cannotIn": {
"_leaf": true,
- "_type": "cannotInOutCheckbox",
+ "_type": "checkboxSet",
+ "_checkboxSet": {
+ "prefix":["上: ","下: ","
左: ","右: "],
+ "key":["up","down","left","right"]
+ },
"_data": "该图块的不可入方向\n可以在这里定义不能朝哪个方向进入该图块,可以达到悬崖之类的效果\n例如 [\"down\"] 代表不能从该图块的上方点朝向下进入此图块\n此值对背景层、事件层、前景层上的图块均有效"
},
"canBreak": {