Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
draft-js-counter-plugin
Advanced tools
This is a plugin for the draft-js-plugins-editor
.
This plugin adds character and word counting functionality to your editor!
First instantiate the plugin:
import createCounterPlugin from 'draft-js-counter-plugin';
const counterPlugin = createCounterPlugin();
Now get the CharCounter
, WordCounter
, and LineCounter
components from the instance:
const { CharCounter, WordCounter, LineCounter } = counterPlugin;
Which take one prop:
limit
(optional): a number in which the style of the text will change to reflect that the user is over the limitRender them with those props and your editor now has counting functionality!
<CharCounter editorState={ this.state.editorState } limit={200} />
<WordCounter editorState={ this.state.editorState } limit={30} />
<LineCounter editorState={ this.state.editorState } limit={10} />
The plugin ships with a default styling available at this location in the installed package:
node_modules/draft-js-counter-plugin/lib/plugin.css
.
Follow the steps below to import the css file by using Webpack's style-loader
and css-loader
.
Install Webpack loaders: npm install style-loader css-loader --save-dev
Add the below section to Webpack config (if your Webpack already has loaders array, simply add the below loader object({test:foo, loaders:bar[]}
) as an item in the array).
module: {
loaders: [{
test: /\.css$/,
loaders: [
'style-loader', 'css'
]
}]
}
Add the below import line to your component to tell Webpack to inject style to your component.
import 'draft-js-counter-plugin/lib/plugin.css';
Restart Webpack.
FAQs
Counter Plugin for DraftJS
The npm package draft-js-counter-plugin receives a total of 784 weekly downloads. As such, draft-js-counter-plugin popularity was classified as not popular.
We found that draft-js-counter-plugin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.