nodebb-plugin-composer-default 10.1.5 → 10.1.7
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
package/static/lib/admin.js
CHANGED
|
@@ -1,23 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
define('admin/plugins/composer-default', ['settings'
|
|
4
|
-
|
|
3
|
+
define('admin/plugins/composer-default', ['settings'], function (Settings) {
|
|
4
|
+
const ACP = {};
|
|
5
5
|
|
|
6
6
|
ACP.init = function () {
|
|
7
7
|
Settings.load('composer-default', $('.composer-default-settings'));
|
|
8
8
|
|
|
9
9
|
$('#save').on('click', function () {
|
|
10
|
-
Settings.save('composer-default', $('.composer-default-settings')
|
|
11
|
-
alerts.alert({
|
|
12
|
-
type: 'success',
|
|
13
|
-
alert_id: 'composer-default-saved',
|
|
14
|
-
title: 'Settings Saved',
|
|
15
|
-
message: 'Please reload your NodeBB to apply these settings',
|
|
16
|
-
clickfn: function () {
|
|
17
|
-
socket.emit('admin.reload');
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
});
|
|
10
|
+
Settings.save('composer-default', $('.composer-default-settings'));
|
|
21
11
|
});
|
|
22
12
|
};
|
|
23
13
|
|
package/static/lib/client.js
CHANGED
|
@@ -38,21 +38,24 @@ $(document).ready(function () {
|
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
$(window).on('action:composer.post.new', function (ev, data) {
|
|
41
|
+
// backwards compatibility
|
|
42
|
+
data.body = data.body || data.text;
|
|
43
|
+
data.title = data.title || data.topicName;
|
|
41
44
|
if (config['composer-default'].composeRouteEnabled !== 'on') {
|
|
42
45
|
require(['composer'], function (composer) {
|
|
43
46
|
composer.newReply({
|
|
44
47
|
tid: data.tid,
|
|
45
48
|
toPid: data.pid,
|
|
46
|
-
title: data.
|
|
47
|
-
body: data.
|
|
49
|
+
title: data.title,
|
|
50
|
+
body: data.body,
|
|
48
51
|
});
|
|
49
52
|
});
|
|
50
53
|
} else {
|
|
51
54
|
ajaxify.go(
|
|
52
55
|
'compose?tid=' + data.tid +
|
|
53
56
|
(data.pid ? '&toPid=' + data.pid : '') +
|
|
54
|
-
(data.
|
|
55
|
-
(data.
|
|
57
|
+
(data.title ? '&title=' + encodeURIComponent(data.title) : '') +
|
|
58
|
+
(data.body ? '&body=' + encodeURIComponent(data.body) : '')
|
|
56
59
|
);
|
|
57
60
|
}
|
|
58
61
|
});
|
|
@@ -50,7 +50,11 @@ define('composer/preview', ['hooks'], function (hooks) {
|
|
|
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
|
-
|
|
53
|
+
const previewToggled = localStorage.getItem('composer:previewToggled');
|
|
54
|
+
const hidePreviewOnOpen = config['composer-default'].hidePreviewOnOpen === 'on';
|
|
55
|
+
let show = !isMobile && (
|
|
56
|
+
((previewToggled === null && !hidePreviewOnOpen) || previewToggled)
|
|
57
|
+
);
|
|
54
58
|
const previewContainer = postContainer.querySelector('.preview-container');
|
|
55
59
|
const writeContainer = postContainer.querySelector('.write-container');
|
|
56
60
|
|
|
@@ -74,11 +78,7 @@ define('composer/preview', ['hooks'], function (hooks) {
|
|
|
74
78
|
previewContainer.classList.toggle('hide', !show);
|
|
75
79
|
writeContainer.classList.toggle('w-50', show);
|
|
76
80
|
writeContainer.classList.toggle('w-100', !show);
|
|
77
|
-
|
|
78
|
-
localStorage.setItem('composer:previewToggled', true);
|
|
79
|
-
} else {
|
|
80
|
-
localStorage.removeItem('composer:previewToggled');
|
|
81
|
-
}
|
|
81
|
+
localStorage.setItem('composer:previewToggled', show);
|
|
82
82
|
}
|
|
83
83
|
showText.classList.toggle('hide', show);
|
|
84
84
|
hideText.classList.toggle('hide', !show);
|
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
<div class="row">
|
|
3
3
|
<div class="col-sm-2 col-12 settings-header">General</div>
|
|
4
4
|
<div class="col-sm-10 col-12">
|
|
5
|
-
<div class="
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
<div class="form-check form-switch">
|
|
6
|
+
<input id="composeRouteEnabled" class="form-check-input" type="checkbox" name="composeRouteEnabled" />
|
|
7
|
+
<label for="composeRouteEnabled" class="form-check-label">Use a separate route for the composer</label>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<div class="form-check form-switch">
|
|
11
|
+
<input type="checkbox" class="form-check-input" id="hidePreviewOnOpen" name="hidePreviewOnOpen" />
|
|
12
|
+
<label for="hidePreviewOnOpen" class="form-check-label">Hide preview on open</label>
|
|
10
13
|
</div>
|
|
11
14
|
</div>
|
|
12
15
|
</div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<div class="tag-row">
|
|
2
2
|
<div class="tags-container d-flex align-items-center {{{ if tagWhitelist.length }}}haswhitelist{{{ end }}}">
|
|
3
3
|
<div class="btn-group dropup me-2 {{{ if !tagWhitelist.length }}}hidden{{{ end }}}" component="composer/tag/dropdown">
|
|
4
|
-
<button class="btn btn-
|
|
4
|
+
<button class="btn btn-sm btn-link text-body dropdown-toggle" data-bs-toggle="dropdown" type="button">
|
|
5
5
|
<span class="visible-sm-inline visible-md-inline visible-lg-inline"><i class="fa fa-tags"></i></span>
|
|
6
6
|
[[tags:select_tags]]
|
|
7
7
|
</button>
|