nodebb-plugin-composer-default 7.0.20 → 8.0.0
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nodebb-plugin-composer-default",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "Default composer for NodeBB",
|
|
5
5
|
"main": "library.js",
|
|
6
6
|
"repository": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"readmeFilename": "README.md",
|
|
28
28
|
"nbbpm": {
|
|
29
|
-
"compatibility": "^
|
|
29
|
+
"compatibility": "^2.0.0"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"screenfull": "^5.0.2",
|
package/plugin.json
CHANGED
|
@@ -27,10 +27,8 @@
|
|
|
27
27
|
"composer/scheduler.js": "./static/lib/composer/scheduler.js",
|
|
28
28
|
"composer/tags.js": "./static/lib/composer/tags.js",
|
|
29
29
|
"composer/uploads.js": "./static/lib/composer/uploads.js",
|
|
30
|
-
"composer/autocomplete.js": "./static/lib/composer/autocomplete.js"
|
|
30
|
+
"composer/autocomplete.js": "./static/lib/composer/autocomplete.js",
|
|
31
|
+
"../admin/plugins/composer-default.js": "./static/lib/admin.js"
|
|
31
32
|
},
|
|
32
|
-
"acpScripts": [
|
|
33
|
-
"./static/lib/admin.js"
|
|
34
|
-
],
|
|
35
33
|
"templates": "static/templates"
|
|
36
34
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
define('composer/autocomplete', [
|
|
3
|
+
define('composer/autocomplete', [
|
|
4
|
+
'composer/preview', 'textcomplete', 'textcomplete.contenteditable'
|
|
5
|
+
], function (preview, TextComplete, TextCompleteContentEditable) {
|
|
4
6
|
var autocomplete = {
|
|
5
7
|
_active: {},
|
|
6
8
|
};
|
|
@@ -42,12 +44,14 @@ define('composer/autocomplete', ['composer/preview'], function (preview) {
|
|
|
42
44
|
clearTimeout(timer);
|
|
43
45
|
timer = setTimeout(function () {
|
|
44
46
|
var dropdown = document.querySelector('.' + dropdownClass);
|
|
45
|
-
|
|
47
|
+
if (dropdown) {
|
|
48
|
+
var pos = dropdown.getBoundingClientRect();
|
|
46
49
|
|
|
47
|
-
|
|
50
|
+
var margin = parseFloat(dropdown.style.marginTop, 10) || 0;
|
|
48
51
|
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
var offset = window.innerHeight + margin - 10 - pos.bottom;
|
|
53
|
+
dropdown.style.marginTop = Math.min(offset, 0) + 'px';
|
|
54
|
+
}
|
|
51
55
|
}, 0);
|
|
52
56
|
});
|
|
53
57
|
|
|
@@ -68,17 +72,16 @@ define('composer/autocomplete', ['composer/preview'], function (preview) {
|
|
|
68
72
|
}
|
|
69
73
|
var editor;
|
|
70
74
|
if (element.nodeName === 'TEXTAREA') {
|
|
71
|
-
|
|
72
|
-
editor = new Textarea(element);
|
|
75
|
+
editor = new TextComplete.Textarea(element);
|
|
73
76
|
} else if (element.nodeName === 'DIV' && element.getAttribute('contenteditable') === 'true') {
|
|
74
|
-
var ContentEditable =
|
|
77
|
+
var ContentEditable = TextCompleteContentEditable.default;
|
|
75
78
|
editor = new ContentEditable(element);
|
|
76
79
|
}
|
|
77
80
|
|
|
78
81
|
// yuku-t/textcomplete inherits directionality from target element itself
|
|
79
82
|
element.setAttribute('dir', document.querySelector('html').getAttribute('data-dir'));
|
|
80
83
|
|
|
81
|
-
var textcomplete = new
|
|
84
|
+
var textcomplete = new TextComplete.Textcomplete(editor, {
|
|
82
85
|
dropdown: data.options,
|
|
83
86
|
});
|
|
84
87
|
textcomplete.register(data.strategies);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
define('composer/formatting', [
|
|
4
|
+
'composer/preview', 'composer/resize', 'topicThumbs', 'screenfull',
|
|
5
|
+
], function (preview, resize, topicThumbs, screenfull) {
|
|
6
6
|
var formatting = {};
|
|
7
7
|
|
|
8
8
|
var formattingDispatchTable = {
|
package/static/lib/composer.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
/* globals screenfull */
|
|
4
|
-
|
|
5
3
|
define('composer', [
|
|
6
4
|
'taskbar',
|
|
7
5
|
'translator',
|
|
@@ -22,10 +20,10 @@ define('composer', [
|
|
|
22
20
|
'hooks',
|
|
23
21
|
'messages',
|
|
24
22
|
'search',
|
|
23
|
+
'screenfull',
|
|
25
24
|
], function (taskbar, translator, uploads, formatting, drafts, tags,
|
|
26
25
|
categoryList, preview, resize, autocomplete, scheduler, scrollStop,
|
|
27
|
-
topicThumbs, api, bootbox, alerts, hooks, messagesModule, search
|
|
28
|
-
) {
|
|
26
|
+
topicThumbs, api, bootbox, alerts, hooks, messagesModule, search, screenfull) {
|
|
29
27
|
var composer = {
|
|
30
28
|
active: undefined,
|
|
31
29
|
posts: {},
|
|
@@ -175,7 +173,7 @@ define('composer', [
|
|
|
175
173
|
if (showAlert) {
|
|
176
174
|
alerts.alert({
|
|
177
175
|
type: 'danger',
|
|
178
|
-
timeout:
|
|
176
|
+
timeout: 10000,
|
|
179
177
|
title: '',
|
|
180
178
|
message: message,
|
|
181
179
|
alert_id: 'post_error',
|
|
@@ -198,7 +196,7 @@ define('composer', [
|
|
|
198
196
|
formatting.addButton(iconClass, onClick, title);
|
|
199
197
|
};
|
|
200
198
|
|
|
201
|
-
composer.newTopic =
|
|
199
|
+
composer.newTopic = async (data) => {
|
|
202
200
|
var pushData = {
|
|
203
201
|
action: 'topics.post',
|
|
204
202
|
cid: data.cid,
|
|
@@ -209,10 +207,10 @@ define('composer', [
|
|
|
209
207
|
isMain: true,
|
|
210
208
|
};
|
|
211
209
|
|
|
212
|
-
|
|
210
|
+
({ pushData } = await hooks.fire('filter:composer.topic.push', {
|
|
213
211
|
data: data,
|
|
214
212
|
pushData: pushData,
|
|
215
|
-
});
|
|
213
|
+
}));
|
|
216
214
|
|
|
217
215
|
push(pushData);
|
|
218
216
|
};
|
|
@@ -794,7 +792,7 @@ define('composer', [
|
|
|
794
792
|
removeComposerHistory();
|
|
795
793
|
}
|
|
796
794
|
|
|
797
|
-
|
|
795
|
+
hooks.fire('action:composer.' + action, { composerData: composerData, data: data });
|
|
798
796
|
})
|
|
799
797
|
.catch((err) => {
|
|
800
798
|
// Restore composer on error
|