|
|
@@ -425,15 +425,26 @@ $(function() {
|
|
|
_csrf: csrfToken
|
|
|
},
|
|
|
progressText: '(Uploading file...)',
|
|
|
- urlText: "\n",
|
|
|
- allowedTypes: '*'
|
|
|
+ jsonFieldName: 'url',
|
|
|
+ };
|
|
|
+
|
|
|
+ // if files upload is set
|
|
|
+ var config = crowi.getConfig();
|
|
|
+ if (config.upload.file) {
|
|
|
+ attachmentOption.allowedTypes = '*';
|
|
|
+ }
|
|
|
+
|
|
|
+ attachmentOption.remoteFilename = function(file) {
|
|
|
+ return file.name;
|
|
|
};
|
|
|
|
|
|
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`;
|
|
|
+ this.settings.urlText = `[${file.name}]({filename})\n`;
|
|
|
+ } else {
|
|
|
+ this.settings.urlText = `\n`;
|
|
|
}
|
|
|
}
|
|
|
|