nodebb-plugin-composer-default 10.3.5 → 10.3.6
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 +1 -1
- package/static/lib/composer.js +19 -23
package/package.json
CHANGED
package/static/lib/composer.js
CHANGED
|
@@ -226,23 +226,24 @@ define('composer', [
|
|
|
226
226
|
if (data.body) {
|
|
227
227
|
data.body = '> ' + data.body.replace(/\n/g, '\n> ') + '\n\n';
|
|
228
228
|
}
|
|
229
|
-
|
|
229
|
+
|
|
230
|
+
const composerTid = data.uuid ? composer.posts[data.uuid].tid : data.tid;
|
|
231
|
+
const inDifferentTopic = parseInt(data.tid, 10) !== parseInt(composerTid, 10);
|
|
232
|
+
const useTopicLink = data.title && (data.selectedPid || data.toPid) && inDifferentTopic;
|
|
233
|
+
const postHref = `${config.relative_path}/post/${encodeURIComponent(data.selectedPid || data.toPid)}`;
|
|
234
|
+
const topicLink = `[${escapedTitle}](${postHref})`;
|
|
235
|
+
|
|
236
|
+
const quoteKey = useTopicLink ?
|
|
237
|
+
'> [[modules:composer.user-said-in, ' + data.username + ', ' + topicLink + ']]\n>\n' :
|
|
238
|
+
'> [[modules:composer.user-said, ' + data.username + ', ' + postHref + ']]\n>\n';
|
|
239
|
+
|
|
230
240
|
if (data.uuid === undefined) {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
});
|
|
238
|
-
} else {
|
|
239
|
-
composer.newReply({
|
|
240
|
-
tid: data.tid,
|
|
241
|
-
toPid: data.toPid,
|
|
242
|
-
title: data.title,
|
|
243
|
-
body: '[[modules:composer.user-said, ' + data.username + ']]\n' + data.body,
|
|
244
|
-
});
|
|
245
|
-
}
|
|
241
|
+
composer.newReply({
|
|
242
|
+
tid: data.tid,
|
|
243
|
+
toPid: data.toPid,
|
|
244
|
+
title: data.title,
|
|
245
|
+
body: quoteKey + data.body,
|
|
246
|
+
});
|
|
246
247
|
return;
|
|
247
248
|
} else if (data.uuid !== composer.active) {
|
|
248
249
|
// If the composer is not currently active, activate it
|
|
@@ -252,18 +253,13 @@ define('composer', [
|
|
|
252
253
|
var postContainer = $('.composer[data-uuid="' + data.uuid + '"]');
|
|
253
254
|
var bodyEl = postContainer.find('textarea');
|
|
254
255
|
var prevText = bodyEl.val();
|
|
255
|
-
if (data.title && (data.selectedPid || data.toPid)) {
|
|
256
|
-
translator.translate('[[modules:composer.user-said-in, ' + data.username + ', ' + link + ']]\n', config.defaultLang, onTranslated);
|
|
257
|
-
} else {
|
|
258
|
-
translator.translate('[[modules:composer.user-said, ' + data.username + ']]\n', config.defaultLang, onTranslated);
|
|
259
|
-
}
|
|
260
256
|
|
|
261
|
-
function
|
|
257
|
+
translator.translate(quoteKey, config.defaultLang, function (translated) {
|
|
262
258
|
composer.posts[data.uuid].body = (prevText.length ? prevText + '\n\n' : '') + translated + data.body;
|
|
263
259
|
bodyEl.val(composer.posts[data.uuid].body);
|
|
264
260
|
focusElements(postContainer);
|
|
265
261
|
preview.render(postContainer);
|
|
266
|
-
}
|
|
262
|
+
});
|
|
267
263
|
};
|
|
268
264
|
|
|
269
265
|
composer.newReply = function (data) {
|