nodebb-plugin-composer-default 10.0.44 → 10.0.46
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
|
@@ -10,6 +10,9 @@ define('composer/scheduler', ['benchpress', 'bootbox', 'alerts'], function (Benc
|
|
|
10
10
|
};
|
|
11
11
|
let displayBtnCons = [];
|
|
12
12
|
let displayBtns;
|
|
13
|
+
let submitContainer;
|
|
14
|
+
let submitOptionsCon;
|
|
15
|
+
|
|
13
16
|
const submitBtn = {
|
|
14
17
|
el: null,
|
|
15
18
|
icon: null,
|
|
@@ -27,6 +30,8 @@ define('composer/scheduler', ['benchpress', 'bootbox', 'alerts'], function (Benc
|
|
|
27
30
|
|
|
28
31
|
displayBtnCons = $postContainer[0].querySelectorAll('.display-scheduler');
|
|
29
32
|
displayBtns = $postContainer[0].querySelectorAll('.display-scheduler i');
|
|
33
|
+
submitContainer = $postContainer.find('[component="composer/submit/container"]');
|
|
34
|
+
submitOptionsCon = $postContainer.find('[component="composer/submit/options/container"]');
|
|
30
35
|
|
|
31
36
|
submitBtn.el = $postContainer[0].querySelector('.composer-submit:not(.btn-sm)');
|
|
32
37
|
submitBtn.icon = submitBtn.el.querySelector('i');
|
|
@@ -58,6 +63,9 @@ define('composer/scheduler', ['benchpress', 'bootbox', 'alerts'], function (Benc
|
|
|
58
63
|
scheduler.onChangeCategory = function (categoryData) {
|
|
59
64
|
toggleDisplayButtons(categoryData.privileges['topics:schedule']);
|
|
60
65
|
toggleItems(false);
|
|
66
|
+
const optionsVisible = categoryData.privileges['topics:schedule'] || submitOptionsCon.attr('data-submit-options') > 0;
|
|
67
|
+
submitContainer.find('.composer-submit').toggleClass('rounded-1', !optionsVisible);
|
|
68
|
+
submitOptionsCon.toggleClass('hidden', !optionsVisible);
|
|
61
69
|
scheduler.reset();
|
|
62
70
|
};
|
|
63
71
|
|
package/static/lib/composer.js
CHANGED
|
@@ -332,9 +332,6 @@ define('composer', [
|
|
|
332
332
|
postContainer.attr('data-uuid', post_uuid);
|
|
333
333
|
}
|
|
334
334
|
|
|
335
|
-
var bodyEl = postContainer.find('textarea');
|
|
336
|
-
var submitBtn = postContainer.find('.composer-submit');
|
|
337
|
-
|
|
338
335
|
categoryList.init(postContainer, composer.posts[post_uuid]);
|
|
339
336
|
scheduler.init(postContainer, composer.posts);
|
|
340
337
|
|
|
@@ -350,7 +347,7 @@ define('composer', [
|
|
|
350
347
|
composer.posts[post_uuid].modified = true;
|
|
351
348
|
});
|
|
352
349
|
|
|
353
|
-
|
|
350
|
+
postContainer.on('click', '.composer-submit', function (e) {
|
|
354
351
|
e.preventDefault();
|
|
355
352
|
e.stopPropagation(); // Other click events bring composer back to active state which is undesired on submit
|
|
356
353
|
|
|
@@ -360,7 +357,7 @@ define('composer', [
|
|
|
360
357
|
|
|
361
358
|
require(['mousetrap'], function (mousetrap) {
|
|
362
359
|
mousetrap(postContainer.get(0)).bind('mod+enter', function () {
|
|
363
|
-
|
|
360
|
+
postContainer.find('.composer-submit').attr('disabled', true);
|
|
364
361
|
post(post_uuid);
|
|
365
362
|
});
|
|
366
363
|
});
|
|
@@ -393,11 +390,12 @@ define('composer', [
|
|
|
393
390
|
composer.minimize(post_uuid);
|
|
394
391
|
});
|
|
395
392
|
|
|
396
|
-
|
|
393
|
+
const textareaEl = postContainer.find('textarea');
|
|
394
|
+
textareaEl.on('input propertychange', utils.debounce(function () {
|
|
397
395
|
preview.render(postContainer);
|
|
398
396
|
}, 250));
|
|
399
397
|
|
|
400
|
-
|
|
398
|
+
textareaEl.on('scroll', function () {
|
|
401
399
|
preview.matchScroll(postContainer);
|
|
402
400
|
});
|
|
403
401
|
|
|
@@ -25,19 +25,20 @@
|
|
|
25
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 composer-minimize" 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
|
-
<div class="btn-group btn-group-sm">
|
|
29
|
-
<button class="btn btn-primary composer-submit fw-bold" data-action="post" tabindex="6" data-text-variant=" [[topic:composer.schedule]]"><i class="fa fa-check"></i> [[topic:composer.submit]]</button>
|
|
30
|
-
{{{ if (submitOptions.length || canSchedule) }}}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
28
|
+
<div class="btn-group btn-group-sm" component="composer/submit/container">
|
|
29
|
+
<button class="btn btn-primary composer-submit fw-bold {{{ if !(submitOptions.length || canSchedule) }}}rounded-1{{{ end }}}" data-action="post" tabindex="6" data-text-variant=" [[topic:composer.schedule]]"><i class="fa fa-check"></i> [[topic:composer.submit]]</button>
|
|
30
|
+
<div component="composer/submit/options/container" data-submit-options="{submitOptions.length}" class="btn-group btn-group-sm {{{ if !(submitOptions.length || canSchedule) }}}hidden{{{ end }}}">
|
|
31
|
+
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
|
32
|
+
<i class="fa fa-caret-down"></i>
|
|
33
|
+
<span class="sr-only">[[topic:composer.additional-options]]</span>
|
|
34
|
+
</button>
|
|
35
|
+
<ul class="dropdown-menu dropdown-menu-end p-1">
|
|
36
|
+
<li><a class="dropdown-item rounded-1 display-scheduler {{{ if !canSchedule }}}hidden{{{ end }}}">[[topic:composer.post-later]]</a></li>
|
|
37
|
+
{{{ each submitOptions }}}
|
|
38
|
+
<li><a class="dropdown-item rounded-1" href="#" data-action="{./action}">{./text}</a></li>
|
|
39
|
+
{{{ end }}}
|
|
40
|
+
</ul>
|
|
41
|
+
</div>
|
|
41
42
|
</div>
|
|
42
43
|
</div>
|
|
43
44
|
</div>
|