1
0
mirror of https://github.com/flarum/core.git synced 2025-07-14 13:26:23 +02:00

Mithril 2 Update (#19)

Update for Mithril 2
This commit is contained in:
Alexander Skvortsov
2020-09-23 22:51:50 -04:00
committed by GitHub
parent 5081cd47c1
commit ab63a55d60
3 changed files with 23 additions and 23 deletions

View File

@ -17,7 +17,7 @@ import MarkdownButton from './components/MarkdownButton';
app.initializers.add('flarum-markdown', function(app) {
let index = 1;
extend(TextEditor.prototype, 'init', function() {
extend(TextEditor.prototype, 'oninit', function() {
this.textareaId = 'textarea'+(index++);
});
@ -25,19 +25,17 @@ app.initializers.add('flarum-markdown', function(app) {
vdom.children[0].attrs.id = this.textareaId;
});
extend(TextEditor.prototype, 'configTextarea', function(value, element, isInitialized, context) {
if (isInitialized) return;
const editor = new MarkdownArea(element, {
extend(TextEditor.prototype, 'oncreate', function() {
this.editor = new MarkdownArea(this.$('textarea')[0], {
keyMap: {
indent: ['Ctrl+m'],
outdent: ['Ctrl+M']
}
});
});
context.onunload = function() {
editor.destroy();
};
extend(TextEditor.prototype, 'onremove', function () {
this.editor.destroy();
});
extend(TextEditor.prototype, 'toolbarItems', function(items) {