Skip to content

Commit 859dafb

Browse files
authored
Remove key handling mac paste workaround and focus on maintable (#12890)
* Remove paste keybinding workaround on macOs Prevents pasting * request focus on main table for new library tab to prevent pasting in the search bar * changelog * Update CHANGELOG.md with recent changes
1 parent 0dc9d7d commit 859dafb

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

src/main/java/org/jabref/gui/LibraryTab.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import javafx.beans.property.SimpleListProperty;
2323
import javafx.beans.value.ObservableBooleanValue;
2424
import javafx.collections.ListChangeListener;
25+
import javafx.event.ActionEvent;
2526
import javafx.event.Event;
2627
import javafx.geometry.Orientation;
2728
import javafx.scene.Node;
@@ -1172,10 +1173,14 @@ public void notify(Node graphic, String text, List<Action> actions, Duration dur
11721173
this.show();
11731174
if ((duration != null) && !duration.equals(Duration.ZERO)) {
11741175
PauseTransition delay = new PauseTransition(duration);
1175-
delay.setOnFinished(e -> this.hide());
1176+
delay.setOnFinished(this::handle);
11761177
delay.play();
11771178
}
11781179
}
1180+
1181+
private void handle(ActionEvent e) {
1182+
this.hide();
1183+
}
11791184
}
11801185

11811186
public DatabaseNotification getNotificationPane() {

src/main/java/org/jabref/gui/frame/JabRefFrame.java

+1-12
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
import org.jabref.logic.UiCommand;
5151
import org.jabref.logic.ai.AiService;
5252
import org.jabref.logic.journals.JournalAbbreviationRepository;
53-
import org.jabref.logic.os.OS;
5453
import org.jabref.logic.util.BuildInfo;
5554
import org.jabref.logic.util.TaskExecutor;
5655
import org.jabref.model.database.BibDatabaseContext;
@@ -62,7 +61,6 @@
6261
import com.tobiasdiez.easybind.EasyBind;
6362
import com.tobiasdiez.easybind.EasyObservableList;
6463
import com.tobiasdiez.easybind.Subscription;
65-
import org.fxmisc.richtext.CodeArea;
6664
import org.jspecify.annotations.NonNull;
6765
import org.slf4j.Logger;
6866
import org.slf4j.LoggerFactory;
@@ -313,16 +311,6 @@ private void initKeyBindings() {
313311
case NEW_INPROCEEDINGS:
314312
new NewEntryAction(this::getCurrentLibraryTab, StandardEntryType.InProceedings, dialogService, preferences, stateManager).execute();
315313
break;
316-
case PASTE:
317-
if (OS.OS_X) { // Workaround for a jdk issue that executes paste twice when using cmd+v in a TextField
318-
// Extra workaround for CodeArea, which does not inherit from TextInputControl
319-
if (!(stateManager.getFocusOwner().isPresent() && (stateManager.getFocusOwner().get() instanceof CodeArea))) {
320-
event.consume();
321-
break;
322-
}
323-
break;
324-
}
325-
break;
326314
default:
327315
}
328316
}
@@ -499,6 +487,7 @@ public void addTab(@NonNull LibraryTab libraryTab, boolean raisePanel) {
499487
if (raisePanel) {
500488
tabbedPane.getSelectionModel().select(libraryTab);
501489
tabbedPane.requestFocus();
490+
libraryTab.getMainTable().requestFocus();
502491
}
503492

504493
libraryTab.setContextMenu(createTabContextMenuFor(libraryTab));

0 commit comments

Comments
 (0)