forked from yuki-kimoto/gitprep
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0f2db5f
commit 4a2121f
Showing
5 changed files
with
86 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
function insertAtCaret(target, str) { | ||
var obj = $(target); | ||
obj.focus(); | ||
if(navigator.userAgent.match(/MSIE/)) { | ||
var r = document.selection.createRange(); | ||
r.text = str; | ||
r.select(); | ||
} else { | ||
var s = obj.val(); | ||
var p = obj.get(0).selectionStart; | ||
var np = p + str.length; | ||
obj.val(s.substr(0, p) + str + s.substr(p)); | ||
obj.get(0).setSelectionRange(np, np); | ||
} | ||
} | ||
|
||
function init_icon_input () { | ||
// Comment icon | ||
$('.icon-add-header-text').on('click', function () { | ||
var textarea = $(this).closest('form').find('textarea'); | ||
insertAtCaret(textarea, "# "); | ||
}); | ||
$('.icon-add-bold-text').on('click', function () { | ||
var textarea = $(this).closest('form').find('textarea'); | ||
insertAtCaret(textarea, "****"); | ||
}); | ||
$('.icon-add-italic-text').on('click', function () { | ||
var textarea = $(this).closest('form').find('textarea'); | ||
insertAtCaret(textarea, "__"); | ||
}); | ||
$('.icon-insert-quote').on('click', function () { | ||
var textarea = $(this).closest('form').find('textarea'); | ||
insertAtCaret(textarea, "> "); | ||
}); | ||
$('.icon-insert-code').on('click', function () { | ||
var textarea = $(this).closest('form').find('textarea'); | ||
insertAtCaret(textarea, "``"); | ||
}); | ||
$('.icon-add-link').on('click', function () { | ||
var textarea = $(this).closest('form').find('textarea'); | ||
insertAtCaret(textarea, "[](url)"); | ||
}); | ||
$('.icon-add-bulleted-list').on('click', function () { | ||
var textarea = $(this).closest('form').find('textarea'); | ||
insertAtCaret(textarea, "- "); | ||
}); | ||
$('.icon-add-numbered-list').on('click', function () { | ||
var textarea = $(this).closest('form').find('textarea'); | ||
insertAtCaret(textarea, "1. "); | ||
}); | ||
$('.icon-mension-user').on('click', function () { | ||
var textarea = $(this).closest('form').find('textarea'); | ||
insertAtCaret(textarea, "@"); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
<div class="issue-add-comment-icon"> | ||
<i class="issue-icon-add-header-text icon icon-font" title="Add header text"></i> | ||
<i class="issue-icon-add-bold-text icon icon-bold" title="Add bold text"></i> | ||
<i class="issue-icon-add-italic-text icon icon-italic" title="Add italic text"></i> | ||
<i class="icon-add-header-text icon icon-font" title="Add header text"></i> | ||
<i class="icon-add-bold-text icon icon-bold" title="Add bold text"></i> | ||
<i class="icon-add-italic-text icon icon-italic" title="Add italic text"></i> | ||
<span style="margin-left:10px"></span> | ||
<i class="issue-icon-insert-quote icon icon-comment" title="Insert a quote"></i> | ||
<i class="issue-icon-insert-code icon icon-file" title="Insert a code"></i> | ||
<i class="issue-icon-add-link icon icon-map-marker" title="Add a link"></i> | ||
<i class="icon-insert-quote icon icon-comment" title="Insert a quote"></i> | ||
<i class="icon-insert-code icon icon-file" title="Insert a code"></i> | ||
<i class="icon-add-link icon icon-map-marker" title="Add a link"></i> | ||
<span style="margin-left:10px"></span> | ||
<i class="issue-icon-add-bulleted-list icon icon-list" title="Add a bulleted list"></i> | ||
<i class="issue-icon-add-numbered-list icon icon-th-list" title="Add a numbered list"></i> | ||
<i class="icon-add-bulleted-list icon icon-list" title="Add a bulleted list"></i> | ||
<i class="icon-add-numbered-list icon icon-th-list" title="Add a numbered list"></i> | ||
<span style="margin-left:10px"></span> | ||
<i class="issue-icon-mension-user icon icon-user" title="Directory mension a user"></i> | ||
<i class="icon-mension-user icon icon-user" title="Directory mension a user"></i> | ||
<!-- | ||
<i class="issue-icon-reference-issue icon icon-bookmark" title="Reference a issue or pull request"></i> | ||
<i class="icon-reference-issue icon icon-bookmark" title="Reference a issue or pull request"></i> | ||
--> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters