mirror of
https://github.com/redmine/redmine.git
synced 2026-02-04 21:59:57 +01:00
Fix race condition in addInlineAttachmentMarkup causing cursor movement before async image markup insertion (#43662).
Patch by Yasu Saku (user:skys). git-svn-id: https://svn.redmine.org/redmine/trunk@24352 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -313,14 +313,14 @@ function addInlineAttachmentMarkup(file) {
|
||||
+ (newLineAfter ? '\n' : '')
|
||||
+ description.substring(cursorPosition, description.length)
|
||||
);
|
||||
})
|
||||
|
||||
// move cursor into next line
|
||||
cursorPosition = $textarea.prop('selectionStart');
|
||||
$textarea.prop({
|
||||
'selectionStart': cursorPosition + 1,
|
||||
'selectionEnd': cursorPosition + 1
|
||||
});
|
||||
// Move cursor after the inserted markup
|
||||
var newCursorPosition = cursorPosition + (newLineBefore ? 1 : 0) + imageMarkup.length;
|
||||
$textarea.prop({
|
||||
'selectionStart': newCursorPosition + 1,
|
||||
'selectionEnd': newCursorPosition + 1
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user