|
@@ -463,12 +463,20 @@ $(function() {
|
|
|
_csrf: csrfToken
|
|
_csrf: csrfToken
|
|
|
},
|
|
},
|
|
|
progressText: '(Uploading file...)',
|
|
progressText: '(Uploading file...)',
|
|
|
- urlText: "\n\n"
|
|
|
|
|
|
|
+ urlText: "\n",
|
|
|
|
|
+ allowedTypes: '*'
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ attachmentOption.onFileReceived = function(file) {
|
|
|
|
|
+ // if not image
|
|
|
|
|
+ if (!file.type.match(/^image\/.+$/)) {
|
|
|
|
|
+ // modify urlText with 'a' tag
|
|
|
|
|
+ this.settings.urlText = `<a href="{filename}">${file.name}</a>\n`;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
attachmentOption.onFileUploadResponse = function(res) {
|
|
attachmentOption.onFileUploadResponse = function(res) {
|
|
|
var result = JSON.parse(res.response);
|
|
var result = JSON.parse(res.response);
|
|
|
- console.log(result);
|
|
|
|
|
|
|
|
|
|
if (result.ok && result.pageCreated) {
|
|
if (result.ok && result.pageCreated) {
|
|
|
var page = result.page,
|
|
var page = result.page,
|