浏览代码

more prevent inserts

Nicolas Cannasse 5 年之前
父节点
当前提交
d4d7d5f826
共有 2 个文件被更改,包括 4 次插入1 次删除
  1. 3 1
      hide/comp/cdb/Editor.hx
  2. 1 0
      hide/comp/cdb/Table.hx

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

@@ -684,6 +684,8 @@ class Editor extends Component {
 	}
 	}
 
 
 	function moveLine( line : Line, delta : Int ) {
 	function moveLine( line : Line, delta : Int ) {
+		if( !line.table.canInsert() )
+			return;
 		beginChanges();
 		beginChanges();
 		var index = line.table.sheet.moveLine(line.index, delta);
 		var index = line.table.sheet.moveLine(line.index, delta);
 		if( index != null ) {
 		if( index != null ) {
@@ -694,7 +696,7 @@ class Editor extends Component {
 	}
 	}
 
 
 	public function popupLine( line : Line ) {
 	public function popupLine( line : Line ) {
-		if( view != null && !line.table.view.insert )
+		if( !line.table.canInsert() )
 			return;
 			return;
 		var sheet = line.table.sheet;
 		var sheet = line.table.sheet;
 		var sepIndex = sheet.separators.indexOf(line.index);
 		var sepIndex = sheet.separators.indexOf(line.index);

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

@@ -193,6 +193,7 @@ class Table extends Component {
 		var title = if( sheet.props.separatorTitles != null ) sheet.props.separatorTitles[sindex] else null;
 		var title = if( sheet.props.separatorTitles != null ) sheet.props.separatorTitles[sindex] else null;
 		if( title != null ) content.text(title);
 		if( title != null ) content.text(title);
 		sep.dblclick(function(e) {
 		sep.dblclick(function(e) {
+			if( !canInsert() ) return;
 			content.empty();
 			content.empty();
 			J("<input>").appendTo(content).focus().val(title == null ? "" : title).blur(function(_) {
 			J("<input>").appendTo(content).focus().val(title == null ? "" : title).blur(function(_) {
 				title = JTHIS.val();
 				title = JTHIS.val();