[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/lib/scripts/ -> textselection.js (summary)

Text selection related functions.

File Size: 152 lines (4 kb)
Included or required:0 times
Referenced: 1 time
Includes or requires: 0 files

Defines 6 functions

  selection_class()
  DWgetSelection()
  DWsetSelection()
  pasteText()
  insertTags()
  insertAtCarret()

Functions
Functions that are not part of a class:

selection_class()   X-Ref
selection prototype

Object that capsulates the selection in a textarea. Returned by DWgetSelection.

author: Andreas Gohr <andi@splitbrain.org>

DWgetSelection(textArea)   X-Ref
Get current selection/cursor position in a given textArea

link: http://groups.drupal.org/node/1210
link: http://linebyline.blogspot.com/2006/11/textarea-cursor-position-in-internet.html
returns: object - a selection object
author: Andreas Gohr <andi@splitbrain.org>

DWsetSelection(selection)   X-Ref
Set the selection

You need to get a selection object via DWgetSelection() first, then modify the
start and end properties and pass it back to this function.

param: {selection_class} selection  a selection object as returned by DWgetSelection()
link: http://groups.drupal.org/node/1210
author: Andreas Gohr <andi@splitbrain.org>

pasteText(selection,text,opts)   X-Ref
Inserts the given text at the current cursor position or replaces the current
selection

param: {string}  text           the new text to be pasted
param: {selection_class}  selection     selection object returned by DWgetSelection
param: {int}     opts.startofs  number of charcters at the start to skip from new selection
param: {int}     opts.endofs    number of characters at the end to skip from new selection
param: {boolean} opts.nosel     set true if new text should not be selected
author: Andreas Gohr <andi@splitbrain.org>

insertTags(textAreaID, tagOpen, tagClose, sampleText)   X-Ref
Format selection

Apply tagOpen/tagClose to selection in textarea, use sampleText instead
of selection if there is none.

author: Andreas Gohr <andi@splitbrain.org>

insertAtCarret(textAreaID, text)   X-Ref
Wraps around pasteText() for backward compatibility

author: Andreas Gohr <andi@splitbrain.org>