mirror of https://github.com/zulip/zulip.git
Break compose.js and drafts.js dependency.
This commit is contained in:
parent
b609911656
commit
6464514ca9
|
@ -144,7 +144,8 @@
|
||||||
"katex": false,
|
"katex": false,
|
||||||
"Clipboard": false,
|
"Clipboard": false,
|
||||||
"emoji_picker": false,
|
"emoji_picker": false,
|
||||||
"hotspots": false
|
"hotspots": false,
|
||||||
|
"compose_ui": false
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"no-restricted-syntax": 0,
|
"no-restricted-syntax": 0,
|
||||||
|
|
|
@ -18,6 +18,7 @@ add_dependencies({
|
||||||
compose_state: 'js/compose_state',
|
compose_state: 'js/compose_state',
|
||||||
people: 'js/people',
|
people: 'js/people',
|
||||||
util: 'js/util',
|
util: 'js/util',
|
||||||
|
compose_ui: 'js/compose_ui',
|
||||||
});
|
});
|
||||||
|
|
||||||
var compose_actions = require('js/compose_actions.js');
|
var compose_actions = require('js/compose_actions.js');
|
||||||
|
|
|
@ -42,10 +42,6 @@ function clear_out_file_list(jq_file_list) {
|
||||||
// $("#file_input").val("");
|
// $("#file_input").val("");
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.autosize_textarea = function () {
|
|
||||||
$("#new_message_content").trigger("autosize.resize");
|
|
||||||
};
|
|
||||||
|
|
||||||
function show_all_everyone_warnings() {
|
function show_all_everyone_warnings() {
|
||||||
var current_stream = stream_data.get_sub(compose_state.stream_name());
|
var current_stream = stream_data.get_sub(compose_state.stream_name());
|
||||||
var stream_count = current_stream.subscribers.num_items();
|
var stream_count = current_stream.subscribers.num_items();
|
||||||
|
@ -292,7 +288,7 @@ function process_send_time(message_id, start_time, locally_echoed) {
|
||||||
function clear_compose_box() {
|
function clear_compose_box() {
|
||||||
$("#new_message_content").val('').focus();
|
$("#new_message_content").val('').focus();
|
||||||
drafts.delete_draft_after_send();
|
drafts.delete_draft_after_send();
|
||||||
exports.autosize_textarea();
|
compose_ui.autosize_textarea();
|
||||||
$("#send-status").hide(0);
|
$("#send-status").hide(0);
|
||||||
$("#compose-send-button").removeAttr('disabled');
|
$("#compose-send-button").removeAttr('disabled');
|
||||||
$("#sending-indicator").hide();
|
$("#sending-indicator").hide();
|
||||||
|
@ -891,7 +887,7 @@ $(function () {
|
||||||
// This is a dropped file, so make the filename a link to the image
|
// This is a dropped file, so make the filename a link to the image
|
||||||
textbox.val(textbox.val() + "[" + filename + "](" + uri + ")" + " ");
|
textbox.val(textbox.val() + "[" + filename + "](" + uri + ")" + " ");
|
||||||
}
|
}
|
||||||
exports.autosize_textarea();
|
compose_ui.autosize_textarea();
|
||||||
$("#compose-send-button").removeAttr("disabled");
|
$("#compose-send-button").removeAttr("disabled");
|
||||||
$("#send-status").removeClass("alert-info")
|
$("#send-status").removeClass("alert-info")
|
||||||
.hide();
|
.hide();
|
||||||
|
@ -933,7 +929,7 @@ $(function () {
|
||||||
compose_actions.start('stream');
|
compose_actions.start('stream');
|
||||||
}
|
}
|
||||||
textbox.val(textbox.val() + contents);
|
textbox.val(textbox.val() + contents);
|
||||||
exports.autosize_textarea();
|
compose_ui.autosize_textarea();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ function clear_box() {
|
||||||
|
|
||||||
exports.clear_textarea();
|
exports.clear_textarea();
|
||||||
$("#new_message_content").removeData("draft-id");
|
$("#new_message_content").removeData("draft-id");
|
||||||
compose.autosize_textarea();
|
compose_ui.autosize_textarea();
|
||||||
$("#send-status").hide(0);
|
$("#send-status").hide(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
var compose_ui = (function () {
|
||||||
|
|
||||||
|
var exports = {};
|
||||||
|
|
||||||
|
exports.autosize_textarea = function () {
|
||||||
|
$("#new_message_content").trigger("autosize.resize");
|
||||||
|
};
|
||||||
|
|
||||||
|
return exports;
|
||||||
|
|
||||||
|
}());
|
||||||
|
if (typeof module !== 'undefined') {
|
||||||
|
module.exports = compose_ui;
|
||||||
|
}
|
|
@ -382,7 +382,7 @@ exports.content_typeahead_selected = function (item) {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
$('#new_message_content').caret(beginning.length, beginning.length);
|
$('#new_message_content').caret(beginning.length, beginning.length);
|
||||||
// Also, trigger autosize to check if compose box needs to be resized.
|
// Also, trigger autosize to check if compose box needs to be resized.
|
||||||
compose.autosize_textarea();
|
compose_ui.autosize_textarea();
|
||||||
}, 0);
|
}, 0);
|
||||||
return beginning + rest;
|
return beginning + rest;
|
||||||
};
|
};
|
||||||
|
|
|
@ -134,7 +134,7 @@ exports.restore_draft = function (draft_id) {
|
||||||
draft_copy.subject = "";
|
draft_copy.subject = "";
|
||||||
}
|
}
|
||||||
compose_actions.start(draft_copy.type, draft_copy);
|
compose_actions.start(draft_copy.type, draft_copy);
|
||||||
compose.autosize_textarea();
|
compose_ui.autosize_textarea();
|
||||||
$("#new_message_content").data("draft-id", draft_id);
|
$("#new_message_content").data("draft-id", draft_id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -949,6 +949,7 @@ JS_SPECS = {
|
||||||
'js/typing_events.js',
|
'js/typing_events.js',
|
||||||
'js/ui_init.js',
|
'js/ui_init.js',
|
||||||
'js/emoji_picker.js',
|
'js/emoji_picker.js',
|
||||||
|
'js/compose_ui.js',
|
||||||
# JS bundled by webpack is also included here if PIPELINE_ENABLED setting is true
|
# JS bundled by webpack is also included here if PIPELINE_ENABLED setting is true
|
||||||
],
|
],
|
||||||
'output_filename': 'min/app.js'
|
'output_filename': 'min/app.js'
|
||||||
|
|
Loading…
Reference in New Issue