DEV: allow custom composer heights in CSS (#18094)

This commit is contained in:
Kris 2022-08-25 18:12:35 -04:00 committed by GitHub
parent 97f094e5ee
commit 9d9c48fcb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -1235,8 +1235,11 @@ export default Controller.extend({
this.model.set("reply", opts.topicBody); this.model.set("reply", opts.topicBody);
} }
// The two custom properties below can be overriden by themes/plugins to set different default composer heights.
const defaultComposerHeight = const defaultComposerHeight =
this.model.action === "reply" ? "300px" : "400px"; this.model.action === "reply"
? "var(--reply-composer-height, 300px)"
: "var(--new-topic-composer-height, 400px)";
this.set("model.composerHeight", defaultComposerHeight); this.set("model.composerHeight", defaultComposerHeight);
document.documentElement.style.setProperty( document.documentElement.style.setProperty(

View File

@ -65,7 +65,7 @@ acceptance("Composer", function (needs) {
assert.strictEqual( assert.strictEqual(
document.documentElement.style.getPropertyValue("--composer-height"), document.documentElement.style.getPropertyValue("--composer-height"),
"400px", "var(--new-topic-composer-height, 400px)",
"sets --composer-height to 400px when creating topic" "sets --composer-height to 400px when creating topic"
); );
@ -83,7 +83,7 @@ acceptance("Composer", function (needs) {
await click(".toggle-fullscreen"); await click(".toggle-fullscreen");
assert.strictEqual( assert.strictEqual(
document.documentElement.style.getPropertyValue("--composer-height"), document.documentElement.style.getPropertyValue("--composer-height"),
"400px", "var(--new-topic-composer-height, 400px)",
"sets --composer-height back to 400px when composer is opened from draft mode" "sets --composer-height back to 400px when composer is opened from draft mode"
); );