From 4d37aad6782cf938594078342502cc30c1d6a9bf Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Wed, 13 Sep 2023 18:05:43 -0400 Subject: [PATCH] MM-53524/MM-53525 Clean up post textbox measurement (#23973) * Don't always render post textbox preview in background * Remove most usage of custom-textarea--emoji-picker This class is only needed by the pre-AdvancedTextEditor usage of the Textbox. It otherwise conflicted with the code that controls the AdvancedTextEditor's right padding * Change right padding for post textbox to use CSS class * Remove AutosizeTextarea.recalculatePadding This was only needed because we started setting the padding of the textarea programatically at some point. Originally, we could rely on the reference textarea having the same styling because it had the same CSS class as the actual textarea. * Change reference textarea to a div Using an actual textarea to measure the size of the text doesn't allow us to measure the width of the text because textareas don't stretch to fit text. Using a div with the same styling as the textarea works though * Remove redundant measuring div from AutosizeTextarea * Update snapshots for AutosizeTextarea * Fix padding being counted twice when measuring width * Change AutosizeTextarea to use a ResizeObserver to be more responsive * Fix right padding on post preview * Disable transitions when AutosizeTextarea first measures * Fix measurement of trailing newlines * Revert "Disable transitions when AutosizeTextarea first measures" This reverts commit a036fdbfd64e49af9a2eaa3d3e06a5af453b1a5c. * Revert "Change AutosizeTextarea to use a ResizeObserver to be more responsive" This reverts commit c8fa4a19bde087a0fe80e3639aed2f3ae2eae04a. --------- Co-authored-by: Mattermost Build --- .../autosize_textarea.test.tsx.snap | 13 +-- .../__snapshots__/textbox.test.tsx.snap | 91 +------------------ .../advanced_text_editor.scss | 18 +++- .../advanced_text_editor.tsx | 24 +---- .../src/components/autosize_textarea.tsx | 51 ++++------- .../src/components/textbox/textbox.tsx | 41 ++++----- .../channels/src/sass/components/_post.scss | 28 +----- .../channels/src/sass/responsive/_mobile.scss | 7 -- 8 files changed, 63 insertions(+), 210 deletions(-) diff --git a/webapp/channels/src/components/__snapshots__/autosize_textarea.test.tsx.snap b/webapp/channels/src/components/__snapshots__/autosize_textarea.test.tsx.snap index 3bda56384f..5b4e3eae43 100644 --- a/webapp/channels/src/components/__snapshots__/autosize_textarea.test.tsx.snap +++ b/webapp/channels/src/components/__snapshots__/autosize_textarea.test.tsx.snap @@ -35,24 +35,15 @@ exports[`components/AutosizeTextarea should match snapshot, init 1`] = ` } } > -