nodebb-plugin-composer-default 10.3.20 → 10.3.21

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.3.20",
3
+ "version": "10.3.21",
4
4
  "description": "Default composer for NodeBB",
5
5
  "main": "library.js",
6
6
  "repository": {
@@ -3,9 +3,10 @@
3
3
  define('composer/categoryList', [
4
4
  'categorySelector', 'taskbar', 'api',
5
5
  ], function (categorySelector, taskbar, api) {
6
- var categoryList = {};
6
+ const categoryList = {};
7
7
 
8
- var selector;
8
+ let selector;
9
+ let mobileSelector;
9
10
 
10
11
  categoryList.init = function (postContainer, postData) {
11
12
  var listContainer = postContainer.find('.category-list-container');
@@ -25,31 +26,35 @@ define('composer/categoryList', [
25
26
  onSelect: function (selectedCategory) {
26
27
  if (postData.hasOwnProperty('cid')) {
27
28
  changeCategory(postContainer, postData, selectedCategory);
29
+ mobileSelector.selectCategory(selectedCategory.cid, selectedCategory.categoryEl);
28
30
  }
29
31
  },
30
32
  });
31
33
  if (!selector) {
32
34
  return;
33
35
  }
34
- if (postData.cid && postData.category) {
35
- selector.selectedCategory = { cid: postData.cid, name: postData.category.name };
36
- } else if (ajaxify.data.template.compose && ajaxify.data.selectedCategory) {
37
- // separate composer route
38
- selector.selectedCategory = { cid: ajaxify.data.cid, name: ajaxify.data.selectedCategory };
39
- }
40
-
41
36
  // this is the mobile category selector
42
- categorySelector.init(
37
+ mobileSelector = categorySelector.init(
43
38
  postContainer.find('.mobile-navbar [component="category-selector"]'), {
44
39
  privilege: 'topics:create',
45
40
  states: ['watching', 'tracking', 'notwatching', 'ignoring'],
46
41
  onSelect: function (selectedCategory) {
47
42
  if (postData.hasOwnProperty('cid')) {
48
43
  changeCategory(postContainer, postData, selectedCategory);
44
+ selector.selectCategory(selectedCategory.cid, selectedCategory.categoryEl);
49
45
  }
50
46
  },
51
47
  });
52
48
 
49
+ if (postData.cid && postData.category) {
50
+ selector.selectedCategory = { cid: postData.cid, name: postData.category.name };
51
+ mobileSelector.selectedCategory = { cid: postData.cid, name: postData.category.name };
52
+ } else if (ajaxify.data.template.compose && ajaxify.data.selectedCategory) {
53
+ // separate composer route
54
+ selector.selectedCategory = { cid: ajaxify.data.cid, name: ajaxify.data.selectedCategory };
55
+ mobileSelector.selectedCategory = { cid: ajaxify.data.cid, name: ajaxify.data.selectedCategory };
56
+ }
57
+
53
58
  toggleDropDirection(postContainer);
54
59
  };
55
60
 
@@ -17,7 +17,7 @@
17
17
 
18
18
  <div class="d-flex gap-1 flex-nowrap">
19
19
  <button class="btn btn-sm btn-primary display-scheduler fs-5 {{{ if !canSchedule }}} hidden{{{ end }}}">
20
- <i class="fa fa-clock-o"></i>
20
+ <i class="fa fa-fw fa-clock-o"></i>
21
21
  </button>
22
22
  <button class="btn btn-sm btn-primary composer-submit fs-5" data-action="post" tabindex="-1"><i class="fa fa-fw fa-chevron-right"></i></button>
23
23
  </div>