nodebb-plugin-composer-default 7.0.14 → 7.0.15
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/admin.js +2 -2
- package/static/lib/composer/drafts.js +3 -3
- package/static/lib/composer/resize.js +1 -1
- package/static/lib/composer/scheduler.js +2 -2
- package/static/lib/composer/tags.js +8 -8
- package/static/lib/composer/uploads.js +5 -4
- package/static/lib/composer.js +6 -5
package/package.json
CHANGED
package/static/lib/admin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
define('admin/plugins/composer-default', ['settings'], function (Settings) {
|
|
3
|
+
define('admin/plugins/composer-default', ['settings', 'alerts'], function (Settings, alerts) {
|
|
4
4
|
var ACP = {};
|
|
5
5
|
|
|
6
6
|
ACP.init = function () {
|
|
@@ -8,7 +8,7 @@ define('admin/plugins/composer-default', ['settings'], function (Settings) {
|
|
|
8
8
|
|
|
9
9
|
$('#save').on('click', function () {
|
|
10
10
|
Settings.save('composer-default', $('.composer-default-settings'), function () {
|
|
11
|
-
|
|
11
|
+
alerts.alert({
|
|
12
12
|
type: 'success',
|
|
13
13
|
alert_id: 'composer-default-saved',
|
|
14
14
|
title: 'Settings Saved',
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
define('composer/drafts', ['api'], function (api) {
|
|
3
|
+
define('composer/drafts', ['api', 'alerts'], function (api, alerts) {
|
|
4
4
|
var drafts = {};
|
|
5
|
-
var
|
|
5
|
+
var saveThrottleId;
|
|
6
6
|
|
|
7
7
|
drafts.init = function (postContainer, postData) {
|
|
8
8
|
var draftIconEl = postContainer.find('.draft-icon');
|
|
@@ -263,7 +263,7 @@ define('composer/drafts', ['api'], function (api) {
|
|
|
263
263
|
} else if (type === 'tid') {
|
|
264
264
|
socket.emit('topics.getTopic', id, function (err, topicObj) {
|
|
265
265
|
if (err) {
|
|
266
|
-
return
|
|
266
|
+
return alerts.error(err);
|
|
267
267
|
}
|
|
268
268
|
composer.newReply(id, undefined, topicObj.title, draft.text);
|
|
269
269
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
define('composer/scheduler', ['benchpress', 'bootbox'], function (Benchpress, bootbox) {
|
|
3
|
+
define('composer/scheduler', ['benchpress', 'bootbox', 'alerts'], function (Benchpress, bootbox, alerts) {
|
|
4
4
|
const scheduler = {};
|
|
5
5
|
const state = {
|
|
6
6
|
timestamp: 0,
|
|
@@ -128,7 +128,7 @@ define('composer/scheduler', ['benchpress', 'bootbox'], function (Benchpress, bo
|
|
|
128
128
|
if (!bothFilled || isNaN(timestamp) || timestamp < Date.now()) {
|
|
129
129
|
state.timestamp = 0;
|
|
130
130
|
const message = timestamp < Date.now() ? '[[error:scheduling-to-past]]' : '[[error:invalid-schedule-date]]';
|
|
131
|
-
|
|
131
|
+
alerts.alert({
|
|
132
132
|
type: 'danger',
|
|
133
133
|
timeout: 3000,
|
|
134
134
|
title: '',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
define('composer/tags', function () {
|
|
4
|
+
define('composer/tags', ['alerts'], function (alerts) {
|
|
5
5
|
var tags = {};
|
|
6
6
|
|
|
7
7
|
var minTags;
|
|
@@ -38,7 +38,7 @@ define('composer/tags', function () {
|
|
|
38
38
|
cid: postData.cid,
|
|
39
39
|
}, function (err, tags) {
|
|
40
40
|
if (err) {
|
|
41
|
-
return
|
|
41
|
+
return alerts.error(err);
|
|
42
42
|
}
|
|
43
43
|
if (tags) {
|
|
44
44
|
response(tags);
|
|
@@ -64,11 +64,11 @@ define('composer/tags', function () {
|
|
|
64
64
|
reachedMaxTags;
|
|
65
65
|
|
|
66
66
|
if (event.item.length < config.minimumTagLength) {
|
|
67
|
-
return
|
|
67
|
+
return alerts.error('[[error:tag-too-short, ' + config.minimumTagLength + ']]');
|
|
68
68
|
} else if (event.item.length > config.maximumTagLength) {
|
|
69
|
-
return
|
|
69
|
+
return alerts.error('[[error:tag-too-long, ' + config.maximumTagLength + ']]');
|
|
70
70
|
} else if (reachedMaxTags) {
|
|
71
|
-
return
|
|
71
|
+
return alerts.error('[[error:too-many-tags, ' + maxTags + ']]');
|
|
72
72
|
}
|
|
73
73
|
if (different) {
|
|
74
74
|
tagEl.tagsinput('add', cleanTag);
|
|
@@ -88,10 +88,10 @@ define('composer/tags', function () {
|
|
|
88
88
|
}
|
|
89
89
|
socket.emit('topics.canRemoveTag', { tag: event.item }, function (err, allowed) {
|
|
90
90
|
if (err) {
|
|
91
|
-
return
|
|
91
|
+
return alerts.error(err);
|
|
92
92
|
}
|
|
93
93
|
if (!allowed) {
|
|
94
|
-
|
|
94
|
+
alerts.error('[[error:cant-remove-system-tag]]');
|
|
95
95
|
skipAddCheck = true;
|
|
96
96
|
tagEl.tagsinput('add', event.item);
|
|
97
97
|
}
|
|
@@ -106,7 +106,7 @@ define('composer/tags', function () {
|
|
|
106
106
|
var cid = postData.hasOwnProperty('cid') ? postData.cid : ajaxify.data.cid;
|
|
107
107
|
socket.emit('topics.isTagAllowed', { tag: event.item, cid: cid || 0 }, function (err, allowed) {
|
|
108
108
|
if (err) {
|
|
109
|
-
return
|
|
109
|
+
return alerts.error(err);
|
|
110
110
|
}
|
|
111
111
|
if (!allowed) {
|
|
112
112
|
skipRemoveCheck = true;
|
|
@@ -4,8 +4,9 @@ define('composer/uploads', [
|
|
|
4
4
|
'composer/preview',
|
|
5
5
|
'composer/categoryList',
|
|
6
6
|
'translator',
|
|
7
|
+
'alerts',
|
|
7
8
|
'jquery-form',
|
|
8
|
-
], function (preview, categoryList, translator) {
|
|
9
|
+
], function (preview, categoryList, translator, alerts) {
|
|
9
10
|
var uploads = {
|
|
10
11
|
inProgress: {},
|
|
11
12
|
};
|
|
@@ -193,7 +194,7 @@ define('composer/uploads', [
|
|
|
193
194
|
for (i = 0; i < files.length; ++i) {
|
|
194
195
|
isImage = files[i].type.match(/image./);
|
|
195
196
|
if ((isImage && !app.user.privileges['upload:post:image']) || (!isImage && !app.user.privileges['upload:post:file'])) {
|
|
196
|
-
return
|
|
197
|
+
return alerts.error('[[error:no-privileges]]');
|
|
197
198
|
}
|
|
198
199
|
}
|
|
199
200
|
|
|
@@ -207,7 +208,7 @@ define('composer/uploads', [
|
|
|
207
208
|
|
|
208
209
|
if (files[i].size > parseInt(config.maximumFileSize, 10) * 1024) {
|
|
209
210
|
uploadForm[0].reset();
|
|
210
|
-
return
|
|
211
|
+
return alerts.error('[[error:file-too-big, ' + config.maximumFileSize + ']]');
|
|
211
212
|
}
|
|
212
213
|
|
|
213
214
|
text = insertText(text, textarea.getCursorPosition(), (isImage ? '!' : '') + '[' + filenameMapping[i] + '](' + uploadingText + ') ');
|
|
@@ -321,7 +322,7 @@ define('composer/uploads', [
|
|
|
321
322
|
if (xhr && xhr.status === 413) {
|
|
322
323
|
msg = xhr.statusText || 'Request Entity Too Large';
|
|
323
324
|
}
|
|
324
|
-
|
|
325
|
+
alerts.error(msg);
|
|
325
326
|
$(window).trigger('action:composer.uploadError', {
|
|
326
327
|
post_uuid: post_uuid,
|
|
327
328
|
message: msg,
|
package/static/lib/composer.js
CHANGED
|
@@ -18,12 +18,13 @@ define('composer', [
|
|
|
18
18
|
'topicThumbs',
|
|
19
19
|
'api',
|
|
20
20
|
'bootbox',
|
|
21
|
+
'alerts',
|
|
21
22
|
'hooks',
|
|
22
23
|
'messages',
|
|
23
24
|
'search',
|
|
24
25
|
], function (taskbar, translator, uploads, formatting, drafts, tags,
|
|
25
26
|
categoryList, preview, resize, autocomplete, scheduler, scrollStop,
|
|
26
|
-
topicThumbs, api, bootbox, hooks, messagesModule, search
|
|
27
|
+
topicThumbs, api, bootbox, alerts, hooks, messagesModule, search
|
|
27
28
|
) {
|
|
28
29
|
var composer = {
|
|
29
30
|
active: undefined,
|
|
@@ -107,7 +108,7 @@ define('composer', [
|
|
|
107
108
|
|
|
108
109
|
function alreadyOpen(post) {
|
|
109
110
|
// If a composer for the same cid/tid/pid is already open, return the uuid, else return bool false
|
|
110
|
-
var
|
|
111
|
+
var type;
|
|
111
112
|
var id;
|
|
112
113
|
|
|
113
114
|
if (post.hasOwnProperty('cid')) {
|
|
@@ -172,7 +173,7 @@ define('composer', [
|
|
|
172
173
|
const { showAlert } = await hooks.fire('filter:composer.error', { post_uuid, message, showAlert: true });
|
|
173
174
|
|
|
174
175
|
if (showAlert) {
|
|
175
|
-
|
|
176
|
+
alerts.alert({
|
|
176
177
|
type: 'danger',
|
|
177
178
|
timeout: 3000,
|
|
178
179
|
title: '',
|
|
@@ -276,7 +277,7 @@ define('composer', [
|
|
|
276
277
|
composer.editPost = function (pid) {
|
|
277
278
|
socket.emit('plugins.composer.push', pid, function (err, threadData) {
|
|
278
279
|
if (err) {
|
|
279
|
-
return
|
|
280
|
+
return alerts.error(err);
|
|
280
281
|
}
|
|
281
282
|
threadData.action = 'posts.edit';
|
|
282
283
|
threadData.pid = pid;
|
|
@@ -297,7 +298,7 @@ define('composer', [
|
|
|
297
298
|
} else {
|
|
298
299
|
socket.emit('plugins.composer.getFormattingOptions', function (err, options) {
|
|
299
300
|
if (err) {
|
|
300
|
-
return
|
|
301
|
+
return alerts.error(err);
|
|
301
302
|
}
|
|
302
303
|
composer.formatting = options;
|
|
303
304
|
createNewComposer(post_uuid);
|