Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

compose_box: Handle compose and preview expansion.

Karl Stolleya3c13999243d
diff --git a/web/styles/compose.css b/web/styles/compose.css
index a69dddf3559..a22e11fd468 100644
--- a/web/styles/compose.css
+++ b/web/styles/compose.css
@@ -237,7 +237,7 @@
4px outside padding.
TODO: get this value into a CSS variable. */
- grid-template: auto 32px / minmax(0, 1fr) 112px;
+ grid-template: minmax(0, 1fr) 32px / minmax(0, 1fr) 112px;
grid-template-areas:
"compose-textarea message-send-controls-container"
"message-formatting-controls-container . ";
@@ -249,8 +249,20 @@
}
}
-#compose-textarea {
+#compose-textarea,
+#preview-message-area-container {
grid-area: compose-textarea;
+ /* When the compose box is full screen, this
+ auto height will kick in and make sure that
+ the textarea opens to fill its whole grid
+ area. */
+ height: auto;
+}
+
+#preview-message-area-container {
+ /* Keep preview container invisible outside
+ of preview mode. */
+ display: none;
}
#message-send-controls-container {
@@ -1141,17 +1153,35 @@ textarea.new_message_textarea,
}
#compose-textarea,
+ #preview_message_area {
+ /* When in full screen, override any height-
+ related properties set on the textarea itself,
+ e.g., from manually resizing the textarea. */
+ max-height: none !important;
+ height: auto !important;
+ }
+
#preview_message_area {
/* Setting height to 0 is necessary to make the flex+Simplebar
combination work correctly, without pushing the compose
controls offscreen when previewing a very tall message. */
- max-height: none !important;
height: 0;
flex: 1;
}
}
.preview_mode {
+ #preview-message-area-container {
+ /* When in preview mode, we display the
+ preview container as a columnar flexbox.
+ This containing element is necessary
+ because Simplebar on its own will cause
+ a grid blowout despite a minmax(0, 1fr)
+ row definition. */
+ display: flex;
+ flex-flow: column;
+ }
+
.preview_mode_disabled {
cursor: not-allowed;
opacity: 0.3;
diff --git a/web/templates/compose.hbs b/web/templates/compose.hbs
index 43dcab79bdc..899ed15d86e 100644
--- a/web/templates/compose.hbs
+++ b/web/templates/compose.hbs
@@ -76,9 +76,11 @@
<div class="messagebox-wrapper">
<div class="messagebox">
<textarea class="new_message_textarea" name="content" id='compose-textarea' placeholder="{{t 'Compose your message here' }}" tabindex="0" aria-label="{{t 'Compose your message here...' }}"></textarea>
- <div class="scrolling_list preview_message_area" data-simplebar id="preview_message_area" style="display:none;">
- <div class="markdown_preview_spinner"></div>
- <div class="preview_content rendered_markdown"></div>
+ <div id="preview-message-area-container">
+ <div class="scrolling_list preview_message_area" data-simplebar id="preview_message_area" style="display:none;">
+ <div class="markdown_preview_spinner"></div>
+ <div class="preview_content rendered_markdown"></div>
+ </div>
</div>
<div class="drag"></div>