nodebb-plugin-composer-default 7.0.16 → 7.0.20
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
|
@@ -436,16 +436,6 @@
|
|
|
436
436
|
box-shadow: none;
|
|
437
437
|
}
|
|
438
438
|
|
|
439
|
-
.imagedrop {
|
|
440
|
-
position: absolute;
|
|
441
|
-
top: 250px;
|
|
442
|
-
text-align: center;
|
|
443
|
-
font-size: 24px;
|
|
444
|
-
color: #999;
|
|
445
|
-
width: 100%;
|
|
446
|
-
display: none;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
439
|
.draft-icon {
|
|
450
440
|
font-family: 'FontAwesome';
|
|
451
441
|
color: @state-success-text;
|
|
@@ -261,7 +261,7 @@ define('composer/drafts', ['api', 'alerts'], function (api, alerts) {
|
|
|
261
261
|
tags: [],
|
|
262
262
|
});
|
|
263
263
|
} else if (type === 'tid') {
|
|
264
|
-
|
|
264
|
+
api.get('/topics/' + id, {}, function (err, topicObj) {
|
|
265
265
|
if (err) {
|
|
266
266
|
return alerts.error(err);
|
|
267
267
|
}
|
|
@@ -17,6 +17,7 @@ define('composer/formatting', ['composer/preview', 'composer/resize', 'topicThum
|
|
|
17
17
|
},
|
|
18
18
|
|
|
19
19
|
thumbs: function () {
|
|
20
|
+
formatting.exitFullscreen();
|
|
20
21
|
var postContainer = this;
|
|
21
22
|
require(['composer'], function (composer) {
|
|
22
23
|
const uuid = postContainer.get(0).getAttribute('data-uuid');
|
|
@@ -61,11 +62,18 @@ define('composer/formatting', ['composer/preview', 'composer/resize', 'topicThum
|
|
|
61
62
|
});
|
|
62
63
|
|
|
63
64
|
screenfull.toggle(postContainer.get(0));
|
|
65
|
+
$(window).trigger('action:composer.fullscreen', { postContainer: postContainer });
|
|
64
66
|
},
|
|
65
67
|
};
|
|
66
68
|
|
|
67
69
|
var buttons = [];
|
|
68
70
|
|
|
71
|
+
formatting.exitFullscreen = function () {
|
|
72
|
+
if (screenfull.isEnabled && screenfull.isFullscreen) {
|
|
73
|
+
screenfull.exit();
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
69
77
|
formatting.addComposerButtons = function () {
|
|
70
78
|
for (var x = 0, numButtons = buttons.length; x < numButtons; x++) {
|
|
71
79
|
$('.formatting-bar .formatting-group #fileForm').before('<li tabindex="-1" data-format="' + buttons[x].name + '" title="' + (buttons[x].title || '') + '"><i class="' + buttons[x].iconClass + '"></i></li>');
|
|
@@ -5,8 +5,9 @@ define('composer/uploads', [
|
|
|
5
5
|
'composer/categoryList',
|
|
6
6
|
'translator',
|
|
7
7
|
'alerts',
|
|
8
|
+
'uploadHelpers',
|
|
8
9
|
'jquery-form',
|
|
9
|
-
], function (preview, categoryList, translator, alerts) {
|
|
10
|
+
], function (preview, categoryList, translator, alerts, uploadHelpers) {
|
|
10
11
|
var uploads = {
|
|
11
12
|
inProgress: {},
|
|
12
13
|
};
|
|
@@ -67,103 +68,33 @@ define('composer/uploads', [
|
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
function initializeDragAndDrop(post_uuid) {
|
|
70
|
-
var draggingDocument = false;
|
|
71
71
|
var postContainer = $('.composer[data-uuid="' + post_uuid + '"]');
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (draggingDocument) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
drop.css('top', '0px');
|
|
80
|
-
drop.css('height', postContainer.height() + 'px');
|
|
81
|
-
drop.css('line-height', postContainer.height() + 'px');
|
|
82
|
-
drop.show();
|
|
83
|
-
|
|
84
|
-
drop.on('dragleave', function () {
|
|
85
|
-
drop.hide();
|
|
86
|
-
drop.off('dragleave');
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function onDragDrop(e) {
|
|
91
|
-
e.preventDefault();
|
|
92
|
-
var files = e.originalEvent.dataTransfer.files;
|
|
93
|
-
var fd;
|
|
94
|
-
|
|
95
|
-
if (files.length) {
|
|
96
|
-
if (window.FormData) {
|
|
97
|
-
fd = new FormData();
|
|
98
|
-
for (var i = 0; i < files.length; ++i) {
|
|
99
|
-
fd.append('files[]', files[i], files[i].name);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
72
|
+
uploadHelpers.handleDragDrop({
|
|
73
|
+
container: postContainer,
|
|
74
|
+
callback: function (upload) {
|
|
103
75
|
uploadContentFiles({
|
|
104
|
-
files: files,
|
|
76
|
+
files: upload.files,
|
|
105
77
|
post_uuid: post_uuid,
|
|
106
78
|
route: '/api/post/upload',
|
|
107
|
-
formData:
|
|
79
|
+
formData: upload.formData,
|
|
108
80
|
});
|
|
109
81
|
}
|
|
110
|
-
|
|
111
|
-
drop.hide();
|
|
112
|
-
return false;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function cancel(e) {
|
|
116
|
-
e.preventDefault();
|
|
117
|
-
return false;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
$(document)
|
|
121
|
-
.off('dragstart')
|
|
122
|
-
.on('dragstart', function () {
|
|
123
|
-
draggingDocument = true;
|
|
124
|
-
})
|
|
125
|
-
.off('dragend')
|
|
126
|
-
.on('dragend', function () {
|
|
127
|
-
draggingDocument = false;
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
postContainer.on('dragenter', onDragEnter);
|
|
131
|
-
|
|
132
|
-
drop.on('dragover', cancel);
|
|
133
|
-
drop.on('dragenter', cancel);
|
|
134
|
-
drop.on('drop', onDragDrop);
|
|
82
|
+
});
|
|
135
83
|
}
|
|
136
84
|
|
|
137
85
|
function initializePaste(post_uuid) {
|
|
138
86
|
var postContainer = $('.composer[data-uuid="' + post_uuid + '"]');
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
[].some.call(items, function (item) {
|
|
143
|
-
var blob = item.getAsFile();
|
|
144
|
-
|
|
145
|
-
if (!blob) {
|
|
146
|
-
return false;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
var blobName = utils.generateUUID() + '-' + blob.name;
|
|
150
|
-
|
|
151
|
-
var fd = null;
|
|
152
|
-
if (window.FormData) {
|
|
153
|
-
fd = new FormData();
|
|
154
|
-
fd.append('files[]', blob, blobName);
|
|
155
|
-
}
|
|
156
|
-
|
|
87
|
+
uploadHelpers.handlePaste({
|
|
88
|
+
container: postContainer,
|
|
89
|
+
callback: function (upload) {
|
|
157
90
|
uploadContentFiles({
|
|
158
|
-
files:
|
|
159
|
-
fileNames:
|
|
91
|
+
files: upload.files,
|
|
92
|
+
fileNames: upload.fileNames,
|
|
160
93
|
post_uuid: post_uuid,
|
|
161
94
|
route: '/api/post/upload',
|
|
162
|
-
formData:
|
|
95
|
+
formData: upload.formData,
|
|
163
96
|
});
|
|
164
|
-
|
|
165
|
-
return true;
|
|
166
|
-
});
|
|
97
|
+
},
|
|
167
98
|
});
|
|
168
99
|
}
|
|
169
100
|
|
package/static/lib/composer.js
CHANGED
|
@@ -367,10 +367,7 @@ define('composer', [
|
|
|
367
367
|
return removeComposerHistory();
|
|
368
368
|
}
|
|
369
369
|
|
|
370
|
-
|
|
371
|
-
if (screenfull.isEnabled && screenfull.isFullscreen) {
|
|
372
|
-
screenfull.exit();
|
|
373
|
-
}
|
|
370
|
+
formatting.exitFullscreen();
|
|
374
371
|
|
|
375
372
|
var btn = $(this).prop('disabled', true);
|
|
376
373
|
translator.translate('[[modules:composer.discard]]', function (translated) {
|
|
@@ -777,7 +774,7 @@ define('composer', [
|
|
|
777
774
|
message: data.message,
|
|
778
775
|
timeout: 10000,
|
|
779
776
|
clickfn: function () {
|
|
780
|
-
ajaxify.go(`/post-queue
|
|
777
|
+
ajaxify.go(`/post-queue/${data.id}`);
|
|
781
778
|
},
|
|
782
779
|
});
|
|
783
780
|
} else if (action === 'topics.post') {
|