1.0.0 • Published 6 years ago

ui-text-controller v1.0.0

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

ui-text-controller

A simple JavaScript utility for conditionally joining UITextController together.

Installation:

$ npm install ui-text-controller --save

Usage

Load this module through the Import command

import UITextController from "ui-text-controller"

Create an instance of controller by calling new UITextController.

    var controller = new UITextController({
        div: '#frame',
        onSelectionChange: selection => {
          console.log(selection.toString());
        }
    })

Pass an object literal with the following options:

NameTypeDefaultDescription
divHTMLElement, StringnoneThe element where the text select event is observed. Normally that's the only text container
startBtnClassNameStringnullUser can customize the start button style name
endBtnClassNameStringnullUser can customize the end button style name
textBgColorString'rgba(51,143,255,0.5)'User can customize the text to select the color
holdDelayNumber800delay time when the user is pressed on the screen
autoInitBooleantrueDoes it default to initialize
onSelectionChange()functionnullCustom event when the finger selection changed
onClear()functionnullwhen user selected, Then we can clear the controller
onSelectStart()functionnullStart selecting the function to execute
onSelect()functionnullThe function executed in the selection
onSelectEnd()functionnullFunction at the top of the choice after completion of the selection

Methods

  • init() - The initialization function after the plug-in is loaded.

  • destroy() - Destruction function when UITextController is not needed.

  • update() - Refresh the data when the content data is changed or the window is rotated,hot tipWhen the data contains pictures, such as images that affect the computing position, it is necessary to perform the action after the image is loaded.

  • clear() - Events that need to be hidden when the user has other operations that need to be hidden the 'UITextController'.

Demo

qrdoe