Selaa lähdekoodia

some additional minor cdb fixes

Nicolas Cannasse 6 vuotta sitten
vanhempi
commit
ce0643e2d5
3 muutettua tiedostoa jossa 14 lisäystä ja 16 poistoa
  1. 11 1
      hide/comp/cdb/Cell.hx
  2. 3 2
      hide/comp/cdb/Editor.hx
  3. 0 13
      hide/comp/cdb/Table.hx

+ 11 - 1
hide/comp/cdb/Cell.hx

@@ -23,6 +23,16 @@ class Cell extends Component {
 		root.addClass("t_" + typeNames[column.type.getIndex()]);
 		if( column.kind == Script ) root.addClass("t_script");
 		refresh();
+		switch( column.type ) {
+		case TList, TProperties:
+			element.click(function(e) {
+				if( e.shiftKey ) return;
+				e.stopPropagation();
+				@:privateAccess line.table.toggleList(this);
+			});
+		default:
+			element.dblclick(function(_) edit());
+		}
 	}
 
 	function get_table() return line.table;
@@ -272,7 +282,7 @@ class Cell extends Component {
 				case K.ESCAPE:
 					refresh();
 					table.editor.element.focus();
-				case K.ENTER if( !e.shiftKey ):
+				case K.ENTER if( !e.shiftKey || !column.type.match(TString|TDynamic|TCustom(_)) ):
 					closeEdit();
 					e.preventDefault();
 				case K.ENTER if( !longText ):

+ 3 - 2
hide/comp/cdb/Editor.hx

@@ -67,6 +67,7 @@ class Editor extends Component {
 			if( cell != null && cell.isTextInput() && !e.ctrlKey )
 				cell.edit();
 		});
+		element.contextmenu(function(e) e.preventDefault());
 		keys = new hide.ui.Keys(element);
 		keys.addListener(onKey);
 		keys.register("search", function() {
@@ -343,7 +344,7 @@ class Editor extends Component {
 					break;
 				}
 			if( tparent != null )
-				tparent.lines[t.parent.line].cells[t.parent.column].open(true);
+				tparent.lines[t.parent.line].cells[tparent.displayMode == Properties ? 0 : t.parent.column].open(true);
 		}
 
 		if( cur != null ) {
@@ -769,7 +770,7 @@ class Editor extends Component {
 
 	public function focus() {
 		if( element.is(":focus") ) return;
-		element.focus();
+		(element[0] : Dynamic).focus({ preventScroll : true });
 		onFocus();
 	}
 

+ 0 - 13
hide/comp/cdb/Table.hx

@@ -127,17 +127,6 @@ class Table extends Component {
 					editor.cursor.clickCell(cell, e.shiftKey);
 					e.stopPropagation();
 				});
-
-				switch( c.type ) {
-				case TList, TProperties:
-					cell.element.click(function(e) {
-						if( e.shiftKey ) return;
-						e.stopPropagation();
-						toggleList(cell);
-					});
-				default:
-					cell.element.dblclick(function(_) cell.edit());
-				}
 			}
 		}
 
@@ -245,8 +234,6 @@ class Table extends Component {
 					return;
 				}
 			});
-
-			cell.element.dblclick(function(_) cell.edit());
 		}
 
 		// add/edit properties