Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
quill-paste-smart
Advanced tools
Readme
This plugin extends the default clipboard module of Quill.js to prevent users from pasting HTML that does not belong into the editor. To do so it looks into your toolbar configuration and deciding which tags and attributes are allowed based on the possible formats.
However, you can also decide on your own, what is allowed.
You can install this plugin either with npm or with yarn.
Run one of the following commands from your projects root in a bash prompt.
npm -i quill-paste-smart
# or: yarn add quill-paste-smart
To tell Quill to use this plugin instead of its own clipboard module you need to register it.
import Quill from 'quill';
import PasteSmart from 'quill-paste-smart';
Quill.register('modules/clipboard', PasteSmart, true);
Out of the box this plugin will remove all HTML tags and attributes that are not available in the toolbar formats.
If you don't agree with the default settings, you can decide what is allowed by yourself.
Also I thought it could be useful to keep the pasted content selected after pasting.
A valid configuration could look like this:
const options = {
theme: 'snow'
modules: {
clipboard: {
allowed: {
tags: ['a', 'b', 'strong', 'u', 's', 'i', 'p', 'br', 'ul', 'ol', 'li', 'span'],
attributes: ['href', 'rel', 'target', 'class']
},
keepSelection: true,
},
},
};
new Quill('#editor', options);
This plugin is licensed under the terms of the MIT License (See LICENSE file for details).
FAQs
Quill Extension to paste only supported HTML
The npm package quill-paste-smart receives a total of 12,234 weekly downloads. As such, quill-paste-smart popularity was classified as popular.
We found that quill-paste-smart demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).