nodebb-plugin-composer-default 10.0.23 → 10.0.25

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.23",
3
+ "version": "10.0.25",
4
4
  "description": "Default composer for NodeBB",
5
5
  "main": "library.js",
6
6
  "repository": {
@@ -5,7 +5,14 @@ define('composer/drafts', ['api', 'alerts'], function (api, alerts) {
5
5
  const draftSaveDelay = 1000;
6
6
  drafts.init = function (postContainer, postData) {
7
7
  const draftIconEl = postContainer.find('.draft-icon');
8
+ const uuid = postContainer.attr('data-uuid');
8
9
  function doSaveDraft() {
10
+ // check if composer is still around,
11
+ // it might have been gone by the time this timeout triggers
12
+ if (!$(`[component="composer"][data-uuid="${uuid}"]`).length) {
13
+ return;
14
+ }
15
+
9
16
  if (!postData.save_id) {
10
17
  postData.save_id = utils.generateSaveId(app.user.uid);
11
18
  }
@@ -45,12 +45,12 @@ define('composer/preview', ['hooks'], function (hooks) {
45
45
 
46
46
  preview.handleToggler = function ($postContainer) {
47
47
  const postContainer = $postContainer.get(0);
48
-
49
- const isMobile = ['xs', 'sm'].includes(utils.findBootstrapEnvironment());
48
+ preview.env = utils.findBootstrapEnvironment();
49
+ const isMobile = ['xs', 'sm'].includes(preview.env);
50
50
  const toggler = postContainer.querySelector('.formatting-bar [data-action="preview"]');
51
51
  const showText = toggler.querySelector('.show-text');
52
52
  const hideText = toggler.querySelector('.hide-text');
53
- let show = localStorage.getItem('composer:previewToggled') || (preview.env === 'xs' || preview.env === 'sm');
53
+ let show = localStorage.getItem('composer:previewToggled') && !isMobile;
54
54
  const previewContainer = postContainer.querySelector('.preview-container');
55
55
  const writeContainer = postContainer.querySelector('.write-container');
56
56
 
@@ -62,10 +62,14 @@ define('composer/preview', ['hooks'], function (hooks) {
62
62
  if (isMobile) {
63
63
  previewContainer.classList.toggle('hide', false);
64
64
  writeContainer.classList.toggle('maximized', false);
65
+
65
66
  previewContainer.classList.toggle('d-none', !show);
66
67
  previewContainer.classList.toggle('d-flex', show);
68
+ previewContainer.classList.toggle('w-100', show);
69
+
67
70
  writeContainer.classList.toggle('d-flex', !show);
68
71
  writeContainer.classList.toggle('d-none', show);
72
+ writeContainer.classList.toggle('w-100', !show);
69
73
  } else {
70
74
  previewContainer.classList.toggle('hide', !show);
71
75
  writeContainer.classList.toggle('w-50', show);
@@ -2,7 +2,7 @@
2
2
 
3
3
  <div class="composer-container d-flex flex-column gap-1 h-100">
4
4
  <!-- mobile header -->
5
- <nav class="navbar fixed-top mobile-navbar hidden-md hidden-lg text-bg-primary flex-nowrap">
5
+ <nav class="navbar fixed-top mobile-navbar hidden-md hidden-lg text-bg-primary flex-nowrap gap-1">
6
6
  <div class="btn-group">
7
7
  <button class="btn btn-sm btn-primary composer-discard" data-action="discard" tabindex="-1"><i class="fa fa-times"></i></button>
8
8
  <button class="btn btn-sm btn-primary composer-minimize" data-action="minimize" tabindex="-1"><i class="fa fa-minus"></i></button>
@@ -15,7 +15,7 @@
15
15
  <!-- IF !isTopicOrMain -->
16
16
  <h4 class="title text-bg-primary">[[topic:composer.replying_to, "{topicTitle}"]]</h4>
17
17
  <!-- ENDIF !isTopicOrMain -->
18
- <div class="display-scheduler float-end{{{ if !canSchedule }}} hidden{{{ end }}}">
18
+ <div class="display-scheduler p-2 {{{ if !canSchedule }}} hidden{{{ end }}}">
19
19
  <i class="fa fa-clock-o"></i>
20
20
  </div>
21
21
  <div class="btn-group">
@@ -1,5 +1,5 @@
1
- <div class="d-flex justify-content-between align-items-center formatting-bar">
2
- <ul class="list-unstyled mb-0 d-flex formatting-group gap-2">
1
+ <div class="d-flex justify-content-between gap-2 align-items-center formatting-bar">
2
+ <ul class="list-unstyled mb-0 d-flex formatting-group gap-2 overflow-auto">
3
3
  <!-- BEGIN formatting -->
4
4
  <!-- IF formatting.spacer -->
5
5
  <li class="small spacer"></li>
@@ -22,7 +22,7 @@
22
22
  </div>
23
23
  </div>
24
24
 
25
- <div class="d-flex action-bar gap-1 hidden-sm hidden-xs align-items-center">
25
+ <div class="d-none d-md-flex action-bar gap-1 align-items-center">
26
26
  <button class="btn btn-sm btn-link text-body fw-semibold" data-action="hide" tabindex="-1"><i class="fa fa-angle-down"></i> [[topic:composer.hide]]</button>
27
27
  <button class="btn btn-sm btn-link composer-discard text-body fw-semibold" data-action="discard" tabindex="-1"><i class="fa fa-trash"></i> [[topic:composer.discard]]</button>
28
28
  <div class="btn-group btn-group-sm">