compose: Add video link button, powered by Jitsi.

This commit is contained in:
Jack Zhang 2017-08-10 16:51:48 -07:00 committed by Tim Abbott
parent bb80c0cc24
commit fef828a037
4 changed files with 24 additions and 0 deletions

View File

@ -230,6 +230,8 @@ class="fa fa-bars"></i>) icon`
`star (<i class="fa fa-star-o"></i>) icon`
* trash (<i class="fa fa-trash-o"></i>) icon —
`trash (<i class="fa fa-trash-o"></i>) icon`
* video-camera (<i class="fa fa-video-camera"></i>) icon —
`video-camera (<i class="fa fa-video-camera"></i>) icon`
* x (<i class="fa fa-times"></i>) icon —
`x (<i class="fa fa-times"></i>) icon`

View File

@ -1084,6 +1084,17 @@ function test_with_mock_socket(test_params) {
assert(compose_file_input_clicked);
}());
(function test_video_link_compose_clicked() {
var handler = $("#compose").get_on_handler("click", "#video_link");
assert.equal($('#new_message_content').val(), '');
handler(event);
// video link ids consist of 15 random digits
var video_link_regex = /\[Click to join video call\]\(https:\/\/meet.jit.si\/\d{15}\)/;
assert(video_link_regex.test($('#new_message_content').val()));
}());
(function test_markdown_preview_compose_clicked() {
// Tests setup
function setup_visibilities() {

View File

@ -650,6 +650,15 @@ exports.initialize = function () {
$("#preview_content").html(preview_html);
}
$('#compose').on('click', '#video_link', function (e) {
e.preventDefault();
var video_call_id = util.random_int(100000000000000, 999999999999999);
var video_call_link = 'https://meet.jit.si/' + video_call_id;
var video_call_link_text = '[' + _('Click to join video call') + '](' + video_call_link + ')';
compose_state.insert_syntax_and_focus(video_call_link_text);
});
$("#compose").on("click", "#markdown_preview", function (e) {
e.preventDefault();
var content = $("#new_message_content").val();

View File

@ -94,6 +94,8 @@
id="attach_dropbox_files" href="#" title="{{ _('Attach files from Dropbox') }}"></a>
<a class="message-control-button icon-vector-paper-clip notdisplayed"
id="attach_files" href="#" title="{{ _('Attach files') }}"></a>
<a class="message-control-button fa fa-video-camera"
id="video_link" href="#" title="{{ _('Add video call') }}"></a>
<a id="undo_markdown_preview"
class="message-control-button icon-vector-edit"
style="display:none;" title="{{ _('Write') }}"></a>