mirror of
https://github.com/sparksuite/simplemde-markdown-editor.git
synced 2025-09-24 16:40:55 -06: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_div = wrapper.previousSibling;
|
||||||
var toolbar = editor.options.toolbar ? editor.toolbarElements.preview : false;
|
var toolbar = editor.options.toolbar ? editor.toolbarElements.preview : false;
|
||||||
var preview = wrapper.lastChild;
|
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 = document.createElement("div");
|
||||||
preview.className = "editor-preview";
|
preview.className = "editor-preview";
|
||||||
wrapper.appendChild(preview);
|
wrapper.appendChild(preview);
|
||||||
@ -17136,7 +17138,8 @@ var SimpleMDE = function (_Action) {
|
|||||||
// Don't include trailing separators
|
// Don't include trailing separators
|
||||||
if (v === "|") {
|
if (v === "|") {
|
||||||
var nonSeparatorIconsFollow = true;
|
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)) {
|
if (_this3.toolbar[x] !== "|" && (!_this3.options.hideIcons || _this3.options.hideIcons.indexOf(name) == -1)) {
|
||||||
nonSeparatorIconsFollow = false;
|
nonSeparatorIconsFollow = false;
|
||||||
}
|
}
|
||||||
@ -17532,7 +17535,9 @@ exports.default = new (function () {
|
|||||||
var m = data.match(pattern);
|
var m = data.match(pattern);
|
||||||
var count = 0;
|
var count = 0;
|
||||||
if (m === null) return count;
|
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) {
|
if (m[i].charCodeAt(0) >= 0x4E00) {
|
||||||
count += m[i].length;
|
count += m[i].length;
|
||||||
} else {
|
} 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_div = wrapper.previousSibling;
|
||||||
let toolbar = editor.options.toolbar? editor.toolbarElements.preview: false;
|
let toolbar = editor.options.toolbar? editor.toolbarElements.preview: false;
|
||||||
let preview = wrapper.lastChild;
|
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 = document.createElement("div");
|
||||||
preview.className = "editor-preview";
|
preview.className = "editor-preview";
|
||||||
wrapper.appendChild(preview);
|
wrapper.appendChild(preview);
|
||||||
|
@ -363,7 +363,8 @@ class SimpleMDE extends Action {
|
|||||||
// Don't include trailing separators
|
// Don't include trailing separators
|
||||||
if(v === "|") {
|
if(v === "|") {
|
||||||
let nonSeparatorIconsFollow = true;
|
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)) {
|
if(this.toolbar[x] !== "|" && (!this.options.hideIcons || this.options.hideIcons.indexOf(name) == -1)) {
|
||||||
nonSeparatorIconsFollow = false;
|
nonSeparatorIconsFollow = false;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,9 @@ export default new class Utils {
|
|||||||
const m = data.match(pattern);
|
const m = data.match(pattern);
|
||||||
let count = 0;
|
let count = 0;
|
||||||
if(m === null) return count;
|
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) {
|
if(m[i].charCodeAt(0) >= 0x4E00) {
|
||||||
count += m[i].length;
|
count += m[i].length;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user