Browse Source

script edition UX improvements

trethaller 4 years ago
parent
commit
38e77db5f2
6 changed files with 50 additions and 27 deletions
  1. 15 7
      bin/cdb.css
  2. 18 8
      bin/cdb.less
  3. 6 5
      bin/style.css
  4. 5 5
      bin/style.less
  5. 4 0
      hide/comp/CodeEditor.hx
  6. 2 2
      hide/comp/cdb/Cell.hx

+ 15 - 7
bin/cdb.css

@@ -196,12 +196,21 @@
   font-size: 75%;
   font-size: 75%;
 }
 }
 .cdb .cdb-sheet td.t_script {
 .cdb .cdb-sheet td.t_script {
-  font-family: Courier;
   color: #CCC;
   color: #CCC;
 }
 }
+.cdb .cdb-sheet td.t_script div.script {
+  white-space: nowrap;
+  font-family: Consolas, Courier;
+  font-size: 80%;
+  max-height: 200px;
+  overflow: hidden;
+}
 .cdb .cdb-sheet td.t_script input,
 .cdb .cdb-sheet td.t_script input,
 .cdb .cdb-sheet td.t_script textarea {
 .cdb .cdb-sheet td.t_script textarea {
-  font-family: Courier;
+  font-family: Consolas, Courier;
+}
+.cdb .cdb-sheet td.t_script span {
+  display: inline-block;
 }
 }
 .cdb .cdb-sheet td.t_script .kwd {
 .cdb .cdb-sheet td.t_script .kwd {
   color: #88F;
   color: #88F;
@@ -355,16 +364,12 @@
 .cdb .cdb-sheet td.t_file .preview:hover .previewContent {
 .cdb .cdb-sheet td.t_file .preview:hover .previewContent {
   display: block;
   display: block;
 }
 }
-.cdb .cdb-sheet td.t_script {
-  white-space: nowrap;
-  overflow: hidden;
-}
 .cdb .cdb-sheet div.cdb-script {
 .cdb .cdb-sheet div.cdb-script {
   position: relative;
   position: relative;
 }
 }
 .cdb .cdb-sheet div.cdb-script .codeeditor {
 .cdb .cdb-sheet div.cdb-script .codeeditor {
   min-width: 500px;
   min-width: 500px;
-  min-height: 200px;
+  min-height: 500px;
 }
 }
 .cdb.cdb-obj-editor {
 .cdb.cdb-obj-editor {
   margin-top: 10px;
   margin-top: 10px;
@@ -381,6 +386,9 @@
 .cdb.cdb-obj-editor div.cdb-large .cdb-sheet {
 .cdb.cdb-obj-editor div.cdb-large .cdb-sheet {
   min-width: 0 !important;
   min-width: 0 !important;
 }
 }
+.cdb.cdb-obj-editor div.cdb-script .codeeditor {
+  min-height: 300px;
+}
 .cdb .floating-thead {
 .cdb .floating-thead {
   position: fixed;
   position: fixed;
   background-color: #222;
   background-color: #222;

+ 18 - 8
bin/cdb.less

@@ -221,10 +221,20 @@
 		}
 		}
 
 
 		td.t_script {
 		td.t_script {
-			font-family : Courier;
+			div.script {
+				white-space: nowrap;
+				font-family : Consolas, Courier;
+				font-size: 80%;
+				max-height: 200px;
+				overflow: hidden;
+			}
 			input, textarea {
 			input, textarea {
-				font-family : Courier;
+				font-family : Consolas, Courier;
 			}
 			}
+			span {
+				display: inline-block;
+			}
+
 			color : #CCC;
 			color : #CCC;
 			.kwd {
 			.kwd {
 				color : #88F;
 				color : #88F;
@@ -398,16 +408,11 @@
 			}
 			}
 		}
 		}
 
 
-		td.t_script {
-			white-space: nowrap;
-			overflow: hidden;
-		}
-
 		div.cdb-script {
 		div.cdb-script {
 			position : relative;
 			position : relative;
 			.codeeditor {
 			.codeeditor {
 				min-width: 500px;
 				min-width: 500px;
-				min-height: 200px;
+				min-height: 500px;
 			}
 			}
 		}
 		}
 
 
@@ -427,6 +432,11 @@
 		div.cdb-large .cdb-sheet {
 		div.cdb-large .cdb-sheet {
 			min-width: 0 !important;
 			min-width: 0 !important;
 		}
 		}
+		div.cdb-script {
+			.codeeditor {
+				min-height: 300px;
+			}
+		}
 	}
 	}
 
 
 	.floating-thead {
 	.floating-thead {

+ 6 - 5
bin/style.css

@@ -674,14 +674,14 @@ input[type=checkbox]:checked:after {
 }
 }
 .hide-properties .cdb-large .cdb-obj-editor {
 .hide-properties .cdb-large .cdb-obj-editor {
   position: fixed;
   position: fixed;
-  bottom: 0px;
-  right: 0px;
+  bottom: 20px;
+  max-height: 800px;
+  left: 20%;
+  right: 620px;
   z-index: 99;
   z-index: 99;
-  width: 600px;
   overflow: auto;
   overflow: auto;
-  padding: 10px;
+  padding: 2px;
   background: #111;
   background: #111;
-  max-height: 50%;
   overflow-y: auto;
   overflow-y: auto;
 }
 }
 .hide-properties .cdb-large .btn-cdb-large {
 .hide-properties .cdb-large .btn-cdb-large {
@@ -1797,3 +1797,4 @@ div.sp-container input:hover {
   max-height: 800px;
   max-height: 800px;
   min-width: 600px;
   min-width: 600px;
 }
 }
+/* Monaco */

+ 5 - 5
bin/style.less

@@ -741,14 +741,14 @@ input[type=checkbox] {
 	.cdb-large {
 	.cdb-large {
 		.cdb-obj-editor {
 		.cdb-obj-editor {
 			position: fixed;
 			position: fixed;
-			bottom : 0px;
-			right : 0px;
+			bottom : 20px;
+			max-height: 800px;
+			left: 20%;
+			right: 620px;
 			z-index: 99;
 			z-index: 99;
-			width: 600px;
 			overflow: auto;
 			overflow: auto;
-			padding: 10px;
+			padding: 2px;
 			background: #111;
 			background: #111;
-			max-height: 50%;
 			overflow-y: auto;
 			overflow-y: auto;
 		}
 		}
 		.btn-cdb-large {
 		.btn-cdb-large {

+ 4 - 0
hide/comp/CodeEditor.hx

@@ -23,6 +23,10 @@ class CodeEditor extends Component {
 			wordWrap : true,
 			wordWrap : true,
 			minimap : { enabled : false },
 			minimap : { enabled : false },
 			theme : "vs-dark",
 			theme : "vs-dark",
+			lineNumbersMinChars: 3,
+			fontSize: "13px",
+			mouseWheelZoom: true,
+			scrollBeyondLastLine: false
 		});
 		});
 		root.on("mousewheel", function(e) {
 		root.on("mousewheel", function(e) {
 			return false;
 			return false;

+ 2 - 2
hide/comp/cdb/Cell.hx

@@ -257,8 +257,8 @@ class Cell extends Component {
 				var id = c.scope != null ? makeId(scope,c.scope,v) : v;
 				var id = c.scope != null ? makeId(scope,c.scope,v) : v;
 				editor.isUniqueID(sheet,obj,id) ? v : '<span class="error">#DUP($v)</span>';
 				editor.isUniqueID(sheet,obj,id) ? v : '<span class="error">#DUP($v)</span>';
 			}
 			}
-		case TString if( c.kind == Script ):
-			v == "" ? "&nbsp;" : colorizeScript(c,v, sheet.idCol == null ? null : Reflect.field(obj, sheet.idCol.name));
+		case TString if( c.kind == Script ):  // wrap content in div because td cannot have max-height
+			v == "" ? "&nbsp;" : '<div class="script">${colorizeScript(c,v, sheet.idCol == null ? null : Reflect.field(obj, sheet.idCol.name))}</div>';
 		case TString, TLayer(_):
 		case TString, TLayer(_):
 			v == "" ? "&nbsp;" : StringTools.htmlEscape(v).split("\n").join("<br/>");
 			v == "" ? "&nbsp;" : StringTools.htmlEscape(v).split("\n").join("<br/>");
 		case TRef(sname):
 		case TRef(sname):