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:
@@ -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) {
|
||||||
|
Reference in New Issue
Block a user