mirror of
https://github.com/sparksuite/simplemde-markdown-editor.git
synced 2024-06-09 01:12:14 +02:00
avoid repeated calculation length
This commit is contained in:
parent
4c7bae0caf
commit
ef0d99728b
File diff suppressed because one or more lines are too long
|
@ -15945,7 +15945,9 @@ var Action = function () {
|
|||
var toolbar_div = wrapper.previousSibling;
|
||||
var toolbar = editor.options.toolbar ? editor.toolbarElements.preview : false;
|
||||
var preview = wrapper.lastChild;
|
||||
if (!preview || !/editor-preview/.test(preview.className)) {
|
||||
var notCreate = !preview || !/editor-preview/.test(preview.className);
|
||||
|
||||
if (notCreate) {
|
||||
preview = document.createElement("div");
|
||||
preview.className = "editor-preview";
|
||||
wrapper.appendChild(preview);
|
||||
|
@ -17136,7 +17138,8 @@ var SimpleMDE = function (_Action) {
|
|||
// Don't include trailing separators
|
||||
if (v === "|") {
|
||||
var nonSeparatorIconsFollow = true;
|
||||
for (var x = i + 1; x < _this3.toolbar.length; x++) {
|
||||
var toolbarLength = _this3.toolbar.length;
|
||||
for (var x = i + 1; x < toolbarLength; x++) {
|
||||
if (_this3.toolbar[x] !== "|" && (!_this3.options.hideIcons || _this3.options.hideIcons.indexOf(name) == -1)) {
|
||||
nonSeparatorIconsFollow = false;
|
||||
}
|
||||
|
@ -17532,7 +17535,9 @@ exports.default = new (function () {
|
|||
var m = data.match(pattern);
|
||||
var count = 0;
|
||||
if (m === null) return count;
|
||||
for (var i = 0; i < m.length; i++) {
|
||||
|
||||
var mLength = m.length;
|
||||
for (var i = 0; i < mLength; i++) {
|
||||
if (m[i].charCodeAt(0) >= 0x4E00) {
|
||||
count += m[i].length;
|
||||
} else {
|
||||
|
|
4
dist/simplemde.min.js
vendored
4
dist/simplemde.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -490,7 +490,9 @@ export default class Action {
|
|||
let toolbar_div = wrapper.previousSibling;
|
||||
let toolbar = editor.options.toolbar? editor.toolbarElements.preview: false;
|
||||
let preview = wrapper.lastChild;
|
||||
if (!preview || !/editor-preview/.test(preview.className)){
|
||||
const notCreate = !preview || !/editor-preview/.test(preview.className)
|
||||
|
||||
if (notCreate){
|
||||
preview = document.createElement("div");
|
||||
preview.className = "editor-preview";
|
||||
wrapper.appendChild(preview);
|
||||
|
|
|
@ -363,7 +363,8 @@ class SimpleMDE extends Action {
|
|||
// Don't include trailing separators
|
||||
if(v === "|") {
|
||||
let nonSeparatorIconsFollow = true;
|
||||
for(let x = (i + 1); x < this.toolbar.length; x++) {
|
||||
const toolbarLength = this.toolbar.length
|
||||
for(let x = (i + 1); x < toolbarLength; x++) {
|
||||
if(this.toolbar[x] !== "|" && (!this.options.hideIcons || this.options.hideIcons.indexOf(name) == -1)) {
|
||||
nonSeparatorIconsFollow = false;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,9 @@ export default new class Utils {
|
|||
const m = data.match(pattern);
|
||||
let count = 0;
|
||||
if(m === null) return count;
|
||||
for(let i = 0; i < m.length; i++) {
|
||||
|
||||
const mLength = m.length
|
||||
for(let i = 0; i < mLength; i++) {
|
||||
if(m[i].charCodeAt(0) >= 0x4E00) {
|
||||
count += m[i].length;
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue