diff --git a/extensions/markdown/js/src/forum/components/MarkdownButton.js b/extensions/markdown/js/src/forum/components/MarkdownButton.js index 6ad05e094..cd88699af 100644 --- a/extensions/markdown/js/src/forum/components/MarkdownButton.js +++ b/extensions/markdown/js/src/forum/components/MarkdownButton.js @@ -5,17 +5,19 @@ import apply from '../util/apply'; const modifierKey = navigator.userAgent.match(/Macintosh/) ? '⌘' : 'ctrl'; export default class MarkdownButton extends Component { - config(isInitialized) { - if (isInitialized) return; + oncreate(vnode) { + super.oncreate(vnode); this.$().tooltip(); } view() { - return ; + return ( + + ); } keydown(event) { @@ -26,13 +28,13 @@ export default class MarkdownButton extends Component { } click() { - return apply(this.element, this.props.style); + return apply(this.element, this.attrs.style); } title() { - let tooltip = this.props.title; + let tooltip = this.attrs.title; - if (this.props.hotkey) tooltip += ` <${modifierKey}-${this.props.hotkey}>`; + if (this.attrs.hotkey) tooltip += ` <${modifierKey}-${this.attrs.hotkey}>`; return tooltip; } diff --git a/extensions/markdown/js/src/forum/components/MarkdownToolbar.js b/extensions/markdown/js/src/forum/components/MarkdownToolbar.js index 525fdc2bc..e59e8313e 100644 --- a/extensions/markdown/js/src/forum/components/MarkdownToolbar.js +++ b/extensions/markdown/js/src/forum/components/MarkdownToolbar.js @@ -3,17 +3,17 @@ import Component from 'flarum/Component'; const modifierKey = navigator.userAgent.match(/Macintosh/) ? 'Meta' : 'Control'; export default class MarkdownToolbar extends Component { - config(isInitialized) { - if (isInitialized) return; + oncreate(vnode) { + super.oncreate(vnode); - const field = document.getElementById(this.props.for); + const field = document.getElementById(this.attrs.for); field.addEventListener('keydown', this.shortcut.bind(this)); } - view() { - return