mirror of
https://github.com/flarum/framework.git
synced 2024-11-25 17:57:04 +08:00
Fix tooltip deprecation warning
This commit is contained in:
parent
c9af88e721
commit
f076329636
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user