Fix tooltip deprecation warning

This commit is contained in:
David Wheatley 2021-05-17 14:43:35 +01:00
parent c9af88e721
commit f076329636

View File

@ -1,20 +1,29 @@
import Component from 'flarum/common/Component';
import icon from 'flarum/common/helpers/icon';
import Tooltip from 'flarum/common/components/Tooltip';
export default class MarkdownButton extends Component {
oncreate(vnode) {
super.oncreate(vnode);
this.$().tooltip();
}
view() {
return (
<button className="Button Button--icon Button--link" title={this.attrs.title} data-hotkey={this.attrs.hotkey}
onkeydown={this.keydown.bind(this)} onclick={this.attrs.onclick}>
const button = (
<button
className="Button Button--icon Button--link"
data-hotkey={this.attrs.hotkey}
onkeydown={this.keydown.bind(this)}
onclick={this.attrs.onclick}
>
{icon(this.attrs.icon)}
</button>
);
if (this.attrs.title) {
return <Tooltip text={this.attrs.title}>{button}</Tooltip>;
}
return button;
}
keydown(event) {