Add help text below the input box when a user starts typing

Этот коммит содержится в:
rodrigo
2016-03-06 17:36:15 -03:00
родитель 81ccfca2bf
Коммит d3e914f76a
4 изменённых файлов: 80 добавлений и 7 удалений

Просмотреть файл

@@ -129,12 +129,12 @@ export default class Textbox extends React.Component {
} }
render() { render() {
const hastext = this.props.messageText.length > 0;
let previewLink = null; let previewLink = null;
if (Utils.isFeatureEnabled(PreReleaseFeatures.MARKDOWN_PREVIEW)) { if (Utils.isFeatureEnabled(PreReleaseFeatures.MARKDOWN_PREVIEW)) {
const previewLinkVisible = this.props.messageText.length > 0;
previewLink = ( previewLink = (
<a <a
style={{visibility: previewLinkVisible ? 'visible' : 'hidden'}}
onClick={this.showPreview} onClick={this.showPreview}
className='textbox-preview-link' className='textbox-preview-link'
> >
@@ -153,6 +153,51 @@ export default class Textbox extends React.Component {
); );
} }
let helptext = (
<div
style={{visibility: hastext ? 'visible' : 'hidden', opacity: hastext ? '1' : '0'}}
className='help_format_text'
>
<b>
<FormattedMessage
id='textbox.bold'
defaultMessage='**bold**'
/>
</b>
<i>
<FormattedMessage
id='textbox.italic'
defaultMessage='_italic_'
/>
</i>
<span>~~<strike>
<FormattedMessage
id='textbox.strike'
defaultMessage='strike'
/>
</strike>~~ </span>
<code>
<FormattedMessage
id='textbox.inlinecode'
defaultMessage='`inline code`'
/>
</code>
<code>
<FormattedMessage
id='textbox.preformatted'
defaultMessage='```preformatted```'
/>
</code>
<span>
<FormattedMessage
id='textbox.quote'
defaultMessage='>quote'
/>
</span>
{previewLink}
</div>
);
return ( return (
<div <div
ref='wrapper' ref='wrapper'
@@ -184,7 +229,7 @@ export default class Textbox extends React.Component {
dangerouslySetInnerHTML={{__html: this.state.preview ? TextFormatting.formatText(this.props.messageText) : ''}} dangerouslySetInnerHTML={{__html: this.state.preview ? TextFormatting.formatText(this.props.messageText) : ''}}
> >
</div> </div>
{previewLink} {helptext}
<a <a
target='_blank' target='_blank'
href='http://docs.mattermost.com/help/getting-started/messaging-basics.html' href='http://docs.mattermost.com/help/getting-started/messaging-basics.html'

Просмотреть файл

@@ -58,22 +58,38 @@ body.ios {
box-shadow: none; box-shadow: none;
white-space: normal; white-space: normal;
} }
.textbox-preview-link, .textbox-help-link { .textbox-help-link {
position: absolute; position: absolute;
z-index: 3; z-index: 3;
bottom: -23px; bottom: -23px;
font-size: 13px; font-size: 13px;
cursor: pointer; cursor: pointer;
} }
.textbox-preview-link {
right: 45px;
}
.textbox-help-link { .textbox-help-link {
right: 0; right: 0;
} }
min-height:36px; min-height:36px;
} }
.help_format_text {
position: absolute;
z-index: 3;
bottom: -23px;
font-size: 0.7em;
right: 45px;
color: #999;
transition: visibility 0s, opacity 0.5s linear;
b, i, code {
margin-right: 3px;
}
.textbox-preview-link{
font-size: 13px;
cursor: pointer;
margin-left: 15px;
}
}
.date-separator, .new-separator { .date-separator, .new-separator {
text-align: center; text-align: center;
height: 2em; height: 2em;

Просмотреть файл

@@ -1054,9 +1054,15 @@
"team_signup_welcome.validEmailError": "Please enter a valid email address", "team_signup_welcome.validEmailError": "Please enter a valid email address",
"team_signup_welcome.welcome": "Welcome to:", "team_signup_welcome.welcome": "Welcome to:",
"team_signup_welcome.yes": "Yes, this address is correct", "team_signup_welcome.yes": "Yes, this address is correct",
"textbox.bold": "**bold**",
"textbox.edit": "Edit message", "textbox.edit": "Edit message",
"textbox.help": "Help", "textbox.help": "Help",
"textbox.inlinecode": "`inline code`",
"textbox.italic": "_italic_",
"textbox.preformatted": "```preformatted```",
"textbox.preview": "Preview", "textbox.preview": "Preview",
"textbox.quote": ">quote",
"textbox.strike": "strike",
"tutorial_intro.allSet": "Youre all set", "tutorial_intro.allSet": "Youre all set",
"tutorial_intro.end": "Click “Next” to enter Town Square. This is the first channel teammates see when they sign up. Use it for posting updates everyone needs to know.", "tutorial_intro.end": "Click “Next” to enter Town Square. This is the first channel teammates see when they sign up. Use it for posting updates everyone needs to know.",
"tutorial_intro.invite": "Invite teammates", "tutorial_intro.invite": "Invite teammates",

Просмотреть файл

@@ -1049,9 +1049,15 @@
"team_signup_welcome.validEmailError": "Por favor entre um endereço de e-mail válido", "team_signup_welcome.validEmailError": "Por favor entre um endereço de e-mail válido",
"team_signup_welcome.welcome": "Bem-vindo:", "team_signup_welcome.welcome": "Bem-vindo:",
"team_signup_welcome.yes": "Sim, este endereço de email está correto", "team_signup_welcome.yes": "Sim, este endereço de email está correto",
"textbox.bold": "**negrito**",
"textbox.edit": "Editar mensagem", "textbox.edit": "Editar mensagem",
"textbox.help": "Ajuda", "textbox.help": "Ajuda",
"textbox.inlinecode": "`código`",
"textbox.italic": "_itálico_",
"textbox.preformatted": "```pre-formatado```",
"textbox.preview": "Pré-visualização", "textbox.preview": "Pré-visualização",
"textbox.quote": ">citado",
"textbox.strike": "tachado",
"tutorial_intro.allSet": "Está tudo pronto", "tutorial_intro.allSet": "Está tudo pronto",
"tutorial_intro.end": "Clique em “Próximo” para entrar Town Square. Este é o primeiro canal que sua equipe de trabalho vê quando eles se inscrevem. Use para postar atualizações que todos precisam saber.", "tutorial_intro.end": "Clique em “Próximo” para entrar Town Square. Este é o primeiro canal que sua equipe de trabalho vê quando eles se inscrevem. Use para postar atualizações que todos precisam saber.",
"tutorial_intro.invite": "Convidar pessoas para equipe", "tutorial_intro.invite": "Convidar pessoas para equipe",