nodebb-plugin-composer-default 11.0.0 → 11.0.2

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": "11.0.0",
3
+ "version": "11.0.2",
4
4
  "description": "Default composer for NodeBB",
5
5
  "main": "library.js",
6
6
  "repository": {
@@ -21,8 +21,6 @@ define('composer/scheduler', ['benchpress', 'modals', 'alerts', 'translator'], f
21
21
 
22
22
  const dropdownDisplayBtn = {
23
23
  el: null,
24
- defaultText: '',
25
- activeText: '',
26
24
  };
27
25
 
28
26
  const submitBtn = {
@@ -40,11 +38,6 @@ define('composer/scheduler', ['benchpress', 'modals', 'alerts', 'translator'], f
40
38
  state.timestamp = 0;
41
39
  state.posts = posts;
42
40
 
43
- translator.translateKeys(['[[topic:composer.post-later]]', '[[modules:composer.change-schedule-date]]']).then((translated) => {
44
- dropdownDisplayBtn.defaultText = translated[0];
45
- dropdownDisplayBtn.activeText = translated[1];
46
- });
47
-
48
41
  displayBtnCons = $postContainer[0].querySelectorAll('.display-scheduler');
49
42
  displayBtns = $postContainer[0].querySelectorAll('.display-scheduler i');
50
43
  dropdownDisplayBtn.el = $postContainer[0].querySelector('.dropdown-item.display-scheduler');
@@ -179,14 +172,16 @@ define('composer/scheduler', ['benchpress', 'modals', 'alerts', 'translator'], f
179
172
  state.timestamp = 0;
180
173
  }
181
174
 
182
- function toggleItems(active = true) {
175
+ async function toggleItems(active = true) {
183
176
  displayBtns.forEach(btn => btn.classList.toggle('active', active));
184
177
  if (submitBtn.icon) {
185
178
  submitBtn.icon.classList.toggle('fa-check', !active);
186
179
  submitBtn.icon.classList.toggle('fa-clock-o', active);
187
180
  }
188
181
  if (dropdownDisplayBtn.el) {
189
- dropdownDisplayBtn.el.textContent = active ? dropdownDisplayBtn.activeText : dropdownDisplayBtn.defaultText;
182
+ dropdownDisplayBtn.el.textContent = active ?
183
+ await translator.translateKey('[[modules:composer.change-schedule-date]]') :
184
+ await translator.translateKey('[[topic:composer.post-later]]');
190
185
  cancelBtn.classList.toggle('hidden', !active);
191
186
  }
192
187
  // Toggle submit button text
@@ -686,15 +686,15 @@ define('composer', [
686
686
 
687
687
  if (uploads.inProgress[post_uuid] && uploads.inProgress[post_uuid].length) {
688
688
  return composerAlert(post_uuid, '[[error:still-uploading]]');
689
- } else if (checkTitle && payload.titleLen < parseInt(config.minimumTitleLength, 10)) {
689
+ } else if (!app.user.isAdmin && checkTitle && payload.titleLen < parseInt(config.minimumTitleLength, 10)) {
690
690
  return composerAlert(post_uuid, '[[error:title-too-short, ' + config.minimumTitleLength + ']]');
691
- } else if (checkTitle && payload.titleLen > parseInt(config.maximumTitleLength, 10)) {
691
+ } else if (!app.user.isAdmin && checkTitle && payload.titleLen > parseInt(config.maximumTitleLength, 10)) {
692
692
  return composerAlert(post_uuid, '[[error:title-too-long, ' + config.maximumTitleLength + ']]');
693
693
  } else if (action === 'topics.post' && !isCategorySelected) {
694
694
  return composerAlert(post_uuid, '[[error:category-not-selected]]');
695
- } else if (payload.bodyLen < parseInt(config.minimumPostLength, 10)) {
695
+ } else if (!app.user.isAdmin && payload.bodyLen < parseInt(config.minimumPostLength, 10)) {
696
696
  return composerAlert(post_uuid, '[[error:content-too-short, ' + config.minimumPostLength + ']]');
697
- } else if (payload.bodyLen > parseInt(config.maximumPostLength, 10)) {
697
+ } else if (!app.user.isAdmin && payload.bodyLen > parseInt(config.maximumPostLength, 10)) {
698
698
  return composerAlert(post_uuid, '[[error:content-too-long, ' + config.maximumPostLength + ']]');
699
699
  } else if (checkTitle && !tags.isEnoughTags(post_uuid)) {
700
700
  return composerAlert(post_uuid, '[[error:not-enough-tags, ' + tags.minTagCount() + ']]');
@@ -369,12 +369,9 @@
369
369
  }
370
370
  }
371
371
 
372
- @include media-breakpoint-up(md) {
373
- // without this formatting elements that are dropdowns are not visible on desktop.
374
- // on mobile dropdowns use bottom-sheet and overflow is auto
375
- .formatting-group {
376
- overflow: visible!important;
377
- }
372
+ // without this formatting elements that are dropdowns are not visible
373
+ .formatting-group:has([aria-expanded="true"]) {
374
+ overflow:visible!important;
378
375
  }
379
376
 
380
377
  @import './zen-mode';
@@ -1,5 +1,5 @@
1
1
  <div class="d-flex justify-content-between gap-2 align-items-center formatting-bar m-0">
2
- <ul class="list-unstyled mb-0 d-flex formatting-group gap-2 overflow-auto">
2
+ <ul class="list-unstyled mb-0 d-flex formatting-group gap-2 overflow-auto ghost-scrollbar" style="min-width: 0;">
3
3
  {{{ each formatting }}}
4
4
  {{{ if ./spacer }}}
5
5
  <li class="small spacer"></li>
@@ -42,10 +42,16 @@
42
42
  <span class="visually-hidden">[[topic:composer.additional-options]]</span>
43
43
  </button>
44
44
  <ul class="dropdown-menu dropdown-menu-end p-1" role="menu">
45
- <li><a class="dropdown-item rounded-1 display-scheduler {{{ if !canSchedule }}}hidden{{{ end }}}" role="menuitem">[[topic:composer.post-later]]</a></li>
46
- <li><a class="dropdown-item rounded-1 cancel-scheduling hidden" role="menuitem">[[modules:composer.cancel-scheduling]]</a></li>
45
+ <li>
46
+ <a class="dropdown-item rounded-1 display-scheduler {{{ if !canSchedule }}}hidden{{{ end }}}" role="menuitem">[[topic:composer.post-later]]</a>
47
+ </li>
48
+ <li>
49
+ <a class="dropdown-item rounded-1 cancel-scheduling hidden" role="menuitem">[[modules:composer.cancel-scheduling]]</a>
50
+ </li>
47
51
  {{{ each submitOptions }}}
48
- <li><a class="dropdown-item rounded-1" href="#" data-action="{./action}" role="menuitem">{{./text}}</a></li>
52
+ <li>
53
+ <a class="dropdown-item rounded-1" href="#" data-action="{./action}" role="menuitem">{{./text}}</a>
54
+ </li>
49
55
  {{{ end }}}
50
56
  </ul>
51
57
  </div>