1
0
mirror of https://github.com/flarum/core.git synced 2025-08-02 22:47:33 +02:00

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