Defect #43662 ยป Fix cursor position handling after inserting inline attachment markup.patch
| app/assets/javascripts/attachments.js | ||
|---|---|---|
| 313 | 313 |
+ (newLineAfter ? '\n' : '') |
| 314 | 314 |
+ description.substring(cursorPosition, description.length) |
| 315 | 315 |
); |
| 316 |
}) |
|
| 317 | ||
| 318 |
// move cursor into next line
|
|
| 319 |
cursorPosition = $textarea.prop('selectionStart');
|
|
| 320 |
$textarea.prop({
|
|
| 321 |
'selectionStart': cursorPosition + 1,
|
|
| 322 |
'selectionEnd': cursorPosition + 1
|
|
| 323 |
}); |
|
| 316 |
|
|
| 317 |
// Move cursor after the inserted markup |
|
| 318 |
var newCursorPosition = cursorPosition + (newLineBefore ? 1 : 0) + imageMarkup.length;
|
|
| 319 |
$textarea.prop({
|
|
| 320 |
'selectionStart': newCursorPosition + 1,
|
|
| 321 |
'selectionEnd': newCursorPosition + 1
|
|
| 322 |
});
|
|
| 323 |
});
|
|
| 324 | 324 | |
| 325 | 325 |
} |
| 326 | 326 |
} |