mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
File uploads using Dropbox.
(imported from commit c552133fc7025eca526fbfef24fd544260d7111b)
This commit is contained in:
@@ -1096,6 +1096,10 @@ $(function () {
|
||||
if (window.XMLHttpRequest && (new XMLHttpRequest()).upload) {
|
||||
$("#compose #attach_files").removeClass("notdisplayed");
|
||||
}
|
||||
if (feature_flags.dropbox_integration && Dropbox.isBrowserSupported()) {
|
||||
$("#compose #attach_dropbox_files").removeClass("notdisplayed");
|
||||
}
|
||||
|
||||
|
||||
// Event bindings for "Compose" pane
|
||||
|
||||
@@ -1107,6 +1111,24 @@ $(function () {
|
||||
$("#compose #file_input").trigger("click");
|
||||
} );
|
||||
|
||||
$("#compose").on("click", "#attach_dropbox_files", function (e) {
|
||||
e.preventDefault();
|
||||
var options = {
|
||||
// Required. Called when a user selects an item in the Chooser.
|
||||
success: function (files) {
|
||||
var textbox = $("#new_message_content");
|
||||
var links = _.map(files, function (file) { return '[' + file.name + '](' + file.link +')'; })
|
||||
.join(' ') + ' ';
|
||||
textbox.val(textbox.val() + links);
|
||||
|
||||
},
|
||||
// Optional. A value of false (default) limits selection to a single file, while
|
||||
// true enables multiple file selection.
|
||||
multiselect: true
|
||||
};
|
||||
Dropbox.choose(options);
|
||||
});
|
||||
|
||||
$("#subscriptions_table").on("mouseover", ".subscription_header", function (e) {
|
||||
$(this).addClass("active");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user