Add custom-elements pollyfill & markdown bar if Reflect API is present

Ref #1702
This commit is contained in:
David Sevilla Martín 2019-04-10 18:13:09 -04:00
parent fd53498280
commit 3726307f16
3 changed files with 9 additions and 10 deletions

View File

@ -2869,11 +2869,6 @@
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz",
"integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg="
},
"harmony-reflect": {
"version": "1.6.1",
"resolved": "https://registry.npmjs.org/harmony-reflect/-/harmony-reflect-1.6.1.tgz",
"integrity": "sha512-WJTeyp0JzGtHcuMsi7rw2VwtkvLa+JyfEKJCFyfcS0+CDkjQ5lHPu7zEhFZP+PDSRrEgXa5Ah0l1MbgbE41XjA=="
},
"has": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",

View File

@ -5,7 +5,6 @@
"@github/markdown-toolbar-element": "^0.1.1",
"@webcomponents/custom-elements": "^1.2.1",
"flarum-webpack-config": "0.1.0-beta.10",
"harmony-reflect": "^1.6.1",
"mdarea": "^0.0.10",
"webpack": "^4.26.0",
"webpack-cli": "^3.1.2"

View File

@ -2,12 +2,17 @@ import { extend } from 'flarum/extend';
import TextEditor from 'flarum/components/TextEditor';
import icon from 'flarum/helpers/icon';
import '@webcomponents/custom-elements';
import 'harmony-reflect';
import '@github/markdown-toolbar-element';
import MarkdownArea from 'mdarea/mdarea.js';
let MarkdownArea;
if (window.Reflect) {
require('@webcomponents/custom-elements');
require('@github/markdown-toolbar-element');
MarkdownArea = require('mdarea/mdarea.js');
}
app.initializers.add('flarum-markdown', function(app) {
if (!MarkdownArea) return;
let index = 1;
extend(TextEditor.prototype, 'init', function() {