From 86073588bebda442d110dc8c98b48c0b59f5a12d Mon Sep 17 00:00:00 2001 From: Vinit Singh Date: Tue, 16 Jul 2019 23:49:11 +0530 Subject: [PATCH] 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. --- package.json | 2 +- static/js/bundles/app.js | 1 - static/js/compose_actions.js | 6 ++++-- static/js/compose_ui.js | 6 ++++-- static/js/composebox_typeahead.js | 4 +++- static/js/invite.js | 4 +++- static/js/message_list.js | 4 +++- static/js/resize.js | 4 +++- version.py | 2 +- yarn.lock | 10 +++++----- 10 files changed, 27 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index e9ff21cb81..3a3c39dd7f 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "@types/underscore": "1.8.18", "@types/webpack": "4.4.32", "@types/webpack-dev-server": "3.1.6", + "autosize": "4.0.2", "blueimp-md5": "2.10.0", "cache-loader": "4.0.0", "clipboard": "2.0.4", @@ -27,7 +28,6 @@ "i18next": "3.4.4", "imports-loader": "0.8.0", "jquery": "3.4.1", - "jquery-autosize": "1.17.7", "jquery-caret-plugin": "1.5.2", "jquery-validation": "1.19.0", "katex": "0.10.2", diff --git a/static/js/bundles/app.js b/static/js/bundles/app.js index c6ab92ec7f..a5acd1665d 100644 --- a/static/js/bundles/app.js +++ b/static/js/bundles/app.js @@ -6,7 +6,6 @@ import "../../third/bootstrap-typeahead/typeahead.js"; import "../../third/jquery-filedrop/jquery.filedrop.js"; import "jquery-caret-plugin/src/jquery.caret.js"; import "../../third/jquery-idle/jquery.idle.js"; -import "jquery-autosize"; import "spectrum-colorpicker"; import "../../third/sockjs/sockjs-0.3.4.js"; import "../../third/marked/lib/marked.js"; diff --git a/static/js/compose_actions.js b/static/js/compose_actions.js index 7cc605ddc7..ecdfab9474 100644 --- a/static/js/compose_actions.js +++ b/static/js/compose_actions.js @@ -1,3 +1,5 @@ +var autosize = require('autosize'); + var compose_actions = (function () { var exports = {}; @@ -105,7 +107,7 @@ function clear_box() { } exports.autosize_message_content = function () { - $("#compose-textarea").autosize({ + autosize($("#compose-textarea"), { callback: function () { compose_actions.maybe_scroll_up_selected_message(); }, @@ -417,7 +419,7 @@ exports.quote_and_reply = function (opts) { function replace_content(raw_content) { 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) { diff --git a/static/js/compose_ui.js b/static/js/compose_ui.js index 95e10f59d9..9f69d1201f 100644 --- a/static/js/compose_ui.js +++ b/static/js/compose_ui.js @@ -1,9 +1,11 @@ +var autosize = require('autosize'); + var compose_ui = (function () { var exports = {}; exports.autosize_textarea = function () { - $("#compose-textarea").trigger("autosize.resize"); + autosize.update($("#compose-textarea")); }; 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 // 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) { diff --git a/static/js/composebox_typeahead.js b/static/js/composebox_typeahead.js index cfaf59a14a..7a44cf9ee4 100644 --- a/static/js/composebox_typeahead.js +++ b/static/js/composebox_typeahead.js @@ -1,3 +1,5 @@ +var autosize = require('autosize'); + var composebox_typeahead = (function () { //************************************ @@ -189,7 +191,7 @@ exports.handle_enter = function (textarea, e) { // Now add the newline, remembering to resize the // textarea if needed. textarea.caret("\n"); - textarea.trigger("autosize.resize"); + autosize.update(textarea); e.preventDefault(); return; } diff --git a/static/js/invite.js b/static/js/invite.js index edb9b4a5e4..b1c6a8e8d0 100644 --- a/static/js/invite.js +++ b/static/js/invite.js @@ -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_settings_dev_env_email_access = require('../templates/settings/dev_env_email_access.hbs'); +var autosize = require('autosize'); + var invite = (function () { var exports = {}; @@ -144,7 +146,7 @@ function prepare_form_to_be_shown() { exports.launch = function () { $('#submit-invitation').button(); prepare_form_to_be_shown(); - $("#invitee_emails").focus().autosize(); + autosize($("#invitee_emails").focus()); overlays.open_overlay({ name: 'invite', diff --git a/static/js/message_list.js b/static/js/message_list.js index 8804b80477..cd723c8878 100644 --- a/static/js/message_list.js +++ b/static/js/message_list.js @@ -1,3 +1,5 @@ +var autosize = require('autosize'); + var message_list = (function () { var exports = {}; @@ -311,7 +313,7 @@ exports.MessageList.prototype = { row.find(".message_edit_form").empty().append(edit_obj.form); row.find(".message_content, .status-message, .message_controls").hide(); 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) { diff --git a/static/js/resize.js b/static/js/resize.js index 9118018e95..c527a4c1e4 100644 --- a/static/js/resize.js +++ b/static/js/resize.js @@ -1,3 +1,5 @@ +var autosize = require('autosize'); + var resize = (function () { var exports = {}; @@ -185,7 +187,7 @@ exports.watch_manual_resize = function (element) { }(function (height) { // This callback disables autosize on the textarea. It // will be re-enabled when this component is next opened. - $(element).trigger("autosize.destroy") + autosize.destroy($(element)) .height(height + "px"); })); }; diff --git a/version.py b/version.py index 0f318737e4..62a624eb2f 100644 --- a/version.py +++ b/version.py @@ -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 # removing a dependency requires a major version bump. -PROVISION_VERSION = '38.1' +PROVISION_VERSION = '39.0' diff --git a/yarn.lock b/yarn.lock index 517c98a16c..5012aae489 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1049,6 +1049,11 @@ autoprefixer@^9.5.1: postcss "^7.0.16" 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: version "0.7.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" @@ -5807,11 +5812,6 @@ istanbul-reports@^2.2.4: dependencies: 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: version "1.5.2" resolved "https://registry.yarnpkg.com/jquery-caret-plugin/-/jquery-caret-plugin-1.5.2.tgz#8980e266f2af3cc4976735040fdbb4ed1b3d141c"