mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
FIX: Allow us to insert things between words.
This commit is contained in:
parent
cd1b83997b
commit
15931fce1e
2 changed files with 12 additions and 4 deletions
|
@ -279,10 +279,6 @@ export default Ember.Component.extend({
|
|||
let start = textarea.selectionStart;
|
||||
let end = textarea.selectionEnd;
|
||||
|
||||
if (start === end) {
|
||||
start = end = textarea.value.length;
|
||||
}
|
||||
|
||||
const value = textarea.value.substring(start, end);
|
||||
const pre = textarea.value.slice(0, start);
|
||||
const post = textarea.value.slice(end);
|
||||
|
|
|
@ -411,6 +411,18 @@ testCase(`heading button with no selection`, function(assert, textarea) {
|
|||
});
|
||||
});
|
||||
|
||||
testCase(`rule between things`, function(assert, textarea) {
|
||||
textarea.selectionStart = 5;
|
||||
textarea.selectionEnd = 5;
|
||||
|
||||
click(`button.rule`);
|
||||
andThen(() => {
|
||||
assert.equal(this.get('value'), `hello\n\n----------\n world.`);
|
||||
assert.equal(textarea.selectionStart, 18);
|
||||
assert.equal(textarea.selectionEnd, 18);
|
||||
});
|
||||
});
|
||||
|
||||
testCase(`rule with no selection`, function(assert, textarea) {
|
||||
click(`button.rule`);
|
||||
andThen(() => {
|
||||
|
|
Loading…
Reference in a new issue