-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compose: Make a toggler for full screen size compose box.
This commit makes a working toggler in compose_actions that changes the max height and max height accordingly making the compose box full size. The compose_height.js maintains the state of the height of the compose box and according to it, the toggler updates the height. Also, when the compose box is closed, the compose box is reset to it's default behaviour and height as expected. So, everytime user need not toggle for every message. Fixes #17660
- Loading branch information
Showing
4 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Making this similar to compose_state.js | ||
|
||
import $ from "jquery"; | ||
|
||
import * as compose_ui from "./compose_ui"; | ||
|
||
const compose_textarea = $("#compose-textarea"); | ||
let is_full_size = false; // true or false | ||
|
||
function get_expected_full_height() { | ||
// This returns the full size of the compose box | ||
// Panels can have different height and this calculates it accordignly | ||
return window.innerHeight - 138 - Number.parseInt($("#panels").css("height"), 10); | ||
} | ||
|
||
// Some functions to handle the state explicitely | ||
export function set_is_full_size(is_full) { | ||
is_full_size = is_full; | ||
} | ||
|
||
export function get_is_full_size() { | ||
return is_full_size; | ||
} | ||
|
||
export function make_compose_box_full_size() { | ||
set_is_full_size(true); | ||
|
||
compose_textarea.css("max-height", get_expected_full_height()); | ||
compose_textarea.css("height", get_expected_full_height()); | ||
$("#floating_recipient_bar").css("z-index", -1); | ||
|
||
$("#collapse_composebox_button").show(); | ||
$("#expand_composebox_button").hide(); | ||
} | ||
|
||
export function make_compose_box_original_size() { | ||
set_is_full_size(false); | ||
|
||
compose_textarea.css("max-height", "calc(50vh - 50px)"); | ||
$("#floating_recipient_bar").css("z-index", 98); | ||
|
||
$("#collapse_composebox_button").hide(); | ||
$("#expand_composebox_button").show(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters