Merge "Allow reply widget header and footer to wrap when it's narrow"

This commit is contained in:
jenkins-bot 2020-08-10 22:27:51 +00:00 committed by Gerrit Code Review
commit b681eec8e4
3 changed files with 26 additions and 10 deletions

View file

@ -70,7 +70,7 @@ CommentTarget.static.importRules.external.blacklist = ve.extendObject(
);
CommentTarget.prototype.attachToolbar = function () {
this.$element.parent().parent().prepend( this.getToolbar().$element );
this.$element.parent().parent().children().first().prepend( this.getToolbar().$element );
};
CommentTarget.prototype.getSurfaceConfig = function ( config ) {

View file

@ -78,6 +78,12 @@ function ReplyWidget( commentController, comment, pageName, oldId, config ) {
// Initialize to avoid flicker when switching mode
this.modeTabSelect.selectItemByData( this.getMode() );
this.$headerWrapper = $( '<div>' ).addClass( 'dt-ui-replyWidget-headerWrapper' );
this.$headerWrapper.append(
// (visual mode toolbar magically appears here)
this.modeTabSelect.$element
);
this.$preview = $( '<div>' )
.addClass( 'dt-ui-replyWidget-preview' )
.attr( 'data-label', mw.msg( 'discussiontools-replywidget-preview' ) )
@ -125,7 +131,7 @@ function ReplyWidget( commentController, comment, pageName, oldId, config ) {
// Initialization
this.$element.addClass( 'dt-ui-replyWidget' ).append(
this.modeTabSelect.$element,
this.$headerWrapper,
this.replyBodyWidget.$element,
this.$preview,
this.$actionsWrapper

View file

@ -30,34 +30,44 @@
}
}
&-headerWrapper {
display: flex;
// Allow wrapping when the space is very narrow (mode switcher above toolbar)
flex-wrap: wrap-reverse;
}
&-modeTabs {
box-shadow: none;
height: 3em;
text-align: right;
// Stretch to all available space
flex-grow: 1;
.oo-ui-tabOptionWidget:last-child {
margin-right: 2px;
}
}
&-ve .dt-ui-replyWidget-modeTabs {
position: absolute;
z-index: 2;
top: 0;
right: 0;
}
&-actionsWrapper {
display: flex;
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;