Browse Source

Removed parent actions from EditorPane.

pull/170/head
weisj 5 years ago
parent
commit
ec1250184f
  1. 11
      core/src/main/java/com/github/weisj/darklaf/ui/text/DarkEditorPaneUI.java
  2. 1
      core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextUI.java

11
core/src/main/java/com/github/weisj/darklaf/ui/text/DarkEditorPaneUI.java

@ -28,12 +28,16 @@ import java.awt.*;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
import javax.swing.*; import javax.swing.*;
import javax.swing.plaf.ActionMapUIResource;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.UIResource; import javax.swing.plaf.UIResource;
import javax.swing.text.*; import javax.swing.text.*;
import javax.swing.text.html.HTMLDocument; import javax.swing.text.html.HTMLDocument;
import javax.swing.text.html.StyleSheet; import javax.swing.text.html.StyleSheet;
import com.github.weisj.darklaf.ui.text.action.DeleteNextCharAction;
import com.github.weisj.darklaf.ui.text.action.DeletePreviousCharAction;
import com.github.weisj.darklaf.ui.text.action.ToggleInsertAction;
import com.github.weisj.darklaf.util.PropertyKey; import com.github.weisj.darklaf.util.PropertyKey;
import com.github.weisj.darklaf.util.PropertyUtil; import com.github.weisj.darklaf.util.PropertyUtil;
@ -242,7 +246,7 @@ public class DarkEditorPaneUI extends DarkTextUI {
* Fetch an action map to use. The map for a JEditorPane is not shared because it changes with the EditorKit. * Fetch an action map to use. The map for a JEditorPane is not shared because it changes with the EditorKit.
*/ */
public ActionMap getActionMap() { public ActionMap getActionMap() {
ActionMap am = super.getActionMap(); ActionMap am = new ActionMapUIResource();
am.put("requestFocus", new FocusAction()); am.put("requestFocus", new FocusAction());
EditorKit editorKit = getEditorKit(getComponent()); EditorKit editorKit = getEditorKit(getComponent());
if (editorKit != null) { if (editorKit != null) {
@ -257,6 +261,11 @@ public class DarkEditorPaneUI extends DarkTextUI {
TransferHandler.getCopyAction()); TransferHandler.getCopyAction());
am.put(TransferHandler.getPasteAction().getValue(Action.NAME), am.put(TransferHandler.getPasteAction().getValue(Action.NAME),
TransferHandler.getPasteAction()); TransferHandler.getPasteAction());
if (editorKit instanceof DefaultEditorKit) {
am.put(DefaultEditorKit.deletePrevCharAction, new DeletePreviousCharAction());
am.put(DefaultEditorKit.deleteNextCharAction, new DeleteNextCharAction());
am.put(TOGGLE_INSERT, new ToggleInsertAction());
}
return am; return am;
} }

1
core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextUI.java

@ -376,7 +376,6 @@ public abstract class DarkTextUI extends BasicTextUI implements PropertyChangeLi
* processed when the text component has focus and isn't editable. * processed when the text component has focus and isn't editable.
* *
*/ */
System.out.println(getEditorKit(editor));
if (getEditorKit(editor) instanceof DefaultEditorKit) { if (getEditorKit(editor) instanceof DefaultEditorKit) {
if (map != null) { if (map != null) {
Object obj = map.get(DefaultEditorKit.insertBreakAction); Object obj = map.get(DefaultEditorKit.insertBreakAction);

Loading…
Cancel
Save