Formatting buttons: handle multiple paragraphs
This commit is contained in:
parent
1d48189eb1
commit
b9be722f73
1 changed files with 8 additions and 6 deletions
|
@ -34,6 +34,7 @@
|
|||
var enclose = function(mark) {
|
||||
var re = new RegExp(escape(mark) + '(\\S[^]*?\\S|\\S)' + escape(mark), 'g');
|
||||
return select(function(selection) {
|
||||
return selection.replace(/[^]*?(?=\n{2,})|[^]*/g, function(selection) {
|
||||
var replacement = selection.replace(re, '$1');
|
||||
if (replacement.length == selection.length)
|
||||
replacement = replacement.replace(/\S[^]*\S|\S/, function (str) {
|
||||
|
@ -41,6 +42,7 @@
|
|||
});
|
||||
return replacement;
|
||||
});
|
||||
});
|
||||
};
|
||||
var quote = select(function(selection) {
|
||||
var lines = selection.split('\n');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue