nodebb-plugin-composer-default 10.0.42 → 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/library.js CHANGED
@@ -96,6 +96,7 @@ plugin.getFormattingOptions = async function () {
96
96
  name: 'thumbs',
97
97
  title: '[[topic:composer.thumb_title]]',
98
98
  className: 'fa fa-address-card-o',
99
+ badge: true,
99
100
  visibility: {
100
101
  ...defaultVisibility,
101
102
  reply: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-composer-default",
3
- "version": "10.0.42",
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,
@@ -867,7 +867,9 @@ define('composer', [
867
867
 
868
868
  if (thumbs.length) {
869
869
  const formatEl = postContainer.find('[data-format="thumbs"]');
870
- formatEl.attr('data-count', thumbs.length);
870
+ formatEl.find('.badge')
871
+ .text(thumbs.length)
872
+ .toggleClass('hidden', !thumbs.length);
871
873
  }
872
874
  });
873
875
  }
@@ -77,23 +77,6 @@
77
77
  color: $gray-200;
78
78
  }
79
79
  }
80
-
81
- .formatting-group {
82
- li {
83
- &[data-format="thumbs"][data-count]:after {
84
- content: attr(data-count);
85
- background: $info;
86
- color: $white;
87
- font-weight: 600;
88
- position: absolute;
89
- top: 5px;
90
- left: 2.5em;
91
- padding: 0px 5px;
92
- border-radius: 5px;
93
- font-size: 0.75em;
94
- }
95
- }
96
- }
97
80
  }
98
81
 
99
82
  .tags-container {
@@ -6,8 +6,11 @@
6
6
  {{{ else }}}
7
7
  {{{ if (./visibility.desktop && ((isTopicOrMain && ./visibility.main) || (!isTopicOrMain && ./visibility.reply))) }}}
8
8
  <li class="small">
9
- <a href="#" class="btn btn-sm btn-link text-reset" tabindex="-1" data-format="{./name}" title="{./title}">
9
+ <a href="#" class="btn btn-sm btn-link text-reset position-relative" tabindex="-1" data-format="{./name}" title="{./title}">
10
10
  <i class="{./className}"></i>
11
+ {{{ if ./badge }}}
12
+ <span class="px-1 position-absolute top-0 start-100 translate-middle-x badge rounded text-bg-info"></span>
13
+ {{{ end }}}
11
14
  </a>
12
15
  </li>
13
16
  {{{ end }}}