editor: outdent on ol removal (#4088)

This commit is contained in:
John McLear 2020-06-07 09:51:12 +01:00 committed by GitHub
parent 71a1f28ab9
commit c5584fb5b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 6 deletions

View file

@ -5166,6 +5166,14 @@ function Ace2Inner(){
var t = '';
var level = 0;
var listType = /([a-z]+)([0-9]+)/.exec(getLineListType(n));
// Used to outdent if ol is removed
if(allLinesAreList){
var togglingOn = false;
}else{
var togglingOn = true;
}
if (listType)
{
t = listType[1];
@ -5173,12 +5181,22 @@ function Ace2Inner(){
}
var t = getLineListType(n);
// if already a list, deindent
if (allLinesAreList && level != 1) { level = level - 1; }
// if already indented, then add a level of indentation to the list
else if (t && !allLinesAreList) { level = level + 1; }
if(t === listType) togglingOn = false;
if(togglingOn){
mods.push([n, allLinesAreList ? 'indent' + level : (t ? type + level : type + '1')]);
}else{
// scrap the entire indentation and list type
if(level === 1){ // if outdending but are the first item in the list then outdent
setLineListType(n, ''); // outdent
}
// else change to indented not bullet
if(level > 1){
setLineListType(n, ''); // remove bullet
setLineListType(n, "indent"+level); // in/outdent
}
}
mods.push([n, allLinesAreList ? 'indent' + level : (t ? type + level : type + '1')]);
}
_.each(mods, function(mod){

View file

@ -70,7 +70,7 @@ var sauceTestWorker = async.queue(function (testSettings, callback) {
}, 10000);
}, 1); //run 4 tests in parrallel
}, 1); //run 1 test in parrallel
// 1) Firefox on Linux
sauceTestWorker.push({