Merge pull request #69 from zhaouv/v2.0-editor-20180304

表格css以及编辑细节调整
This commit is contained in:
Zhang Chen 2018-03-09 21:12:22 +08:00 committed by GitHub
commit 882446c442
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 66 additions and 68 deletions

View File

@ -19,37 +19,6 @@
width: 435px;
}
/*
#left1 {
left: 5px;
top: 650px;
width: 435px;
}
#left2 {
left: 448px;
top: 650px;
width: 440px;
}
#left3 {
left: 900px;
top: 650px;
width: 440px;
}
#left4 {
left: 5px;
top: 1290px;
width: 435px;
}
#left5 {
left: 448px;
top: 1290px;
width: 440px;
}
*/
#left6 {
left: 5px;
/* top: 1930px; */
@ -81,13 +50,7 @@
height: 700px;
width: 940px;
}
/*
#left8 {
left: 900px;
top: 1290px;
width: 440px;
}
*/
.etable table,
.etable table td {
color: #000;
@ -133,25 +96,6 @@
overflow: visible;
}
.etable tr:not(:first-child) :last-child {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
}
.etable tr:not(:first-child) input:last-child {
}
.etable tr:not(:first-child) select:last-child {
}
.etable tr:not(:first-child) textarea:last-child {
}
.etable tr:not(:first-child) > :last-child:hover {
border: 1px solid rgb(87, 198, 232);
box-shadow: 0px 0px 3px rgb(87, 198, 232);
@ -161,4 +105,45 @@
.etable tr:not(:first-child) > :nth-child(1):hover {
border: 1px solid rgb(87, 232, 198);
box-shadow: 0px 0px 3px rgb(87, 232, 198);
}
}
.etable tr:not(:first-child) > :last-child {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
position: relative;
}
div.etableInputDiv {
position: absolute;
padding: 5px 0 0 5px;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
.etableInputDiv > * {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
background-color: rgba(255, 255, 255, 0);
border: none;
}
.etableInputDiv input {
}
.etableInputDiv select {
}
.etableInputDiv textarea {
resize: none;
}
.etableInputDiv textarea:hover {
margin: -5px;
}

View File

@ -302,7 +302,7 @@ editor_blockly.id='';
editor_blockly.import = function(id_){
var thisTr = document.getElementById(id_);
if(!thisTr)return;
if(!thisTr)return false;
var input = thisTr.children[2].children[0].children[0];
var field = thisTr.children[0].getAttribute('title');
var type = {
@ -319,12 +319,13 @@ editor_blockly.import = function(id_){
"--point--未完成数据转移":'point',
}[field];
if(!type)return;
if(!type)return false;
editor_blockly.id=id_;
document.getElementById('codeArea').value = input.value;
document.getElementById('entryType').value = type;
editor_blockly.parse();
editor_blockly.show();
return true;
}
editor_blockly.show = function(){document.getElementById('left6').style='';}

View File

@ -77,8 +77,9 @@ editor_mode.prototype.objToTable = function(obj,commentObj){
//现阶段这样会更实用,20180218
}
input.ondblclick = function(){
editor_blockly.import(guid);
editor_multi.import(guid);
if(!editor_blockly.import(guid))
if(!editor_multi.import(guid)){}
}
});
}
@ -119,7 +120,7 @@ editor_mode.prototype.objToTr = function(obj,commentObj,field){
var outstr=['<tr id="',guid,'"><td title="',field,'">',shortField,'</td>',
'<td title="',commentHTMLescape,'">',shortCommentHTMLescape,'</td>',
'<td><div>',editor_mode.objToTd(thiseval,comment),'</div></td></tr>\n',
'<td><div class="etableInputDiv">',editor_mode.objToTd(thiseval,comment),'</div></td></tr>\n',
];
return [outstr.join(''),guid];
}

View File

@ -11,6 +11,7 @@ var codeEditor = CodeMirror.fromTextArea(document.getElementById("multiLineCode"
});
editor_multi.id='';
editor_multi.isString=false;
editor_multi.show = function(){document.getElementById('left7').style='';}
editor_multi.hide = function(){document.getElementById('left7').style='z-index:-1;opacity: 0;';}
@ -18,14 +19,20 @@ editor_multi.hide = function(){document.getElementById('left7').style='z-index:-
editor_multi.import = function(id_){
var thisTr = document.getElementById(id_);
if(!thisTr)return;
if(!thisTr)return false;
var input = thisTr.children[2].children[0].children[0];
var field = thisTr.children[0].getAttribute('title');
var type = input.value && (input.value.slice(0,11)==='"function (');
if(!type)return;
if(!input.type || input.type!=='textarea')return false;
editor_multi.id=id_;
codeEditor.setValue(JSON.parse(input.value)||'');
editor_multi.isString=false;
if(input.value.slice(0,1)==='"'){
editor_multi.isString=true;
codeEditor.setValue(JSON.parse(input.value)||'');
} else {
codeEditor.setValue(input.value||'');
}
editor_multi.show();
return true;
}
editor_multi.cancel = function(){
@ -48,7 +55,11 @@ editor_multi.confirm = function (){
var thisTr = document.getElementById(editor_multi.id);
editor_multi.id='';
var input = thisTr.children[2].children[0].children[0];
input.value = JSON.stringify(value);
if(editor_multi.isString){
input.value = JSON.stringify(value);
} else {
input.value = value;
}
editor_multi.hide();
input.onchange();
}