2
0
Эх сурвалжийг харах

Merge branch 'master' of https://github.com/HeapsIO/hide

LeoVgr 3 сар өмнө
parent
commit
75f348b415

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

@@ -134,7 +134,11 @@ class Cell {
 						keys : this.editor.config.get("key.cdb.showUnreferenced"),
 					}
 				];
-				menu.append(hide.view.RemoteConsoleView.getCdbMenuActions(this.table.sheet.name, this.value));
+				var remoteMenu = hide.view.RemoteConsoleView.getCdbMenuActions(this.table.sheet.name, this.value);
+				if (!remoteMenu.isEmpty()) {
+					menu.push({ label : "", isSeparator : true });
+					menu.append(remoteMenu);
+				}
 		case TRef(sname):
 			if( value != null && value != "" )
 				menu = [

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

@@ -2129,9 +2129,20 @@ class Editor extends Component {
 
 
 	public function popupLine( line : Line ) {
-		if( !line.table.canInsert() ) return;
-
 		var sheet = line.table.sheet;
+		var remoteMenu: Array<hide.comp.ContextMenu.MenuItem> = [];
+		if (sheet.idCol != null) {
+			var id = Reflect.field(line.obj, sheet.idCol.name);
+			remoteMenu.append(hide.view.RemoteConsoleView.getCdbMenuActions(sheet.name, id));
+		}
+
+		if( !line.table.canInsert() ) {
+			if (!remoteMenu.isEmpty()) {
+				hide.comp.ContextMenu.createFromPoint(ide.mouseX, ide.mouseY, remoteMenu);
+			}
+			return;
+		}
+
 		var selectedLines = cursor.getSelectedLines();
 		var isSelectedLine = selectedLines.contains(line);
 		var firstLine = isSelectedLine ? selectedLines[0] : line;
@@ -2287,6 +2298,10 @@ class Editor extends Component {
 				},
 			});
 		}
+		if (!remoteMenu.isEmpty()) {
+			menu.push({ label : "", isSeparator : true });
+			menu.append(remoteMenu);
+		}
 		hide.comp.ContextMenu.createFromPoint(ide.mouseX, ide.mouseY, menu);
 	}