mirror of
https://github.com/flarum/core.git
synced 2025-07-30 21:20:24 +02:00
Fix tooltip deprecation warning
This commit is contained in:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user