Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/keenwrite.git

'Insert Image' action added

AuthorKarl Tauber <email>
Date2015-08-05 11:06:12 GMT+0200
Commit371f7be41100c6f0a4d8a878ad86600392d50963
Parentd644262
Delta90 lines added, 0 lines removed, 90-line increase
src/main/java/org/markdownwriterfx/editor/MarkdownEditorPane.java
import org.fxmisc.undo.UndoManager;
import org.fxmisc.wellbehaved.event.EventHandlerHelper;
+import org.markdownwriterfx.dialogs.ImageDialog;
import org.markdownwriterfx.dialogs.LinkDialog;
import org.markdownwriterfx.util.Utils;
public void insertLink() {
LinkDialog dialog = new LinkDialog(getNode().getScene().getWindow(), getPath().getParent());
+ dialog.showAndWait().ifPresent(result -> {
+ textArea.replaceSelection(result);
+ });
+ }
+
+ public void insertImage() {
+ ImageDialog dialog = new ImageDialog(getNode().getScene().getWindow(), getPath().getParent());
dialog.showAndWait().ifPresent(result -> {
textArea.replaceSelection(result);
src/main/java/org/markdownwriterfx/dialogs/ImageDialog.jfd
+JFDML JFormDesigner: "9.9.9.9.9999" Java: "1.8.0_51" encoding: "UTF-8"
+
+new FormModel {
+ contentType: "form/javafx"
+ root: new FormRoot {
+ add( new FormContainer( "org.tbee.javafx.scene.layout.fxml.MigPane", new FormLayoutManager( class org.tbee.javafx.scene.layout.fxml.MigPane ) {
+ "$layoutConstraints": ""
+ "$columnConstraints": "[shrink 0,fill][300,grow,fill][fill]"
+ "$rowConstraints": "[][][][]"
+ } ) {
+ name: "pane"
+ add( new FormComponent( "javafx.scene.control.Label" ) {
+ name: "urlLabel"
+ "text": "Image URL:"
+ auxiliary() {
+ "JavaCodeGenerator.variableLocal": true
+ }
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 0"
+ } )
+ add( new FormComponent( "org.markdownwriterfx.controls.EscapeTextField" ) {
+ name: "urlField"
+ "escapeCharacters": "()"
+ "text": "http://yourlink.com"
+ "promptText": "http://yourlink.com"
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 1 0"
+ } )
+ add( new FormComponent( "org.markdownwriterfx.controls.BrowseFileButton" ) {
+ name: "linkBrowseFileButton"
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 2 0"
+ } )
+ add( new FormComponent( "javafx.scene.control.Label" ) {
+ name: "textLabel"
+ "text": "Alternate Text:"
+ auxiliary() {
+ "JavaCodeGenerator.variableLocal": true
+ }
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 1"
+ } )
+ add( new FormComponent( "org.markdownwriterfx.controls.EscapeTextField" ) {
+ name: "textField"
+ "escapeCharacters": "[]"
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 1 1 2 1"
+ } )
+ add( new FormComponent( "javafx.scene.control.Label" ) {
+ name: "titleLabel"
+ "text": "Title (tooltip):"
+ auxiliary() {
+ "JavaCodeGenerator.variableLocal": true
+ }
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 2"
+ } )
+ add( new FormComponent( "org.markdownwriterfx.controls.EscapeTextField" ) {
+ name: "titleField"
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 1 2 2 1"
+ } )
+ add( new FormComponent( "javafx.scene.control.Label" ) {
+ name: "previewLabel"
+ "text": "Markdown Preview:"
+ auxiliary() {
+ "JavaCodeGenerator.variableLocal": true
+ }
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 3"
+ } )
+ add( new FormComponent( "javafx.scene.control.Label" ) {
+ name: "previewField"
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 1 3 2 1"
+ } )
+ }, new FormLayoutConstraints( null ) {
+ "location": new javafx.geometry.Point2D( 0.0, 0.0 )
+ "size": new javafx.geometry.Dimension2D( 500.0, 300.0 )
+ } )
+ }
+}