diff --git a/.browserslistrc b/.browserslistrc new file mode 100644 index 000000000..47c683699 --- /dev/null +++ b/.browserslistrc @@ -0,0 +1,2 @@ +>0.25% +not op_mini all \ No newline at end of file diff --git a/resources/assets/js/components/markdown-editor.js b/resources/assets/js/components/markdown-editor.js index 5688ebd61..9e2bb3915 100644 --- a/resources/assets/js/components/markdown-editor.js +++ b/resources/assets/js/components/markdown-editor.js @@ -395,35 +395,30 @@ class MarkdownEditor { } // Scroll to a specified text - scrollToText(searchText) {; + scrollToText(searchText) { if (!searchText) { return; } + const content = this.cm.getValue(); const lines = content.split(/\r?\n/); - let lineNumber = -1; - for (let i = 0; i !== lines.length; ++i) { - const line = lines[i]; - if (!line) { - continue; - } - if (line.indexOf(searchText) !== -1) { - lineNumber = i; - break; - } + let lineNumber = lines.findIndex(line => { + return line && line.indexOf(searchText) !== -1; + }); + + if (lineNumber === -1) { + return; } - if (lineNumber !== -1) { - this.cm.scrollIntoView({ - line: lineNumber, - }, 200); - this.cm.focus(); - // set the cursor location. - this.cm.setCursor({ - line: lineNumber, - char: lines[lineNumber].length - }) - } + this.cm.scrollIntoView({ + line: lineNumber, + }, 200); + this.cm.focus(); + // set the cursor location. + this.cm.setCursor({ + line: lineNumber, + char: lines[lineNumber].length + }) } } diff --git a/resources/assets/js/index.js b/resources/assets/js/index.js index 6b24d5ee1..f202c322e 100644 --- a/resources/assets/js/index.js +++ b/resources/assets/js/index.js @@ -1,5 +1,4 @@ // Global Polyfills -import "@babel/polyfill" import "./services/dom-polyfills" // Url retrieval function diff --git a/webpack.config.js b/webpack.config.js index c5ce4829f..5c0501e3b 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -25,7 +25,11 @@ const config = { use: { loader: 'babel-loader', options: { - presets: ['@babel/preset-env'] + presets: [[ + '@babel/preset-env', { + useBuiltIns: 'usage' + } + ]] } } },