Closed fiatjaf closed 6 years ago
Hey, I want to contribute, but I can't seem to find where the upload widget is triggered, and I can't set a live preview locally on my computer, can you point me to the right direction?
Have you tried to run it on your computer? What error have you encountered? (I should have a guide for that, I know.)
Basically you should get away with git clone
the repo, them cd
to it and npm install
. I've added a note about it on the README. I've also added an image with the source tree of the repository to help newcomers understand the codebase.
Anyway, the upload widget is here. See the FileUpload
component? Also the Preview
component + action buttons if a file has already been dragged and is set at state.mediaUpload
?
Please let me know of anything you want to let me know.
Hmm, it kinda worked, but there is only a green background now. Is there something I should set in the preferences.js? It doesn't seem obvious what I should set if that is it.
You don't have to set anything.
If you're seeing just the green background then the bundle.js
script is probably not present or has a basic error. Can you open the Javascript console and tell if there is and what error is shown there?
"Warning: Accessing createClass via the main React package is deprecated, and will be removed in React v16.0. Use a plain JavaScript class instead. If you're not yet ready to migrate, create-react-class v15.* is available on npm as a temporary, drop-in replacement. For more info see https://fb.me/react-create-class" bundle.js:73464:7
"Warning: Accessing PropTypes via the main React package is deprecated, and will be removed in React v16.0. Use the latest available v15.* prop-types package from npm instead. For info on usage, compatibility, migration and more, see https://fb.me/prop-types-docs" bundle.js:73464:7
Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object. Check the render method of
_class
. in _class bundle.js:16629:7Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. Check the render method of
_class
. bundle.js:16375:15
I think if you rebuild it will reproduce, except if there is a dependency i am missing.
Should i get an older version of react maybe?
No, these warnings are from some dependencies which are relying deprecated React APIs. You can ignore them. The problem here is the error. Are you haven't changed the code? (if you did, please post the diff.)
Hey did @cmendonis get this working for you? Happy to pick it up if it's still up for grabs.
It's still up for grabs, @noblepaper. Please let me know if you have any trouble.
defaultMediaUploadPath
is a customizable setting that tells coisas the directory path into which it will place media files uploaded through the sidebar drag-and-drop upload widget.As a feature for users who do not want that upload widget there (because they do not want to have a "media" folder, for example) we should not show that
UploadFile
component whendefaultMediaUploadPath
is set tofalse
ornull
.This can be done by a simple check of
window.coisas.defaultMediaUploadPath
before rendering theUploadFile
component on the sidebar. If it is falsy (except for empty strings, which should be valid) then do not render it.