aboutsummaryrefslogtreecommitdiffstats
path: root/view/tpl/jot-header.tpl
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2015-11-20 21:55:13 -0500
committerAndrew Manning <tamanning@zoho.com>2015-11-20 21:55:13 -0500
commit6083cd255990c82380a85029b3951160eb558ac9 (patch)
tree57ad8a6088499e1ab1de1393771f174e588aee7e /view/tpl/jot-header.tpl
parent179730e4851bfb26151502d4473231df86b9c8df (diff)
downloadvolse-hubzilla-6083cd255990c82380a85029b3951160eb558ac9.tar.gz
volse-hubzilla-6083cd255990c82380a85029b3951160eb558ac9.tar.bz2
volse-hubzilla-6083cd255990c82380a85029b3951160eb558ac9.zip
If text is selected in profile-jot-text when the link button is pressed, the input URL is applied around the text. Otherwise, the normal link data fetch occurs.
Diffstat (limited to 'view/tpl/jot-header.tpl')
-rwxr-xr-xview/tpl/jot-header.tpl30
1 files changed, 21 insertions, 9 deletions
diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl
index b405e4ac8..84fccc105 100755
--- a/view/tpl/jot-header.tpl
+++ b/view/tpl/jot-header.tpl
@@ -190,15 +190,27 @@ function enableOnUser(){
}
function jotGetLink() {
- reply = prompt("{{$linkurl}}");
- if(reply && reply.length) {
- reply = bin2hex(reply);
- $('#profile-rotator').spin('tiny');
- $.get('{{$baseurl}}/linkinfo?f=&binurl=' + reply, function(data) {
- addeditortext(data);
- $('#profile-rotator').spin(false);
- });
- }
+ textarea = document.getElementById('profile-jot-text');
+ if (textarea.selectionStart || textarea.selectionStart == "0") {
+ var start = textarea.selectionStart;
+ var end = textarea.selectionEnd;
+ if (end > start) {
+ reply = prompt("{{$linkurl}}");
+ if(reply && reply.length) {
+ textarea.value = textarea.value.substring(0, start) + "[url=" + reply + "]" + textarea.value.substring(start, end) + "[/url]" + textarea.value.substring(end, textarea.value.length);
+ }
+ } else {
+ reply = prompt("{{$linkurl}}");
+ if(reply && reply.length) {
+ reply = bin2hex(reply);
+ $('#profile-rotator').spin('tiny');
+ $.get('{{$baseurl}}/linkinfo?f=&binurl=' + reply, function(data) {
+ addeditortext(data);
+ $('#profile-rotator').spin(false);
+ });
+ }
+ }
+ }
}
function jotVideoURL() {