Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Commit

Permalink
fix(FormattingToolbar): use label as popup content - I270
Browse files Browse the repository at this point in the history
Signed-off-by: irmerk <[email protected]>
  • Loading branch information
jolanglinais committed Mar 9, 2020
1 parent eb55ae3 commit 4a4aba4
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions src/FormattingToolbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ export default class FormatToolbar extends React.Component {
/**
* Render a mark-toggling toolbar button.
*/
renderMarkButton(type, icon, hi, wi, pa, vBox, classInput) {
renderMarkButton(type, label, icon, hi, wi, pa, vBox, classInput) {
const { editor, editorProps } = this.props;

const isActive = action.hasMark(editor, type);
Expand All @@ -292,7 +292,7 @@ export default class FormatToolbar extends React.Component {

return (
<Popup
content={tips.capitalizeWord(type)}
content={label}
style={style}
position='bottom center'
trigger={
Expand Down Expand Up @@ -375,17 +375,17 @@ export default class FormatToolbar extends React.Component {
const selectedInlineHref = document.getClosestInline(selection.anchor.path);
const selectedText = this.props.editor.value.document
.getFragmentAtRange(this.props.editor.value.selection).text;
return (
return (
<Ref
innerRef={node => {
innerRef={(node) => {
this.setLinkFormPopup = node;
}}
>
<Popup
context={this.linkButtonRef}
content={
<Ref
innerRef={node => {
innerRef={(node) => {
this.setLinkForm = node;
}}
>
Expand All @@ -406,28 +406,28 @@ export default class FormatToolbar extends React.Component {
<label>Link URL</label>
<Input
ref={this.hyperlinkInputRef}
placeholder={"http://example.com"}
placeholder={'http://example.com'}
defaultValue={
isLinkBool &&
action.isOnlyLink(this.props.editor) &&
selectedInlineHref
? selectedInlineHref.data.get("href")
: ""
isLinkBool
&& action.isOnlyLink(this.props.editor)
&& selectedInlineHref
? selectedInlineHref.data.get('href')
: ''
}
name="url"
/>
</Form.Field>
{isLinkBool &&
action.isOnlyLink(this.props.editor) &&
selectedInlineHref && (
{isLinkBool
&& action.isOnlyLink(this.props.editor)
&& selectedInlineHref && (
<PopupLinkWrapper>
<a href={selectedInlineHref.data.get("href")}
<a href={selectedInlineHref.data.get('href')}
target='_blank'
>
{selectedInlineHref.data.get("href")}
{selectedInlineHref.data.get('href')}
</a>
</PopupLinkWrapper>
)}
)}
<Form.Field>
<Button
secondary
Expand Down Expand Up @@ -516,7 +516,7 @@ export default class FormatToolbar extends React.Component {

return (
<Popup
content={tips.capitalizeWord(action)}
content={tips.capitalizeWord(action)}
style={style}
position='bottom center'
trigger={
Expand Down Expand Up @@ -576,6 +576,7 @@ export default class FormatToolbar extends React.Component {
{
this.renderMarkButton(
boldIcon.type(),
boldIcon.label(),
boldIcon.icon,
boldIcon.height(),
boldIcon.width(),
Expand All @@ -587,6 +588,7 @@ export default class FormatToolbar extends React.Component {
{
this.renderMarkButton(
italicIcon.type(),
italicIcon.label(),
italicIcon.icon,
italicIcon.height(),
italicIcon.width(),
Expand All @@ -598,6 +600,7 @@ export default class FormatToolbar extends React.Component {
{/* {
this.renderMarkButton(
underlineIcon.type(),
boldIcon.label(),
underlineIcon.icon,
underlineIcon.height(),
underlineIcon.width(),
Expand All @@ -610,6 +613,7 @@ export default class FormatToolbar extends React.Component {
{
this.renderMarkButton(
codeIcon.type(),
codeIcon.label(),
codeIcon.icon,
codeIcon.height(),
codeIcon.width(),
Expand Down Expand Up @@ -714,4 +718,4 @@ FormatToolbar.propTypes = {
TOOLTIP: PropTypes.string,
DIVIDER: PropTypes.string,
}),
};
};

0 comments on commit 4a4aba4

Please sign in to comment.