mediawiki-extensions-Discus.../modules/dt.ui.ReplyWidget.less
Bartosz Dziewoński ca8781a3a0 Add a link to preferences within the Reply and New Discussion Tools
Bug: T291002
Change-Id: Id99f77d3a181aedd23305b7afa61a0a3fb6dabb7
2021-09-27 21:52:07 +00:00

270 lines
5.8 KiB
Plaintext

.ext-discussiontools-ui-replyWidget {
margin-bottom: 1em;
position: relative;
clear: both;
}
// @supports does not work when nested
@supports ( display: flow-root ) {
.ext-discussiontools-ui-replyWidget {
// Allow the widget to be squished next to floating elements (T278476).
//
// To ensure that everything is squished to the same width, introduce a block formatting context
// (otherwise the preview or textarea could be wider than the container and mess up the layout).
// https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
//
// All of the usual ways to do this (listed on that page) have unwanted side-effects
// (in particular, `overflow: hidden` cuts off VE inspectors), so we must use this relatively
// recent property, and only apply this fix on supporting browsers, notably excluding IE 11
// (https://caniuse.com/?search=flow-root)
display: flow-root;
min-width: 250px;
clear: none;
}
}
.ext-discussiontools-ui-replyWidget { /* stylelint-disable-line no-duplicate-selectors */
> .oo-ui-textInputWidget {
max-width: none;
.oo-ui-inputWidget-input {
line-height: 1.5em;
overflow-y: hidden;
}
}
.ve-ui-targetToolbar > .oo-ui-toolbar-bar {
background: none;
box-shadow: none;
border: 0;
> .oo-ui-toolbar-actions {
display: none;
}
}
.oo-ui-toolbar-position-top .ve-ui-toolbarDialog-position-above {
border-top: 0;
.oo-ui-window-body {
padding-left: 0;
padding-right: 0;
}
}
.ve-ui-targetToolbar {
display: flex;
// Allow wrapping when the space is very narrow (mode switcher above toolbar)
flex-wrap: wrap-reverse;
> .oo-ui-windowManager {
flex-basis: 100%;
box-shadow: 0 -1px 1px 0 rgba( 0, 0, 0, 0.1 );
}
}
&-modeTabs {
box-shadow: none;
height: 3em;
text-align: right;
// Stretch to all available space
flex-grow: 1;
// Hide outline that can appear after switching modes via keyboard
outline: 0;
.oo-ui-tabOptionWidget:last-child {
margin-right: 2px;
}
// When mode tabs are focussed, the only available option uses the same styles as normal focus
.ext-discussiontools-ui-modeTab.oo-ui-optionWidget-highlighted {
color: #36c;
border-radius: 2px;
box-shadow: inset 0 0 0 2px #36c;
}
// The unavailable option in mode tabs is disabled, to make it un-interactable, but we want it
// to look as if it was selected
.ext-discussiontools-ui-modeTab.oo-ui-widget-disabled {
color: #36c;
box-shadow: inset 0 -2px 0 0 #36c;
}
}
&-actionsWrapper {
margin-top: 0.5em;
display: flex;
// Allow wrapping when the space is very narrow (buttons above the footer text)
flex-wrap: wrap-reverse;
// When wrapping, align actions to the right
justify-content: flex-end;
}
&-actions {
// Add spacing before the footer when wrapping
margin-bottom: 0.5em;
margin-left: 3em;
white-space: nowrap;
}
&-footer {
// Preferred width; if there isn't enough space, this wraps under the actions
flex-basis: 20em;
// Stretch to all available space
flex-grow: 1;
font-size: 0.75em;
color: #54595d;
> * {
&:first-child {
margin-top: 0;
}
&:last-child {
margin-bottom: 0;
}
}
&-links {
// Extra specificity to override rules from MediaWiki
.mw-content-ltr &,
.mw-content-rtl & {
margin: 0;
padding: 0;
}
li {
display: inline;
&:after {
content: ' • ';
}
&:last-child:after {
content: '';
}
}
}
}
&-preview {
background: #f6f6f6;
padding: 0.5em 1em;
&:empty {
height: 0;
padding: 0;
overflow: hidden;
}
&:before {
content: attr( data-label );
color: #808080;
}
.ext-discussiontools-ui-replyWidget:not( .ext-discussiontools-ui-replyWidget-newTopic ) & > .mw-parser-output {
margin-left: -1.6em;
}
> .mw-parser-output > h2:first-child {
// Remove excess spacing above section title for preview
padding-top: 0;
margin-top: 0.25em;
}
}
&-anonWarning,
&-advanced {
&.oo-ui-messageWidget-block {
padding: 8px 12px;
}
}
&-captcha {
margin-top: 0.5em;
}
&-error {
margin-bottom: 0.5em;
}
&-anonWarning {
margin-bottom: 0.5em;
display: flex;
align-items: center;
// Allow wrapping when the space is very narrow (buttons below the warning text)
flex-wrap: wrap;
// When wrapping, align actions to the right
justify-content: flex-end;
&.oo-ui-messageWidget-block {
> .oo-ui-iconElement-icon {
background-position: center center;
transform: scale( 1.5 );
transform-origin: 0 center;
left: 1em;
}
}
> .oo-ui-labelElement-label {
flex-grow: 1;
flex-basis: 20em;
margin-left: 3em;
}
.ext-discussiontools-ui-replyWidget-actions {
// Fix alignment within message widget
margin-top: 0.5em;
}
}
&-editSummaryField {
// We want to display the "Summary" label and the checkboxes on the same line (above the summary
// field), but prevent them from overlapping if there's not enough space. The checkboxes are
// after the summary field in the DOM for accessibility reasons, but we want to display them
// above it, and we can't achieve this with floats.
.oo-ui-fieldLayout-body {
display: flex;
flex-flow: row-reverse wrap;
justify-content: space-between;
}
.ext-discussiontools-ui-replyWidget-checkboxes {
order: 1;
}
.oo-ui-fieldLayout-header {
order: 2;
// Stretch to all available space on the line
flex-grow: 1;
}
.oo-ui-fieldLayout-field {
order: 3;
// Force to a separate line
width: 100%;
}
}
&-editSummary {
max-width: none;
}
&-advanced.oo-ui-element-hidden + .ext-discussiontools-ui-replyWidget-anonWarning {
// Removing spacing between message widgets when the first is hidden
margin-top: 0;
}
&-advancedToggle {
font-size: 0.75em;
.oo-ui-indicatorElement-indicator {
min-width: auto;
}
.oo-ui-buttonElement-button {
min-height: auto;
}
}
}