Socket
Socket
Sign inDemoInstall

@patternslib/pat-content-mirror

Package Overview
Dependencies
1
Maintainers
7
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @patternslib/pat-content-mirror

A pattern for content-mirror


Version published
Maintainers
7
Install size
1.21 MB
Created

Changelog

Source

3.0.0 (2022-06-28)

Maintenance

  • @patternslib/patternslib needs to be installed. Adding to devDependencies to avoid version clashes with other packages depending on it. (b3fa0aa)

  • Upgrade to @patternslib/dev 2.2.0 and adapt module federation config. (8b5c424)

Readme

Source

pat-content-mirror

A pattern that provides rich dynamic functionality to a textarea. It is used for comments in the social stream.

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 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>

Documentation

PropertyValueDefaultTypeDescription
targeta CSS selectorp.content-mirror .textstringa CSS selector that indicates in which element(s) the content of the textarea should be mirrored

Keywords

FAQs

Last updated on 28 Jun 2022

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc