mirror of
https://github.com/sparksuite/simplemde-markdown-editor.git
synced 2025-09-24 16:40:55 -06:00
optimal traversal
This commit is contained in:
parent
ef0d99728b
commit
5030bb7522
File diff suppressed because one or more lines are too long
@ -360,7 +360,7 @@ export default class Action {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = block_start; i <= block_end; i++){
|
for (let i = block_start; i <= block_end; i++){
|
||||||
cm.indentLine(i, "subtract"); // TODO: this doesn't get tracked in the history, so can't be undone :(
|
cm.indentLine(i, "subtract"); // TODO: this doesn't get tracked in the history, so can't be undone :(
|
||||||
}
|
}
|
||||||
cm.focus();
|
cm.focus();
|
||||||
|
@ -87,7 +87,7 @@ class SimpleMDE extends Action {
|
|||||||
options.toolbar = [];
|
options.toolbar = [];
|
||||||
|
|
||||||
// Loop over the built in buttons, to get the preferred order
|
// Loop over the built in buttons, to get the preferred order
|
||||||
for(let key in toolbarBuiltInButtons) {
|
for(const key in toolbarBuiltInButtons) {
|
||||||
if(toolbarBuiltInButtons.hasOwnProperty(key)) {
|
if(toolbarBuiltInButtons.hasOwnProperty(key)) {
|
||||||
if(key.indexOf("separator-") != -1) {
|
if(key.indexOf("separator-") != -1) {
|
||||||
options.toolbar.push("|");
|
options.toolbar.push("|");
|
||||||
@ -176,7 +176,7 @@ class SimpleMDE extends Action {
|
|||||||
const self = this;
|
const self = this;
|
||||||
let keyMaps = {};
|
let keyMaps = {};
|
||||||
|
|
||||||
for(let key in options.shortcuts) {
|
for(const key in options.shortcuts) {
|
||||||
// null stands for "do not bind this command"
|
// null stands for "do not bind this command"
|
||||||
if(options.shortcuts[key] !== null && bindings[key] !== null) {
|
if(options.shortcuts[key] !== null && bindings[key] !== null) {
|
||||||
keyMaps[utils.fixShortcut(options.shortcuts[key])] = () => bindings[key](self);
|
keyMaps[utils.fixShortcut(options.shortcuts[key])] = () => bindings[key](self);
|
||||||
@ -406,7 +406,7 @@ class SimpleMDE extends Action {
|
|||||||
this.codemirror.on("cursorActivity", () => {
|
this.codemirror.on("cursorActivity", () => {
|
||||||
let stat = base.getState(this.codemirror);
|
let stat = base.getState(this.codemirror);
|
||||||
|
|
||||||
for(let key in toolbarData) {
|
for(const key in toolbarData) {
|
||||||
(function(key) {
|
(function(key) {
|
||||||
let el = toolbarData[key];
|
let el = toolbarData[key];
|
||||||
if(stat[key]) {
|
if(stat[key]) {
|
||||||
|
@ -37,7 +37,7 @@ export default new class Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getBindingName (f){
|
getBindingName (f){
|
||||||
for(let key in bindings) {
|
for(const key in bindings) {
|
||||||
if(bindings[key] === f) {
|
if(bindings[key] === f) {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user