Browse Source

Merge branch 'master' of https://github.com/transloadit/uppy

Kevin van Zonneveld 9 năm trước cách đây
mục cha
commit
33a14dc0eb
4 tập tin đã thay đổi với 24 bổ sung6 xóa
  1. 8 1
      CHANGELOG.md
  2. 7 0
      pre-commit.hook
  3. 2 3
      src/core/Utils.js
  4. 7 2
      src/plugins/FakeModal.js

+ 8 - 1
CHANGELOG.md

@@ -32,6 +32,10 @@ Ideas that will be planned into a release at one point
 - [ ] tus: Add support tus 1.0 uploading capabilities (#3)
 - [ ] website: Make cycling through taglines pretty (in terms of code and a nice animation or sth)
 
+- [ ] core: Rename “selecter” to “getter” or “acquire”
+- [ ] modal: State: which tab is open? get parameters?
+- [ ] modal: Avoid duplicating event listeners
+
 ## 0.0.5 (May 03, 2016)
 
 - [ ] meta: Consider using <waffle.io> instead of Markdown task tracking. Some discussion [here](https://transloadit.slack.com/archives/general/p1455693654000062) (@hedgerh, @arturi, @tim-kos, @kvz)
@@ -45,7 +49,7 @@ look at https://github.com/akiran/react-slick
 
 ## 0.0.3 (March 01, 2016)
 
-- [ ] core: throw an error when one Plugin is `.use`d twice. We don't support that now, and will result in very confusing behavior
+- [ ] core: throw an error when one Plugin is `.use`d twice. We don't support that now, and will result in very confusing behavior (@kvz)
 - [ ] modal: Make sure modal renders under one dom node (@arturi)
 - [ ] modal: Make `ProgressBar` work with the new Modal (@kvz)
 - [ ] google: Convert `GoogleDrive` to adhere to `Dummy`'s format, so it's compatible with the new Modal (@hedgerh)
@@ -53,6 +57,9 @@ look at https://github.com/akiran/react-slick
 - [ ] dragdrop: Convert `DragDrop` to adhere to `Dummy`'s format, so it's compatible with the new Modal (@arturi)
 - [ ] modal: Rename FakeModal to Modal, deprecating our old one (@kvz)
 - [ ] modal: Make the Modal look like Harry's sketchup  (@hedgerh)
+
+-- 
+
 - [ ] core: clean up package.json. We've accumulated duplication and weirdness by hacking just for our current problem without keeping a wider view of what was already there (@arturi)
 - [ ] google: Add basic Google Drive plugin example (can just use `target: "<string>"` so long as modal is in the works by @arturi) (@hedgerh)
 - [ ] meta: Decide on tagline(s) (@kvz, @hedgerh, @arturi, @tim-kos)

+ 7 - 0
pre-commit.hook

@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+PATH=$PATH:/usr/local/bin:/usr/local/sbin
+
+npm run test || echo "Tests (or tasks) failed, aborting the commit" && exit 1
+
+echo "All tests passed, committing your changes"
+exit 0

+ 2 - 3
src/core/Utils.js

@@ -98,9 +98,8 @@ function addListenerMulti (el, events, cb) {
   }
 }
 
-function qsa (selector) {
-  var nodeList = document.querySelectorAll(selector)
-  return Array.prototype.slice.call(nodeList, 0)
+function qsa (selector, context) {
+  return Array.prototype.slice.call((context || document).querySelectorAll(selector) || [])
 }
 
 export default {

+ 7 - 2
src/plugins/FakeModal.js

@@ -28,6 +28,13 @@ export default class FakeModal extends Plugin {
   }
 
   prepareTarget (callerPlugin) {
+    console.log(callerPlugin.type)
+
+    if (callerPlugin.type !== 'selecter' || callerPlugin.type !== 'progress') {
+      this.core.log('Error: Modal can only be used by plugins of type `selecter` or `progress`')
+      return
+    }
+
     const callerPluginName = callerPlugin.constructor.name
 
     // add tab panel
@@ -56,8 +63,6 @@ export default class FakeModal extends Plugin {
       </a></li>
     `
 
-    console.log('yoyoyoyoy')
-
     this.initEvents()
 
     return document.querySelector(`#${callerPluginName}`)