Procházet zdrojové kódy

change inline-attachment setting according to the type of uploading file

Yuki Takei před 9 roky
rodič
revize
f1cf955b0d
1 změnil soubory, kde provedl 8 přidání a 1 odebrání
  1. 8 1
      resource/js/crowi-form.js

+ 8 - 1
resource/js/crowi-form.js

@@ -429,9 +429,16 @@ $(function() {
       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) {
       var result = JSON.parse(res.response);
-      console.log(result);
 
       if (result.ok && result.pageCreated) {
         var page = result.page,