diff --git a/app/static/scripts/editor.js b/app/static/scripts/editor.js index 1ce15f2..47c9c0b 100644 --- a/app/static/scripts/editor.js +++ b/app/static/scripts/editor.js @@ -124,6 +124,22 @@ function editor_set_title(event, level, diff) }); } +function editor_quote(event) +{ + editor_act_on_lines(event, function(line) { + /* Strip all the initial > (and count them) */ + let count = 0; + while(count < line.length && line[count] == '>') count++; + + let contents_index = count; + if(count < line.length && line[count] == ' ') contents_index++; + let contents = line.slice(contents_index); + + /* Apply the difference */ + return '>'.repeat(count + 1) + ' ' + contents; + }); +} + previewTimeout = null; ta = document.querySelector(".editor textarea"); ta.addEventListener('keydown', function(e) { diff --git a/app/templates/widgets/editor.html b/app/templates/widgets/editor.html index 9942cf7..ead4515 100644 --- a/app/templates/widgets/editor.html +++ b/app/templates/widgets/editor.html @@ -54,12 +54,12 @@ - -