# Yatta! API

# Class: WordType

Defined in: | lib/Types/TextTypes.coffee
Inherits: | types.ListManager

## Overview

Note: Currently, only Text is supported!

Handles a WordType-like data structures with support for insertText/deleteText at a word-position.

## Variables Summary

type =

      "WordType"

  Identifies this class. Use it to check whether this is a word-type or something else.

  ### Examples:

  ####

      var x = yatta.val('unknown')
      if (x.type === "WordType") {
        console.log JSON.stringify(x.toJson())
      }

## Instance Method Summary

- # (void) applyDelete()
- # (void) cleanup()
- # (void) push(content)
- # (void) insertAfter(left, content)
- # (WordType) insertText(position, content) Inserts a string into the word.
- # (WordType) deleteText(position, length) Deletes a part of the word.
- # (WordType) replaceText(text) Replace the content of this word with another one.
- # (String) val() Get the String-representation of this word.
- # (void) toString() Same as WordType.val
- # (void) setReplaceManager(op) Private In most cases you would embed a WordType in a Replaceable, wich is handled by the ReplaceManager in order to provide replace functionality.
- # (void) bind(textfield) Bind this WordType to a textfield or input field.
- # (void) _encode() Private Encode this operation in such a way that it can be parsed by remote peers.

## Constructor Details

# (void) constructor(uid, beginning, end, prev, next, origin) Private

### Parameters:

- uid ( `Object` ) — A unique identifier. If uid is undefined, a new uid will be created.

## Instance Method Details

# (void) applyDelete()

# (void) cleanup()

# (void) push(content)

# (void) insertAfter(left, content)

# (WordType) insertText(position, content)

Inserts a string into the word.

### Returns:

- ( `WordType` ) — This WordType object.

# (WordType) deleteText(position, length)

Deletes a part of the word.

### Returns:

- ( `WordType` ) — This WordType object

# (WordType) replaceText(text)

Replace the content of this word with another one. Concurrent replacements are not merged! Only one of the replacements will be used.

### Returns:

- ( `WordType` ) — Returns the new WordType object.

# (String) val()

Get the String-representation of this word.

### Returns:

- ( `String` ) — The String-representation of this object.

# (void) toString()

Same as WordType.val

### See also:

- WordType.val

# (void) setReplaceManager(op) Private

In most cases you would embed a WordType in a Replaceable, wich is handled by the ReplaceManager in order to provide replace functionality.

# (void) bind(textfield)

Bind this WordType to a textfield or input field.

### Examples:

####

    var textbox = document.getElementById("textfield");
    yatta.bind(textbox);

# (void) _encode() Private

Encode this operation in such a way that it can be parsed by remote peers.

Quickly fuzzy find classes, mixins, methods, file:

- T Open fuzzy finder dialog

Control the navigation frame:

- L Toggle list view
- C Show class list
- I Show mixin list
- F Show file list
- M Show method list
- E Show extras list

You can focus and blur the search input:

- S Focus search input
- Esc Blur search input