Преглед на файлове

Don't unnecessarily set height on textarea

JC Brand преди 6 години
родител
ревизия
79990f7e01
променени са 3 файла, в които са добавени 12 реда и са изтрити 4 реда
  1. 1 0
      CHANGES.md
  2. 6 2
      dist/converse.js
  3. 5 2
      src/converse-chatview.js

+ 1 - 0
CHANGES.md

@@ -5,6 +5,7 @@
 - Bugfix: MUC commands were being ignored
 - Bugfix: Multiple rooms shown active in the rooms list
 - Bugfix: Don't open chats when receiving messages without a `body`
+- Bugfix: Typing in the textarea can become very slow in large MUCs
 - UI: Always show the OMEMO lock icon (grayed out if not available).
 - Use `publish-options` with `pubsub#access_model` set to `open` when publishing OMEMO public keys and devices
 - Add a new `converse-pubsub` plugin, for generic PubSub operations

+ 6 - 2
dist/converse.js

@@ -50420,9 +50420,13 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
       },
 
       inputChanged(ev) {
-        ev.target.style.height = 'auto'; // Fixes weirdness
+        const new_height = ev.target.scrollHeight + 'px';
 
-        ev.target.style.height = ev.target.scrollHeight + 'px';
+        if (ev.target.style.height !== new_height) {
+          ev.target.style.height = 'auto'; // Fixes weirdness
+
+          ev.target.style.height = new_height;
+        }
       },
 
       clearMessages(ev) {

+ 5 - 2
src/converse-chatview.js

@@ -1008,8 +1008,11 @@ converse.plugins.add('converse-chatview', {
             },
 
             inputChanged (ev) {
-                ev.target.style.height = 'auto'; // Fixes weirdness
-                ev.target.style.height = (ev.target.scrollHeight) + 'px';
+                const new_height = ev.target.scrollHeight + 'px';
+                if (ev.target.style.height !== new_height) {
+                    ev.target.style.height = 'auto'; // Fixes weirdness
+                    ev.target.style.height = new_height;
+                }
             },
 
             clearMessages (ev) {