Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-select-on-focus

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-select-on-focus

Selects the text contents of inputs, textareas, and contenteditable elements on focus

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

vue-select-on-focus

Build Status

Selects the text contents of inputs, textareas, and contenteditable elements on focus.

Install

$ npm install --save vue-select-on-focus

or

$ yarn add vue-select-on-focus

or include the UMD build, hosted by unpkg in a <script> tag.

<script src="//unpkg.com/vue-select-on-focus" />

Usage

Globally

import Vue from "vue"
import selectOnFocus from "vue-select-on-focus"

Vue.use(selectOnFocus)

Per-component

import selectOnFocus from "vue-select-on-focus"

export default {
  directives: { selectOnFocus },
  template: "<div><input type='text' value='Lorem Ipsum' v-select-on-focus /></div>"
}

The directive will work with any text input, textarea, or contenteditable element.

Passing a custom range

If you don't want to select all the text contents, you can pass in an object with start and end values to the directive.

import selectOnFocus from "vue-select-on-focus"

export default {
  directives: { selectOnFocus },
  template: "<div><input type='text' value='Lorem Ipsum' v-select-on-focus='customRange' /></div>",
  data() {
    return {
      customRange: {
        start: 2,
        end: 5
      }
    }
  }
}

In this example the letters rem would be selected when the input is focused.

Development

# To run the example
$ npm run example

# To run the tests
$ npm test

# To publish the dist file
$ npm run build

License

MIT © Collin Henderson

FAQs

Package last updated on 06 Dec 2018

Did you know?

Socket

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc