Add events for default editing actions
This commit is contained in:
@@ -13,10 +13,15 @@ import org.fxmisc.richtext.model.StyleSpans;
|
||||
import org.fxmisc.richtext.model.TwoDimensional.Bias;
|
||||
import org.fxmisc.richtext.model.TwoDimensional.Position;
|
||||
|
||||
import app.events.CopyEvent;
|
||||
import app.events.CutEvent;
|
||||
import app.events.EditorChangedEvent;
|
||||
import app.events.LanguageChangedEvent;
|
||||
import app.events.PasteEvent;
|
||||
import app.events.RedoEvent;
|
||||
import app.events.ToggleCommentEvent;
|
||||
import app.events.ToggleWrapTextEvent;
|
||||
import app.events.UndoEvent;
|
||||
import app.events.FileSaveStateChangedEvent;
|
||||
import app.model.Model;
|
||||
import app.service.LanguageOperations;
|
||||
@@ -141,4 +146,34 @@ public class EditorController implements Initializable, Controller {
|
||||
this.setWrapText(event.getIsWrapped());
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void handle(UndoEvent event) {
|
||||
if (this.editor.isFocused())
|
||||
this.editor.undo();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void handle(RedoEvent event) {
|
||||
if (this.editor.isFocused())
|
||||
this.editor.redo();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void handle(CopyEvent event) {
|
||||
if (this.editor.isFocused())
|
||||
this.editor.copy();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void handle(CutEvent event) {
|
||||
if (this.editor.isFocused())
|
||||
this.editor.cut();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void handle(PasteEvent event) {
|
||||
if (this.editor.isFocused())
|
||||
this.editor.paste();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user