This commit is contained in:
2020-04-18 14:38:38 +00:00
parent 0abcc52267
commit 9e71436ae8

View File

@@ -360,14 +360,37 @@ export default {
if (this.selection.hasSelection) {
let s = this.getSelectedBlock();
s = s.replace(/\n/gi, "\n* ");
if (s.length > 0 && s[0] != "\n") {
s = "* " + s;
}
s = s + "\n";
this.replaceSelectedBlock(s);
} else {
this.replaceSelectedText("\n* ");
}
},
clickOl() {
//if a selected block with several lines then prepend each line
//if a selected block with one line only then prepend start of first line after last linefeed
this.getSelectedRange();
this.replaceSelectedText("* " + this.getSelectedText());
if (this.selection.hasSelection) {
let s = this.getSelectedBlock();
let ret = "";
let listItem = 0;
for (let i = 0; i < s.length; i++) {
if (s[i] == "\n") {
++listItem;
ret += "\n" + listItem + ". ";
} else {
ret += s[i];
}
}
ret += "\n";
this.replaceSelectedBlock(ret);
} else {
this.replaceSelectedText("\n1. ");
}
},
clickTask() {
this.getSelectedRange();