mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 17:36:27 +00:00
Add a compose API for starting, canceling, and finishing messages
(imported from commit 372e1c2ae19a72bcbb989fa2be5c510a1278fc69)
This commit is contained in:
@@ -2,6 +2,37 @@ var compose = (function () {
|
|||||||
|
|
||||||
var exports = {};
|
var exports = {};
|
||||||
|
|
||||||
|
exports.start = function (msg_type, opts) {
|
||||||
|
opts = $.extend({ 'message_type': msg_type,
|
||||||
|
'stream': '',
|
||||||
|
'subject': '',
|
||||||
|
'huddle_recipient': '',
|
||||||
|
'message': '' },
|
||||||
|
opts);
|
||||||
|
|
||||||
|
$("#stream").val(opts.stream);
|
||||||
|
$("#subject").val(opts.subject);
|
||||||
|
$("#huddle_recipient").val(opts.huddle_recipient);
|
||||||
|
$("#new_message_content").val(opts.message);
|
||||||
|
|
||||||
|
$('#sidebar a[href="#home"]').tab('show');
|
||||||
|
|
||||||
|
if (msg_type === 'stream') {
|
||||||
|
exports.show('stream', $("#stream"));
|
||||||
|
} else {
|
||||||
|
exports.show('personal', $("#huddle_recipient"));
|
||||||
|
}
|
||||||
|
hotkeys.set_compose();
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.cancel = function () {
|
||||||
|
compose.hide();
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.finish = function () {
|
||||||
|
$("#compose form").ajaxSubmit();
|
||||||
|
};
|
||||||
|
|
||||||
exports.show = function (tabname, focus_area) {
|
exports.show = function (tabname, focus_area) {
|
||||||
if (reloading_app) {
|
if (reloading_app) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user