Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
case 72:
editor.headline();
break;
+
+ // L - Link
+ case 76:
+ editor.link();
+ break;
}
});
}
this.parent.find("#headline").click(this.headline.bind(this));
this.parent.find("#headline-down").click(this.headline_down.bind(this));
this.parent.find("#headline-up").click(this.headline_up.bind(this));
+
+ // Links
+ this.parent.find("#link").click(this.link.bind(this));
}
// Functions to modify the text
}
}
+ link() {
+ // Handle URLs
+ if (this.selection.text.startsWith("https://") || this.selection.text.startsWith("http://")) {
+ this.replaceSelection("[" + this.selection.text + "](" + this.selection.text + ")");
+ // Handle selected text
+ } else {
+ this.replaceSelection("[" + this.selection.text + "]()")
+ }
+ }
+
// Headlines
findLevel() {
</button>
</div>
+ <button type="button" class="btn btn-sm btn-secondary mr-2"
+ id="link" title="{{ _("Link") }} [{{ _("Ctrl") }}-L]">
+ <i class="fas fa-link"></i>
+ </button>
+
<a class="btn btn-sm btn-secondary" href="{{ path }}/_files"
target="_blank" title="{{ _("Files") }}">
<i class="fas fa-images"></i>