
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
@patternslib/pat-content-mirror
Advanced tools
A pattern that provides rich dynamic functionality to a textarea. It is used for single-line text input that should be able to wrap into the next line. Line breaks, tabs or multiple space characters are not allowed, removed from the text input and replaced with a single space character.
The main functionality is provided by maintaining a "mirror" element that
is updated every time the main textarea is changed. This element, which
can be specified using a CSS selector in the target
option, sits behind the
textarea, and allows us to overcome the limitations of text-only content in
the html textarea element. The user interacts with the textarea, mostly by
typing, and the .content-mirror reflects the textarea content, but can also
contain links to other users or tags.
The difference to a contenteditable element is, that a textarea automatically participates as a form element in form submissions and validation.
The pattern would typically be applied to a textarea element, though it is
not required.
In addition, another element must be present to act as the content mirror.
When the designated content mirror is empty, the pattern injects a placeholder
element (<em class="placeholder">Leave a comment</em>
).
By default, the pattern looks for the content mirror using the CSS selector
p.content-mirror .text
, though this can be overridden by the target
option.
The placeholder can be overridden by the placeholder
attribute.
The example html below shows a structure that would work with the defaults:
<p class="content-mirror"
><span class="text"
><em class="placeholder">Leave a comment</em></span
></p>
<textarea placeholder="Leave a comment" class="pat-content-mirror"></textarea>
Property | Value | Default | Type | Description |
---|---|---|---|---|
target | a CSS selector | p.content-mirror .text | string | a CSS selector that indicates in which element(s) the content of the textarea should be mirrored |
FAQs
A pattern for content-mirror
The npm package @patternslib/pat-content-mirror receives a total of 244 weekly downloads. As such, @patternslib/pat-content-mirror popularity was classified as not popular.
We found that @patternslib/pat-content-mirror demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 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.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.