Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
ampersand-filereader-input-view
Advanced tools
A view module for returning metadata via callback using browser FileReader.
A view module for returning metadata via callback using browser FileReader. Works well with ampersand-form-view.
It does the following:
callback
prop/method with metadata for file selected.npm install ampersand-filereader-input-view
The only required attributes are name and type. Everything else is optional (even the callback.)
var InputView = require('ampersand-filereader-input-view');
var field = new FileReaderInputView({
// form input's `name` attribute
name: 'file',
// You can replace the built-in template for the parent item
// just give it an html string. Make sure it has a single "root" element that contains:
// - an element with a `data-hook="label"` attribute
// - an element with a `data-hook="fieldContainer"` this is where individual fields go
// - an element with a `data-hook="main-message-container"` attribute (this we'll show/hide)
// - an elememt with a `data-hook="main-message-text"` attribute (where message text goes for error)
template: // some HTML string,
// Template for individual view. It should be a string of HTML
// Make sure it has a single "root" element that contains
// - an element with a `data-hook="label"` attribute
// - an element with a `data-hook="message-container"` attribute (this we'll show/hide)
// - an elememt with a `data-hook="message-text"` attribute (where message text goes for error)
// function called when file selected
// - arguments returned by callback:
// * 1st: fileInputView - view object of the file form-field
// * 2nd: data - object containing metadata for file selected
callback: function (fileInputView, data) {}
// Label name
label: 'File',
// Optional placeholder attribute
placeholder: 'file',
// optional, this is the element that will be
// replaced by this view. If you don't
// give it one, it will create one.
el: document.getElementByID('field'),
// class to set on input when input is valid
validClass: 'input-valid', // <- that's the default
// type value to use for the input tag's type value
type: 'file',
// class to set on input when input is valid
invalidClass: 'input-invalid', // <- that's the default
// Message to use if error is that it's required
// but no value was set.
requiredMessage: 'This field is required.',
// optional, you can pass in the parent view explicitly
parent: someViewInstance
});
// append it somewhere or use it in side an ampersand-form-view
document.querySelector('form').appendChild(field.el);
Created by @gdibble.
MIT
FAQs
A view module for returning metadata via callback using browser FileReader.
The npm package ampersand-filereader-input-view receives a total of 2 weekly downloads. As such, ampersand-filereader-input-view popularity was classified as not popular.
We found that ampersand-filereader-input-view demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.