dependencies: Upgrade jquery-autosize 1.17.7 to autosize 4.0.2.

The API for the autosize library changed upstream, so several changes
had to be made to relevant js files for a successful upgrade.

Resolves #12695.
This commit is contained in:
Vinit Singh 2019-07-16 23:49:11 +05:30 committed by Tim Abbott
parent 9233b3bc75
commit 86073588be
10 changed files with 27 additions and 16 deletions

View File

@ -9,6 +9,7 @@
"@types/underscore": "1.8.18", "@types/underscore": "1.8.18",
"@types/webpack": "4.4.32", "@types/webpack": "4.4.32",
"@types/webpack-dev-server": "3.1.6", "@types/webpack-dev-server": "3.1.6",
"autosize": "4.0.2",
"blueimp-md5": "2.10.0", "blueimp-md5": "2.10.0",
"cache-loader": "4.0.0", "cache-loader": "4.0.0",
"clipboard": "2.0.4", "clipboard": "2.0.4",
@ -27,7 +28,6 @@
"i18next": "3.4.4", "i18next": "3.4.4",
"imports-loader": "0.8.0", "imports-loader": "0.8.0",
"jquery": "3.4.1", "jquery": "3.4.1",
"jquery-autosize": "1.17.7",
"jquery-caret-plugin": "1.5.2", "jquery-caret-plugin": "1.5.2",
"jquery-validation": "1.19.0", "jquery-validation": "1.19.0",
"katex": "0.10.2", "katex": "0.10.2",

View File

@ -6,7 +6,6 @@ import "../../third/bootstrap-typeahead/typeahead.js";
import "../../third/jquery-filedrop/jquery.filedrop.js"; import "../../third/jquery-filedrop/jquery.filedrop.js";
import "jquery-caret-plugin/src/jquery.caret.js"; import "jquery-caret-plugin/src/jquery.caret.js";
import "../../third/jquery-idle/jquery.idle.js"; import "../../third/jquery-idle/jquery.idle.js";
import "jquery-autosize";
import "spectrum-colorpicker"; import "spectrum-colorpicker";
import "../../third/sockjs/sockjs-0.3.4.js"; import "../../third/sockjs/sockjs-0.3.4.js";
import "../../third/marked/lib/marked.js"; import "../../third/marked/lib/marked.js";

View File

