nodebb-plugin-composer-default 10.0.43 → 10.0.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-composer-default",
3
- "version": "10.0.43",
3
+ "version": "10.0.44",
4
4
  "description": "Default composer for NodeBB",
5
5
  "main": "library.js",
6
6
  "repository": {
@@ -130,7 +130,7 @@ define('composer/uploads', [
130
130
  }
131
131
 
132
132
  var filenameMapping = [];
133
-
133
+ let filesText = '';
134
134
  for (i = 0; i < files.length; ++i) {
135
135
  // The filename map has datetime and iterator prepended so that they can be properly tracked even if the
136
136
  // filenames are identical.
@@ -141,9 +141,13 @@ define('composer/uploads', [
141
141
  uploadForm[0].reset();
142
142
  return alerts.error('[[error:file-too-big, ' + config.maximumFileSize + ']]');
143
143
  }
144
-
145
- text = insertText(text, textarea.getCursorPosition(), (isImage ? '!' : '') + '[' + filenameMapping[i] + '](' + uploadingText + ') ');
144
+ filesText += (isImage ? '!' : '') + '[' + filenameMapping[i] + '](' + uploadingText + ') ';
146
145
  }
146
+
147
+ const cursorPosition = textarea.getCursorPosition();
148
+ const textLen = text.length;
149
+ text = insertText(text, cursorPosition, filesText);
150
+
147
151
  if (uploadForm.length) {
148
152
  postContainer.find('[data-action="post"]').prop('disabled', true);
149
153
  }
@@ -225,7 +229,7 @@ define('composer/uploads', [
225
229
  }
226
230
  }
227
231
  preview.render(postContainer);
228
- textarea.focus();
232
+ textarea.selectRange(cursorPosition + textarea.val().length - textLen);
229
233
  postContainer.find('[data-action="post"]').prop('disabled', false);
230
234
  $(window).trigger('action:composer.upload', {
231
235
  post_uuid: post_uuid,