nodebb-plugin-composer-default 10.3.6 → 10.3.8
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/library.js
CHANGED
|
@@ -45,19 +45,22 @@ plugin.addAdminNavigation = async function (header) {
|
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
plugin.addPrefetchTags = async function (hookData) {
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
48
|
+
const { req } = hookData;
|
|
49
|
+
if (req.uid > 0) {
|
|
50
|
+
const prefetch = [
|
|
51
|
+
'/assets/src/modules/composer.js', '/assets/src/modules/composer/uploads.js', '/assets/src/modules/composer/drafts.js',
|
|
52
|
+
'/assets/src/modules/composer/tags.js', '/assets/src/modules/composer/categoryList.js', '/assets/src/modules/composer/resize.js',
|
|
53
|
+
'/assets/src/modules/composer/autocomplete.js', '/assets/templates/composer.tpl',
|
|
54
|
+
`/assets/language/${meta.config.defaultLang || 'en-GB'}/topic.json`,
|
|
55
|
+
`/assets/language/${meta.config.defaultLang || 'en-GB'}/modules.json`,
|
|
56
|
+
`/assets/language/${meta.config.defaultLang || 'en-GB'}/tags.json`,
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
hookData.links = hookData.links.concat(prefetch.map(path => ({
|
|
60
|
+
rel: 'prefetch',
|
|
61
|
+
href: `${nconf.get('relative_path') + path}?${meta.config['cache-buster']}`,
|
|
62
|
+
})));
|
|
63
|
+
}
|
|
61
64
|
|
|
62
65
|
return hookData;
|
|
63
66
|
};
|
|
@@ -178,7 +181,9 @@ plugin.filterComposerBuild = async function (hookData) {
|
|
|
178
181
|
}
|
|
179
182
|
globalPrivileges['topics:tag'] = canTagTopics;
|
|
180
183
|
const cid = parseInt(req.query.cid, 10);
|
|
181
|
-
const topicTitle = topicData && topicData.title ?
|
|
184
|
+
const topicTitle = topicData && topicData.title ?
|
|
185
|
+
topicData.title :
|
|
186
|
+
validator.escape(String(req.query.title || ''));
|
|
182
187
|
return {
|
|
183
188
|
req: req,
|
|
184
189
|
res: res,
|
|
@@ -197,6 +202,13 @@ plugin.filterComposerBuild = async function (hookData) {
|
|
|
197
202
|
// can't use title property as that is used for page title
|
|
198
203
|
topicTitle: topicTitle,
|
|
199
204
|
titleLength: topicTitle ? topicTitle.length : 0,
|
|
205
|
+
titleLabel: translator.compile(
|
|
206
|
+
isEditing ?
|
|
207
|
+
'topic:composer.editing-in' :
|
|
208
|
+
'topic:composer.replying-to',
|
|
209
|
+
`"${topicTitle}"`
|
|
210
|
+
),
|
|
211
|
+
|
|
200
212
|
topic: topicData,
|
|
201
213
|
thumb: topicData ? topicData.thumb : '',
|
|
202
214
|
body: body,
|
package/package.json
CHANGED
package/static/lib/composer.js
CHANGED
|
@@ -444,18 +444,19 @@ define('composer', [
|
|
|
444
444
|
var isGuestPost = postData ? parseInt(postData.uid, 10) === 0 : false;
|
|
445
445
|
const isScheduled = postData.timestamp > Date.now();
|
|
446
446
|
|
|
447
|
-
// see
|
|
448
|
-
// https://github.com/NodeBB/NodeBB/issues/2994 and
|
|
449
|
-
// https://github.com/NodeBB/NodeBB/issues/1951
|
|
450
|
-
// remove when 1951 is resolved
|
|
451
|
-
|
|
452
|
-
var title = postData.title.replace(/%/g, '%').replace(/,/g, ',');
|
|
453
447
|
postData.category = await getSelectedCategory(postData);
|
|
454
448
|
const privileges = postData.category ? postData.category.privileges : ajaxify.data.privileges;
|
|
455
449
|
const topicTemplate = isTopic && postData.category ? postData.category.topicTemplate : '';
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
450
|
+
|
|
451
|
+
let data = {
|
|
452
|
+
topicTitle: postData.title,
|
|
453
|
+
titleLength: postData.title.length,
|
|
454
|
+
titleLabel: translator.compile(
|
|
455
|
+
isEditing ?
|
|
456
|
+
'topic:composer.editing-in' :
|
|
457
|
+
'topic:composer.replying-to',
|
|
458
|
+
`"${postData.title}"`
|
|
459
|
+
),
|
|
459
460
|
body: utils.escapeHTML(translator.escape(postData.body) || topicTemplate),
|
|
460
461
|
mobile: composer.bsEnvironment === 'xs' || composer.bsEnvironment === 'sm',
|
|
461
462
|
resizable: true,
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
</div>
|
|
13
13
|
{{{ end }}}
|
|
14
14
|
{{{ if !isTopicOrMain }}}
|
|
15
|
-
<h4 class="title text-bg-primary">{
|
|
15
|
+
<h4 class="title text-bg-primary">{titleLabel}</h4>
|
|
16
16
|
{{{ end }}}
|
|
17
17
|
<div class="display-scheduler p-2 {{{ if !canSchedule }}} hidden{{{ end }}}">
|
|
18
18
|
<i class="fa fa-clock-o"></i>
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
{{{ if isTopicOrMain }}}
|
|
16
16
|
<input class="title form-control h-100 rounded-1 shadow-none" type="text" placeholder="[[topic:composer.title-placeholder]]" value="{topicTitle}" />
|
|
17
17
|
{{{ else }}}
|
|
18
|
-
<span class="{{{ if !template.compose }}}d-none d-md-block{{{ else }}}d-block{{{ end }}} title h-100 text-truncate">{
|
|
18
|
+
<span class="{{{ if !template.compose }}}d-none d-md-block{{{ else }}}d-block{{{ end }}} title h-100 text-truncate">{titleLabel}</span>
|
|
19
19
|
{{{ end }}}
|
|
20
20
|
<div id="quick-search-container" class="quick-search-container mt-2 dropdown-menu d-block p-2 hidden">
|
|
21
21
|
<div class="text-center loading-indicator"><i class="fa fa-spinner fa-spin"></i></div>
|