FIX: blockquote button implementation
Previously clicking on blockquote in the middle of sentence would result in incorrect formatting
This commit is contained in:
parent
5897ae945a
commit
e2f57a154b
|
@ -78,7 +78,7 @@ class Toolbar {
|
|||
group: 'insertions',
|
||||
icon: 'quote-right',
|
||||
shortcut: 'Shift+9',
|
||||
perform: e => e.applySurround('> ', '', 'code_text')
|
||||
perform: e => e.applyList('> ', 'blockquote_text')
|
||||
});
|
||||
|
||||
this.addButton({id: 'code', group: 'insertions', shortcut: 'Shift+C', action: 'formatCode'});
|
||||
|
|
|
@ -1129,6 +1129,7 @@ en:
|
|||
options: "Options"
|
||||
whisper: "whisper"
|
||||
unlist: "unlisted"
|
||||
blockquote_text: "Blockquote"
|
||||
|
||||
add_warning: "This is an official warning."
|
||||
toggle_whisper: "Toggle Whisper"
|
||||
|
|
|
@ -515,29 +515,37 @@ third line`
|
|||
|
||||
|
||||
testCase('quote button', function(assert, textarea) {
|
||||
click('button.quote');
|
||||
andThen(() => {
|
||||
assert.equal(this.get('value'), 'hello world.');
|
||||
});
|
||||
|
||||
andThen(() => {
|
||||
textarea.selectionStart = 6;
|
||||
textarea.selectionEnd = 11;
|
||||
textarea.selectionEnd = 9;
|
||||
});
|
||||
|
||||
click('button.quote');
|
||||
andThen(() => {
|
||||
assert.equal(this.get('value'), 'hello > world.');
|
||||
assert.equal(textarea.selectionStart, 6);
|
||||
assert.equal(textarea.selectionEnd, 13);
|
||||
assert.equal(this.get('value'), 'hello\n\n> wor\n\nld.');
|
||||
assert.equal(textarea.selectionStart, 7);
|
||||
assert.equal(textarea.selectionEnd, 12);
|
||||
});
|
||||
|
||||
click('button.quote');
|
||||
|
||||
andThen(() => {
|
||||
assert.equal(this.get('value'), 'hello\n\nwor\n\nld.');
|
||||
assert.equal(textarea.selectionStart, 7);
|
||||
assert.equal(textarea.selectionEnd, 10);
|
||||
});
|
||||
|
||||
andThen(() => {
|
||||
textarea.selectionStart = 15;
|
||||
textarea.selectionEnd = 15;
|
||||
});
|
||||
|
||||
click('button.quote');
|
||||
andThen(() => {
|
||||
assert.equal(this.get('value'), 'hello world.');
|
||||
assert.equal(textarea.selectionStart, 6);
|
||||
assert.equal(textarea.selectionEnd, 11);
|
||||
assert.equal(this.get('value'), 'hello\n\nwor\n\nld.\n\n> Blockquote');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
testCase(`bullet button with no selection`, function(assert, textarea) {
|
||||
|
|
Loading…
Reference in New Issue