Răsfoiți Sursa

Draggable style

Sotaro KARASAWA 10 ani în urmă
părinte
comite
3fa094a01a
2 a modificat fișierele cu 17 adăugiri și 3 ștergeri
  1. 13 3
      lib/views/_form.html
  2. 4 0
      resource/css/_layout.scss

+ 13 - 3
lib/views/_form.html

@@ -79,11 +79,21 @@
     var attachmentOption = {
       uploadUrl: '/_api/attachment/page/' + pageId,
       extraParams: {},
-      dataProcessor: function(data) {
-        console.log(data);
-      }
+      progressText: 'Uploading file...',
+      urlText: "\n![file]({filename})\n",
+      onFileUploadResponse: function(res) {
+        console.log("onUploadedFile", res);
+
+        return true;
+      },
     };
     $('textarea#form-body').inlineattachment(attachmentOption);
+    $('textarea#form-body').on('dragenter dragover', function() {
+        $(this).addClass('dragover');
+      });
+    $('textarea#form-body').on('drop dragleave dragend', function() {
+        $(this).removeClass('dragover');
+      });
   });
 
 

+ 4 - 0
resource/css/_layout.scss

@@ -434,6 +434,10 @@
             padding-top: 18px;
             border: none;
             box-shadow: none;
+
+            &.dragover {
+              border: dashed 10px #ccc;
+            }
           }
           .preview-body {
             height: 100%;