A platform for community discussion. Free, open, simple.
DEV: move composer into grid (#40608)
chapoi4c4ff6e55eb3
diff --git a/app/assets/stylesheets/common/upcoming-changes/_index.scss b/app/assets/stylesheets/common/upcoming-changes/_index.scssindex 460bcae0d1d..8c8ed59ce84 100644--- a/app/assets/stylesheets/common/upcoming-changes/_index.scss+++ b/app/assets/stylesheets/common/upcoming-changes/_index.scss@@ -1,2 +1,3 @@@import "uc-enable-composer-redesign";+@import "uc-enable-main-outlet-grid-layout-change";@import "uc-modernize-foundation-theme";diff --git a/app/assets/stylesheets/common/upcoming-changes/uc-enable-main-outlet-grid-layout-change.scss b/app/assets/stylesheets/common/upcoming-changes/uc-enable-main-outlet-grid-layout-change.scssnew file mode 100644index 00000000000..e258274ab33--- /dev/null+++ b/app/assets/stylesheets/common/upcoming-changes/uc-enable-main-outlet-grid-layout-change.scss@@ -0,0 +1,9 @@+@use "lib/viewport";++:where(.uc-enable-main-outlet-grid-layout-change) {+ --d-sidebar-width: 15em;++ @include viewport.until(lg) {+ --d-sidebar-width: 13em;+ }+}diff --git a/config/locales/server.en.yml b/config/locales/server.en.ymlindex 47accc2754f..3e012ee6cf4 100644--- a/config/locales/server.en.yml+++ b/config/locales/server.en.yml@@ -3155,6 +3155,7 @@ en:enable_auto_grid_images: "Automatically wraps images in [grid] tags when 3 or more images are uploaded in the composer."enable_new_checkbox_style: "Enable the redesigned checkbox style for FormKit checkboxes."enable_composer_redesign: "Enable the redesigned composer."+ enable_main_outlet_grid_layout_change: "Place the composer inside the main layout grid so themes can position it in a grid column, and use a narrower sidebar."enable_composer_toolbar_customization: "Let members choose which buttons appear in their composer toolbar, from their interface preferences."prioritize_recently_used_tags: "When adding tags while creating or editing a topic, show the tags the member has recently used on their own topics at the top of the list, before the most popular tags of the forum."experimental_impersonation_time_limit_minutes: "How long before an impersonation session is automatically ended."diff --git a/config/site_settings.yml b/config/site_settings.ymlindex cb3d2350ba3..ed28f94ac06 100644--- a/config/site_settings.yml+++ b/config/site_settings.yml@@ -4836,6 +4836,16 @@ experimental:impact: "other,all_members"body_class: truelearn_more_url: "https://meta.discourse.org/t/-/407849"+ enable_main_outlet_grid_layout_change:+ default: false+ client: true+ hidden: true+ area: "experimental"+ upcoming_change:+ status: "alpha"+ impact: "other,all_members"+ body_class: true+ learn_more_url: "https://meta.discourse.org/t/-/414357"enable_composer_toolbar_customization:default: falseclient: truediff --git a/frontend/discourse/app/templates/application.gjs b/frontend/discourse/app/templates/application.gjsindex 9cad42476ac..ae0d8686de7 100644--- a/frontend/discourse/app/templates/application.gjs+++ b/frontend/discourse/app/templates/application.gjs@@ -142,6 +142,15 @@ export default <template>{{#if @controller.showPoweredBy}}<PoweredByDiscourse />{{/if}}++ {{! Composer lives inside the grid so themes can place it in a grid+ column (e.g. Horizon peek mode). It is position:fixed in its default+ state, so its DOM location here does not affect normal positioning —+ however this relies on #main-outlet-wrapper never establishing a containing+ block (no transform/filter/contain/will-change/perspective). }}+ {{#if @controller.siteSettings.enable_main_outlet_grid_layout_change}}+ <ComposerContainer />+ {{/if}}</div><PluginOutlet@@ -165,7 +174,9 @@ export default <template><ModalContainer /><DesignWizardPanel /><DialogHolder />- <ComposerContainer />+ {{#unless @controller.siteSettings.enable_main_outlet_grid_layout_change}}+ <ComposerContainer />+ {{/unless}}<RenderGlimmerContainer />{{#if @controller.showFooterNav}}diff --git a/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-composer-test.js b/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-composer-test.jsindex be8eaf1ddd1..40c5e379757 100644--- a/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-composer-test.js+++ b/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-composer-test.js@@ -170,7 +170,7 @@ acceptance("composer", function (needs) {assert.dom("input.format-input").hasValue("LTS");// Insert the date- await click(".btn-primary");+ await click(".discourse-local-dates-create-modal .btn-primary");// Verify the format is preserved in the output (not changed to LL)assertdiff --git a/themes/horizon/scss/composer-peek-mode.scss b/themes/horizon/scss/composer-peek-mode.scssindex c98830d253d..d3e0d4f0e6a 100644--- a/themes/horizon/scss/composer-peek-mode.scss+++ b/themes/horizon/scss/composer-peek-mode.scss@@ -30,40 +30,74 @@}}- #reply-control:not(.fullscreen).hide-preview {- width: 100%;- right: var(--main-grid-gap);- top: var(--header-offset);- bottom: var(--main-grid-gap);- left: unset;- max-width: 36.5vw;+ .sidebar-wrapper .sidebar-container {+ height: unset;}- &.has-sidebar-page {- #main-outlet-wrapper {- grid-template-columns:- var(--d-sidebar-width) calc(100vw - 38vw - var(--d-sidebar-width))- 1fr;+ &:not(:where(.uc-enable-main-outlet-grid-layout-change)) {+ #reply-control:not(.fullscreen).hide-preview {+ width: 100%;+ right: var(--main-grid-gap);+ top: var(--header-offset);+ bottom: var(--main-grid-gap);+ left: unset;+ max-width: 36.5vw;}- }- &:not(.has-sidebar-page) {- #main-outlet-wrapper {- grid-template-columns: 0 calc(100vw - 52vw) 1fr;+ &.has-sidebar-page {+ #main-outlet-wrapper {+ grid-template-columns:+ var(--d-sidebar-width)+ calc(100vw - 38vw - var(--d-sidebar-width))+ 1fr;+ }}- #reply-control:not(.fullscreen).hide-preview {- max-width: 46vw;+ &:not(.has-sidebar-page) {+ #main-outlet-wrapper {+ grid-template-columns: 0 calc(100vw - 52vw) 1fr;+ }++ #reply-control:not(.fullscreen).hide-preview {+ max-width: 46vw;+ }}- }- .sidebar-wrapper .sidebar-container {- height: unset;+ &:not(.keyboard-visible) {+ #reply-control:not(.fullscreen).hide-preview {+ height: unset;+ }+ }}- &:not(.keyboard-visible) {+ &:where(.uc-enable-main-outlet-grid-layout-change) {+ --composer-peek-min-width: 30em;+#reply-control:not(.fullscreen).hide-preview {- height: unset;+ position: sticky;+ grid-column: 3;+ grid-row: 1;+ align-self: start;+ top: var(--header-offset);+ height: calc(100dvh - var(--header-offset) - var(--main-grid-gap));+ width: auto;+ min-width: 0;+ max-width: none;+ margin: 0;+ }++ &.has-sidebar-page #main-outlet-wrapper {+ grid-template-columns:+ var(--d-sidebar-width)+ minmax(0, 1fr)+ minmax(var(--composer-peek-min-width), 1fr);+ }++ &:not(.has-sidebar-page) #main-outlet-wrapper {+ grid-template-columns:+ 0+ minmax(0, 1fr)+ minmax(var(--composer-peek-min-width), 1fr);}}}