[ Index ]

PHP Cross Reference of DokuWiki




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

Text selection related functions.

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

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

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

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.

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

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

author: Andreas Gohr <andi@splitbrain.org>
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

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>