reformat table

This commit is contained in:
ckcz123 2019-10-22 20:46:37 +08:00
parent a9d3a94f0e
commit 103f2c6415
5 changed files with 93 additions and 16 deletions

View File

@ -121,6 +121,7 @@
display: block;
width: 100%;
overflow: auto;
word-break: break-all;
}
.etable table th {
@ -157,14 +158,19 @@
}
.etable tr > :nth-child(3) {
width: 60%
width: 35%;
}
.etable tr > :nth-child(4) {
width: 25%;
padding: 0;
}
.etable table {
overflow: visible;
}
.etable tr:not(:first-child) > :last-child:hover {
.etable tr:not(:first-child) > :nth-child(3):hover {
border: 1px solid rgb(87, 198, 232);
box-shadow: 0px 0px 3px rgb(87, 198, 232);
}
@ -175,14 +181,17 @@
box-shadow: 0px 0px 3px rgb(87, 232, 198);
}
.etable tr:not(:first-child) > :last-child {
.etable tr:not(:first-child) > :nth-child(3) {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
position: relative;
}
.etable tr > :nth-child(4) {
text-align: center;
}
div.etableInputDiv {
position: absolute;
padding: 5px 0 0 5px;

View File

@ -135,6 +135,7 @@
display: block;
width: 100%;
overflow: auto;
word-break: break-all;
}
.etable table th {
@ -171,14 +172,19 @@
}
.etable tr > :nth-child(3) {
width: 60%
width: 30%;
}
.etable tr > :nth-child(4) {
width: 30%;
text-align: center;
}
.etable table {
overflow: visible;
}
.etable tr:not(:first-child) > :last-child:hover {
.etable tr:not(:first-child) > :nth-child(3):hover {
border: 1px solid rgb(87, 198, 232);
box-shadow: 0px 0px 3px rgb(87, 198, 232);
}
@ -189,11 +195,10 @@
box-shadow: 0px 0px 3px rgb(87, 232, 198);
}
.etable tr:not(:first-child) > :last-child {
.etable tr:not(:first-child) > :nth-child(3) {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
position: relative;
}

View File

@ -622,9 +622,45 @@ function omitedcheckUpdateFunction(event) {
var code = Blockly.JavaScript.workspaceToCode(editor_blockly.workspace);
code = code.replace(/\\(i|c|d|e)/g, '\\\\$1');
eval('var obj=' + code);
if (this.checkAsync(obj) && confirm("警告!存在不等待执行完毕的事件但却没有用【等待所有异步事件处理完毕】来等待" +
"它们执行完毕,这样可能会导致录像检测系统出问题。\n你要返回修改么")) return;
setvalue(JSON.stringify(obj));
}
// 检查"不等待处理完毕"
editor_blockly.checkAsync = function (obj) {
if (!(obj instanceof Array)) return false;
var hasAsync = false;
for (var i = 0; i < obj.length; ++i) {
var one = obj[i];
if (one.type == 'if' && (this.checkAsync(one['true']) || this.checkAsync(one['false'])))
return true;
if ((one.type == 'while' || one.type == 'dowhile') && this.checkAsync(one.data))
return true;
if (one.type == 'if' && (this.checkAsync(one.yes) || this.checkAsync(one.no)))
return true;
if (one.type == 'choices') {
var list = one.choices;
if (list instanceof Array) {
for (var j = 0; j < list.length; j++) {
if (this.checkAsync(list[j].action)) return true;
}
}
}
if (one.type == 'switch') {
var list = one.caseList;
if (list instanceof Array) {
for (var j = 0; j < list.length; j++) {
if (this.checkAsync(list[j].action)) return true;
}
}
}
if (one.async && one.type != 'animate') hasAsync = true;
if (one.type == 'waitAsync') hasAsync = false;
}
return hasAsync;
}
var previewBlock = function (b) {
var types = [
"previewUI_s", "clearMap_s", "clearMap_1_s", "setAttribute_s", "fillText_s",

View File

@ -50,13 +50,13 @@ editor_listen_wrapper = function (editor) {
var mobileview = document.getElementById('mobileview');
var mid = document.getElementById('mid');
var right = document.getElementById('right');
var mobileeditdata = document.getElementById('mobileeditdata');
// var mobileeditdata = document.getElementById('mobileeditdata');
editor.showdataarea = function (callShowMode) {
mid.style = 'z-index:-1;opacity: 0;';
right.style = 'z-index:-1;opacity: 0;';
mobileeditdata.style = '';
// mobileeditdata.style = '';
if (callShowMode) editor.mode.showMode(editor.dom.editModeSelect.value);
editor.uifunctions.hideMidMenu();
}
@ -66,17 +66,17 @@ editor_listen_wrapper = function (editor) {
mobileview.children[1].onclick = function () {
mid.style = '';
right.style = 'z-index:-1;opacity: 0;';
mobileeditdata.style = 'z-index:-1;opacity: 0;';
// mobileeditdata.style = 'z-index:-1;opacity: 0;';
editor.lastClickId = '';
}
mobileview.children[3].onclick = function () {
mid.style = 'z-index:-1;opacity: 0;';
right.style = '';
mobileeditdata.style = 'z-index:-1;opacity: 0;';
// mobileeditdata.style = 'z-index:-1;opacity: 0;';
editor.lastClickId = '';
}
/*
var gettrbyid = function () {
if (!editor.lastClickId) return false;
thisTr = document.getElementById(editor.lastClickId);
@ -100,6 +100,7 @@ editor_listen_wrapper = function (editor) {
if (!info) return;
printf(info[0].children[1].getAttribute('title'))
}
*/
//=====

View File

@ -26,13 +26,19 @@ editor_table_wrapper = function (editor) {
editor_table.prototype.textarea = function (value, indent) {
return /* html */`<textarea spellcheck='false'>${JSON.stringify(value, null, indent || 0)}</textarea>\n`
}
editor_table.prototype.editGrid = function (showComment) {
var html = "";
if (showComment) html += "<button onclick='editor.table.onCommentBtnClick(this)'>显示完整注释</button><br/>";
html += "<button onclick='editor.table.onEditBtnClick(this)'>编辑表格内容</button>";
return html;
}
editor_table.prototype.title = function () {
return /* html */`\n<tr><td>条目</td><td>注释</td><td>值</td></tr>\n`
return /* html */`\n<tr><td>条目</td><td>注释</td><td>值</td><td>操作</td></tr>\n`
}
editor_table.prototype.gap = function (field) {
return /* html */`<tr><td>----</td><td>----</td><td>${field}</td></tr>\n`
return /* html */`<tr><td>----</td><td>----</td><td>${field}</td><td>----</td></tr>\n`
}
editor_table.prototype.tr = function (guid, field, shortField, commentHTMLescape, cobjstr, shortCommentHTMLescape, tdstr) {
@ -40,6 +46,7 @@ editor_table_wrapper = function (editor) {
<td title="${field}">${shortField}</td>
<td title="${commentHTMLescape}" cobj="${cobjstr}">${shortCommentHTMLescape}</td>
<td><div class="etableInputDiv">${tdstr}</div></td>
<td>${editor.table.editGrid(commentHTMLescape != shortCommentHTMLescape)}</td>
</tr>\n`
}
@ -194,7 +201,7 @@ editor_table_wrapper = function (editor) {
// "['a']['b']" => "b"
var shortField = field.split("']").slice(-2)[0].split("['").slice(-1)[0];
// 把长度超过 charlength 的字符改成 固定长度+...的形式
shortField = (shortField.length < charlength ? shortField : shortField.slice(0, charlength) + '...');
// shortField = (shortField.length < charlength ? shortField : shortField.slice(0, charlength) + '...');
// 完整的内容转义后供悬停查看
var commentHTMLescape = editor.util.HTMLescape(comment);
@ -299,6 +306,25 @@ editor_table_wrapper = function (editor) {
}
}
/**
* "显示完整注释"被按下时
*/
editor_table.prototype.onCommentBtnClick = function (button) {
var tr = button.parentNode.parentNode;
printf(tr.children[1].getAttribute('title'));
}
/**
* "编辑表格内容"被按下时
*/
editor_table.prototype.onEditBtnClick = function (button) {
var tr = button.parentNode.parentNode;
var guid = tr.getAttribute('id');
var cobj = JSON.parse(tr.children[1].getAttribute('cobj'));
if (cobj._type === 'event') editor_blockly.import(guid, { type: cobj._event });
if (cobj._type === 'textarea') editor_multi.import(guid, { lint: cobj._lint, string: cobj._string });
}
/**
* 双击表格时
* 正常编辑: 尝试用事件编辑器或多行文本编辑器打开