@ -1,3 +1,5 @@
var autosize = require('autosize');
var compose_actions = (function () { var compose_actions = (function () {
var exports = {}; var exports = {};
@ -105,7 +107,7 @@ function clear_box() {
} }
exports.autosize_message_content = function () { exports.autosize_message_content = function () {
$("#compose-textarea").autosize({ autosize($("#compose-textarea"), {
callback: function () { callback: function () {
compose_actions.maybe_scroll_up_selected_message(); compose_actions.maybe_scroll_up_selected_message();
}, },
@ -417,7 +419,7 @@ exports.quote_and_reply = function (opts) {
function replace_content(raw_content) { function replace_content(raw_content) {
compose_ui.replace_syntax('[Quoting…]', '```quote\n' + raw_content + '\n```', textarea); compose_ui.replace_syntax('[Quoting…]', '```quote\n' + raw_content + '\n```', textarea);
$("#compose-textarea").trigger("autosize.resize"); autosize.update($('#compose-textarea'));
} }
if (message && message.raw_content) { if (message && message.raw_content) {

View File

@ -1,9 +1,11 @@
var autosize = require('autosize');
var compose_ui = (function () { var compose_ui = (function () {
var exports = {}; var exports = {};
exports.autosize_textarea = function () { exports.autosize_textarea = function () {
$("#compose-textarea").trigger("autosize.resize"); autosize.update($("#compose-textarea"));
}; };
exports.smart_insert = function (textarea, syntax) { exports.smart_insert = function (textarea, syntax) {
@ -42,7 +44,7 @@ exports.smart_insert = function (textarea, syntax) {
// This should just call exports.autosize_textarea, but it's a bit // This should just call exports.autosize_textarea, but it's a bit
// annoying for the unit tests, so we don't do that. // annoying for the unit tests, so we don't do that.
textarea.trigger("autosize.resize"); autosize.update(textarea);
}; };
exports.insert_syntax_and_focus = function (syntax, textarea) { exports.insert_syntax_and_focus = function (syntax, textarea) {

View File

@ -1,3 +1,5 @@
var autosize = require('autosize');
var composebox_typeahead = (function () { var composebox_typeahead = (function () {
//************************************ //************************************
@ -189,7 +191,7 @@ exports.handle_enter = function (textarea, e) {
// Now add the newline, remembering to resize the // Now add the newline, remembering to resize the
// textarea if needed. // textarea if needed.
textarea.caret("\n"); textarea.caret("\n");
textarea.trigger("autosize.resize"); autosize.update(textarea);
e.preventDefault(); e.preventDefault();
return; return;
} }

View File

@ -2,6 +2,8 @@ var render_invitation_failed_error = require("../templates/invitation_failed_err
var render_invite_subscription = require('../templates/invite_subscription.hbs'); var render_invite_subscription = require('../templates/invite_subscription.hbs');
var render_settings_dev_env_email_access = require('../templates/settings/dev_env_email_access.hbs'); var render_settings_dev_env_email_access = require('../templates/settings/dev_env_email_access.hbs');
var autosize = require('autosize');
var invite = (function () { var invite = (function () {
var exports = {}; var exports = {};
@ -144,7 +146,7 @@ function prepare_form_to_be_shown() {
exports.launch = function () { exports.launch = function () {
$('#submit-invitation').button(); $('#submit-invitation').button();
prepare_form_to_be_shown(); prepare_form_to_be_shown();
$("#invitee_emails").focus().autosize(); autosize($("#invitee_emails").focus());
overlays.open_overlay({ overlays.open_overlay({
name: 'invite', name: 'invite',

View File

@ -1,3 +1,5 @@
var autosize = require('autosize');
var message_list = (function () { var message_list = (function () {
var exports = {}; var exports = {};
@ -311,7 +313,7 @@ exports.MessageList.prototype = {
row.find(".message_edit_form").empty().append(edit_obj.form); row.find(".message_edit_form").empty().append(edit_obj.form);
row.find(".message_content, .status-message, .message_controls").hide(); row.find(".message_content, .status-message, .message_controls").hide();
row.find(".message_edit").css("display", "block"); row.find(".message_edit").css("display", "block");
row.find(".message_edit_content").autosize(); autosize(row.find(".message_edit_content"));
}, },
hide_edit_message: function MessageList_hide_edit_message(row) { hide_edit_message: function MessageList_hide_edit_message(row) {

View File

@ -1,3 +1,5 @@
var autosize = require('autosize');
var resize = (function () { var resize = (function () {
var exports = {}; var exports = {};
@ -185,7 +187,7 @@ exports.watch_manual_resize = function (element) {
}(function (height) { }(function (height) {
// This callback disables autosize on the textarea. It // This callback disables autosize on the textarea. It
// will be re-enabled when this component is next opened. // will be re-enabled when this component is next opened.
$(element).trigger("autosize.destroy") autosize.destroy($(element))
.height(height + "px"); .height(height + "px");
})); }));
}; };

View File

@ -21,4 +21,4 @@ LATEST_RELEASE_ANNOUNCEMENT = "https://blog.zulip.org/2019/03/01/zulip-2-0-relea
# Typically, adding a dependency only requires a minor version bump, and # Typically, adding a dependency only requires a minor version bump, and
# removing a dependency requires a major version bump. # removing a dependency requires a major version bump.
PROVISION_VERSION = '38.1' PROVISION_VERSION = '39.0'

View File

@ -1049,6 +1049,11 @@ autoprefixer@^9.5.1:
postcss "^7.0.16" postcss "^7.0.16"
postcss-value-parser "^3.3.1" postcss-value-parser "^3.3.1"
autosize@4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/autosize/-/autosize-4.0.2.tgz#073cfd07c8bf45da4b9fd153437f5bafbba1e4c9"
integrity sha512-jnSyH2d+qdfPGpWlcuhGiHmqBJ6g3X+8T+iRwFrHPLVcdoGJE/x6Qicm6aDHfTsbgZKxyV8UU/YB2p4cjKDRRA==
aws-sign2@~0.7.0: aws-sign2@~0.7.0:
version "0.7.0" version "0.7.0"
resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8"
@ -5807,11 +5812,6 @@ istanbul-reports@^2.2.4:
dependencies: dependencies:
handlebars "^4.1.2" handlebars "^4.1.2"
jquery-autosize@1.17.7:
version "1.17.7"
resolved "https://registry.yarnpkg.com/jquery-autosize/-/jquery-autosize-1.17.7.tgz#3e6292fac80b120e68e4ae8f44de3f82d427e5f7"
integrity sha1-PmKS+sgLEg5o5K6PRN4/gtQn5fc=
jquery-caret-plugin@1.5.2: jquery-caret-plugin@1.5.2:
version "1.5.2" version "1.5.2"
resolved "https://registry.yarnpkg.com/jquery-caret-plugin/-/jquery-caret-plugin-1.5.2.tgz#8980e266f2af3cc4976735040fdbb4ed1b3d141c" resolved "https://registry.yarnpkg.com/jquery-caret-plugin/-/jquery-caret-plugin-1.5.2.tgz#8980e266f2af3cc4976735040fdbb4ed1b3d141c"